From patchwork Mon Jun 15 16:33:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 49889 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0F7CD205DE for ; Mon, 15 Jun 2015 16:34:40 +0000 (UTC) Received: by lbbwc1 with SMTP id wc1sf2048072lbb.3 for ; Mon, 15 Jun 2015 09:34:39 -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=jtyVuq5BEGV9hiWN0zC6EqirC8O5vONp3jZKhrB5hGe9CPs+N9UStHAz/N4poKQvpM Jrmsxie5yzlD2JH1tKiwEWdrA6VnhxuAI8theglvj5481vcMBW0LjBHT26E37CD/Q9O/ wV1+eQaHdICdyWwmZZ1U5pBeZfC1hOq60l1GBiYRiiidyjRXf8fwTO1KrmYmsJrSAXm/ mm01Hxl4I372Sch4v8WdkltSaknASpL0SSOjpb/JcaBqX8ajPGYVqbhER59iObGDj1Ir mRT0Pu4qzhWGdvUONN1Nm1FeTTocSradZPJxpTOOV18L4yL501Jv+DXj+XArBtA3JBfp 2TMg== X-Gm-Message-State: ALoCoQmQ8T9eMtcK3yaFeiikb8gcxmvU37Q7/HgSh9ItK1oRVLanwcH1SV/VPftseba+pskUfIIY X-Received: by 10.112.188.233 with SMTP id gd9mr925663lbc.12.1434386079043; Mon, 15 Jun 2015 09:34:39 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.30.103 with SMTP id r7ls754159lah.106.gmail; Mon, 15 Jun 2015 09:34:38 -0700 (PDT) X-Received: by 10.112.72.2 with SMTP id z2mr1046659lbu.39.1434386078896; Mon, 15 Jun 2015 09:34:38 -0700 (PDT) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id o7si6498097lao.73.2015.06.15.09.34.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jun 2015 09:34:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by lbbqq2 with SMTP id qq2so57030202lbb.3 for ; Mon, 15 Jun 2015 09:34:38 -0700 (PDT) X-Received: by 10.152.6.69 with SMTP id y5mr27564974lay.72.1434386078578; Mon, 15 Jun 2015 09:34:38 -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 hn6csp1533963lbb; Mon, 15 Jun 2015 09:34:38 -0700 (PDT) X-Received: by 10.194.123.4 with SMTP id lw4mr51971336wjb.94.1434386072561; Mon, 15 Jun 2015 09:34:32 -0700 (PDT) Received: from mail-wg0-f48.google.com (mail-wg0-f48.google.com. [74.125.82.48]) by mx.google.com with ESMTPS id k7si19163780wiw.92.2015.06.15.09.34.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jun 2015 09:34:32 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 74.125.82.48 as permitted sender) client-ip=74.125.82.48; Received: by wgbhy7 with SMTP id hy7so40153642wgb.2 for ; Mon, 15 Jun 2015 09:34:32 -0700 (PDT) X-Received: by 10.180.79.227 with SMTP id m3mr33530846wix.71.1434386072309; Mon, 15 Jun 2015 09:34:32 -0700 (PDT) Received: from midway01-04-00.lavalab ([81.128.185.50]) by mx.google.com with ESMTPSA id bh7sm19677484wjb.8.2015.06.15.09.34.30 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 15 Jun 2015 09:34:31 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, qemu-devel@nongnu.org, peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, pbonzini@redhat.com, alex.williamson@redhat.com Cc: christoffer.dall@linaro.org, patches@linaro.org, b.reynal@virtualopensystems.com, vikrams@codeaurora.org Subject: [RESEND PATCH v16 5/6] sysbus: add irq_routing_notifier Date: Mon, 15 Jun 2015 17:33:57 +0100 Message-Id: <1434386038-9246-6-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1434386038-9246-1-git-send-email-eric.auger@linaro.org> References: <1434386038-9246-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.217.174 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 {