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

[Xen-changelog] [xen-unstable] svm: Handle MC4_MISC threshold register for guests



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1180009829 -3600
# Node ID 2623444e6d335c0b5780c01339199a2f69f79092
# Parent  acee9e2c6f8be4f4e89d0f402d05de4970edb24e
svm: Handle MC4_MISC threshold register for guests

The threshold register has been introduced in AMD RevF CPUs along with
SVM (Actually this MCA/MCE msr register existed before, but had no
meaning). Therefore no need for additional cpuid checks.

On read access it reports the HVM guest the register has been locked
by the BIOS. This means, it is not available for OS use. Thus, write
accesses are simply ignored. This behaviour actually matches real HW,
so guests can deal with this.

Signed-off-by: Christoph Egger <Christoph.Egger@xxxxxxx>
---
 xen/arch/x86/hvm/svm/svm.c |   16 ++++++++++++++++
 xen/include/asm-x86/msr.h  |   21 +++++++++++++++++++++
 2 files changed, 37 insertions(+)

diff -r acee9e2c6f8b -r 2623444e6d33 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Thu May 24 11:33:39 2007 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c        Thu May 24 13:30:29 2007 +0100
@@ -177,6 +177,14 @@ static inline int long_mode_do_msr_write
         if ( !svm_paging_enabled(v) )
             vmcb->efer &= ~(EFER_LME | EFER_LMA);
 
+        break;
+
+    case MSR_K8_MC4_MISC: /* Threshold register */
+        /*
+         * MCA/MCE: Threshold register is reported to be locked, so we ignore
+         * all write accesses. This behaviour matches real HW, so guests should
+         * have no problem with this.
+         */
         break;
 
     default:
@@ -2062,6 +2070,14 @@ static inline void svm_do_msr_access(
             msr_content = v->arch.hvm_svm.cpu_shadow_efer;
             break;
 
+        case MSR_K8_MC4_MISC: /* Threshold register */
+            /*
+             * MCA/MCE: We report that the threshold register is unavailable
+             * for OS use (locked by the BIOS).
+             */
+            msr_content = 1ULL << 61; /* MC4_MISC.Locked */
+            break;
+
         default:
             if ( rdmsr_hypervisor_regs(ecx, &eax, &edx) ||
                  rdmsr_safe(ecx, eax, edx) == 0 )
diff -r acee9e2c6f8b -r 2623444e6d33 xen/include/asm-x86/msr.h
--- a/xen/include/asm-x86/msr.h Thu May 24 11:33:39 2007 +0100
+++ b/xen/include/asm-x86/msr.h Thu May 24 13:30:29 2007 +0100
@@ -216,6 +216,27 @@ static inline void write_efer(__u64 val)
 #define MSR_IA32_MC0_STATUS            0x401
 #define MSR_IA32_MC0_ADDR              0x402
 #define MSR_IA32_MC0_MISC              0x403
+
+/* K8 Machine Check MSRs */
+#define MSR_K8_MC1_CTL                 0x404
+#define MSR_K8_MC1_STATUS              0x405
+#define MSR_K8_MC1_ADDR                        0x406
+#define MSR_K8_MC1_MISC                        0x407
+
+#define MSR_K8_MC2_CTL                 0x408
+#define MSR_K8_MC2_STATUS              0x409
+#define MSR_K8_MC2_ADDR                        0x40A
+#define MSR_K8_MC2_MISC                        0x40B
+
+#define MSR_K8_MC3_CTL                 0x40C
+#define MSR_K8_MC3_STATUS              0x40D
+#define MSR_K8_MC3_ADDR                        0x40E
+#define MSR_K8_MC3_MISC                        0x40F
+
+#define MSR_K8_MC4_CTL                 0x410
+#define MSR_K8_MC4_STATUS              0x411
+#define MSR_K8_MC4_ADDR                        0x412
+#define MSR_K8_MC4_MISC                        0x413
 
 /* Pentium IV performance counter MSRs */
 #define MSR_P4_BPU_PERFCTR0            0x300

_______________________________________________
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®.