mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
x86/xstate: Stop tracking nonlazy xstate use
With the removal of lazy FPU, the full state is always restored on context switch so stop tracking whether nonlazy xstate is used. Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
This commit is contained in:
1 parent
4b9851c645
commit
7eb3d8420d
6 files changed
+3
-23
No files matched your search
@@ -1013,7 +1013,6 @@ long arch_do_domctl(
|
||||
|
||||
v->arch.xcr0 = _xcr0;
|
||||
v->arch.xcr0_accum = _xcr0_accum;
|
||||
v->arch.nonlazy_xstate_used = _xcr0_accum & XSTATE_NONLAZY;
|
||||
compress_xsave_states(v, _xsave_area,
|
||||
evc->size - PV_XSAVE_HDR_SIZE);
|
||||
|
||||
|
||||
@@ -1384,7 +1384,6 @@ static int cf_check hvm_load_cpu_xsave_states(
|
||||
|
||||
v->arch.xcr0 = ctxt->xcr0;
|
||||
v->arch.xcr0_accum = ctxt->xcr0_accum;
|
||||
v->arch.nonlazy_xstate_used = ctxt->xcr0_accum & XSTATE_NONLAZY;
|
||||
compress_xsave_states(v, &ctxt->save_area,
|
||||
size - offsetof(struct hvm_hw_cpu_xsave, save_area));
|
||||
|
||||
|
||||
+1
-11
@@ -108,25 +108,18 @@ static inline void fpu_fxrstor(struct vcpu *v)
|
||||
/* FPU Save Functions */
|
||||
/*******************************/
|
||||
|
||||
static inline uint64_t vcpu_xsave_mask(const struct vcpu *v)
|
||||
{
|
||||
return v->arch.nonlazy_xstate_used ? XSTATE_ALL : XSTATE_LAZY;
|
||||
}
|
||||
|
||||
/* Save x87 extended state */
|
||||
static inline void fpu_xsave(struct vcpu *v)
|
||||
{
|
||||
bool ok;
|
||||
uint64_t mask = vcpu_xsave_mask(v);
|
||||
|
||||
ASSERT(mask);
|
||||
/*
|
||||
* XCR0 normally represents what guest OS set. In case of Xen itself,
|
||||
* we set the accumulated feature mask before doing save/restore.
|
||||
*/
|
||||
ok = set_xcr0(v->arch.xcr0_accum | XSTATE_FP_SSE);
|
||||
ASSERT(ok);
|
||||
xsave(v, mask);
|
||||
xsave(v, XSTATE_ALL);
|
||||
ok = set_xcr0(v->arch.xcr0 ?: XSTATE_FP_SSE);
|
||||
ASSERT(ok);
|
||||
}
|
||||
@@ -202,9 +195,6 @@ void vcpu_restore_fpu(struct vcpu *v)
|
||||
*/
|
||||
static bool _vcpu_save_fpu(struct vcpu *v)
|
||||
{
|
||||
if ( !v->arch.nonlazy_xstate_used )
|
||||
return false;
|
||||
|
||||
ASSERT(!is_idle_vcpu(v));
|
||||
|
||||
/* This can happen, if a paravirtualised guest OS has set its CR0.TS. */
|
||||
|
||||
@@ -667,9 +667,6 @@ struct arch_vcpu
|
||||
* it explicitly enables it via xcr0.
|
||||
*/
|
||||
uint64_t xcr0_accum;
|
||||
/* This variable determines whether nonlazy extended state has been used,
|
||||
* and thus should be saved/restored. */
|
||||
bool nonlazy_xstate_used;
|
||||
|
||||
struct vmce vmce;
|
||||
|
||||
|
||||
@@ -33,12 +33,10 @@ extern uint32_t mxcsr_mask;
|
||||
#define XSTATE_FP_SSE (X86_XCR0_X87 | X86_XCR0_SSE)
|
||||
#define XCNTXT_MASK (X86_XCR0_X87 | X86_XCR0_SSE | X86_XCR0_YMM | \
|
||||
X86_XCR0_OPMASK | X86_XCR0_ZMM | X86_XCR0_HI_ZMM | \
|
||||
XSTATE_NONLAZY)
|
||||
X86_XCR0_BNDREGS | X86_XCR0_BNDCSR | X86_XCR0_PKRU | \
|
||||
X86_XCR0_TILE_CFG | X86_XCR0_TILE_DATA)
|
||||
|
||||
#define XSTATE_ALL (~(1ULL << 63))
|
||||
#define XSTATE_NONLAZY (X86_XCR0_BNDREGS | X86_XCR0_BNDCSR | X86_XCR0_PKRU | \
|
||||
X86_XCR0_TILE_CFG | X86_XCR0_TILE_DATA)
|
||||
#define XSTATE_LAZY (XSTATE_ALL & ~XSTATE_NONLAZY)
|
||||
#define XSTATE_XSAVES_ONLY 0
|
||||
#define XSTATE_COMPACTION_ENABLED (1ULL << 63)
|
||||
|
||||
|
||||
@@ -1002,9 +1002,6 @@ int handle_xsetbv(u32 index, u64 new_bv)
|
||||
curr->arch.xcr0 = new_bv;
|
||||
curr->arch.xcr0_accum |= new_bv;
|
||||
|
||||
if ( new_bv & XSTATE_NONLAZY )
|
||||
curr->arch.nonlazy_xstate_used = 1;
|
||||
|
||||
mask &= ~XSTATE_FP_SSE;
|
||||
if ( mask )
|
||||
{
|
||||
|
||||