Skip to contentSkip to conversation

target/i386: Switch back XFRM value

PATCH RESEND In review Yang Zhong 4 participants 5 messages Oct 26, 2022 – Apr 6, 2023

lore
Share & tools
lore

Yang Zhong

author
#0 lore raw

PATCH RESEND v2 1/1 target/i386: Switch back XFRM value

The previous patch wrongly replaced FEAT_XSAVE_XCR0_{LO|HI} with FEAT_XSAVE_XSS_{LO|HI} in CPUID(EAX=12,ECX=1):{ECX,EDX}, which made SGX enclave only supported SSE and x87 feature(xfrm=0x3).

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 ad623d91e4..19aaed877b 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.30.2
Reviewed-by on v2 1/1
#1 lore raw
Quoted 16 lines · Yang

The previous patch wrongly replaced FEAT_XSAVE_XCR0_{LO|HI} with FEAT_XSAVE_XSS_{LO|HI} in CPUID(EAX=12,ECX=1):{ECX,EDX}, which made SGX enclave only supported SSE and x87 feature(xfrm=0x3).

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 +0 -0
index ad623d91e4..19aaed877b 100644

target/i386/cpu.c void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, · line 5588

Quoted 7 lines
target/i386/cpu.c +2 -2
@@ -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];

Oops, that's my fault to replace with wrong definitions, thanks for the fix!

Quoted 3 lines
target/i386/cpu.c +0 -0
              /* FP and SSE are always allowed regardless of XSAVE/XCR0. */
              *ecx |= XSTATE_FP_MASK | XSTATE_SSE_MASK;
#2 lore raw
Quoted 29 lines · Weijiang
Quoted 16 lines · Yang

The previous patch wrongly replaced FEAT_XSAVE_XCR0_{LO|HI} with FEAT_XSAVE_XSS_{LO|HI} in CPUID(EAX=12,ECX=1):{ECX,EDX}, which made SGX enclave only supported SSE and x87 feature(xfrm=0x3).

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 +0 -0
index ad623d91e4..19aaed877b 100644

target/i386/cpu.c void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, · line 5588

Quoted 7 lines
target/i386/cpu.c +2 -2
@@ -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];

Oops, that's my fault to replace with wrong definitions, thanks for the fix!

Quoted 1 line

Hi,
I do not have any background on this but stumbled over this and wondered, is there any particular reason why this wasn't applied yet?

It seemed to fix a former mistake, was acked and then ... silence

Quoted 4 lines
Quoted 3 lines
target/i386/cpu.c +0 -0
              /* FP and SSE are always allowed regardless of XSAVE/XCR0. */
              *ecx |= XSTATE_FP_MASK | XSTATE_SSE_MASK;
Signature · 3 lines
Christian Ehrhardt
Senior Staff Engineer, Ubuntu Server
Canonical Ltd
#3 lore raw
Quoted 28 lines · Christian Ehrhardt
Quoted 27 lines · Weijiang
Quoted 16 lines · Yang

The previous patch wrongly replaced FEAT_XSAVE_XCR0_{LO|HI} with FEAT_XSAVE_XSS_{LO|HI} in CPUID(EAX=12,ECX=1):{ECX,EDX}, which made SGX enclave only supported SSE and x87 feature(xfrm=0x3).

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 +0 -0
index ad623d91e4..19aaed877b 100644

target/i386/cpu.c void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, · line 5588

Quoted 7 lines
target/i386/cpu.c +2 -2
@@ -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];

Oops, that's my fault to replace with wrong definitions, thanks for the fix!

Quoted 6 lines
Quoted 1 line

Hi,
I do not have any background on this but stumbled over this and wondered, is there any particular reason why this wasn't applied yet?

It seemed to fix a former mistake, was acked and then ... silence

Chris, thanks for the catch!

I double checked this patch isn't in the latest 8.0.0-rc1 tree.

Hi, Paolo,

Could you help merge this fixup patch? Thanks!

Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
target/i386/cpu.c +0 -0
               /* FP and SSE are always allowed regardless of XSAVE/XCR0. */
               *ecx |= XSTATE_FP_MASK | XSTATE_SSE_MASK;
#4 lore raw
Quoted 37 lines · Weijiang
Quoted 28 lines · Christian Ehrhardt
Quoted 27 lines · Weijiang
Quoted 16 lines · Yang

The previous patch wrongly replaced FEAT_XSAVE_XCR0_{LO|HI} with FEAT_XSAVE_XSS_{LO|HI} in CPUID(EAX=12,ECX=1):{ECX,EDX}, which made SGX enclave only supported SSE and x87 feature(xfrm=0x3).

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 +0 -0
index ad623d91e4..19aaed877b 100644

target/i386/cpu.c void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, · line 5588

Quoted 7 lines
target/i386/cpu.c +2 -2
@@ -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];

Oops, that's my fault to replace with wrong definitions, thanks for the fix!

Quoted 6 lines
Quoted 1 line

Hi,
I do not have any background on this but stumbled over this and wondered, is there any particular reason why this wasn't applied yet?

It seemed to fix a former mistake, was acked and then ... silence

Quoted 8 lines

Chris, thanks for the catch!

I double checked this patch isn't in the latest 8.0.0-rc1 tree.

Hi, Paolo,

Could you help merge this fixup patch? Thanks!

Hello all,

Let me rebase this patch and resend it, thanks!

Yang

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
target/i386/cpu.c +0 -0
               /* FP and SSE are always allowed regardless of XSAVE/XCR0. */
               *ecx |= XSTATE_FP_MASK | XSTATE_SSE_MASK;