From patchwork Fri Jun 26 15:30:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 50364 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 87843228FD for ; Fri, 26 Jun 2015 15:30:56 +0000 (UTC) Received: by laar3 with SMTP id r3sf27857427laa.1 for ; Fri, 26 Jun 2015 08:30:55 -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=Dl+/Y+Xk9ti2376KDmp7vk4BFS+2fhixbTO9gtDfU1PuC5mTXBx4mdqYvy+uiv1ZTS aFcLWgGYi55t0ms1BiMy3Ojvbcqb93dmJtU0gNLNDdI0Bh1YAUYbsktIBSwXEfpiws9G yttxbqil8IZc2VZc605si5kdrh56Af1PgE1nD18GxgwUpTFUJbgxzv+2iRoqHIyK2+V7 /aWYh49s17AYrhXI53aryE1CfBPb/Eq/WJdEItQ1YiSwgr2w+V6HuAFCXdulXwTwLQqP fiJIVTgkgxA0om8FeAwVqRvILAicDfRvbAQ8XSUteJqmNHsqU7sAxIf+GLghilsmNnZs 82/A== X-Gm-Message-State: ALoCoQlMxy5Wo3/sV1C5p77tU3P0JQHNBw4jAzco1YDOq6lubF5t3pdwda1FYm9B67EjRShh5NFl X-Received: by 10.112.255.66 with SMTP id ao2mr1431211lbd.15.1435332655537; Fri, 26 Jun 2015 08:30:55 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.170.197 with SMTP id ao5ls577794lac.53.gmail; Fri, 26 Jun 2015 08:30:55 -0700 (PDT) X-Received: by 10.112.53.226 with SMTP id e2mr2158502lbp.124.1435332655392; Fri, 26 Jun 2015 08:30:55 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id uo9si27691954lbb.12.2015.06.26.08.30.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jun 2015 08:30:55 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by lagi2 with SMTP id i2so66036469lag.2 for ; Fri, 26 Jun 2015 08:30:55 -0700 (PDT) X-Received: by 10.152.26.163 with SMTP id m3mr2130711lag.86.1435332655313; Fri, 26 Jun 2015 08:30:55 -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 hn6csp4833lbb; Fri, 26 Jun 2015 08:30:54 -0700 (PDT) X-Received: by 10.112.50.148 with SMTP id c20mr2093114lbo.27.1435332651782; Fri, 26 Jun 2015 08:30:51 -0700 (PDT) Received: from mail-wg0-f42.google.com (mail-wg0-f42.google.com. [74.125.82.42]) by mx.google.com with ESMTPS id k2si59116125wje.107.2015.06.26.08.30.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jun 2015 08:30:51 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 74.125.82.42 as permitted sender) client-ip=74.125.82.42; Received: by wguu7 with SMTP id u7so91311613wgu.3 for ; Fri, 26 Jun 2015 08:30:51 -0700 (PDT) X-Received: by 10.194.95.167 with SMTP id dl7mr3991329wjb.53.1435332651498; Fri, 26 Jun 2015 08:30:51 -0700 (PDT) Received: from midway01-04-00.lavalab ([81.128.185.50]) by mx.google.com with ESMTPSA id b5sm2688575wic.3.2015.06.26.08.30.49 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Jun 2015 08:30:50 -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 v17 4/6] sysbus: add irq_routing_notifier Date: Fri, 26 Jun 2015 16:30:32 +0100 Message-Id: <1435332634-10721-5-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1435332634-10721-1-git-send-email-eric.auger@linaro.org> References: <1435332634-10721-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.50 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 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 {