]> xenbits.xensource.com Git - xen.git/commit
x86/msr: introduce guest_rdmsr()
authorSergey Dyasli <sergey.dyasli@citrix.com>
Mon, 25 Sep 2017 08:56:13 +0000 (10:56 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 25 Sep 2017 08:56:13 +0000 (10:56 +0200)
commit37f074a33831633118735b61c6f4e7b413792629
treef0194e25bcc5dcfd95b02b0f63c35aba2e4fbcb5
parente7a370733bd20c2c078dade477cd4597557a82e7
x86/msr: introduce guest_rdmsr()

The new function is responsible for handling RDMSR from both HVM and PV
guests. Currently it handles only 2 MSRs:

    MSR_INTEL_PLATFORM_INFO
    MSR_INTEL_MISC_FEATURES_ENABLES

It has a different behaviour compared to the old MSR handlers: if MSR
is being handled by guest_rdmsr() then RDMSR will either succeed (if
a guest is allowed to access it based on its MSR policy) or produce
a GP fault. A guest will never see a H/W value of some MSR unknown to
this function.

guest_rdmsr() unifies and replaces the handling code from
vmx_msr_read_intercept() and priv_op_read_msr().

Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
This (along with the prep work in init_domain_msr_policy()) also fixes
a bug where Dom0 could probe and find CPUID faulting, even though it
couldn't actually use it.

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
xen/arch/x86/hvm/hvm.c
xen/arch/x86/hvm/vmx/vmx.c
xen/arch/x86/msr.c
xen/arch/x86/pv/emul-priv-op.c
xen/include/asm-x86/msr.h