From patchwork Wed May 27 09:11:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 49008 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E0893214B4 for ; Wed, 27 May 2015 09:11:47 +0000 (UTC) Received: by wifx6 with SMTP id x6sf3260616wif.1 for ; Wed, 27 May 2015 02:11:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=T+3Pe/iePCkIXLnlom+yu6TFtdbN9zU92x5+AmXDiQY=; b=XpPQCN+D7hMxTHjGPo3GsJ6+23mQXB1oIMrZl7pHqYBWujfOfaN/kinnDoO3xd7qh8 W0DCc5PdCSouWmGuGtsuZkOubv54V6fqb44mqYwWhzO6UX8cFHDijxOXYTTj2UjLhp5K arnkAzN0QuIjVshB0bb+wkeOdtAj5+KVH+xN/C8UGE7GM9XpRQ5GpcSdov+qLgQhJYej muinQA/uCXw+tgO0BQraimBdnrcDUH9cOTLE8hiXcy6I8odpJdQ0eM5Yw1wP2sOjRgir KPKJZ3gUTa+9AVviD9z09ZmOP9IsqjgJuGQXvsHn6BOcPpZlq9FSzgcy0H6XTMkM6rq3 7arQ== X-Gm-Message-State: ALoCoQnWnb3gQKM7Rsh1gRpggVZVtuS5SRx4U4Px4HBzyucIuvSkqBwjpZs7wypfc/klEGuKybwm X-Received: by 10.112.14.101 with SMTP id o5mr31288373lbc.3.1432717907207; Wed, 27 May 2015 02:11:47 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.7 with SMTP id m7ls17007laj.70.gmail; Wed, 27 May 2015 02:11:47 -0700 (PDT) X-Received: by 10.152.37.9 with SMTP id u9mr6571319laj.65.1432717907068; Wed, 27 May 2015 02:11:47 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id ao2si13154145lac.169.2015.05.27.02.11.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 May 2015 02:11:47 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by lagv1 with SMTP id v1so2657915lag.3 for ; Wed, 27 May 2015 02:11:47 -0700 (PDT) X-Received: by 10.112.222.133 with SMTP id qm5mr27061925lbc.86.1432717906961; Wed, 27 May 2015 02:11:46 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp206242lbb; Wed, 27 May 2015 02:11:46 -0700 (PDT) X-Received: by 10.180.99.39 with SMTP id en7mr48923925wib.31.1432717896712; Wed, 27 May 2015 02:11:36 -0700 (PDT) Received: from mail-wg0-f41.google.com (mail-wg0-f41.google.com. [74.125.82.41]) by mx.google.com with ESMTPS id ds10si2987251wib.15.2015.05.27.02.11.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 May 2015 02:11:36 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 74.125.82.41 as permitted sender) client-ip=74.125.82.41; Received: by wgv5 with SMTP id 5so3699482wgv.1 for ; Wed, 27 May 2015 02:11:36 -0700 (PDT) X-Received: by 10.194.89.225 with SMTP id br1mr8806723wjb.97.1432717896465; Wed, 27 May 2015 02:11:36 -0700 (PDT) Received: from midway01-04-00.lavalab ([81.128.185.50]) by mx.google.com with ESMTPSA id ej5sm25828061wjd.22.2015.05.27.02.11.35 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 27 May 2015 02:11:35 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, qemu-devel@nongnu.org, alex.williamson@redhat.com Cc: christoffer.dall@linaro.org, kvmarm@lists.cs.columbia.edu, patches@linaro.org, peter.maydell@linaro.org, agraf@suse.de, pbonzini@redhat.com, b.reynal@virtualopensystems.com, vikrams@codeaurora.org Subject: [PATCH v16 8/9] sysbus: add irq_routing_notifier Date: Wed, 27 May 2015 10:11:10 +0100 Message-Id: <1432717871-2393-9-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1432717871-2393-1-git-send-email-eric.auger@linaro.org> References: <1432717871-2393-1-git-send-email-eric.auger@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: eric.auger@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 --- v15 -> v16: - add Vikram's T-b v14 -> v15: - add Peter R-b v2 -> v3 (integrated into this series v14): - 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 {