Commit 61f20813 authored by Jing Liu's avatar Jing Liu Committed by Paolo Bonzini

kvm: x86: Disable RDMSR interception of IA32_XFD_ERR

This saves one unnecessary VM-exit in guest #NM handler, given that the
MSR is already restored with the guest value before the guest is resumed.
Suggested-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarJing Liu <jing2.liu@intel.com>
Signed-off-by: default avatarYang Zhong <yang.zhong@intel.com>
Message-Id: <20220105123532.12586-15-yang.zhong@intel.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 548e8365
...@@ -162,6 +162,7 @@ static u32 vmx_possible_passthrough_msrs[MAX_POSSIBLE_PASSTHROUGH_MSRS] = { ...@@ -162,6 +162,7 @@ static u32 vmx_possible_passthrough_msrs[MAX_POSSIBLE_PASSTHROUGH_MSRS] = {
MSR_FS_BASE, MSR_FS_BASE,
MSR_GS_BASE, MSR_GS_BASE,
MSR_KERNEL_GS_BASE, MSR_KERNEL_GS_BASE,
MSR_IA32_XFD_ERR,
#endif #endif
MSR_IA32_SYSENTER_CS, MSR_IA32_SYSENTER_CS,
MSR_IA32_SYSENTER_ESP, MSR_IA32_SYSENTER_ESP,
...@@ -7288,6 +7289,11 @@ static void vmx_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu) ...@@ -7288,6 +7289,11 @@ static void vmx_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu)
} }
} }
if (kvm_cpu_cap_has(X86_FEATURE_XFD))
vmx_set_intercept_for_msr(vcpu, MSR_IA32_XFD_ERR, MSR_TYPE_R,
!guest_cpuid_has(vcpu, X86_FEATURE_XFD));
set_cr4_guest_host_mask(vmx); set_cr4_guest_host_mask(vmx);
vmx_write_encls_bitmap(vcpu, NULL); vmx_write_encls_bitmap(vcpu, NULL);
......
...@@ -349,7 +349,7 @@ struct vcpu_vmx { ...@@ -349,7 +349,7 @@ struct vcpu_vmx {
struct lbr_desc lbr_desc; struct lbr_desc lbr_desc;
/* Save desired MSR intercept (read: pass-through) state */ /* Save desired MSR intercept (read: pass-through) state */
#define MAX_POSSIBLE_PASSTHROUGH_MSRS 13 #define MAX_POSSIBLE_PASSTHROUGH_MSRS 14
struct { struct {
DECLARE_BITMAP(read, MAX_POSSIBLE_PASSTHROUGH_MSRS); DECLARE_BITMAP(read, MAX_POSSIBLE_PASSTHROUGH_MSRS);
DECLARE_BITMAP(write, MAX_POSSIBLE_PASSTHROUGH_MSRS); DECLARE_BITMAP(write, MAX_POSSIBLE_PASSTHROUGH_MSRS);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment