Skip to contentSkip to conversation

CPUID workaround for intel CPU - Re: [PROBLEM] mtrr's not set, 2.6.13

PATCH In review Shaohua Li 2 participants 2 messages Sep 29, 2005

lore
Share & tools
lore

Shaohua Li

author
#0 lore raw

PATCH 1/1 CPUID workaround for intel CPU - Re: [PROBLEM] mtrr's not set, 2.6.13

Hi Andrew,
This is patch to fix the Jim McCloskey's MTRR issue.
CPUID workaround for steppings 0F33h(supporting x86) and 0F34h(supporting x86 and EM64T). Detail info can be found at:
http://download.intel.com/design/Xeon/specupdt/30240216.pdf
http://download.intel.com/design/Pentium4/specupdt/30235221.pdf

---

 linux-2.6.14-rc2-root/arch/i386/kernel/cpu/mtrr/main.c |    8 ++++++++
 linux-2.6.14-rc2-root/arch/x86_64/kernel/setup.c       |    6 ++++++
 2 files changed, 14 insertions(+)
arch/i386/kernel/cpu/mtrr/main.c renamed from arch/i386/kernel/cpu/mtrr/main.c~cpuid_errta +8 -0
diff -puN arch/i386/kernel/cpu/mtrr/main.c~cpuid_errta arch/i386/kernel/cpu/mtrr/main.c
@@ -626,6 +626,14 @@ void __init mtrr_bp_init(void)
 		if (cpuid_eax(0x80000000) >= 0x80000008) {
 			u32 phys_addr;
 			phys_addr = cpuid_eax(0x80000008) & 0xff;
+			/* CPUID workaround for Intel 0F33/0F34 CPU */
+			if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
+			    boot_cpu_data.x86 == 0xF &&
+			    boot_cpu_data.x86_model == 0x3 &&
+			    (boot_cpu_data.x86_mask == 0x3 ||
+			     boot_cpu_data.x86_mask == 0x4))
+				phys_addr = 36;
+
 			size_or_mask = ~((1 << (phys_addr - PAGE_SHIFT)) - 1);
 			size_and_mask = ~size_or_mask & 0xfff00000;
 		} else if (boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR &&
arch/x86_64/kernel/setup.c renamed from arch/x86_64/kernel/setup.c~cpuid_errta +6 -0
diff -puN arch/x86_64/kernel/setup.c~cpuid_errta arch/x86_64/kernel/setup.c
@@ -992,6 +992,12 @@ static void __cpuinit init_intel(struct 
 		unsigned eax = cpuid_eax(0x80000008);
 		c->x86_virt_bits = (eax >> 8) & 0xff;
 		c->x86_phys_bits = eax & 0xff;
+		/* CPUID workaround for Intel 0F34 CPU */
+		if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
+		    boot_cpu_data.x86 == 0xF &&
+		    boot_cpu_data.x86_model == 0x3 &&
+		    boot_cpu_data.x86_mask == 0x4)
+			c->x86_phys_bits = 36;
 	}
 
 	if (c->x86 == 15)

_

#1 lore raw
Quoted 18 lines · Shaohua Li

Hi Andrew,
This is patch to fix the Jim McCloskey's MTRR issue.
CPUID workaround for steppings 0F33h(supporting x86) and 0F34h(supporting x86 and EM64T). Detail info can be found at:
http://download.intel.com/design/Xeon/specupdt/30240216.pdf
http://download.intel.com/design/Pentium4/specupdt/30235221.pdf

---

 linux-2.6.14-rc2-root/arch/i386/kernel/cpu/mtrr/main.c |    8 ++++++++
 linux-2.6.14-rc2-root/arch/x86_64/kernel/setup.c       |    6 ++++++
 2 files changed, 14 insertions(+)

diff -puN arch/i386/kernel/cpu/mtrr/main.c~cpuid_errta arch/i386/kernel/cpu/mtrr/main.c

arch/i386/kernel/cpu/mtrr/main.c void __init mtrr_bp_init(void) · line 635

Quoted 10 lines
arch/i386/kernel/cpu/mtrr/main.c renamed from arch/i386/kernel/cpu/mtrr/main.c~cpuid_errta +7 -0
@@ -626,6 +626,14 @@ void __init mtrr_bp_init(void)
 		if (cpuid_eax(0x80000000) >= 0x80000008) {
 			u32 phys_addr;
 			phys_addr = cpuid_eax(0x80000008) & 0xff;
+			/* CPUID workaround for Intel 0F33/0F34 CPU */
+			if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
+			    boot_cpu_data.x86 == 0xF &&
+			    boot_cpu_data.x86_model == 0x3 &&
+			    (boot_cpu_data.x86_mask == 0x3 ||
+			     boot_cpu_data.x86_mask == 0x4))
+				phys_addr = 36;

Please change the comment to indicate the actual erratum number. Something like "Work around P4 Erratum #<N>" should do.

/Mikael