]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - arch/x86/kernel/cpu/amd.c
x86/cpu: Move X86_BUG_ESPFIX initialization to generic_identify()
[mirror_ubuntu-artful-kernel.git] / arch / x86 / kernel / cpu / amd.c
index 97c59fd60702f4ceacad7c4d46a3c8d5de7dacbf..6e47e3a916f12a03069a7c38ef21e9b2df5edcdf 100644 (file)
@@ -75,14 +75,17 @@ static inline int wrmsrl_amd_safe(unsigned msr, unsigned long long val)
  */
 
 extern __visible void vide(void);
-__asm__(".globl vide\n\t.align 4\nvide: ret");
+__asm__(".globl vide\n"
+       ".type vide, @function\n"
+       ".align 4\n"
+       "vide: ret\n");
 
 static void init_amd_k5(struct cpuinfo_x86 *c)
 {
 #ifdef CONFIG_X86_32
 /*
  * General Systems BIOSen alias the cpu frequency registers
- * of the Elan at 0x000df000. Unfortuantly, one of the Linux
+ * of the Elan at 0x000df000. Unfortunately, one of the Linux
  * drivers subsequently pokes it, and changes the CPU speed.
  * Workaround : Remove the unneeded alias.
  */
@@ -306,7 +309,6 @@ static void amd_get_topology(struct cpuinfo_x86 *c)
                u32 eax, ebx, ecx, edx;
 
                cpuid(0x8000001e, &eax, &ebx, &ecx, &edx);
-               nodes_per_socket = ((ecx >> 8) & 7) + 1;
                node_id = ecx & 7;
 
                /* get compute unit information */
@@ -317,7 +319,6 @@ static void amd_get_topology(struct cpuinfo_x86 *c)
                u64 value;
 
                rdmsrl(MSR_FAM10H_NODE_ID, value);
-               nodes_per_socket = ((value >> 3) & 7) + 1;
                node_id = value & 7;
        } else
                return;
@@ -519,6 +520,18 @@ static void bsp_init_amd(struct cpuinfo_x86 *c)
 
        if (cpu_has(c, X86_FEATURE_MWAITX))
                use_mwaitx_delay();
+
+       if (boot_cpu_has(X86_FEATURE_TOPOEXT)) {
+               u32 ecx;
+
+               ecx = cpuid_ecx(0x8000001e);
+               nodes_per_socket = ((ecx >> 8) & 7) + 1;
+       } else if (boot_cpu_has(X86_FEATURE_NODEID_MSR)) {
+               u64 value;
+
+               rdmsrl(MSR_FAM10H_NODE_ID, value);
+               nodes_per_socket = ((value >> 3) & 7) + 1;
+       }
 }
 
 static void early_init_amd(struct cpuinfo_x86 *c)
@@ -536,6 +549,10 @@ static void early_init_amd(struct cpuinfo_x86 *c)
                        set_sched_clock_stable();
        }
 
+       /* Bit 12 of 8000_0007 edx is accumulated power mechanism. */
+       if (c->x86_power & BIT(12))
+               set_cpu_cap(c, X86_FEATURE_ACC_POWER);
+
 #ifdef CONFIG_X86_64
        set_cpu_cap(c, X86_FEATURE_SYSCALL32);
 #else