Skip to contentSkip to conversation

hw/intc/arm_gic_kvm: set up a flat irqchip routing table

PATCH New Eric Auger 1 participant 1 message Jul 31, 2015

lore
Share & tools
lore

Eric Auger

author
#0 lore raw

PATCH 1/1 hw/intc/arm_gic_kvm: set up a flat irqchip routing table

In case the kernel supports GSI routing, we set up irqchip routing entries for GIC SPIs. This is not mandated as long as MSI routing is not used (because the kernel sets a default irqchip routing table). However once MSI routing gets used (for VIRTIO-PCI vhost for example), the first call to KVM_SET_GSI_ROUTING overrides the kernel default irqchip table. If no routing entry exists for the GSI, any IRQFD signaling for this GSI will fail.

---

gsi routing for ARM is functional but needs to be maturated. The API for MSI routing still is in discussion. See http://www.spinics.net/lists/kvm/msg118792.html

---
 hw/intc/arm_gic_kvm.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
hw/intc/arm_gic_kvm.c +12 -0
index f56bff1..58d8303 100644
@@ -631,6 +631,18 @@ static void kvm_arm_gic_realize(DeviceState *dev, Error **errp)
                             KVM_DEV_ARM_VGIC_GRP_ADDR,
                             KVM_VGIC_V2_ADDR_TYPE_CPU,
                             s->dev_fd);
+
+    if (kvm_check_extension(kvm_state, KVM_CAP_IRQ_ROUTING)) {
+        /* set up irq routing */
+        kvm_init_irq_routing(kvm_state);
+        for (i = 0; i < s->num_irq - GIC_INTERNAL; ++i) {
+            kvm_irqchip_add_irq_route(kvm_state, i, 0, i);
+        }
+
+        kvm_gsi_routing_allowed = true;
+
+        kvm_irqchip_commit_routes(kvm_state);
+    }
 }
 
 static void kvm_arm_gic_class_init(ObjectClass *klass, void *data)
Signature · 1 line
1.8.3.2