From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56533) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnTLk-0003x0-33 for qemu-devel@nongnu.org; Wed, 29 Apr 2015 10:52:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YnTLe-0001fN-Va for qemu-devel@nongnu.org; Wed, 29 Apr 2015 10:52:31 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:35864) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnTLe-0001fI-PG for qemu-devel@nongnu.org; Wed, 29 Apr 2015 10:52:26 -0400 Received: by wizk4 with SMTP id k4so183441600wiz.1 for ; Wed, 29 Apr 2015 07:52:26 -0700 (PDT) From: Eric Auger Date: Wed, 29 Apr 2015 15:52:06 +0100 Message-Id: <1430319127-25907-10-git-send-email-eric.auger@linaro.org> In-Reply-To: <1430319127-25907-1-git-send-email-eric.auger@linaro.org> References: <1430319127-25907-1-git-send-email-eric.auger@linaro.org> Subject: [Qemu-devel] [PATCH v14 09/10] sysbus: add irq_routing_notifier List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: eric.auger@st.com, eric.auger@linaro.org, qemu-devel@nongnu.org, alex.williamson@redhat.com, agraf@suse.de, pbonzini@redhat.com, peter.crosthwaite@xilinx.com Cc: peter.maydell@linaro.org, b.reynal@virtualopensystems.com, vikrams@codeaurora.org, patches@linaro.org, Bharat.Bhushan@freescale.com, borntraeger@de.ibm.com, cornelia.huck@de.ibm.com, alex.bennee@linaro.org, kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org Add a new connect_irq_notifier notifier in the SysBusDeviceClass. This notifier, if populated, is called after sysbus_connect_irq. This mechanism is used to setup VFIO signaling once VFIO platform devices get attached to their platform bus, on a machine init done notifier. Signed-off-by: Eric Auger --- v2 -> v3: - rename irq_routing_notifier into connect_irq_notifier v1 -> v2: - duly put the notifier in the class and not in the device --- hw/core/sysbus.c | 6 ++++++ include/hw/sysbus.h | 1 + 2 files changed, 7 insertions(+) diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index b53c351..2d22aec 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -109,7 +109,13 @@ qemu_irq sysbus_get_connected_irq(SysBusDevice *dev, int n) void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq) { + SysBusDeviceClass *sbd = SYS_BUS_DEVICE_GET_CLASS(dev); + qdev_connect_gpio_out_named(DEVICE(dev), SYSBUS_DEVICE_GPIO_IRQ, n, irq); + + if (sbd->connect_irq_notifier) { + sbd->connect_irq_notifier(dev, irq); + } } /* Check whether an MMIO region exists */ diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h index d1f3f00..e80b26d 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -41,6 +41,7 @@ typedef struct SysBusDeviceClass { /*< public >*/ int (*init)(SysBusDevice *dev); + void (*connect_irq_notifier)(SysBusDevice *dev, qemu_irq irq); } SysBusDeviceClass; struct SysBusDevice { -- 1.8.3.2