Skip to contentSkip to conversation

target/i386: Fix wrong XSAVE feature names

PATCH In review Xiaocheng Dong 2 participants 2 messages Dec 8, 2022 – Dec 9, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/i386: Fix wrong XSAVE feature names

The previous patch changes the name from FEAT_XSAVE_COMP_{LO|HI} to FEAT_XSAVE_XCR0_{LO|HI}, the changes for CPUID.0x12.0x1 should be FEAT_XSAVE_XCR0_{LO|HI}, the SGX can't work in VM if these are not right

Fixes 301e90675c3f ("target/i386: Enable support for XSAVES based features")
---
 target/i386/cpu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target/i386/cpu.c +2 -2
index 22b681ca37..0f71ff9fea 100644
@@ -5584,8 +5584,8 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
         } else {
             *eax &= env->features[FEAT_SGX_12_1_EAX];
             *ebx &= 0; /* ebx reserve */
-            *ecx &= env->features[FEAT_XSAVE_XSS_LO];
-            *edx &= env->features[FEAT_XSAVE_XSS_HI];
+            *ecx &= env->features[FEAT_XSAVE_XCR0_LO];
+            *edx &= env->features[FEAT_XSAVE_XCR0_HI];
 
             /* FP and SSE are always allowed regardless of XSAVE/XCR0. */
             *ecx |= XSTATE_FP_MASK | XSTATE_SSE_MASK;
Signature · 1 line
2.31.1
#1 lore raw

In fact, one month ago, I have sent out V2 for this issue. thanks!
https://lists.nongnu.org/archive/html/qemu-devel/2022-10/msg04825.html

Yang

Quoted 30 lines · Xiaocheng Dong

The previous patch changes the name from FEAT_XSAVE_COMP_{LO|HI} to FEAT_XSAVE_XCR0_{LO|HI}, the changes for CPUID.0x12.0x1 should be FEAT_XSAVE_XCR0_{LO|HI}, the SGX can't work in VM if these are not right

Fixes 301e90675c3f ("target/i386: Enable support for XSAVES based features")
---
 target/i386/cpu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target/i386/cpu.c +2 -2
index 22b681ca37..0f71ff9fea 100644
@@ -5584,8 +5584,8 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
         } else {
             *eax &= env->features[FEAT_SGX_12_1_EAX];
             *ebx &= 0; /* ebx reserve */
-            *ecx &= env->features[FEAT_XSAVE_XSS_LO];
-            *edx &= env->features[FEAT_XSAVE_XSS_HI];
+            *ecx &= env->features[FEAT_XSAVE_XCR0_LO];
+            *edx &= env->features[FEAT_XSAVE_XCR0_HI];
 
             /* FP and SSE are always allowed regardless of XSAVE/XCR0. */
             *ecx |= XSTATE_FP_MASK | XSTATE_SSE_MASK;
Signature · 1 line
2.31.1