From patchwork Mon Jul 6 18:35:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Williamson X-Patchwork-Id: 491754 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id AB1F7140DBC for ; Tue, 7 Jul 2015 04:36:28 +1000 (AEST) Received: from localhost ([::1]:52432 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCBFi-0005o9-Q8 for incoming@patchwork.ozlabs.org; Mon, 06 Jul 2015 14:36:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36523) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCBEh-0004Jz-R8 for qemu-devel@nongnu.org; Mon, 06 Jul 2015 14:35:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZCBEc-0003AM-Vd for qemu-devel@nongnu.org; Mon, 06 Jul 2015 14:35:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35051) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCBEc-0003AE-Q5 for qemu-devel@nongnu.org; Mon, 06 Jul 2015 14:35:18 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 6F5FC91596 for ; Mon, 6 Jul 2015 18:35:18 +0000 (UTC) Received: from gimli.home (ovpn-113-190.phx2.redhat.com [10.3.113.190]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t66IZHUx004416; Mon, 6 Jul 2015 14:35:18 -0400 From: Alex Williamson To: qemu-devel@nongnu.org Date: Mon, 06 Jul 2015 12:35:17 -0600 Message-ID: <20150706183517.15635.72316.stgit@gimli.home> In-Reply-To: <20150706183311.15635.76314.stgit@gimli.home> References: <20150706183311.15635.76314.stgit@gimli.home> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 07/11] sysbus: add irq_routing_notifier X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Eric Auger 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 Reviewed-by: Peter Crosthwaite Tested-by: Vikram Sethi Reviewed-by: Peter Maydell Signed-off-by: Alex Williamson --- 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 278a2d1..3c58629 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 34f93c3..cc1dba4 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -58,6 +58,7 @@ typedef struct SysBusDeviceClass { * omitted then. (This is not considered a fatal error.) */ char *(*explicit_ofw_unit_address)(const SysBusDevice *dev); + void (*connect_irq_notifier)(SysBusDevice *dev, qemu_irq irq); } SysBusDeviceClass; struct SysBusDevice {