target/i386: Change wrong XFRM value
PATCH v3 1/1 target/i386: Change wrong 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).
--- target/i386/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/i386/cpu.c +2 -2
@@ -5718,8 +5718,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 ;
Quoted 3 lines · Yang Zhong
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).
I don't particularly like the sentence's second half, and looks it's better to also call out "wrong XFRM value in SGX CPUID leaf" in the patch title.
Anyway ...
Quoted 5 lines
Fixes 301e90675c3f ("target/i386: Enable support for XSAVES based features")Signed-off-by Yang Zhong <[email protected]>Reviewed-by Yang Weijiang <[email protected]>
...
Quoted 19 lines
--- target/i386/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)target/i386/cpu.c +2
-2@@ -5718,8 +5718,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 ;
Paolo Bonzini
AppliedQueued, thanks.
Paolo
Quoted 2 lines · Paolo Bonzini
Queued, thanks.
Paolo, thanks!
Yang
Quoted 3 lines
Paolo
Quoted 5 lines · Yang Zhong
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")
This seems to be -stable material, no?
/mjt
Quoted 9 lines · Michael Tokarev
Quoted 5 lines · Yang Zhong
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")This seems to be -stable material, no?
I checked Qemu stable-7.2, the 301e90675c3f patch was included into this release. So, this fix patch need to be merged into stable release. thanks!
Regards,
Yang
Quoted 1 line
/mjt