aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-11-14 11:39:56 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-11-14 11:39:56 -0500
commit8528d662489a980305c7b0d1d41aca3e140c1e3d (patch)
tree0161b8390b141ba6560fb9309b5efe7f9eafcd16 /arch/x86/kernel
parent5d69561b7b32b89380b5390b62e5a0c50bfe6568 (diff)
parentd49597fd3bc7d9534de55e9256767f073be1b33a (diff)
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Ingo Molnar: "Misc fixes: - fix an Intel/MID boot crash/hang bug - fix a cache topology mis-parsing bug on certain AMD CPUs - fix a virtualization firmware bug by adding a check+quirk workaround on the kernel side" * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/cpu: Deal with broken firmware (VMWare/XEN) x86/cpu/AMD: Fix cpu_llc_id for AMD Fam17h systems x86/platform/intel-mid: Retrofit pci_platform_pm_ops ->get_state hook
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r--arch/x86/kernel/cpu/amd.c6
-rw-r--r--arch/x86/kernel/cpu/common.c32
2 files changed, 31 insertions, 7 deletions
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index b81fe2d63e15..1e81a37c034e 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -347,7 +347,6 @@ static void amd_detect_cmp(struct cpuinfo_x86 *c)
347#ifdef CONFIG_SMP 347#ifdef CONFIG_SMP
348 unsigned bits; 348 unsigned bits;
349 int cpu = smp_processor_id(); 349 int cpu = smp_processor_id();
350 unsigned int socket_id, core_complex_id;
351 350
352 bits = c->x86_coreid_bits; 351 bits = c->x86_coreid_bits;
353 /* Low order bits define the core id (index of core in socket) */ 352 /* Low order bits define the core id (index of core in socket) */
@@ -365,10 +364,7 @@ static void amd_detect_cmp(struct cpuinfo_x86 *c)
365 if (c->x86 != 0x17 || !cpuid_edx(0x80000006)) 364 if (c->x86 != 0x17 || !cpuid_edx(0x80000006))
366 return; 365 return;
367 366
368 socket_id = (c->apicid >> bits) - 1; 367 per_cpu(cpu_llc_id, cpu) = c->apicid >> 3;
369 core_complex_id = (c->apicid & ((1 << bits) - 1)) >> 3;
370
371 per_cpu(cpu_llc_id, cpu) = (socket_id << 3) | core_complex_id;
372#endif 368#endif
373} 369}
374 370
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 9bd910a7dd0a..cc9e980c68ec 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -979,6 +979,35 @@ static void x86_init_cache_qos(struct cpuinfo_x86 *c)
979} 979}
980 980
981/* 981/*
982 * The physical to logical package id mapping is initialized from the
983 * acpi/mptables information. Make sure that CPUID actually agrees with
984 * that.
985 */
986static void sanitize_package_id(struct cpuinfo_x86 *c)
987{
988#ifdef CONFIG_SMP
989 unsigned int pkg, apicid, cpu = smp_processor_id();
990
991 apicid = apic->cpu_present_to_apicid(cpu);
992 pkg = apicid >> boot_cpu_data.x86_coreid_bits;
993
994 if (apicid != c->initial_apicid) {
995 pr_err(FW_BUG "CPU%u: APIC id mismatch. Firmware: %x CPUID: %x\n",
996 cpu, apicid, c->initial_apicid);
997 c->initial_apicid = apicid;
998 }
999 if (pkg != c->phys_proc_id) {
1000 pr_err(FW_BUG "CPU%u: Using firmware package id %u instead of %u\n",
1001 cpu, pkg, c->phys_proc_id);
1002 c->phys_proc_id = pkg;
1003 }
1004 c->logical_proc_id = topology_phys_to_logical_pkg(pkg);
1005#else
1006 c->logical_proc_id = 0;
1007#endif
1008}
1009
1010/*
982 * This does the hard work of actually picking apart the CPU stuff... 1011 * This does the hard work of actually picking apart the CPU stuff...
983 */ 1012 */
984static void identify_cpu(struct cpuinfo_x86 *c) 1013static void identify_cpu(struct cpuinfo_x86 *c)
@@ -1103,8 +1132,7 @@ static void identify_cpu(struct cpuinfo_x86 *c)
1103#ifdef CONFIG_NUMA 1132#ifdef CONFIG_NUMA
1104 numa_add_cpu(smp_processor_id()); 1133 numa_add_cpu(smp_processor_id());
1105#endif 1134#endif
1106 /* The boot/hotplug time assigment got cleared, restore it */ 1135 sanitize_package_id(c);
1107 c->logical_proc_id = topology_phys_to_logical_pkg(c->phys_proc_id);
1108} 1136}
1109 1137
1110/* 1138/*