Skip to content

Commit 429ab57

Browse files
Sean Christophersonbonzini
authored andcommitted
KVM: nVMX: Report NMIs as allowed when in L2 and Exit-on-NMI is set
Report NMIs as allowed when the vCPU is in L2 and L2 is being run with Exit-on-NMI enabled, as NMIs are always unblocked from L1's perspective in this case. Signed-off-by: Sean Christopherson <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent a9fa7cb commit 429ab57

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

arch/x86/kvm/vmx/nested.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -698,11 +698,6 @@ static bool nested_exit_intr_ack_set(struct kvm_vcpu *vcpu)
698698
VM_EXIT_ACK_INTR_ON_EXIT;
699699
}
700700

701-
static bool nested_exit_on_nmi(struct kvm_vcpu *vcpu)
702-
{
703-
return nested_cpu_has_nmi_exiting(get_vmcs12(vcpu));
704-
}
705-
706701
static int nested_vmx_check_apic_access_controls(struct kvm_vcpu *vcpu,
707702
struct vmcs12 *vmcs12)
708703
{

arch/x86/kvm/vmx/nested.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,11 @@ static inline bool nested_cpu_has_save_preemption_timer(struct vmcs12 *vmcs12)
225225
VM_EXIT_SAVE_VMX_PREEMPTION_TIMER;
226226
}
227227

228+
static inline bool nested_exit_on_nmi(struct kvm_vcpu *vcpu)
229+
{
230+
return nested_cpu_has_nmi_exiting(get_vmcs12(vcpu));
231+
}
232+
228233
/*
229234
* In nested virtualization, check if L1 asked to exit on external interrupts.
230235
* For most existing hypervisors, this will always return true.

arch/x86/kvm/vmx/vmx.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4515,6 +4515,9 @@ static bool vmx_nmi_allowed(struct kvm_vcpu *vcpu)
45154515
if (to_vmx(vcpu)->nested.nested_run_pending)
45164516
return false;
45174517

4518+
if (is_guest_mode(vcpu) && nested_exit_on_nmi(vcpu))
4519+
return true;
4520+
45184521
if (!enable_vnmi &&
45194522
to_vmx(vcpu)->loaded_vmcs->soft_vnmi_blocked)
45204523
return false;

0 commit comments

Comments
 (0)