Skip to content

Commit d873318

Browse files
committed
KVM: selftests: Drop manual XCR0 configuration from AMX test
Now that CR4.OSXSAVE and XCR0 are setup by default, drop the manual enabling of OXSAVE and XTILE from the AMX test. Reviewed-by: Vitaly Kuznetsov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 3678c7f commit d873318

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

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

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ static inline void __xsavec(struct xstate *xstate, uint64_t rfbm)
8686

8787
static void check_xtile_info(void)
8888
{
89+
GUEST_ASSERT((xgetbv(0) & XFEATURE_MASK_XTILE) == XFEATURE_MASK_XTILE);
90+
8991
GUEST_ASSERT(this_cpu_has_p(X86_PROPERTY_XSTATE_MAX_SIZE_XCR0));
9092
GUEST_ASSERT(this_cpu_property(X86_PROPERTY_XSTATE_MAX_SIZE_XCR0) <= XSAVE_SIZE);
9193

@@ -122,29 +124,12 @@ static void set_tilecfg(struct tile_config *cfg)
122124
}
123125
}
124126

125-
static void init_regs(void)
126-
{
127-
uint64_t cr4, xcr0;
128-
129-
GUEST_ASSERT(this_cpu_has(X86_FEATURE_XSAVE));
130-
131-
/* turn on CR4.OSXSAVE */
132-
cr4 = get_cr4();
133-
cr4 |= X86_CR4_OSXSAVE;
134-
set_cr4(cr4);
135-
GUEST_ASSERT(this_cpu_has(X86_FEATURE_OSXSAVE));
136-
137-
xcr0 = xgetbv(0);
138-
xcr0 |= XFEATURE_MASK_XTILE;
139-
xsetbv(0x0, xcr0);
140-
GUEST_ASSERT((xgetbv(0) & XFEATURE_MASK_XTILE) == XFEATURE_MASK_XTILE);
141-
}
142-
143127
static void __attribute__((__flatten__)) guest_code(struct tile_config *amx_cfg,
144128
struct tile_data *tiledata,
145129
struct xstate *xstate)
146130
{
147-
init_regs();
131+
GUEST_ASSERT(this_cpu_has(X86_FEATURE_XSAVE) &&
132+
this_cpu_has(X86_FEATURE_OSXSAVE));
148133
check_xtile_info();
149134
GUEST_SYNC(1);
150135

0 commit comments

Comments
 (0)