summaryrefslogtreecommitdiff
path: root/xen/arch/x86/msr.c
diff options
context:
space:
mode:
authorAndrew Cooper <andrew.cooper3@citrix.com>2020-07-21 18:25:15 +0100
committerAndrew Cooper <andrew.cooper3@citrix.com>2020-07-23 15:42:48 +0100
commit8a7bf75eb5bba4046c1aa278330a371545a6ecbd (patch)
tree0c70c0caac7bdca96c711274365dfa0e68c53c68 /xen/arch/x86/msr.c
parentffe4f0fe17b5288e0c19955cd1ba589e6db1b0fe (diff)
x86/vmce: Dispatch vmce_{rd,wr}msr() from guest_{rd,wr}msr()
... rather than from the default clauses of the PV and HVM MSR handlers. This means that we no longer take the vmce lock for any unknown MSR, and accesses to architectural MCE banks outside of the subset implemented for the guest no longer fall further through the unknown MSR path. The bank limit of 32 isn't stated anywhere I can locate, but is a consequence of the MSR layout described in SDM Volume 4. With the vmce calls removed, the hvm alternative_call()'s expression can be simplified substantially. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Diffstat (limited to 'xen/arch/x86/msr.c')
-rw-r--r--xen/arch/x86/msr.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 22f921cc71..ca4307e19f 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -227,6 +227,14 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
*val = msrs->misc_features_enables.raw;
break;
+ case MSR_IA32_MCG_CAP ... MSR_IA32_MCG_CTL: /* 0x179 -> 0x17b */
+ case MSR_IA32_MCx_CTL2(0) ... MSR_IA32_MCx_CTL2(31): /* 0x280 -> 0x29f */
+ case MSR_IA32_MCx_CTL(0) ... MSR_IA32_MCx_MISC(31): /* 0x400 -> 0x47f */
+ case MSR_IA32_MCG_EXT_CTL: /* 0x4d0 */
+ if ( vmce_rdmsr(msr, val) < 0 )
+ goto gp_fault;
+ break;
+
case MSR_X2APIC_FIRST ... MSR_X2APIC_LAST:
if ( !is_hvm_domain(d) || v != curr )
goto gp_fault;
@@ -436,6 +444,14 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
break;
}
+ case MSR_IA32_MCG_CAP ... MSR_IA32_MCG_CTL: /* 0x179 -> 0x17b */
+ case MSR_IA32_MCx_CTL2(0) ... MSR_IA32_MCx_CTL2(31): /* 0x280 -> 0x29f */
+ case MSR_IA32_MCx_CTL(0) ... MSR_IA32_MCx_MISC(31): /* 0x400 -> 0x47f */
+ case MSR_IA32_MCG_EXT_CTL: /* 0x4d0 */
+ if ( vmce_wrmsr(msr, val) < 0 )
+ goto gp_fault;
+ break;
+
case MSR_X2APIC_FIRST ... MSR_X2APIC_LAST:
if ( !is_hvm_domain(d) || v != curr )
goto gp_fault;