From patchwork Wed Jun 14 16:52:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 9786939 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 770BC60325 for ; Wed, 14 Jun 2017 16:54:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 690241FF15 for ; Wed, 14 Jun 2017 16:54:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5DD4B28604; Wed, 14 Jun 2017 16:54:29 +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 06E4C1FF15 for ; Wed, 14 Jun 2017 16:54:29 +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 1dLBXX-0007QX-Le; Wed, 14 Jun 2017 16:53:07 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLBXW-0007Np-O1 for xen-devel@lists.xenproject.org; Wed, 14 Jun 2017 16:53:06 +0000 Received: from [193.109.254.147] by server-5.bemta-6.messagelabs.com id 17/3A-03371-2F961495; Wed, 14 Jun 2017 16:53:06 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRWlGSWpSXmKPExsVysyfVTfdjpmO kwYQVWhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8azv5uZCi4JVcz69YC9gfEAfxcjF4eQwGZG iZmbelkgnOWMEos7TjN3MXJysAnoSuy4+RrMFhEIlXi64DszSBGzwHVGidM75rOBJIQF3CSWT 90KZrMIqEr8+PsDrIFXwFri8rntLCC2hICcRMP5+2BxTqD41O2TmboYOYC2WUncXKE/gZF7AS PDKkaN4tSistQiXUMzvaSizPSMktzEzBxdQwMzvdzU4uLE9NScxKRiveT83E2MQA8zAMEOxvs bAw4xSnIwKYnyThV0jBTiS8pPqcxILM6ILyrNSS0+xCjDwaEkwesMDBghwaLU9NSKtMwcYKjB pCU4eJREeLemAqV5iwsSc4sz0yFSpxgVpcR5z2YAJQRAEhmleXBtsPC+xCgrJczLCHSIEE9Ba lFuZgmq/CtGcQ5GJWHesnSgKTyZeSVw018BLWYCWhx0wQFkcUkiQkqqgTHr4xHxBiddxpXVBx h5t2+69drg4Xq+7Ldl4S9u3K7xyao+HMpr9FHfmOv5hpidjLyr42Z2Xet+8XD/0o7Haf6VB9Q dJ+xx2KnAK/bGrK40tinuLOepS2cOs3b8yXg9bYOBa12f9KKLwv6ZM5fsWRvyUbxnj+J3j98n /h5Yq7B71ebMHaq9n+4osRRnJBpqMRcVJwIABWHLsmoCAAA= X-Env-Sender: andre.przywara@arm.com X-Msg-Ref: server-8.tower-27.messagelabs.com!1497459185!97418742!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 39566 invoked from network); 14 Jun 2017 16:53:05 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-8.tower-27.messagelabs.com with SMTP; 14 Jun 2017 16:53:05 -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 01BB815B2; Wed, 14 Jun 2017 09:53:05 -0700 (PDT) Received: from e104803-lin.lan (unknown [10.1.207.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A4D343F3E1; Wed, 14 Jun 2017 09:53:03 -0700 (PDT) From: Andre Przywara To: Julien Grall , Stefano Stabellini Date: Wed, 14 Jun 2017 17:52:21 +0100 Message-Id: <20170614165223.7543-33-andre.przywara@arm.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170614165223.7543-1-andre.przywara@arm.com> References: <20170614165223.7543-1-andre.przywara@arm.com> Cc: xen-devel@lists.xenproject.org, Vijaya Kumar K , Vijay Kilari , Shanker Donthineni , Manish Jaggi Subject: [Xen-devel] [PATCH v12 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 f853987..335272f 100644 --- a/xen/arch/arm/vgic-v3-its.c +++ b/xen/arch/arm/vgic-v3-its.c @@ -1454,6 +1454,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 90a2ae3..4287ae1 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. */