Eric added the qemu_irq/gsi hash table to let VFIO platform device
setup irqfd when kvm enabled [1]. And he setup the qemu_irq/gsi
mapping in arm_gic_kvm.c [2]. But this mapping is not setting up in
arm_gicv3_kvm.c. When VM use VFIO platform device with gicv3,
the irqfd setup will fail and fallback to userspace handled eventfd
in `vfio_start_irqfd_injection`.

This patch will setup the qemu_irq/gsi mapping for gicv3, so that
VFIO platform device with gicv3 can use kvm irqfd to accelerate.

[1] 
https://lore.kernel.org/qemu-devel/20150706183506.15635.61812.st...@gimli.home/
[2] 
https://lore.kernel.org/qemu-devel/20150706183512.15635.915.st...@gimli.home/

Signed-off-by: Luca Wei <luca....@verisilicon.com>
---
 hw/intc/arm_gicv3_kvm.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
index 72ad916d3d..7e90f8b723 100644
--- a/hw/intc/arm_gicv3_kvm.c
+++ b/hw/intc/arm_gicv3_kvm.c
@@ -807,6 +807,11 @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Error 
**errp)

     gicv3_init_irqs_and_mmio(s, kvm_arm_gicv3_set_irq, NULL);

+    for (i = 0; i < s->num_irq - GIC_INTERNAL; i++) {
+        qemu_irq irq = qdev_get_gpio_in(dev, i);
+        kvm_irqchip_set_qemuirq_gsi(kvm_state, irq, i);
+    }
+
     for (i = 0; i < s->num_cpu; i++) {
         ARMCPU *cpu = ARM_CPU(qemu_get_cpu(i));

--
2.41.0.windows.3

Reply via email to