mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
KVM: arm64: vgic-v2: Force vgic init on injection outside the run loop
Make sure that any attempt to inject an interrupt from userspace or an irqfd results in the GICv2 lazy init to take place. This is not currently necessary as the init is also performed on *any* interrupt injection. But as we're about to remove that, let's introduce it here. Reviewed-by: Oliver Upton <oupton@kernel.org> Link: https://patch.msgid.link/20260520100200.543845-6-maz@kernel.org Signed-off-by: Marc Zyngier <maz@kernel.org>
This commit is contained in:
parent
2772383afc
commit
1a8685ed8c
|
|
@ -51,6 +51,7 @@
|
|||
|
||||
#include <linux/irqchip/arm-gic-v5.h>
|
||||
|
||||
#include "vgic/vgic.h"
|
||||
#include "sys_regs.h"
|
||||
|
||||
static enum kvm_mode kvm_mode = KVM_MODE_DEFAULT;
|
||||
|
|
@ -1497,8 +1498,13 @@ int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level,
|
|||
|
||||
return vcpu_interrupt_line(vcpu, irq_num, level);
|
||||
case KVM_ARM_IRQ_TYPE_PPI:
|
||||
if (!irqchip_in_kernel(kvm))
|
||||
if (irqchip_in_kernel(kvm)) {
|
||||
int ret = vgic_lazy_init(kvm);
|
||||
if (ret)
|
||||
return ret;
|
||||
} else {
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
vcpu = kvm_get_vcpu_by_id(kvm, vcpu_id);
|
||||
if (!vcpu)
|
||||
|
|
@ -1525,8 +1531,13 @@ int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level,
|
|||
|
||||
return kvm_vgic_inject_irq(kvm, vcpu, irq_num, level, NULL);
|
||||
case KVM_ARM_IRQ_TYPE_SPI:
|
||||
if (!irqchip_in_kernel(kvm))
|
||||
if (irqchip_in_kernel(kvm)) {
|
||||
int ret = vgic_lazy_init(kvm);
|
||||
if (ret)
|
||||
return ret;
|
||||
} else {
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
if (vgic_is_v5(kvm)) {
|
||||
/* Build a GICv5-style IntID here */
|
||||
|
|
|
|||
|
|
@ -20,9 +20,15 @@ static int vgic_irqfd_set_irq(struct kvm_kernel_irq_routing_entry *e,
|
|||
int level, bool line_status)
|
||||
{
|
||||
unsigned int spi_id = e->irqchip.pin + VGIC_NR_PRIVATE_IRQS;
|
||||
int ret;
|
||||
|
||||
if (!vgic_valid_spi(kvm, spi_id))
|
||||
return -EINVAL;
|
||||
|
||||
ret = vgic_lazy_init(kvm);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return kvm_vgic_inject_irq(kvm, NULL, spi_id, level, NULL);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user