From patchwork Fri Jun 26 17:29:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 50370 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3D7E822902 for ; Fri, 26 Jun 2015 17:29:46 +0000 (UTC) Received: by wgjx7 with SMTP id x7sf6639258wgj.3 for ; Fri, 26 Jun 2015 10:29:45 -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=wjeDMhG/LGNjT7T/twFHS4CeLaLOjJUqGvQ3/bUKpQo=; b=hM4O0+ttOAdZRMtOVdaEoCEnpBl62RTlIci6+htBbTNsofU3VnJAX/ACnAdTp9yYsh 7U71P9M8OgJ4AP+u7+urJNqfCfDRFLzK3u1nLEeFcHEK5Po1l8HpPjqDq6pgTEauFm3j 5sDjuNJ8VLCEqiC9cXOpxwQqHB9NCCRdFOVKLAIM85I7YY0mZZfjQHTk0UWCM0n9MR4Y cBFwqUs5cDLJ7C9XD2+ZjZO2IXBqV5a0P0oT23bwvZosLv3apM6HXpDV6kk7/QLijx0t K2nUDNP1jHIR43EJEJQdGHdz8PdaN6qbG7Gj68jLqCtwtDXmH0KgDalVarI9qM8dKijP WUMg== X-Gm-Message-State: ALoCoQkRFyI0JRL5389jw/Dvi3HfsgrhpOKE5YAZ/HotDFcg/JvxfjHqR7wNvgmUV5qWiEx9bq42 X-Received: by 10.112.55.104 with SMTP id r8mr1806093lbp.18.1435339785334; Fri, 26 Jun 2015 10:29:45 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.202 with SMTP id d10ls199055laa.69.gmail; Fri, 26 Jun 2015 10:29:45 -0700 (PDT) X-Received: by 10.152.21.5 with SMTP id r5mr2579850lae.24.1435339785072; Fri, 26 Jun 2015 10:29:45 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id kv7si27903558lac.157.2015.06.26.10.29.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jun 2015 10:29:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by lbbpo10 with SMTP id po10so68599107lbb.3 for ; Fri, 26 Jun 2015 10:29:45 -0700 (PDT) X-Received: by 10.112.220.7 with SMTP id ps7mr2566072lbc.72.1435339784983; Fri, 26 Jun 2015 10:29:44 -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 hn6csp69995lbb; Fri, 26 Jun 2015 10:29:44 -0700 (PDT) X-Received: by 10.194.24.196 with SMTP id w4mr4657588wjf.137.1435339782039; Fri, 26 Jun 2015 10:29:42 -0700 (PDT) Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com. [209.85.212.177]) by mx.google.com with ESMTPS id xa3si3257526wjc.106.2015.06.26.10.29.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jun 2015 10:29:42 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.177 as permitted sender) client-ip=209.85.212.177; Received: by wibdq8 with SMTP id dq8so23747379wib.1 for ; Fri, 26 Jun 2015 10:29:41 -0700 (PDT) X-Received: by 10.180.74.132 with SMTP id t4mr7078952wiv.55.1435339781781; Fri, 26 Jun 2015 10:29:41 -0700 (PDT) Received: from midway01-04-00.lavalab ([81.128.185.50]) by mx.google.com with ESMTPSA id m10sm3088489wib.17.2015.06.26.10.29.40 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Jun 2015 10:29:40 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, qemu-devel@nongnu.org, peter.maydell@linaro.org, alex.williamson@redhat.com, pbonzini@redhat.com Cc: peter.crosthwaite@xilinx.com, christoffer.dall@linaro.org, patches@linaro.org Subject: [PATCH v18 4/6] sysbus: add irq_routing_notifier Date: Fri, 26 Jun 2015 18:29:25 +0100 Message-Id: <1435339767-2301-5-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1435339767-2301-1-git-send-email-eric.auger@linaro.org> References: <1435339767-2301-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.171 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 Reviewed-by: Peter Maydell --- 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 92eced9..b1f7fab 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 {