From patchwork Fri Apr 24 12:39:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 47557 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1B47F2121F for ; Fri, 24 Apr 2015 12:39:24 +0000 (UTC) Received: by lbbrr5 with SMTP id rr5sf11077964lbb.3 for ; Fri, 24 Apr 2015 05:39:22 -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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=X72D05DhkSRJ1FQvo0iXiSI7bcUhTTlaECp1HSlSBaE=; b=IyL4ykup6wfFQloSj++2ArBxjEhd4sT27O7XP+MCiif7zw5UuDbgVrHtIaTZijZBI5 rXNNIrBK6BPVVNF85StZ9amPwZZV1whtk/MFoKBPRKyrprq9c+vPLH6nno8zMf0ZsJWB q7P548DAGB1XU6xQuDftHgnLAxU2G/qOn5zGgNUXvjAtbGLftErSJWXdu8crSTGt22DR OzXoiV/+FzT4pCXBf4NI0p9ujD4jymJM9GD0KW3Zx0cEByC7jezPDMSUgmeNnh2NtHgv ZJDM4oW9C8Wmo0gvfG3hISUrGXRzQUrznSfXzFJeKjhHze5nKfl7wO6ybOZWJE0J1sAo rxFA== X-Gm-Message-State: ALoCoQlAYtuxybqTwHghLOd8RiKdsu5uV1RDWicgpKuaBHNWMseYbjAdCDzM5xHuXfXOvlmevDLd X-Received: by 10.194.95.67 with SMTP id di3mr4110415wjb.0.1429879162729; Fri, 24 Apr 2015 05:39:22 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.19.231 with SMTP id i7ls443250lae.85.gmail; Fri, 24 Apr 2015 05:39:22 -0700 (PDT) X-Received: by 10.152.23.163 with SMTP id n3mr6908543laf.34.1429879162481; Fri, 24 Apr 2015 05:39:22 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id w12si8152559lbf.159.2015.04.24.05.39.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Apr 2015 05:39:22 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by lagv1 with SMTP id v1so34178693lag.3 for ; Fri, 24 Apr 2015 05:39:22 -0700 (PDT) X-Received: by 10.112.222.133 with SMTP id qm5mr6789878lbc.86.1429879161859; Fri, 24 Apr 2015 05:39:21 -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 l1csp1164523lbt; Fri, 24 Apr 2015 05:39:21 -0700 (PDT) X-Received: by 10.194.133.102 with SMTP id pb6mr7984829wjb.97.1429879161007; Fri, 24 Apr 2015 05:39:21 -0700 (PDT) Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com. [209.85.212.179]) by mx.google.com with ESMTPS id hb4si3921839wib.41.2015.04.24.05.39.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Apr 2015 05:39:20 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.179 as permitted sender) client-ip=209.85.212.179; Received: by wiun10 with SMTP id n10so18687755wiu.1 for ; Fri, 24 Apr 2015 05:39:20 -0700 (PDT) X-Received: by 10.194.120.132 with SMTP id lc4mr15718856wjb.92.1429879160724; Fri, 24 Apr 2015 05:39:20 -0700 (PDT) Received: from midway01-04-00.lavalab ([81.128.185.50]) by mx.google.com with ESMTPSA id 14sm16747950wjv.0.2015.04.24.05.39.19 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 24 Apr 2015 05:39:19 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, qemu-devel@nongnu.org, peter.maydell@linaro.org, agraf@suse.de, pbonzini@redhat.com Cc: christoffer.dall@linaro.org, kvmarm@lists.cs.columbia.edu, patches@linaro.org, alex.williamson@redhat.com Subject: [PATCH v2] sysbus: add irq_routing_notifier Date: Fri, 24 Apr 2015 13:39:13 +0100 Message-Id: <1429879153-23476-1-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.8.3.2 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.45 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 irq_routing_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 --- 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..8553a6f 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->irq_routing_notifier) { + sbd->irq_routing_notifier(dev, irq); + } } /* Check whether an MMIO region exists */ diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h index d1f3f00..dbf3f0f 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -41,6 +41,7 @@ typedef struct SysBusDeviceClass { /*< public >*/ int (*init)(SysBusDevice *dev); + void (*irq_routing_notifier)(SysBusDevice *dev, qemu_irq irq); } SysBusDeviceClass; struct SysBusDevice {