aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorBorislav Petkov <bp@amd64.org>2011-08-05 14:04:09 -0400
committerH. Peter Anvin <hpa@linux.intel.com>2011-08-05 15:32:33 -0400
commit8fa8b035085e7320c15875c1f6b03b290ca2dd66 (patch)
tree67015568807e0caf987b054cc98c870a2b928f9f /arch
parenta110b5ec7371592eac856ac5c22dc7b518952d44 (diff)
x86, amd: Move BSP code to cpu_dev helper
Move code which is run once on the BSP during boot into the cpu_dev helper. [ hpa: removed bogus cpu_has -> static_cpu_has conversion ] Signed-off-by: Borislav Petkov <borislav.petkov@amd.com> Link: http://lkml.kernel.org/r/20110805180409.GC26217@aftab Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/cpu/amd.c59
1 files changed, 29 insertions, 30 deletions
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index b0234bcbd32a..b6e3e87d25fb 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -410,6 +410,34 @@ static void __cpuinit early_init_amd_mc(struct cpuinfo_x86 *c)
410#endif 410#endif
411} 411}
412 412
413static void __cpuinit bsp_init_amd(struct cpuinfo_x86 *c)
414{
415 if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) {
416
417 if (c->x86 > 0x10 ||
418 (c->x86 == 0x10 && c->x86_model >= 0x2)) {
419 u64 val;
420
421 rdmsrl(MSR_K7_HWCR, val);
422 if (!(val & BIT(24)))
423 printk(KERN_WARNING FW_BUG "TSC doesn't count "
424 "with P0 frequency!\n");
425 }
426 }
427
428 if (c->x86 == 0x15) {
429 unsigned long upperbit;
430 u32 cpuid, assoc;
431
432 cpuid = cpuid_edx(0x80000005);
433 assoc = cpuid >> 16 & 0xff;
434 upperbit = ((cpuid >> 24) << 10) / assoc;
435
436 va_align.mask = (upperbit - 1) & PAGE_MASK;
437 va_align.flags = ALIGN_VA_32 | ALIGN_VA_64;
438 }
439}
440
413static void __cpuinit early_init_amd(struct cpuinfo_x86 *c) 441static void __cpuinit early_init_amd(struct cpuinfo_x86 *c)
414{ 442{
415 early_init_amd_mc(c); 443 early_init_amd_mc(c);
@@ -441,36 +469,6 @@ static void __cpuinit early_init_amd(struct cpuinfo_x86 *c)
441 set_cpu_cap(c, X86_FEATURE_EXTD_APICID); 469 set_cpu_cap(c, X86_FEATURE_EXTD_APICID);
442 } 470 }
443#endif 471#endif
444
445 /* We need to do the following only once */
446 if (c != &boot_cpu_data)
447 return;
448
449 if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) {
450
451 if (c->x86 > 0x10 ||
452 (c->x86 == 0x10 && c->x86_model >= 0x2)) {
453 u64 val;
454
455 rdmsrl(MSR_K7_HWCR, val);
456 if (!(val & BIT(24)))
457 printk(KERN_WARNING FW_BUG "TSC doesn't count "
458 "with P0 frequency!\n");
459 }
460 }
461
462 if (c->x86 == 0x15) {
463 unsigned long upperbit;
464 u32 cpuid, assoc;
465
466 cpuid = cpuid_edx(0x80000005);
467 assoc = cpuid >> 16 & 0xff;
468 upperbit = ((cpuid >> 24) << 10) / assoc;
469
470 va_align.mask = (upperbit - 1) & PAGE_MASK;
471 va_align.flags = ALIGN_VA_32 | ALIGN_VA_64;
472
473 }
474} 472}
475 473
476static void __cpuinit init_amd(struct cpuinfo_x86 *c) 474static void __cpuinit init_amd(struct cpuinfo_x86 *c)
@@ -692,6 +690,7 @@ static const struct cpu_dev __cpuinitconst amd_cpu_dev = {
692 .c_size_cache = amd_size_cache, 690 .c_size_cache = amd_size_cache,
693#endif 691#endif
694 .c_early_init = early_init_amd, 692 .c_early_init = early_init_amd,
693 .c_bsp_init = bsp_init_amd,
695 .c_init = init_amd, 694 .c_init = init_amd,
696 .c_x86_vendor = X86_VENDOR_AMD, 695 .c_x86_vendor = X86_VENDOR_AMD,
697}; 696};