From patchwork Fri Jun 9 17:41:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 9779015 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5909160318 for ; Fri, 9 Jun 2017 17:44:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4621C286E0 for ; Fri, 9 Jun 2017 17:44:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3AFF8286F6; Fri, 9 Jun 2017 17:44:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D6569286E0 for ; Fri, 9 Jun 2017 17:44:09 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dJNvf-0004oZ-SV; Fri, 09 Jun 2017 17:42:35 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dJNvd-0004jS-UD for xen-devel@lists.xenproject.org; Fri, 09 Jun 2017 17:42:34 +0000 Received: from [85.158.139.211] by server-4.bemta-5.messagelabs.com id F9/12-02181-90EDA395; Fri, 09 Jun 2017 17:42:33 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRWlGSWpSXmKPExsVysyfVTZf1nlW kwfsGXYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNWPD489MBZeEKmbcWczSwHiAv4uRi0NIYDOj xORFjewQznJGiXfLTrN1MXJysAnoSuy4+ZoZxBYRCJV4uuA7M0gRs8B1RonTO+YDFXFwCAu4S fRsKQGpYRFQlXj7awpYPa+AtcTT3SvBbAkBOYmG8/fBbE6g+LY9a8HmCwlYSbQcusw+gZF7AS PDKkaN4tSistQiXSMzvaSizPSMktzEzBxdQwNTvdzU4uLE9NScxKRiveT83E2MQA/XMzAw7mC 8PdnvEKMkB5OSKO+0AqtIIb6k/JTKjMTijPii0pzU4kOMMhwcShK8r+4A5QSLUtNTK9Iyc4Ch BpOW4OBREuF9cRIozVtckJhbnJkOkTrFqCglzrsRpE8AJJFRmgfXBgvvS4yyUsK8jAwMDEI8B alFuZklqPKvGMU5GJWEeQ3vAk3hycwrgZv+CmgxE9DiJe8sQBaXJCKkpBoYS8+omcV4hRqwXu xO4M045Xzl1xH/HKapfeXheSUnbMTsVl4+H/O8hzs/zDu3Tqvy+GzPOr4Y+b0Xf9yM8ahfeYO z8SSfgfl+pXXB7jNzNI2i5AwUd2lHlm45aBx9oanirv3jAt/6MLGiu6l1qX9+pWrw5CQohs8T OL749q+Fe/zenOHUfa/EUpyRaKjFXFScCACxeKNLagIAAA== X-Env-Sender: andre.przywara@arm.com X-Msg-Ref: server-15.tower-206.messagelabs.com!1497030149!88681436!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 548 invoked from network); 9 Jun 2017 17:42:29 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-15.tower-206.messagelabs.com with SMTP; 9 Jun 2017 17:42:29 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EC93E1610; Fri, 9 Jun 2017 10:42:28 -0700 (PDT) Received: from e104803-lin.lan (unknown [10.1.207.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A04C63F578; Fri, 9 Jun 2017 10:42:27 -0700 (PDT) From: Andre Przywara To: Julien Grall , Stefano Stabellini Date: Fri, 9 Jun 2017 18:41:39 +0100 Message-Id: <20170609174141.5068-33-andre.przywara@arm.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170609174141.5068-1-andre.przywara@arm.com> References: <20170609174141.5068-1-andre.przywara@arm.com> Cc: xen-devel@lists.xenproject.org, Vijaya Kumar K , Vijay Kilari , Shanker Donthineni , Manish Jaggi Subject: [Xen-devel] [PATCH v11 32/34] ARM: vITS: increase mmio_count for each ITS X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Increase the count of MMIO regions needed by one for each ITS Dom0 has to emulate. We emulate the ITSes 1:1 from the hardware, so the number is the number of host ITSes. Signed-off-by: Andre Przywara Acked-by: Julien Grall --- xen/arch/arm/vgic-v3-its.c | 15 +++++++++++++++ xen/arch/arm/vgic-v3.c | 3 +++ xen/include/asm-arm/gic_v3_its.h | 7 +++++++ 3 files changed, 25 insertions(+) diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c index d3e0324..4eef37e 100644 --- a/xen/arch/arm/vgic-v3-its.c +++ b/xen/arch/arm/vgic-v3-its.c @@ -1455,6 +1455,21 @@ static const struct mmio_handler_ops vgic_its_mmio_handler = { .write = vgic_v3_its_mmio_write, }; +unsigned int vgic_v3_its_count(const struct domain *d) +{ + struct host_its *hw_its; + unsigned int ret = 0; + + /* Only Dom0 can use emulated ITSes so far. */ + if ( !is_hardware_domain(d) ) + return 0; + + list_for_each_entry(hw_its, &host_its_list, entry) + ret++; + + return ret; +} + int vgic_v3_its_init_domain(struct domain *d) { spin_lock_init(&d->arch.vgic.its_devices_lock); diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c index 296991a..cddb920 100644 --- a/xen/arch/arm/vgic-v3.c +++ b/xen/arch/arm/vgic-v3.c @@ -1814,6 +1814,9 @@ int vgic_v3_init(struct domain *d, int *mmio_count) /* GICD region + number of Redistributors */ *mmio_count = vgic_v3_rdist_count(d) + 1; + /* one region per ITS */ + *mmio_count += vgic_v3_its_count(d); + register_vgic_ops(d, &v3_ops); return 0; diff --git a/xen/include/asm-arm/gic_v3_its.h b/xen/include/asm-arm/gic_v3_its.h index ce46a3f..459b6fe 100644 --- a/xen/include/asm-arm/gic_v3_its.h +++ b/xen/include/asm-arm/gic_v3_its.h @@ -137,6 +137,8 @@ void gicv3_its_dt_init(const struct dt_device_node *node); bool gicv3_its_host_has_its(void); +unsigned int vgic_v3_its_count(const struct domain *d); + void gicv3_do_LPI(unsigned int lpi); int gicv3_lpi_init_rdist(void __iomem * rdist_base); @@ -194,6 +196,11 @@ static inline bool gicv3_its_host_has_its(void) return false; } +static inline unsigned int vgic_v3_its_count(const struct domain *d) +{ + return 0; +} + static inline void gicv3_do_LPI(unsigned int lpi) { /* We don't enable LPIs without an ITS. */