From patchwork Fri Oct 31 14:05:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 39909 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 D9D43202FE for ; Fri, 31 Oct 2014 14:06:27 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id f15sf4231207lbj.7 for ; Fri, 31 Oct 2014 07:06:26 -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=0Ofa06MtkCTM0l+Uecdv9QzbXYOTJTuw0VNvDs9z4Uw=; b=ifWMP4Jr5tAroP0/5Xbc9c8lPnC1r0F9BHMcNrEpu71+ZDOi184HukKUHyft37QH84 HhRr9MSUQgCcCZDoEXBB4oX4gG7Y5ve/DPHBmZQGZX+fiLMaFDwygULbAxp5UvMea/Zf aqvub98/maJE07KPO51NyDICi3dV9kUxxGUNzZni+id8TqXW4D8EPE3/AOMawSppYQ8t udX7dvWpODdONTZQKsgTzGQfhhreqJZ6K1Dqb2/6vF+jy/wA0TRRkNCQdMj39wP4G8Cg zO9Xi1d7O0aw6qvXc+pGb48HWXXkoM9Sn0kCeJv4/yFCJ3BMQVjtwXluTafPT4Uaw5/x FHPw== X-Gm-Message-State: ALoCoQkivWk55Quy4bgGg/1MwsJOsiF1Roq5NrOHljWAp/zLVq3RbSjVvR5QcNZKL2ILDpVTei3i X-Received: by 10.180.105.74 with SMTP id gk10mr707876wib.0.1414764386715; Fri, 31 Oct 2014 07:06:26 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.8 with SMTP id lk8ls401825lac.17.gmail; Fri, 31 Oct 2014 07:06:26 -0700 (PDT) X-Received: by 10.112.77.129 with SMTP id s1mr27192936lbw.36.1414764386566; Fri, 31 Oct 2014 07:06:26 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id p8si16860403lag.62.2014.10.31.07.06.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Oct 2014 07:06:26 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id s18so878217lam.41 for ; Fri, 31 Oct 2014 07:06:26 -0700 (PDT) X-Received: by 10.112.14.69 with SMTP id n5mr26455974lbc.34.1414764386483; Fri, 31 Oct 2014 07:06:26 -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.84.229 with SMTP id c5csp207531lbz; Fri, 31 Oct 2014 07:06:25 -0700 (PDT) X-Received: by 10.180.82.4 with SMTP id e4mr1810738wiy.42.1414764385585; Fri, 31 Oct 2014 07:06:25 -0700 (PDT) Received: from mail-wg0-f52.google.com (mail-wg0-f52.google.com. [74.125.82.52]) by mx.google.com with ESMTPS id yu10si1558573wjc.112.2014.10.31.07.06.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Oct 2014 07:06:25 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 74.125.82.52 as permitted sender) client-ip=74.125.82.52; Received: by mail-wg0-f52.google.com with SMTP id b13so6013200wgh.39 for ; Fri, 31 Oct 2014 07:06:25 -0700 (PDT) X-Received: by 10.180.99.105 with SMTP id ep9mr4199171wib.82.1414764385363; Fri, 31 Oct 2014 07:06:25 -0700 (PDT) Received: from midway01-04-00.lavalab ([88.98.47.97]) by mx.google.com with ESMTPSA id v10sm12504563wiy.23.2014.10.31.07.06.24 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Oct 2014 07:06:24 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, christoffer.dall@linaro.org, qemu-devel@nongnu.org, agraf@suse.de, pbonzini@redhat.com, kim.phillips@freescale.com, a.rigo@virtualopensystems.com, manish.jaggi@caviumnetworks.com, joel.schopp@amd.com Cc: eric.auger@linaro.org, kvmarm@lists.cs.columbia.edu, patches@linaro.org, alex.williamson@redhat.com, peter.maydell@linaro.org, will.deacon@arm.com, Bharat.Bhushan@freescale.com, stuart.yoder@freescale.com, a.motakis@virtualopensystems.com Subject: [PATCH v7 11/16] hw/arm/virt: add support for VFIO devices Date: Fri, 31 Oct 2014 14:05:45 +0000 Message-Id: <1414764350-5140-12-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1414764350-5140-1-git-send-email-eric.auger@linaro.org> References: <1414764350-5140-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.54 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: , VFIO devices are dynamic sysbus devices. They could already be instantiated. However for them to be functional, IRQ injection must be programmed and started. This programming must happen after the sysbus devices are attached to the platform bus and IRQ are bound. Only at that time the GSI they are connected to are identified and irqfd can be programmed. Binding happens in a machine init done notifier registered by the platform bus init. The IRQ start is done in another notifier that must be registered before the platform bus creation. This patchs adds the registration of the IRQ start notifier in machvirt. Signed-off-by: Eric Auger --- The registration of the IRQ start notifier could also happen in the platform bus. --- hw/arm/virt.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 3a09d58..911dbfc 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -44,6 +44,7 @@ #include "qemu/error-report.h" #include "hw/arm/sysbus-fdt.h" #include "hw/platform-bus.h" +#include "hw/vfio/vfio-platform.h" #define NUM_VIRTIO_TRANSPORTS 32 @@ -546,6 +547,14 @@ static void create_platform_bus(VirtBoardInfo *vbi, qemu_irq *pic, MemoryRegion *sysmem = get_system_memory(); /* + * Registers a notifier that starts VFIO IRQ injection. The notifier + * must be registered before the platform bus device creation. This + * latter registers another notifier that binds the dynamic sysbus + * devices to the platform bus. + */ + vfio_register_irq_starter(system_params->platform_bus_first_irq); + + /* * register the notifier that will update the device tree with * the platform bus and device tree nodes. Must be done before * the instantiation of the platform bus device that registers