From: Hans Rosenfeld <hans.rosenfeld@amd.com>
To: <hpa@zytor.com>
Cc: <tglx@linutronix.de>, <mingo@elte.hu>,
<linux-kernel@vger.kernel.org>, <x86@kernel.org>,
Hans Rosenfeld <hans.rosenfeld@amd.com>
Subject: [PATCH 5/5] x86, cacheinfo, amd: fix reported cache parameters for family 0x10
Date: Thu, 7 Jun 2012 18:45:59 +0200 [thread overview]
Message-ID: <1339087559-32604-5-git-send-email-hans.rosenfeld@amd.com> (raw)
In-Reply-To: <1339087559-32604-1-git-send-email-hans.rosenfeld@amd.com>
Family 0x10 RevD and later can use a part of the L3 cache as probe
filter. The size information from CPUID leaf 8000_0006 takes this into
account, but the reported associativity does not. The result are weird
values for ways_of_associativity and number_of_sets.
This patch fixes this for the affected models of family 0x10.
Signed-off-by: Hans Rosenfeld <hans.rosenfeld@amd.com>
---
arch/x86/kernel/cpu/amd_cacheinfo.c | 11 ++++++++++-
arch/x86/kernel/cpu/cacheinfo.c | 4 ++--
arch/x86/kernel/cpu/cacheinfo.h | 3 ++-
3 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/cpu/amd_cacheinfo.c b/arch/x86/kernel/cpu/amd_cacheinfo.c
index e3fda975..5f77600 100644
--- a/arch/x86/kernel/cpu/amd_cacheinfo.c
+++ b/arch/x86/kernel/cpu/amd_cacheinfo.c
@@ -71,7 +71,8 @@ static const unsigned char __cpuinitconst types[] = { 1, 2, 3, 3 };
void __cpuinit amd_cpuid4(int leaf,
union _cpuid_cacheinfo_eax *eax,
union _cpuid_cacheinfo_ebx *ebx,
- union _cpuid_cacheinfo_ecx *ecx)
+ union _cpuid_cacheinfo_ecx *ecx,
+ struct amd_northbridge *nb)
{
unsigned dummy;
unsigned line_size, lines_per_tag, assoc, size_in_kb;
@@ -118,6 +119,14 @@ void __cpuinit amd_cpuid4(int leaf,
size_in_kb = size_in_kb >> 1;
assoc = assoc >> 1;
}
+ /* reduce associativity by amount used by probe filter */
+ if (boot_cpu_data.x86 == 0x10 && boot_cpu_data.x86_model >= 8 &&
+ nb != NULL) {
+ unsigned int reg;
+ pci_read_config_dword(nb->misc, 0x1d4, ®);
+ if ((reg & 0x3))
+ assoc -= 8;
+ }
break;
default:
return;
diff --git a/arch/x86/kernel/cpu/cacheinfo.c b/arch/x86/kernel/cpu/cacheinfo.c
index db04501..9f879bf 100644
--- a/arch/x86/kernel/cpu/cacheinfo.c
+++ b/arch/x86/kernel/cpu/cacheinfo.c
@@ -27,12 +27,12 @@ int __cpuinit cpuid_cacheinfo_lookup_regs(int index,
if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
#if defined(CONFIG_CPU_SUP_AMD)
+ amd_init_l3_cache(this_leaf, index);
if (cpu_has_topoext)
cpuid_count(0x8000001d, index, &eax.full, &ebx.full,
&ecx.full, &edx);
else
- amd_cpuid4(index, &eax, &ebx, &ecx);
- amd_init_l3_cache(this_leaf, index);
+ amd_cpuid4(index, &eax, &ebx, &ecx, this_leaf->nb);
#endif
} else {
#if defined(CONFIG_CPU_SUP_INTEL)
diff --git a/arch/x86/kernel/cpu/cacheinfo.h b/arch/x86/kernel/cpu/cacheinfo.h
index fe39da7..104f818 100644
--- a/arch/x86/kernel/cpu/cacheinfo.h
+++ b/arch/x86/kernel/cpu/cacheinfo.h
@@ -66,7 +66,8 @@ struct _cache_attr {
extern struct attribute ** amd_l3_attrs(struct attribute **);
extern void amd_cpuid4(int, union _cpuid_cacheinfo_eax *,
union _cpuid_cacheinfo_ebx *,
- union _cpuid_cacheinfo_ecx *);
+ union _cpuid_cacheinfo_ecx *,
+ struct amd_northbridge *nb);
extern void amd_init_l3_cache(struct _cpuid_cacheinfo_regs *, int);
extern void cache_shared_amd_cpu_map_setup(unsigned int, int);
extern void cache_shared_intel_cpu_map_setup(unsigned int, int);
--
1.7.7
next prev parent reply other threads:[~2012-06-07 16:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-07 16:45 [PATCH 1/5] x86, cacheinfo, amd: use cpuid topology extensions to enumerate caches Hans Rosenfeld
2012-06-07 16:45 ` [PATCH 2/5] x86, cacheinfo: it's not only cpuid 4 anymore Hans Rosenfeld
2012-06-07 16:45 ` [PATCH 3/5] x86, cacheinfo: split intel_cacheinfo.c Hans Rosenfeld
2012-06-07 16:45 ` [PATCH 4/5] x86, cacheinfo: use find_num_cache_leaves on AMD systems Hans Rosenfeld
2012-06-07 16:45 ` Hans Rosenfeld [this message]
2012-06-08 18:16 ` [PATCH 5/5] x86, cacheinfo, amd: fix reported cache parameters for family 0x10 H. Peter Anvin
2012-06-11 10:33 ` Hans Rosenfeld
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=1339087559-32604-5-git-send-email-hans.rosenfeld@amd.com \
--to=hans.rosenfeld@amd.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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
all inboxes | Powered by JetHome®