diff mbox

[v7,11/16] hw/arm/virt: add support for VFIO devices

Message ID 1414764350-5140-12-git-send-email-eric.auger@linaro.org
State New
Headers show

Commit Message

Auger Eric Oct. 31, 2014, 2:05 p.m. UTC
VFIO devices are dynamic sysbus devices. They could already be
instantiated. However for them to be functional, IRQ injection must
be programmed and started. This programming must happen after the
sysbus devices are attached to the platform bus and IRQ are bound.
Only at that time the GSI they are connected to are identified and
irqfd can be programmed.

Binding happens in a machine init done notifier registered by the
platform bus init. The IRQ start is done in another notifier that
must be registered before the platform bus creation.

This patchs adds the registration of the IRQ start notifier in machvirt.

Signed-off-by: Eric Auger <eric.auger@linaro.org>

---

The registration of the IRQ start notifier could also happen in
the platform bus.
---
 hw/arm/virt.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox

Patch

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 3a09d58..911dbfc 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -44,6 +44,7 @@ 
 #include "qemu/error-report.h"
 #include "hw/arm/sysbus-fdt.h"
 #include "hw/platform-bus.h"
+#include "hw/vfio/vfio-platform.h"
 
 #define NUM_VIRTIO_TRANSPORTS 32
 
@@ -546,6 +547,14 @@  static void create_platform_bus(VirtBoardInfo *vbi, qemu_irq *pic,
     MemoryRegion *sysmem = get_system_memory();
 
     /*
+     * Registers a notifier that starts VFIO IRQ injection. The notifier
+     * must be registered before the platform bus device creation. This
+     * latter registers another notifier that binds the dynamic sysbus
+     * devices to the platform bus.
+     */
+    vfio_register_irq_starter(system_params->platform_bus_first_irq);
+
+    /*
      * register the notifier that will update the device tree with
      * the platform bus and device tree nodes. Must be done before
      * the instantiation of the platform bus device that registers