>From e4dac37229beede8658fccffd6600e7d20c55a04 Mon Sep 17 00:00:00 2001 From: Sean Christopherson Date: Mon, 29 Dec 2025 15:05:46 -0800 Subject: [PATCH 2/4] KVM: selftests: Extend AMX test to set XFD with active XTILE data Re-load tile data in the AMX test before setting XFD, e.g. to verify that KVM doesn't try to state for a disabled component. Explicitly release tile data before performing the #NM test to minimize the chances of a false pass, and to verify that TILERELEASE can execute even if XFD[18]=1. Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/x86/amx_test.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/testing/selftests/kvm/x86/amx_test.c b/tools/testing/selftests/kvm/x86/amx_test.c index 3bcb10f26a70..ab6d8748d7b8 100644 --- a/tools/testing/selftests/kvm/x86/amx_test.c +++ b/tools/testing/selftests/kvm/x86/amx_test.c @@ -162,6 +162,11 @@ static void __attribute__((__flatten__)) guest_code(struct tile_config *amx_cfg, GUEST_ASSERT(!(xstate->header.xstate_bv & XFEATURE_MASK_XTILE_DATA)); GUEST_ASSERT(xstate->header.xcomp_bv & XFEATURE_MASK_XTILE_DATA); + set_tilecfg(amx_cfg); + __ldtilecfg(amx_cfg); + __tileloadd(tiledata); + GUEST_SYNC(AMX_SYNC_SAVE_RESTORE | AMX_SYNC_CHECK_TILEDATA); + /* xfd=0x40000, disable amx tiledata */ wrmsr(MSR_IA32_XFD, XFEATURE_MASK_XTILE_DATA); @@ -176,6 +181,7 @@ static void __attribute__((__flatten__)) guest_code(struct tile_config *amx_cfg, GUEST_SYNC(AMX_SYNC_SAVE_RESTORE); GUEST_ASSERT(rdmsr(MSR_IA32_XFD) == XFEATURE_MASK_XTILE_DATA); + __tilerelease(); set_tilecfg(amx_cfg); __ldtilecfg(amx_cfg); /* Trigger #NM exception */ -- 2.52.0.351.gbe84eed79e-goog