[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v3 07/12] x86/xstate: Map/unmap xsave area in {compress,expand}_xsave_states()
No functional change. Signed-off-by: Alejandro Vallejo <alejandro.vallejo@xxxxxxxxx> --- v2->v3: * Unmap xsave area also before the early return. v1->v2: * No change --- xen/arch/x86/xstate.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c index 12004d7db24b..3d249518a1b7 100644 --- a/xen/arch/x86/xstate.c +++ b/xen/arch/x86/xstate.c @@ -177,7 +177,7 @@ static void setup_xstate_comp(uint16_t *comp_offsets, */ void expand_xsave_states(const struct vcpu *v, void *dest, unsigned int size) { - const struct xsave_struct *xstate = v->arch.xsave_area; + const struct xsave_struct *xstate = VCPU_MAP_XSAVE_AREA(v); const void *src; uint16_t comp_offsets[sizeof(xfeature_mask)*8]; u64 xstate_bv = xstate->xsave_hdr.xstate_bv; @@ -191,7 +191,7 @@ void expand_xsave_states(const struct vcpu *v, void *dest, unsigned int size) if ( !(xstate->xsave_hdr.xcomp_bv & XSTATE_COMPACTION_ENABLED) ) { memcpy(dest, xstate, size); - return; + goto out; } ASSERT(xsave_area_compressed(xstate)); @@ -228,6 +228,9 @@ void expand_xsave_states(const struct vcpu *v, void *dest, unsigned int size) valid &= ~feature; } + + out: + VCPU_UNMAP_XSAVE_AREA(v, xstate); } /* @@ -242,7 +245,7 @@ void expand_xsave_states(const struct vcpu *v, void *dest, unsigned int size) */ void compress_xsave_states(struct vcpu *v, const void *src, unsigned int size) { - struct xsave_struct *xstate = v->arch.xsave_area; + struct xsave_struct *xstate = VCPU_MAP_XSAVE_AREA(v); void *dest; uint16_t comp_offsets[sizeof(xfeature_mask)*8]; u64 xstate_bv, valid; @@ -256,7 +259,7 @@ void compress_xsave_states(struct vcpu *v, const void *src, unsigned int size) if ( !(v->arch.xcr0_accum & XSTATE_XSAVES_ONLY) ) { memcpy(xstate, src, size); - return; + goto out; } /* @@ -294,6 +297,9 @@ void compress_xsave_states(struct vcpu *v, const void *src, unsigned int size) valid &= ~feature; } + + out: + VCPU_UNMAP_XSAVE_AREA(v, xstate); } void xsave(struct vcpu *v, uint64_t mask) -- 2.47.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |