[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-4.1-testing] x86, amd, MTRR: correct DramModEn bit of SYS_CFG MSR



# HG changeset patch
# User Wei Huang <wei.huang2@xxxxxxx>
# Date 1302186101 -3600
# Node ID 4db893357babd205f04db1c45a517fb5836d1c9b
# Parent  bdb1fc99e5a98982b4bdf7ff49181a07728cf5f3
x86, amd, MTRR: correct DramModEn bit of SYS_CFG MSR

Some buggy BIOS might set SYS_CFG DramModEn bit to 1, which can cause
unexpected behavior on AMD platforms. This patch clears DramModEn bit
if it is 1.

Signed-off-by: Wei Huang <wei.huang2@xxxxxxx>
xen-unstable changeset:   23153:8fb61c9ebe49
xen-unstable date:        Wed Apr 06 09:01:31 2011 +0100
---


diff -r bdb1fc99e5a9 -r 4db893357bab xen/arch/x86/cpu/amd.c
--- a/xen/arch/x86/cpu/amd.c    Thu Apr 07 15:20:32 2011 +0100
+++ b/xen/arch/x86/cpu/amd.c    Thu Apr 07 15:21:41 2011 +0100
@@ -318,6 +318,32 @@
                on_each_cpu(disable_c1e, NULL, 1);
 }
 
+/*
+ * BIOS is expected to clear MtrrFixDramModEn bit. According to AMD BKDG : 
+ * "The MtrrFixDramModEn bit should be set to 1 during BIOS initalization of 
+ * the fixed MTRRs, then cleared to 0 for operation."
+ */
+static void check_syscfg_dram_mod_en(void)
+{
+       uint64_t syscfg;
+       static bool_t printed = 0;
+
+       if (!((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) &&
+               (boot_cpu_data.x86 >= 0x0f)))
+               return;
+
+       rdmsrl(MSR_K8_SYSCFG, syscfg);
+       if (!(syscfg & K8_MTRRFIXRANGE_DRAM_MODIFY))
+               return;
+
+       if (!test_and_set_bool(printed))
+               printk(KERN_ERR "MTRR: SYSCFG[MtrrFixDramModEn] not "
+                       "cleared by BIOS, clearing this bit\n");
+
+       syscfg &= ~K8_MTRRFIXRANGE_DRAM_MODIFY;
+       wrmsrl(MSR_K8_SYSCFG, syscfg);
+}
+
 static void __devinit init_amd(struct cpuinfo_x86 *c)
 {
        u32 l, h;
@@ -587,6 +613,8 @@
                disable_c1_ramping();
 
        set_cpuidmask(c);
+
+       check_syscfg_dram_mod_en();
 }
 
 static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 * c, unsigned 
int size)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.