[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] target/i386: Clear xsave pkru bit when KVM XCR0 not support
|
From: |
Paolo Bonzini |
|
Subject: |
Re: [PATCH] target/i386: Clear xsave pkru bit when KVM XCR0 not support |
|
Date: |
Wed, 17 May 2023 19:08:15 +0200 |
|
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 |
On 5/17/23 12:55, Yuchen wrote:
Migrating guest from Intel new CPU (as Gold 6230) to old CPU (as
E5-2650 v4) will pause on the destination host. Because old CPU
not support xsave pkru feature, and KVM KVM_SET_XSAVE ioctl
return EINVAL.
This kernel commit introduces the problem:
ea4d6938d4c0 x86/fpu: Replace KVMs home brewed FPU copy from user
Signed-off-by: YuChen <yu.chen@h3c.com>
Would this work instead?
diff --git a/target/i386/xsave_helper.c b/target/i386/xsave_helper.c
index 996e9f3bfef5..d3e5edad2ecd 100644
--- a/target/i386/xsave_helper.c
+++ b/target/i386/xsave_helper.c
@@ -47,7 +47,7 @@ void x86_cpu_xsave_all_areas(X86CPU *cpu, void *buf, uint32_t
buflen)
stq_p(xmm + 8, env->xmm_regs[i].ZMM_Q(1));
}
- header->xstate_bv = env->xstate_bv;
+ header->xstate_bv = env->xstate_bv & x86_cpu_xsave_xcr0_components(cpu);
e = &x86_ext_save_areas[XSTATE_YMM_BIT];
if (e->size && e->offset) {
Paolo
Re: [PATCH] target/i386: Clear xsave pkru bit when KVM XCR0 not support, Dongli Zhang, 2023/05/17