[PATCH] KVM: arm64: Register irq_bypass consumers only with GICv4
From: Jinqian Yang
Date: Mon Nov 09 2026 - 06:23:39 EST
kvm_arch_has_irq_bypass() on arm64 returns true unconditionally, so
every irqfd assignment registers an irq_bypass consumer even when the
hardware cannot perform GICv4 direct MSI forwarding. In that case
kvm_vgic_v4_set_forwarding() bails out at its very first check, since
vgic_supports_direct_msis() is false without has_gicv4, and the
registration becomes pure overhead: every KVM_IRQFD ioctl takes the
global irq_bypass mutex, which becomes a contention point when many
VMs boot concurrently.
Gate the registration on kvm_vgic_global_state.has_gicv4, the way x86
gates on enable_device_posted_irqs. Functionally this is a no-op:
without GICv4 the consumer registration never did anything beyond
acquiring the lock. On a GICv3-only host booting 100 microVMs
concurrently this cuts the average boot time by ~5 ms, matching the
gain observed with CONFIG_HAVE_KVM_IRQ_BYPASS=n.
Signed-off-by: Jinqian Yang <yangjinqian1@xxxxxxxxxx>
---
arch/arm64/include/asm/kvm_host.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
index 97332ffcb130..785d57388032 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -1744,7 +1744,7 @@ void kvm_set_vm_id_reg(struct kvm *kvm, u32 reg, u64 val);
static inline bool kvm_arch_has_irq_bypass(void)
{
- return true;
+ return kvm_vgic_global_state.has_gicv4;
}
void kvm_idregs_enforce_dependencies(struct kvm *kvm);
--
2.33.0