Skip to content

Commit e7283a2

Browse files
Sean ChristophersonSomasundaram Krishnasamy
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]> (cherry picked from commit 429ab57) Orabug: 31722724 Signed-off-by: Maciej S. Szmigiero <[email protected]> Reviewed-by: Mihai Carabas <[email protected]> Signed-off-by: Somasundaram Krishnasamy <[email protected]>
1 parent 81c0e99 commit e7283a2

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
@@ -657,11 +657,6 @@ static bool nested_exit_intr_ack_set(struct kvm_vcpu *vcpu)
657657
VM_EXIT_ACK_INTR_ON_EXIT;
658658
}
659659

660-
static bool nested_exit_on_nmi(struct kvm_vcpu *vcpu)
661-
{
662-
return nested_cpu_has_nmi_exiting(get_vmcs12(vcpu));
663-
}
664-
665660
static int nested_vmx_check_apic_access_controls(struct kvm_vcpu *vcpu,
666661
struct vmcs12 *vmcs12)
667662
{

arch/x86/kvm/vmx/nested.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,11 @@ static inline bool nested_cpu_has_save_preemption_timer(struct vmcs12 *vmcs12)
228228
VM_EXIT_SAVE_VMX_PREEMPTION_TIMER;
229229
}
230230

231+
static inline bool nested_exit_on_nmi(struct kvm_vcpu *vcpu)
232+
{
233+
return nested_cpu_has_nmi_exiting(get_vmcs12(vcpu));
234+
}
235+
231236
/*
232237
* In nested virtualization, check if L1 asked to exit on external interrupts.
233238
* 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
@@ -4344,6 +4344,9 @@ static int vmx_nmi_allowed(struct kvm_vcpu *vcpu)
43444344
if (to_vmx(vcpu)->nested.nested_run_pending)
43454345
return 0;
43464346

4347+
if (is_guest_mode(vcpu) && nested_exit_on_nmi(vcpu))
4348+
return true;
4349+
43474350
if (!enable_vnmi &&
43484351
to_vmx(vcpu)->loaded_vmcs->soft_vnmi_blocked)
43494352
return 0;

0 commit comments

Comments
 (0)