Skip to content

Commit

Permalink
x86, cpu: Preset default tlb_flushall_shift on AMD
Browse files Browse the repository at this point in the history
Run the mprotect.c microbenchmark on all our families >= K8 and preset
the flushall shift variable accordingly.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Link: http://lkml.kernel.org/r/1344272439-29080-5-git-send-email-bp@amd64.org
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
  • Loading branch information
Borislav Petkov authored and H. Peter Anvin committed Aug 7, 2012
1 parent b46882e commit 057237b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions arch/x86/kernel/cpu/amd.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,17 @@ static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 *c,
}
#endif

static void __cpuinit cpu_set_tlb_flushall_shift(struct cpuinfo_x86 *c)
{
if (!cpu_has_invlpg)
return;

tlb_flushall_shift = 5;

if (c->x86 <= 0x11)
tlb_flushall_shift = 4;
}

static void __cpuinit cpu_detect_tlb_amd(struct cpuinfo_x86 *c)
{
u32 ebx, eax, ecx, edx;
Expand Down Expand Up @@ -788,6 +799,8 @@ static void __cpuinit cpu_detect_tlb_amd(struct cpuinfo_x86 *c)
tlb_lli_2m[ENTRIES] = eax & mask;

tlb_lli_4m[ENTRIES] = tlb_lli_2m[ENTRIES] >> 1;

cpu_set_tlb_flushall_shift(c);
}

static const struct cpu_dev __cpuinitconst amd_cpu_dev = {
Expand Down

0 comments on commit 057237b

Please sign in to comment.