mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-13 20:59:37 +02:00
KVM: VMX: Split out the non-virtualization part of vmx_interrupt_blocked()
commit 322a569c4b
upstream.
Move the non-VMX chunk of the "interrupt blocked" checks to a separate
helper so that KVM can reuse the code to detect if interrupts are blocked
for L2, e.g. to determine if a virtual interrupt _for L2_ is a valid wake
event. If L1 disables HLT-exiting for L2, nested APICv is enabled, and L2
HLTs, then L2 virtual interrupts are valid wake events, but if and only if
interrupts are unblocked for L2.
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240607172609.3205077-4-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
5d104a5e99
commit
e06f46fdf0
|
@ -5048,14 +5048,19 @@ static int vmx_nmi_allowed(struct kvm_vcpu *vcpu, bool for_injection)
|
||||||
return !vmx_nmi_blocked(vcpu);
|
return !vmx_nmi_blocked(vcpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool __vmx_interrupt_blocked(struct kvm_vcpu *vcpu)
|
||||||
|
{
|
||||||
|
return !(vmx_get_rflags(vcpu) & X86_EFLAGS_IF) ||
|
||||||
|
(vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) &
|
||||||
|
(GUEST_INTR_STATE_STI | GUEST_INTR_STATE_MOV_SS));
|
||||||
|
}
|
||||||
|
|
||||||
bool vmx_interrupt_blocked(struct kvm_vcpu *vcpu)
|
bool vmx_interrupt_blocked(struct kvm_vcpu *vcpu)
|
||||||
{
|
{
|
||||||
if (is_guest_mode(vcpu) && nested_exit_on_intr(vcpu))
|
if (is_guest_mode(vcpu) && nested_exit_on_intr(vcpu))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return !(vmx_get_rflags(vcpu) & X86_EFLAGS_IF) ||
|
return __vmx_interrupt_blocked(vcpu);
|
||||||
(vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) &
|
|
||||||
(GUEST_INTR_STATE_STI | GUEST_INTR_STATE_MOV_SS));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vmx_interrupt_allowed(struct kvm_vcpu *vcpu, bool for_injection)
|
static int vmx_interrupt_allowed(struct kvm_vcpu *vcpu, bool for_injection)
|
||||||
|
|
|
@ -400,6 +400,7 @@ u64 construct_eptp(struct kvm_vcpu *vcpu, hpa_t root_hpa, int root_level);
|
||||||
bool vmx_guest_inject_ac(struct kvm_vcpu *vcpu);
|
bool vmx_guest_inject_ac(struct kvm_vcpu *vcpu);
|
||||||
void vmx_update_exception_bitmap(struct kvm_vcpu *vcpu);
|
void vmx_update_exception_bitmap(struct kvm_vcpu *vcpu);
|
||||||
bool vmx_nmi_blocked(struct kvm_vcpu *vcpu);
|
bool vmx_nmi_blocked(struct kvm_vcpu *vcpu);
|
||||||
|
bool __vmx_interrupt_blocked(struct kvm_vcpu *vcpu);
|
||||||
bool vmx_interrupt_blocked(struct kvm_vcpu *vcpu);
|
bool vmx_interrupt_blocked(struct kvm_vcpu *vcpu);
|
||||||
bool vmx_get_nmi_mask(struct kvm_vcpu *vcpu);
|
bool vmx_get_nmi_mask(struct kvm_vcpu *vcpu);
|
||||||
void vmx_set_nmi_mask(struct kvm_vcpu *vcpu, bool masked);
|
void vmx_set_nmi_mask(struct kvm_vcpu *vcpu, bool masked);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user