From: Andreas Herrmann <herrmann.der.user@googlemail.com>
To: "H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@elte.hu>,
Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 4/6] x86, amd: Extract compute unit information for AMD CPUs
Date: Thu, 30 Sep 2010 14:38:57 +0200 [thread overview]
Message-ID: <20100930123857.GE20545@loge.amd.com> (raw)
In-Reply-To: <20100930121839.GA20545@loge.amd.com>
From: Andreas Herrmann <andreas.herrmann3@amd.com>
Get compute unit information from CPUID Fn8000_001E_EBX.
(See AMD CPUID Specification - publication # 25481, revision 2.34,
September 2010.)
Note that each core on a compute unit still has a core_id of its own.
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
---
arch/x86/include/asm/processor.h | 2 ++
arch/x86/kernel/cpu/amd.c | 20 +++++++++++++++-----
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index b871129..cae9c3c 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -110,6 +110,8 @@ struct cpuinfo_x86 {
u16 phys_proc_id;
/* Core id: */
u16 cpu_core_id;
+ /* Compute unit id */
+ u8 compute_unit_id;
/* Index into per_cpu list: */
u16 cpu_index;
#endif
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index c10c2cc..9e093f8 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -256,21 +256,29 @@ static int __cpuinit nearby_node(int apicid)
* Fixup core topology information for
* (1) AMD multi-node processors
* Assumption: Number of cores in each internal node is the same.
+ * (2) AMD processors supporting compute units
*/
#ifdef CONFIG_X86_HT
static void __cpuinit amd_get_topology(struct cpuinfo_x86 *c)
{
- u32 nodes, cores_per_node;
+ u32 nodes;
u8 node_id;
- unsigned long long value;
int cpu = smp_processor_id();
/* get information required for multi-node processors */
if (cpu_has(c, X86_FEATURE_TOPOEXT)) {
- value = cpuid_ecx(0x8000001e);
- nodes = ((value >> 8) & 7) + 1;
- node_id = value & 7;
+ u32 eax, ebx, ecx, edx;
+
+ cpuid(0x8000001e, &eax, &ebx, &ecx, &edx);
+ nodes = ((ecx >> 8) & 7) + 1;
+ node_id = ecx & 7;
+
+ /* get compute unit information */
+ smp_num_siblings = ((ebx >> 8) & 3) + 1;
+ c->compute_unit_id = ebx & 0xff;
} else if (cpu_has(c, X86_FEATURE_NODEID_MSR)) {
+ u64 value;
+
rdmsrl(MSR_FAM10H_NODE_ID, value);
nodes = ((value >> 3) & 7) + 1;
node_id = value & 7;
@@ -279,6 +287,8 @@ static void __cpuinit amd_get_topology(struct cpuinfo_x86 *c)
/* fixup multi-node processor information */
if (nodes > 1) {
+ u32 cores_per_node;
+
set_cpu_cap(c, X86_FEATURE_AMD_DCM);
cores_per_node = c->x86_max_cores / nodes;
--
1.6.4.4
next prev parent reply other threads:[~2010-09-30 12:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-30 12:18 [PATCH 0/6] x86, amd: Add basic support for AMD CPU family 15h Andreas Herrmann
2010-09-30 12:32 ` [PATCH 1/6] x86, mtrr: Assume SYS_CFG[Tom2ForceMemTypeWB] exists on all future AMD CPUs Andreas Herrmann
2010-10-04 20:25 ` [tip:x86/amd-nb] " tip-bot for Andreas Herrmann
2010-09-30 12:33 ` [PATCH 2/6] x86, nmi: Support NMI watchdog on newer AMD CPU families Andreas Herrmann
2010-10-04 20:25 ` [tip:x86/amd-nb] " tip-bot for Andreas Herrmann
2010-09-30 12:36 ` [PATCH 3/6] x86, amd: Add support for CPUID topology extension of AMD CPUs Andreas Herrmann
2010-10-04 20:26 ` [tip:x86/amd-nb] " tip-bot for Andreas Herrmann
2010-09-30 12:38 ` Andreas Herrmann [this message]
2010-10-04 20:26 ` [tip:x86/amd-nb] x86, amd: Extract compute unit information for " tip-bot for Andreas Herrmann
2010-09-30 12:41 ` [PATCH 5/6] x86, amd: Use compute unit information to determine thread siblings Andreas Herrmann
2010-10-04 20:26 ` [tip:x86/amd-nb] " tip-bot for Andreas Herrmann
2010-09-30 12:43 ` [PATCH 6/6] x86, amd_nb: Enable GART support for AMD family 0x15 CPUs Andreas Herrmann
2010-10-04 20:27 ` [tip:x86/amd-nb] " tip-bot for Andreas Herrmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100930123857.GE20545@loge.amd.com \
--to=herrmann.der.user@googlemail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox