|
Joerg Roedel |
7aef11 |
From: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
|
|
Joerg Roedel |
7aef11 |
Date: Fri, 27 Apr 2018 16:48:01 -0500
|
|
Joerg Roedel |
7aef11 |
Subject: x86/CPU/AMD: Derive CPU topology from CPUID function 0xB when
|
|
Joerg Roedel |
7aef11 |
available
|
|
Joerg Roedel |
7aef11 |
Git-commit: 3986a0a805e668a63fac0ca2cdfa8db951f87c4b
|
|
Joerg Roedel |
7aef11 |
Patch-mainline: v4.18-rc1
|
|
Joerg Roedel |
7aef11 |
References: fate#324429
|
|
Joerg Roedel |
7aef11 |
|
|
Joerg Roedel |
7aef11 |
Derive topology information from Extended Topology Enumeration (CPUID
|
|
Joerg Roedel |
7aef11 |
function 0xB) when the information is available.
|
|
Joerg Roedel |
7aef11 |
|
|
Joerg Roedel |
7aef11 |
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
|
|
Joerg Roedel |
7aef11 |
Signed-off-by: Borislav Petkov <bp@suse.de>
|
|
Joerg Roedel |
7aef11 |
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
|
Joerg Roedel |
7aef11 |
Link: http://lkml.kernel.org/r/1524865681-112110-3-git-send-email-suravee.suthikulpanit@amd.com
|
|
Joerg Roedel |
7aef11 |
|
|
Joerg Roedel |
7aef11 |
Acked-by: Joerg Roedel <jroedel@suse.de>
|
|
Joerg Roedel |
7aef11 |
---
|
|
Joerg Roedel |
7aef11 |
arch/x86/kernel/cpu/amd.c | 11 ++++++++++-
|
|
Joerg Roedel |
7aef11 |
1 file changed, 10 insertions(+), 1 deletion(-)
|
|
Joerg Roedel |
7aef11 |
|
|
Joerg Roedel |
7aef11 |
--- a/arch/x86/kernel/cpu/amd.c
|
|
Joerg Roedel |
7aef11 |
+++ b/arch/x86/kernel/cpu/amd.c
|
|
Joerg Roedel |
7aef11 |
@@ -326,6 +326,7 @@ static void amd_get_topology(struct cpui
|
|
Joerg Roedel |
7aef11 |
|
|
Joerg Roedel |
7aef11 |
/* get information required for multi-node processors */
|
|
Joerg Roedel |
7aef11 |
if (boot_cpu_has(X86_FEATURE_TOPOEXT)) {
|
|
Joerg Roedel |
7aef11 |
+ int err;
|
|
Joerg Roedel |
7aef11 |
u32 eax, ebx, ecx, edx;
|
|
Joerg Roedel |
7aef11 |
|
|
Joerg Roedel |
7aef11 |
cpuid(0x8000001e, &eax, &ebx, &ecx, &edx;;
|
|
Joerg Roedel |
7aef11 |
@@ -344,6 +345,14 @@ static void amd_get_topology(struct cpui
|
|
Joerg Roedel |
7aef11 |
}
|
|
Joerg Roedel |
7aef11 |
|
|
Joerg Roedel |
7aef11 |
/*
|
|
Joerg Roedel |
7aef11 |
+ * In case leaf B is available, use it to derive
|
|
Joerg Roedel |
7aef11 |
+ * topology information.
|
|
Joerg Roedel |
7aef11 |
+ */
|
|
Joerg Roedel |
7aef11 |
+ err = detect_extended_topology(c);
|
|
Joerg Roedel |
7aef11 |
+ if (!err)
|
|
Joerg Roedel |
7aef11 |
+ c->x86_coreid_bits = get_count_order(c->x86_max_cores);
|
|
Joerg Roedel |
7aef11 |
+
|
|
Joerg Roedel |
7aef11 |
+ /*
|
|
Joerg Roedel |
7aef11 |
* We may have multiple LLCs if L3 caches exist, so check if we
|
|
Joerg Roedel |
7aef11 |
* have an L3 cache by looking at the L3 cache CPUID leaf.
|
|
Joerg Roedel |
7aef11 |
*/
|
|
Joerg Roedel |
7aef11 |
@@ -393,7 +402,6 @@ static void amd_detect_cmp(struct cpuinf
|
|
Joerg Roedel |
7aef11 |
c->phys_proc_id = c->initial_apicid >> bits;
|
|
Joerg Roedel |
7aef11 |
/* use socket ID also for last level cache */
|
|
Joerg Roedel |
7aef11 |
per_cpu(cpu_llc_id, cpu) = c->phys_proc_id;
|
|
Joerg Roedel |
7aef11 |
- amd_get_topology(c);
|
|
Joerg Roedel |
7aef11 |
#endif
|
|
Joerg Roedel |
7aef11 |
}
|
|
Joerg Roedel |
7aef11 |
|
|
Joerg Roedel |
7aef11 |
@@ -830,6 +838,7 @@ static void init_amd(struct cpuinfo_x86
|
|
Joerg Roedel |
7aef11 |
/* Multi core CPU? */
|
|
Joerg Roedel |
7aef11 |
if (c->extended_cpuid_level >= 0x80000008) {
|
|
Joerg Roedel |
7aef11 |
amd_detect_cmp(c);
|
|
Joerg Roedel |
7aef11 |
+ amd_get_topology(c);
|
|
Joerg Roedel |
7aef11 |
srat_detect_node(c);
|
|
Joerg Roedel |
7aef11 |
}
|
|
Joerg Roedel |
7aef11 |
|