From patchwork Thu Apr 30 12:49:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 47845 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 67CA320553 for ; Thu, 30 Apr 2015 12:49:46 +0000 (UTC) Received: by laat2 with SMTP id t2sf15237039laa.2 for ; Thu, 30 Apr 2015 05:49: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=fzBLVu1VyMOtq7RdwXTRPco0sLJa9FOKjqJK9F52SmM=; b=WIg1Tnvs8ISzFVY5BhH38dWAINQ26rGhOpKnq5e+rUlEzpImGbqxIGxq9whhtSj6iU DpqbWqLoXF+wxNRrN/1IX4VTWMejK4aroUQfBIenjWkqjZxQNfgysjcKNvcYPZSlHgdo U9audmNEaRLrFO15bxC4OGuSO/RHxO1uK9ldgEhhR+5rpqnL3XPVP/CAtKaN4nC9R7LX 9O+lCYRgGDFHYUlK6DM2mugNH7YW42vvivtIlFiJZ56ychqzjjkbDH8hmq771cOB738L xNPtapz3tKzj6kLzMVwDG+UXe+TMHsCF7P0TKpnsN4pa0kwfFPwqXOWztdUuKdLPD4jy Nxlw== X-Gm-Message-State: ALoCoQmXtiUFsQdcR2qynYRjtmJT4PMiItRRc6BLFjzXGzWLvFwkXF7kjtk7RYMry8xLIjPVS8RM X-Received: by 10.112.13.200 with SMTP id j8mr2450139lbc.14.1430398185398; Thu, 30 Apr 2015 05:49:45 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.39 with SMTP id kv7ls374058lac.63.gmail; Thu, 30 Apr 2015 05:49:45 -0700 (PDT) X-Received: by 10.152.43.225 with SMTP id z1mr3500328lal.53.1430398185257; Thu, 30 Apr 2015 05:49:45 -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 j8si1714039lah.14.2015.04.30.05.49.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Apr 2015 05:49:45 -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 labbd9 with SMTP id bd9so43335532lab.2 for ; Thu, 30 Apr 2015 05:49:45 -0700 (PDT) X-Received: by 10.113.10.134 with SMTP id ea6mr3630735lbd.29.1430398185176; Thu, 30 Apr 2015 05:49:45 -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 l1csp3093790lbt; Thu, 30 Apr 2015 05:49:44 -0700 (PDT) X-Received: by 10.180.90.82 with SMTP id bu18mr5293890wib.88.1430398176686; Thu, 30 Apr 2015 05:49:36 -0700 (PDT) Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com. [209.85.212.175]) by mx.google.com with ESMTPS id fs19si3762308wjc.211.2015.04.30.05.49.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Apr 2015 05:49:36 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.175 as permitted sender) client-ip=209.85.212.175; Received: by wizk4 with SMTP id k4so18044781wiz.1 for ; Thu, 30 Apr 2015 05:49:36 -0700 (PDT) X-Received: by 10.180.105.233 with SMTP id gp9mr5327043wib.83.1430398176445; Thu, 30 Apr 2015 05:49:36 -0700 (PDT) Received: from midway01-04-00.lavalab ([81.128.185.50]) by mx.google.com with ESMTPSA id l3sm2332939wik.16.2015.04.30.05.49.35 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 30 Apr 2015 05:49:35 -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 Subject: [PATCH v15 09/10] sysbus: add irq_routing_notifier Date: Thu, 30 Apr 2015 13:49:14 +0100 Message-Id: <1430398155-11214-10-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1430398155-11214-1-git-send-email-eric.auger@linaro.org> References: <1430398155-11214-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.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 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 --- 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 {