mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 16:53:55 -06:00
x86: Support XFD and AMX xsave data migration
XFD(eXtended Feature Disable) allows to enable a feature on xsave state while preventing specific user threads from using the feature. Support save and restore XFD MSRs if CPUID.D.1.EAX[4] enumerate to be valid. Likewise migrate the MSRs and related xsave state necessarily. Signed-off-by: Zeng Guang <guang.zeng@intel.com> Signed-off-by: Wei Wang <wei.w.wang@intel.com> Signed-off-by: Yang Zhong <yang.zhong@intel.com> Message-Id: <20220217060434.52460-8-yang.zhong@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
e56dd3c70a
commit
cdec2b753b
3 changed files with 73 additions and 0 deletions
|
@ -3277,6 +3277,13 @@ static int kvm_put_msrs(X86CPU *cpu, int level)
|
|||
env->msr_ia32_sgxlepubkeyhash[3]);
|
||||
}
|
||||
|
||||
if (env->features[FEAT_XSAVE] & CPUID_D_1_EAX_XFD) {
|
||||
kvm_msr_entry_add(cpu, MSR_IA32_XFD,
|
||||
env->msr_xfd);
|
||||
kvm_msr_entry_add(cpu, MSR_IA32_XFD_ERR,
|
||||
env->msr_xfd_err);
|
||||
}
|
||||
|
||||
/* Note: MSR_IA32_FEATURE_CONTROL is written separately, see
|
||||
* kvm_put_msr_feature_control. */
|
||||
}
|
||||
|
@ -3669,6 +3676,11 @@ static int kvm_get_msrs(X86CPU *cpu)
|
|||
kvm_msr_entry_add(cpu, MSR_IA32_SGXLEPUBKEYHASH3, 0);
|
||||
}
|
||||
|
||||
if (env->features[FEAT_XSAVE] & CPUID_D_1_EAX_XFD) {
|
||||
kvm_msr_entry_add(cpu, MSR_IA32_XFD, 0);
|
||||
kvm_msr_entry_add(cpu, MSR_IA32_XFD_ERR, 0);
|
||||
}
|
||||
|
||||
ret = kvm_vcpu_ioctl(CPU(cpu), KVM_GET_MSRS, cpu->kvm_msr_buf);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
|
@ -3965,6 +3977,12 @@ static int kvm_get_msrs(X86CPU *cpu)
|
|||
env->msr_ia32_sgxlepubkeyhash[index - MSR_IA32_SGXLEPUBKEYHASH0] =
|
||||
msrs[i].data;
|
||||
break;
|
||||
case MSR_IA32_XFD:
|
||||
env->msr_xfd = msrs[i].data;
|
||||
break;
|
||||
case MSR_IA32_XFD_ERR:
|
||||
env->msr_xfd_err = msrs[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue