diff options
author | Andrew Cooper <andrew.cooper3@citrix.com> | 2019-04-09 16:18:46 +0100 |
---|---|---|
committer | Andrew Cooper <andrew.cooper3@citrix.com> | 2019-04-15 17:51:30 +0100 |
commit | be3d5b30331d87e177744dbe23138b9ebcdc86f1 (patch) | |
tree | 626ff7ccfa15fc19cad87ec68a14ebc1094b3a54 /xen/arch/x86/msr.c | |
parent | 1aec95350ac8261cba516371710d4d837c26f6a0 (diff) |
x86/msr: Fix fallout from mostly c/s 832c180
* Fix the shim build by providing a !CONFIG_HVM declaration for
hvm_get_guest_bndcfgs(), and removing the introduced
ASSERT(is_hvm_domain(d))'s. They are needed for DCE to keep the build
working. Furthermore, in this way, the risk of runtime type confusion is
removed.
* Revert the de-const'ing of the vcpu pointer in vmx_get_guest_bndcfgs().
vmx_vmcs_enter() really does mutate the vcpu, and may cause it to undergo a
full de/reschedule, which is contrary to the programmers expectation of
hvm_get_guest_bndcfgs(). guest_rdmsr() was always going to need to lose
its const parameter, and this was the correct time for it to happen.
* The MSRs in vcpu_msrs are in numeric order. Re-position XSS to match.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Diffstat (limited to 'xen/arch/x86/msr.c')
-rw-r--r-- | xen/arch/x86/msr.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c index 815d599588..0049a73bc7 100644 --- a/xen/arch/x86/msr.c +++ b/xen/arch/x86/msr.c @@ -115,7 +115,7 @@ int init_vcpu_msr_policy(struct vcpu *v) return 0; } -int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val) +int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val) { const struct vcpu *curr = current; const struct domain *d = v->domain; @@ -182,13 +182,9 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val) break; case MSR_IA32_BNDCFGS: - if ( !cp->feat.mpx ) + if ( !cp->feat.mpx || !is_hvm_domain(d) || + !hvm_get_guest_bndcfgs(v, val) ) goto gp_fault; - - ASSERT(is_hvm_domain(d)); - if (!hvm_get_guest_bndcfgs(v, val) ) - goto gp_fault; - break; case MSR_IA32_XSS: @@ -375,13 +371,9 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val) break; case MSR_IA32_BNDCFGS: - if ( !cp->feat.mpx ) + if ( !cp->feat.mpx || !is_hvm_domain(d) || + !hvm_set_guest_bndcfgs(v, val) ) goto gp_fault; - - ASSERT(is_hvm_domain(d)); - if ( !hvm_set_guest_bndcfgs(v, val) ) - goto gp_fault; - break; case MSR_IA32_XSS: |