Skip to content

Commit bfc5afc

Browse files
mzhang3579sean-jc
authored andcommitted
KVM: selftests: Verify XTILE_DATA in XSTATE isn't affected by IA32_XFD
Add asserts to verify the XSTATE metadata for XTILE_DATA isn't affected by disabling AMX tile data via IA32_XFD. XFD doesn't intercept XSAVE, it only prevents setting bits in XCR0, i.e. regardless of XFD, AMX state is managed by XSAVE/XRSTOR as long as the corresponding bits are set XCR0. Signed-off-by: Mingwei Zhang <mizhang@google.com> Link: https://lore.kernel.org/r/20230221163655.920289-9-mizhang@google.com [sean: massage changelog] Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 9cbd9aa commit bfc5afc

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

tools/testing/selftests/kvm/x86_64/amx_test.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,16 @@ static void __attribute__((__flatten__)) guest_code(struct tile_config *amx_cfg,
201201

202202
/* xfd=0x40000, disable amx tiledata */
203203
wrmsr(MSR_IA32_XFD, XFEATURE_MASK_XTILEDATA);
204+
205+
/*
206+
* XTILEDATA is cleared in xstate_bv but set in xcomp_bv, this property
207+
* remains the same even when amx tiledata is disabled by IA32_XFD.
208+
*/
209+
xstate->header.xstate_bv = XFEATURE_MASK_XTILEDATA;
210+
__xsavec(xstate, XFEATURE_MASK_XTILEDATA);
211+
GUEST_ASSERT(!(xstate->header.xstate_bv & XFEATURE_MASK_XTILEDATA));
212+
GUEST_ASSERT((xstate->header.xcomp_bv & XFEATURE_MASK_XTILEDATA));
213+
204214
GUEST_SYNC(6);
205215
GUEST_ASSERT(rdmsr(MSR_IA32_XFD) == XFEATURE_MASK_XTILEDATA);
206216
set_tilecfg(amx_cfg);

0 commit comments

Comments
 (0)