From patchwork Wed Apr 29 14:52:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 47722 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CA7462121F for ; Wed, 29 Apr 2015 14:52:39 +0000 (UTC) Received: by wicmx19 with SMTP id mx19sf14681895wic.3 for ; Wed, 29 Apr 2015 07:52: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=Z8zDvR6QkvvSvjvP/xjyx4NsIT3h03ReB6lWiVZlhLo=; b=Wlg1deROjpNVUe09MPNvPg4p+fEmfXq0sesUwbMe088H8CwHNlERjQoq9nU0wEAdq9 1ys0qYkTx3kIA/V+8e730Yd+r7HDzC7UnUI+Ea+5fwSU41M1ZV9d48YTRF5vEbvUbCVz fTfAKwgfC1KYDwsZBv1YkGag/WR1q7FvynuAHDygM2PeZHeTvQRvojkPsKf7HD7H0WTx 8epAM13EU3gybgP1hHOQBvzUSROUM1iT4yKWFOvhWCvqWfWHi6efIRFAUQpY2Vm5egL5 6uJ+td9aEDr+QhYcVLRQ0P1wSh4Brhjq7xQgapIXjd0HF1XtpDeH38Lsh04dphjspHHz TK3g== X-Gm-Message-State: ALoCoQnAxp9vgJVR96taJZ7NN0YZFO69+0puZ1dJ7mjUgNq7307QovetJLcgjOoySDC74dlTwfBI X-Received: by 10.180.11.101 with SMTP id p5mr2071838wib.3.1430319159143; Wed, 29 Apr 2015 07:52:39 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.42 with SMTP id u10ls220265laz.64.gmail; Wed, 29 Apr 2015 07:52:39 -0700 (PDT) X-Received: by 10.152.27.1 with SMTP id p1mr18968460lag.112.1430319158992; Wed, 29 Apr 2015 07:52:38 -0700 (PDT) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id k5si19514039lag.163.2015.04.29.07.52.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Apr 2015 07:52:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by labbd9 with SMTP id bd9so22059874lab.2 for ; Wed, 29 Apr 2015 07:52:38 -0700 (PDT) X-Received: by 10.112.140.231 with SMTP id rj7mr18868987lbb.76.1430319158894; Wed, 29 Apr 2015 07:52: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.67.65 with SMTP id l1csp2553834lbt; Wed, 29 Apr 2015 07:52:38 -0700 (PDT) X-Received: by 10.180.101.138 with SMTP id fg10mr6543827wib.46.1430319146672; Wed, 29 Apr 2015 07:52:26 -0700 (PDT) Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com. [209.85.212.169]) by mx.google.com with ESMTPS id gl4si44194006wjd.179.2015.04.29.07.52.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Apr 2015 07:52:26 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.169 as permitted sender) client-ip=209.85.212.169; Received: by wiun10 with SMTP id n10so68933238wiu.1 for ; Wed, 29 Apr 2015 07:52:26 -0700 (PDT) X-Received: by 10.180.84.8 with SMTP id u8mr9661157wiy.39.1430319146251; Wed, 29 Apr 2015 07:52:26 -0700 (PDT) Received: from midway01-04-00.lavalab ([81.128.185.50]) by mx.google.com with ESMTPSA id it5sm21555782wid.3.2015.04.29.07.52.25 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Apr 2015 07:52:25 -0700 (PDT) From: Eric Auger 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: christoffer.dall@linaro.org, kvmarm@lists.cs.columbia.edu, patches@linaro.org, peter.maydell@linaro.org, alex.bennee@linaro.org, b.reynal@virtualopensystems.com, Bharat.Bhushan@freescale.com, vikrams@codeaurora.org, cornelia.huck@de.ibm.com, borntraeger@de.ibm.com Subject: [PATCH v14 09/10] sysbus: add irq_routing_notifier Date: Wed, 29 Apr 2015 15:52:06 +0100 Message-Id: <1430319127-25907-10-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1430319127-25907-1-git-send-email-eric.auger@linaro.org> References: <1430319127-25907-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.53 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 --- 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 {