Skip to content

Commit fd82221

Browse files
hansendcIngo Molnar
authored andcommitted
x86/cpu/intel: Replace PAT erratum model/family magic numbers with symbolic IFM references
There's an erratum that prevents the PAT from working correctly: https://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/pentium-dual-core-specification-update.pdf # Document 316515 Version 010 The kernel currently disables PAT support on those CPUs, but it does it with some magic numbers. Replace the magic numbers with the new "IFM" macros. Make the check refer to the last affected CPU (INTEL_CORE_YONAH) rather than the first fixed one. This makes it easier to find the documentation of the erratum since Intel documents where it is broken and not where it is fixed. I don't think the Pentium Pro (or Pentium II) is actually affected. But the old check included them, so it can't hurt to keep doing the same. I'm also not completely sure about the "Pentium M" CPUs (models 0x9 and 0xd). But, again, they were included in in the old checks and were close Pentium III derivatives, so are likely affected. While we're at it, revise the comment referring to the erratum name and making sure it is a quote of the language from the actual errata doc. That should make it easier to find in the future when the URL inevitably changes. Why bother with this in the first place? It actually gets rid of one of the very few remaining direct references to c->x86{,_model}. No change in functionality intended. Signed-off-by: Dave Hansen <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Cc: Len Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent c9f016e commit fd82221

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

arch/x86/include/asm/intel-family.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
/* Wildcard match for FAM6 so X86_MATCH_VFM(ANY) works */
4848
#define INTEL_ANY IFM(X86_FAMILY_ANY, X86_MODEL_ANY)
4949

50+
#define INTEL_PENTIUM_PRO IFM(6, 0x01)
51+
5052
#define INTEL_FAM6_CORE_YONAH 0x0E
5153
#define INTEL_CORE_YONAH IFM(6, 0x0E)
5254

arch/x86/kernel/cpu/intel.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -311,16 +311,18 @@ static void early_init_intel(struct cpuinfo_x86 *c)
311311
}
312312

313313
/*
314-
* There is a known erratum on Pentium III and Core Solo
315-
* and Core Duo CPUs.
316-
* " Page with PAT set to WC while associated MTRR is UC
317-
* may consolidate to UC "
318-
* Because of this erratum, it is better to stick with
319-
* setting WC in MTRR rather than using PAT on these CPUs.
314+
* PAT is broken on early family 6 CPUs, the last of which
315+
* is "Yonah" where the erratum is named "AN7":
320316
*
321-
* Enable PAT WC only on P4, Core 2 or later CPUs.
317+
* Page with PAT (Page Attribute Table) Set to USWC
318+
* (Uncacheable Speculative Write Combine) While
319+
* Associated MTRR (Memory Type Range Register) Is UC
320+
* (Uncacheable) May Consolidate to UC
321+
*
322+
* Disable PAT and fall back to MTRR on these CPUs.
322323
*/
323-
if (c->x86 == 6 && c->x86_model < 15)
324+
if (c->x86_vfm >= INTEL_PENTIUM_PRO &&
325+
c->x86_vfm <= INTEL_CORE_YONAH)
324326
clear_cpu_cap(c, X86_FEATURE_PAT);
325327

326328
/*

0 commit comments

Comments
 (0)