clean up MSR save/restore code
v3 cover clean up MSR save/restore code
Paul Durrant (4):
x86: stop handling MSR_IA32_BNDCFGS save/restore in implementation
code
x86: move the saved value of MSR_IA32_XSS into struct vcpu_msrs
x86: stop handling MSR_IA32_XSS save/restore in implementation code
x86: remove defunct init/load/save_msr() hvm_funcs
xen/arch/x86/domain.c | 2 +- xen/arch/x86/hvm/hvm.c | 58 ++++++-------------------- xen/arch/x86/hvm/vmx/vmx.c | 75 +++------------------------------- xen/arch/x86/msr.c | 30 ++++++++++++++ xen/include/asm-x86/hvm/hvm.h | 8 +--- xen/include/asm-x86/hvm/vcpu.h | 1 - xen/include/asm-x86/msr.h | 5 +++ 7 files changed, 57 insertions(+), 122 deletions(-)
---
v2:
- Drop patches #2 and #6 of the v1 series
Signature · 7 lines
2.20.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 1/4 x86: stop handling MSR_IA32_BNDCFGS save/restore in implementation code
Saving and restoring the value of this MSR is currently handled by implementation-specific code despite it being architectural. This patch moves handling of accesses to this MSR from hvm.c into the msr.c, thus allowing the common MSR save/restore code to handle it.
NOTE: Because vmx_get/set_guest_bndcfgs() call vmx_vmcs_enter(), the
struct vcpu pointer passed in, and hence the vcpu pointer passed to guest_rdmsr() cannot be const.
---
Cc: Kevin Tian <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: "Roger Pau Monné" <[email protected]>
Cc: Jun Nakajima <[email protected]>
v3:
- Address further comments from Jan
- Dropped Kevin's R-b because of change to vmx.c
v2:
- Addressed comments from Jan by largely removing hunks
- Keeping Kevin's R-b since remaining hunks in vmx.c are as before
--- xen/arch/x86/hvm/hvm.c | 14 ++------------ xen/arch/x86/hvm/vmx/vmx.c | 26 ++++++-------------------- xen/arch/x86/msr.c | 12 ++++++++++++ xen/include/asm-x86/hvm/hvm.h | 4 ++-- 4 files changed, 22 insertions(+), 34 deletions(-)
xen/arch/x86/hvm/hvm.c +2 -12
@@ -1303,6 +1303,7 @@ static int hvm_load_cpu_xsave_states(struct domain *d, hvm_domain_context_t *h)static const uint32_t msrs_to_send[] = {MSR_SPEC_CTRL ,MSR_INTEL_MISC_FEATURES_ENABLES , +MSR_IA32_BNDCFGS ,MSR_AMD64_DR0_ADDRESS_MASK ,MSR_AMD64_DR1_ADDRESS_MASK ,MSR_AMD64_DR2_ADDRESS_MASK ,
@@ -1440,6 +1441,7 @@ static int hvm_load_cpu_msrs(struct domain *d, hvm_domain_context_t *h)case MSR_SPEC_CTRL :case MSR_INTEL_MISC_FEATURES_ENABLES : +case MSR_IA32_BNDCFGS :case MSR_AMD64_DR0_ADDRESS_MASK : case MSR_AMD64_DR1_ADDRESS_MASK ... MSR_AMD64_DR3_ADDRESS_MASK: rc =guest_wrmsr (v, ctxt->msr[i].index, ctxt->msr[i].val);
@@ -3467,12 +3469,6 @@ int hvm_msr_read_intercept(unsigned int msr, uint64_t *msr_content) *msr_content = v->arch.hvm.msr_xss;break ; -case MSR_IA32_BNDCFGS : -if ( !d->arch.cpuid->feat.mpx || - !hvm_get_guest_bndcfgs (v, msr_content) ) - goto gp_fault; -break ; -case MSR_K8_ENABLE_C1E :case MSR_AMD64_NB_CFG :/*
@@ -3619,12 +3615,6 @@ int hvm_msr_write_intercept(unsigned int msr, uint64_t msr_content, v->arch.hvm.msr_xss = msr_content;break ; -case MSR_IA32_BNDCFGS : -if ( !d->arch.cpuid->feat.mpx || - !hvm_set_guest_bndcfgs (v, msr_content) ) - goto gp_fault; -break ; -case MSR_AMD64_NB_CFG :/* ignore the write */ break ;
xen/arch/x86/hvm/vmx/vmx.c +6 -20
@@ -805,17 +805,6 @@ static unsigned int __init vmx_init_msr(void)static void vmx_save_msr (struct vcpu *v,struct hvm_msr *ctxt) { -vmx_vmcs_enter (v); - -if ( cpu_has_mpx && cpu_has_vmx_mpx ) - { -__vmread (GUEST_BNDCFGS , &ctxt->msr[ctxt->count].val); -if ( ctxt->msr[ctxt->count].val ) - ctxt->msr[ctxt->count++].index =MSR_IA32_BNDCFGS ; - } - -vmx_vmcs_exit (v); -if ( cpu_has_xsaves && cpu_has_vmx_xsaves ) { ctxt->msr[ctxt->count].val = v->arch.hvm.msr_xss;
@@ -835,14 +824,6 @@ static int vmx_load_msr(struct vcpu *v, struct hvm_msr *ctxt) {switch ( ctxt->msr[i].index ) { -case MSR_IA32_BNDCFGS : -if ( cpu_has_mpx && cpu_has_vmx_mpx && -is_canonical_address (ctxt->msr[i].val) && - !(ctxt->msr[i].val &IA32_BNDCFGS_RESERVED ) ) -__vmwrite (GUEST_BNDCFGS , ctxt->msr[i].val); -else if ( ctxt->msr[i].val ) - err = -ENXIO ; -break ;case MSR_IA32_XSS :if ( cpu_has_xsaves && cpu_has_vmx_xsaves ) v->arch.hvm.msr_xss = ctxt->msr[i].val;
@@ -1215,10 +1196,15 @@ static bool vmx_set_guest_bndcfgs(struct vcpu *v, u64 val)return true; } -static bool vmx_get_guest_bndcfgs (struct vcpu *v,u64 *val) +static bool vmx_get_guest_bndcfgs (const struct vcpu *cv,u64 *val) { +struct vcpu *v; +ASSERT (cpu_has_mpx && cpu_has_vmx_mpx); +/* Get a non-const pointer for vmx_vmcs_enter() */ + v = cv->domain->vcpu[cv->vcpu_id]; +vmx_vmcs_enter (v);__vmread (GUEST_BNDCFGS , val);vmx_vmcs_exit (v);
xen/arch/x86/msr.c +12 -0
@@ -160,6 +160,12 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val) ret =guest_rdmsr_x2apic (v, msr, val);break ; +case MSR_IA32_BNDCFGS : +if ( !cp->feat.mpx || !hvm_get_guest_bndcfgs (v, val) ) + goto gp_fault; + +break ; + case 0x40000000 ... 0x400001ff:if (is_viridian_domain (d) ) {
@@ -323,6 +329,12 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val) ret =guest_wrmsr_x2apic (v, msr, val);break ; +case MSR_IA32_BNDCFGS : +if ( !cp->feat.mpx || !hvm_set_guest_bndcfgs (v, val) ) + goto gp_fault; + +break ; + case 0x40000000 ... 0x400001ff:if (is_viridian_domain (d) ) {
xen/include/asm-x86/hvm/hvm.h +2 -2
@@ -149,7 +149,7 @@ struct hvm_function_table {int (*get_guest_pat)(struct vcpu *v,u64 *);int (*set_guest_pat)(struct vcpu *v,u64 ); -bool (*get_guest_bndcfgs)(struct vcpu *v,u64 *); +bool (*get_guest_bndcfgs)(const struct vcpu *v,u64 *);bool (*set_guest_bndcfgs)(struct vcpu *v,u64 );void (*set_tsc_offset)(struct vcpu *v,u64 offset,u64 at_tsc);
@@ -448,7 +448,7 @@ static inline unsigned long hvm_get_shadow_gs_base(struct vcpu *v)return hvm_funcs.get_shadow_gs_base (v); } -static inline bool hvm_get_guest_bndcfgs (struct vcpu *v,u64 *val) +static inline bool hvm_get_guest_bndcfgs (const struct vcpu *v,u64 *val) {return hvm_funcs.get_guest_bndcfgs && hvm_funcs.get_guest_bndcfgs (v, val);
Signature · 7 lines
2.20.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v3 1/4] x86: stop handling MSR_IA32_BNDCFGS save/restore in implementation code
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 14.03.19 at 14:01, <[email protected]> wrote:
xen/arch/x86/hvm/vmx/vmx.c +0
-0@@ -1215,10 +1196,15 @@ static bool vmx_set_guest_bndcfgs(struct vcpu *v, u64 val)return true; }
xen/arch/x86/hvm/vmx/vmx.c static bool vmx_set_guest_bndcfgs(struct vcpu *v, u64 val) · line 1206
Quoted 10 lines
xen/arch/x86/hvm/vmx/vmx.c +5
-1-static bool vmx_get_guest_bndcfgs (struct vcpu *v,u64 *val) +static bool vmx_get_guest_bndcfgs (const struct vcpu *cv,u64 *val) { +struct vcpu *v; +ASSERT (cpu_has_mpx && cpu_has_vmx_mpx); +/* Get a non-const pointer for vmx_vmcs_enter() */ + v = cv->domain->vcpu[cv->vcpu_id];
Any chance this could be made the initializer of the variable?
xen/arch/x86/msr.c int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val) · line 165
Quoted 9 lines
xen/arch/x86/msr.c +3
-0@@ -160,6 +160,12 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val) ret =guest_rdmsr_x2apic (v, msr, val);break ; +case MSR_IA32_BNDCFGS : +if ( !cp->feat.mpx || !hvm_get_guest_bndcfgs (v, val) ) + goto gp_fault;
Didn't we settle on ASSERT(is_hvm_*)?
xen/arch/x86/msr.c int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val) · line 334
Quoted 7 lines
xen/arch/x86/msr.c +3
-0@@ -323,6 +329,12 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val) ret =guest_wrmsr_x2apic (v, msr, val);break ; +case MSR_IA32_BNDCFGS : +if ( !cp->feat.mpx || !hvm_set_guest_bndcfgs (v, val) ) + goto gp_fault;
Same here? Or did Andrew tell you otherwise?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v3 1/4] x86: stop handling MSR_IA32_BNDCFGS save/restore in implementation code
Quoted 21 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 14 March 2019 13:39
To: Paul Durrant <[email protected]>
Cc: Andrew Cooper <[email protected]>; Roger Pau Monne <[email protected]>; Wei Liu <[email protected]>; Jun Nakajima <[email protected]>; Kevin Tian <[email protected]>; xen- devel <[email protected]>
Subject: Re: [PATCH v3 1/4] x86: stop handlingMSR_IA32_BNDCFGSsave/restore in implementation codeQuoted 12 lines
Quoted 1 line
Quoted 1 line · On 14.03.19 at 14:01, <[email protected]> wrote:
xen/arch/x86/hvm/vmx/vmx.c +3
-1@@ -1215,10 +1196,15 @@ static bool vmx_set_guest_bndcfgs(struct vcpu *v, u64 val)return true; } -static bool vmx_get_guest_bndcfgs (struct vcpu *v,u64 *val) +static bool vmx_get_guest_bndcfgs (const struct vcpu *cv,u64 *val) { +struct vcpu *v; +ASSERT (cpu_has_mpx && cpu_has_vmx_mpx);
Quoted 4 lines
xen/arch/x86/hvm/vmx/vmx.c static bool vmx_set_guest_bndcfgs(struct vcpu *v, u64 val) · line 1206
Quoted 2 lines
xen/arch/x86/hvm/vmx/vmx.c +2
-0+/* Get a non-const pointer for vmx_vmcs_enter() */ + v = cv->domain->vcpu[cv->vcpu_id];Any chance this could be made the initializer of the variable?
I thought it looked slightly odd having a comment above the declaration, which is why I did it this way, but I can move it.
Quoted 17 lines
xen/arch/x86/msr.c int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val) · line 165
Quoted 10 lines
xen/arch/x86/msr.c +3
-0@@ -160,6 +160,12 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val) ret =guest_rdmsr_x2apic (v, msr, val);break ; +case MSR_IA32_BNDCFGS : +if ( !cp->feat.mpx || !hvm_get_guest_bndcfgs (v, val) ) + goto gp_fault;Didn't we settle on
ASSERT(is_hvm_*)?Quoted 4 lines
xen/arch/x86/msr.c +0
-0@@ -323,6 +329,12 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val) ret =guest_wrmsr_x2apic (v, msr, val);break ;
Quoted 5 lines
xen/arch/x86/msr.c int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val) · line 334
Quoted 3 lines
xen/arch/x86/msr.c +3
-0+case MSR_IA32_BNDCFGS : +if ( !cp->feat.mpx || !hvm_set_guest_bndcfgs (v, val) ) + goto gp_fault;Same here? Or did Andrew tell you otherwise?
Andrew was ok with me just dropping it, but I can put in the ASSERT if you prefer.
Paul
Quoted 3 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 2/4 x86: move the saved value of MSR_IA32_XSS into struct vcpu_msrs
In reply to Paul DurrantCurrently the value is saved directly in struct hvm_vcpu. This patch simply co-locates it with other saved MSR values. No functional change.
---
Cc: Andrew Cooper <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: "Roger Pau Monné" <[email protected]>
Cc: Jun Nakajima <[email protected]>
--- xen/arch/x86/domain.c | 2 +- xen/arch/x86/hvm/hvm.c | 4 ++-- xen/arch/x86/hvm/vmx/vmx.c | 4 ++-- xen/include/asm-x86/hvm/vcpu.h | 1 - xen/include/asm-x86/msr.h | 5 +++++ 5 files changed, 10 insertions(+), 6 deletions(-)
xen/arch/x86/domain.c +1 -1
@@ -1653,7 +1653,7 @@ static void __context_switch(void)BUG ();if ( cpu_has_xsaves &&is_hvm_vcpu (n) ) -set_msr_xss (n->arch.hvm.msr_xss); +set_msr_xss (n->arch.msrs->xss.raw); }vcpu_restore_fpu_nonlazy (n, false); nd->arch.ctxt_switch->to (n);
xen/arch/x86/hvm/hvm.c +2 -2
@@ -3466,7 +3466,7 @@ int hvm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)case MSR_IA32_XSS :if ( !d->arch.cpuid->xstate.xsaves ) goto gp_fault; - *msr_content = v->arch.hvm.msr_xss; + *msr_content = v->arch.msrs->xss.raw;break ;case MSR_K8_ENABLE_C1E :
@@ -3612,7 +3612,7 @@ int hvm_msr_write_intercept(unsigned int msr, uint64_t msr_content,/* No XSS features currently supported for guests. */ if ( !d->arch.cpuid->xstate.xsaves || msr_content !=0 ) goto gp_fault; - v->arch.hvm.msr_xss = msr_content; + v->arch.msrs->xss.raw = msr_content;break ;case MSR_AMD64_NB_CFG :
xen/arch/x86/hvm/vmx/vmx.c +2 -2
@@ -807,7 +807,7 @@ static void vmx_save_msr(struct vcpu *v, struct hvm_msr *ctxt) {if ( cpu_has_xsaves && cpu_has_vmx_xsaves ) { - ctxt->msr[ctxt->count].val = v->arch.hvm.msr_xss; + ctxt->msr[ctxt->count].val = v->arch.msrs->xss.raw;if ( ctxt->msr[ctxt->count].val ) ctxt->msr[ctxt->count++].index =MSR_IA32_XSS ; }
@@ -826,7 +826,7 @@ static int vmx_load_msr(struct vcpu *v, struct hvm_msr *ctxt) {case MSR_IA32_XSS :if ( cpu_has_xsaves && cpu_has_vmx_xsaves ) - v->arch.hvm.msr_xss = ctxt->msr[i].val; + v->arch.msrs->xss.raw = ctxt->msr[i].val;else err = -ENXIO ;break ;
xen/include/asm-x86/hvm/vcpu.h +0 -1
@@ -176,7 +176,6 @@ struct hvm_vcpu {struct hvm_vcpu_asid n1asid;u64 msr_tsc_adjust; -u64 msr_xss;union {struct vmx_vcpu vmx;
xen/include/asm-x86/msr.h +5 -0
@@ -313,6 +313,11 @@ struct vcpu_msrs* values here may be stale in current context. */ uint32_t dr_mask[4 ]; + +/* 0x00000da0 - MSR_IA32_XSS */ +struct { +uint64_t raw; + } xss; };void init_guest_msr_policy (void );
Signature · 7 lines
2.20.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 3/4 x86: stop handling MSR_IA32_XSS save/restore in implementation code
In reply to Paul DurrantSaving and restoring the value of this MSR is currently handled by implementation-specific code despite it being architectural. This patch moves handling of accesses to this MSR from hvm.c into the msr.c, thus allowing the common MSR save/restore code to handle it.
This patch also adds proper checks of CPUID policy in the new get/set code.
NOTE: MSR_IA32_XSS is the last MSR to be saved and restored by
implementation-specific code. This patch therefore removes the (VMX) definitions and of the init_msr(), save_msr() and load_msr() hvm_funcs, as they are no longer necessary. The declarations of and calls to those hvm_funcs will be cleaned up by a subsequent patch.
---
Cc: Andrew Cooper <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: "Roger Pau Monné" <[email protected]>
Cc: Jun Nakajima <[email protected]>
--- xen/arch/x86/hvm/hvm.c | 15 ++---------- xen/arch/x86/hvm/vmx/vmx.c | 49 -------------------------------------- xen/arch/x86/msr.c | 18 ++++++++++++++ 3 files changed, 20 insertions(+), 62 deletions(-)
xen/arch/x86/hvm/hvm.c +2 -13
@@ -1304,6 +1304,7 @@ static const uint32_t msrs_to_send[] = {MSR_SPEC_CTRL ,MSR_INTEL_MISC_FEATURES_ENABLES ,MSR_IA32_BNDCFGS , +MSR_IA32_XSS ,MSR_AMD64_DR0_ADDRESS_MASK ,MSR_AMD64_DR1_ADDRESS_MASK , MSR_AMD64_DR2_ADDRESS_MASK,
@@ -1442,6 +1443,7 @@ static int hvm_load_cpu_msrs(struct domain *d, hvm_domain_context_t *h)case MSR_SPEC_CTRL :case MSR_INTEL_MISC_FEATURES_ENABLES :case MSR_IA32_BNDCFGS : +case MSR_IA32_XSS :case MSR_AMD64_DR0_ADDRESS_MASK : case MSR_AMD64_DR1_ADDRESS_MASK ... MSR_AMD64_DR3_ADDRESS_MASK: rc =guest_wrmsr (v, ctxt->msr[i].index, ctxt->msr[i].val);
@@ -3463,12 +3465,6 @@ int hvm_msr_read_intercept(unsigned int msr, uint64_t *msr_content) MTRRcap_VCNT))];break ; -case MSR_IA32_XSS : -if ( !d->arch.cpuid->xstate.xsaves ) - goto gp_fault; - *msr_content = v->arch.msrs->xss.raw; -break ; -case MSR_K8_ENABLE_C1E :case MSR_AMD64_NB_CFG :/*
@@ -3608,13 +3604,6 @@ int hvm_msr_write_intercept(unsigned int msr, uint64_t msr_content, goto gp_fault;break ; -case MSR_IA32_XSS : -/* No XSS features currently supported for guests. */ -if ( !d->arch.cpuid->xstate.xsaves || msr_content !=0 ) - goto gp_fault; - v->arch.msrs->xss.raw = msr_content; -break ; -case MSR_AMD64_NB_CFG :/* ignore the write */ break ;
xen/arch/x86/hvm/vmx/vmx.c +0 -49
61 lines not on this page · raw message
xen/arch/x86/msr.c +18 -0
@@ -166,6 +166,13 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)break ; +case MSR_IA32_XSS : +if ( !cp->xstate.xsaves ) + goto gp_fault; + + *val = msrs->xss.raw; +break ; + case 0x40000000 ... 0x400001ff:if (is_viridian_domain (d) ) {
@@ -335,6 +342,17 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)break ; +case MSR_IA32_XSS : +if ( !cp->xstate.xsaves ) + goto gp_fault; + +/* No XSS features currently supported for guests */ +if ( val !=0 ) + goto gp_fault; + + msrs->xss.raw = val; +break ; + case 0x40000000 ... 0x400001ff:if (is_viridian_domain (d) ) {
Signature · 7 lines
2.20.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 4/4 x86: remove defunct init/load/save_msr() hvm_funcs
In reply to Paul DurrantThese hvm_funcs are no longer required since no MSR values are saved or restored by implementation-specific code.
---
Cc: Andrew Cooper <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: "Roger Pau Monné" <[email protected]>
v2:
- Re-instate err check on loop in hvm_load_cpu_msrs()
--- xen/arch/x86/hvm/hvm.c | 29 +++++++++-------------------- xen/include/asm-x86/hvm/hvm.h | 4 ---- 2 files changed, 9 insertions(+), 24 deletions(-)
xen/arch/x86/hvm/hvm.c +9 -20
@@ -1310,7 +1310,6 @@ static const uint32_t msrs_to_send[] = {MSR_AMD64_DR2_ADDRESS_MASK , MSR_AMD64_DR3_ADDRESS_MASK, }; -static unsigned int __read_mostly msr_count_max =ARRAY_SIZE (msrs_to_send);static int hvm_save_cpu_msrs (struct vcpu *v,hvm_domain_context_t *h) {
@@ -1320,7 +1319,7 @@ static int hvm_save_cpu_msrs(struct vcpu *v, hvm_domain_context_t *h)int err; err =_hvm_init_entry (h,CPU_MSR_CODE , v->vcpu_id, -HVM_CPU_MSR_SIZE (msr_count_max)); +HVM_CPU_MSR_SIZE (ARRAY_SIZE (msrs_to_send)));if ( err )return err; ctxt = (struct hvm_msr *)&h->data[h->cur];
@@ -1353,10 +1352,7 @@ static int hvm_save_cpu_msrs(struct vcpu *v, hvm_domain_context_t *h) ctxt->msr[ctxt->count++].val = val; } -if ( hvm_funcs.save_msr ) - hvm_funcs.save_msr (v, ctxt); - -ASSERT (ctxt->count <= msr_count_max); +ASSERT (ctxt->count <=ARRAY_SIZE (msrs_to_send));for ( i =0 ; i < ctxt->count; ++i ) ctxt->msr[i]._rsvd =0 ;
@@ -1431,9 +1427,6 @@ static int hvm_load_cpu_msrs(struct domain *d, hvm_domain_context_t *h)return -EOPNOTSUPP ;/* Checking finished */ -if ( hvm_funcs.load_msr ) - err = hvm_funcs.load_msr (v, ctxt); -for ( i =0 ; !err && i < ctxt->count; ++i ) { switch ( ctxt->msr[i].index )
@@ -1475,17 +1468,13 @@ static int __init hvm_register_CPU_save_and_restore(void)sizeof (struct hvm_save_descriptor ), HVMSR_PER_VCPU); -if ( hvm_funcs.init_msr ) - msr_count_max += hvm_funcs.init_msr (); - -if ( msr_count_max ) -hvm_register_savevm (CPU_MSR_CODE , -"CPU_MSR" , - hvm_save_cpu_msrs, - hvm_load_cpu_msrs, -HVM_CPU_MSR_SIZE (msr_count_max) + -sizeof (struct hvm_save_descriptor ), -HVMSR_PER_VCPU ); +hvm_register_savevm (CPU_MSR_CODE , +"CPU_MSR" , + hvm_save_cpu_msrs, + hvm_load_cpu_msrs, +HVM_CPU_MSR_SIZE (ARRAY_SIZE (msrs_to_send)) + +sizeof (struct hvm_save_descriptor ), +HVMSR_PER_VCPU );return 0 ; }
xen/include/asm-x86/hvm/hvm.h +0 -4
@@ -115,10 +115,6 @@ struct hvm_function_table {void (*save_cpu_ctxt)(struct vcpu *v,struct hvm_hw_cpu *ctxt);int (*load_cpu_ctxt)(struct vcpu *v,struct hvm_hw_cpu *ctxt); -unsigned int (*init_msr)(void ); -void (*save_msr)(struct vcpu *,struct hvm_msr *); -int (*load_msr)(struct vcpu *,struct hvm_msr *); -/* Examine specifics of the guest state. */ unsigned int (*get_interrupt_shadow)(struct vcpu *v);void (*set_interrupt_shadow)(struct vcpu *v,unsigned int intr_shadow);
Signature · 7 lines
2.20.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel