From patchwork Fri May 26 17:35:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 9750885 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 109A76032C for ; Fri, 26 May 2017 17:37:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02106281B7 for ; Fri, 26 May 2017 17:37:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EACA528417; Fri, 26 May 2017 17:37:52 +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 5AEB9281B7 for ; Fri, 26 May 2017 17:37:52 +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 1dEJA9-00064y-1e; Fri, 26 May 2017 17:36:33 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dEJA8-00062c-FR for xen-devel@lists.xenproject.org; Fri, 26 May 2017 17:36:32 +0000 Received: from [85.158.139.211] by server-4.bemta-5.messagelabs.com id ED/01-02181-F9768295; Fri, 26 May 2017 17:36:31 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrCLMWRWlGSWpSXmKPExsVysyfVTXd+uka kwavf/Bbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bn32sYCy4JVWxbadDAeIC/i5GLQ0hgM6PE 3ucXGbsYOYGc5YwSSzaLgNhsAroSO26+ZgaxRQRCJZ4u+M4M0sAssIZRov3TU9YuRg4OYQE3i Rvz1UBMFgFVid9ngkDKeQVsJOa0n2cFsSUE5CQazt8HG8MJFJ919jMTxCpriTdbv7NOYORewM iwilGjOLWoLLVI18hYL6koMz2jJDcxM0fX0MBULze1uDgxPTUnMalYLzk/dxMj0Lf1DAyMOxh 3tPsdYpTkYFIS5Z2+Tj1SiC8pP6UyI7E4I76oNCe1+BCjDAeHkgSvVJpGpJBgUWp6akVaZg4w yGDSEhw8SiK8b1KB0rzFBYm5xZnpEKlTjIpS4rzvQRICIImM0jy4NlhgX2KUlRLmZWRgYBDiK Ugtys0sQZV/xSjOwagkzMsEsp0nM68EbvoroMVMQIt9z6mDLC5JREhJNTCKSt0X6yvbfDbX2S 3Ewa9h3vMOdzbuO1k5u26Eb3V0cHFd2pDZuNJnkmqcC6ek93k9myO/jrmFX9r3X3aDyY5PQqU p6zdMSatwXLPHMN90VfsC9n3aLJUH2K+k/7Y9EvNw9yFTU7mWmQlyvPnMtm5z9vYt33tJuI3j zs+ibXI719U/6rg974oSS3FGoqEWc1FxIgAHrq8yZwIAAA== X-Env-Sender: andre.przywara@arm.com X-Msg-Ref: server-7.tower-206.messagelabs.com!1495820189!97599648!2 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 52596 invoked from network); 26 May 2017 17:36:31 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-7.tower-206.messagelabs.com with SMTP; 26 May 2017 17:36:31 -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 CD9141610; Fri, 26 May 2017 10:36:30 -0700 (PDT) Received: from e104803-lin.lan (unknown [10.1.207.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9351C3F53D; Fri, 26 May 2017 10:36:29 -0700 (PDT) From: Andre Przywara To: Julien Grall , Stefano Stabellini Date: Fri, 26 May 2017 18:35:38 +0100 Message-Id: <20170526173540.10066-31-andre.przywara@arm.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170526173540.10066-1-andre.przywara@arm.com> References: <20170526173540.10066-1-andre.przywara@arm.com> Cc: xen-devel@lists.xenproject.org, Vijaya Kumar K , Vijay Kilari , Shanker Donthineni Subject: [Xen-devel] [PATCH v10 30/32] 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 76e0467..5682a38 100644 --- a/xen/arch/arm/vgic-v3-its.c +++ b/xen/arch/arm/vgic-v3-its.c @@ -1435,6 +1435,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 134e1b0..03d9a8c 100644 --- a/xen/arch/arm/vgic-v3.c +++ b/xen/arch/arm/vgic-v3.c @@ -1798,6 +1798,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 c6404ea..9f70980 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); @@ -192,6 +194,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. */