From patchwork Fri Feb 3 19:18:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 93305 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp738116qgi; Fri, 3 Feb 2017 11:21:03 -0800 (PST) X-Received: by 10.107.173.95 with SMTP id w92mr13794663ioe.136.1486149663150; Fri, 03 Feb 2017 11:21:03 -0800 (PST) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id x33si1977788ita.66.2017.02.03.11.21.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Feb 2017 11:21:03 -0800 (PST) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cZjO5-00049G-HD; Fri, 03 Feb 2017 19:19:13 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cZjO4-00048E-1X for xen-devel@lists.xen.org; Fri, 03 Feb 2017 19:19:12 +0000 Received: from [85.158.143.35] by server-9.bemta-6.messagelabs.com id 8E/70-27165-FA7D4985; Fri, 03 Feb 2017 19:19:11 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTXf99Sk RBn3tjBZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8axn8tZCxbwVVzqn87awNjE3cXIxSEksJlR Ys+CjywQzmlGibebn7B1MXJysAloStz5/IkJxBYRkJa49vkyI4jNLBAlcefiTqAGDg5hgQCJL V+EQMIsAqoSvX83MoPYvAIuEk8XnGQBsSUE5CROHpvMCmJzCrhKfD+3DmykEFDN4vYOlgmM3A sYGVYxahSnFpWlFukamuslFWWmZ5TkJmbm6BoamOnlphYXJ6an5iQmFesl5+duYgT6lwEIdjD e3hhwiFGSg0lJlLfo2pQIIb6k/JTKjMTijPii0pzU4kOMMhwcShK8C0BygkWp6akVaZk5wECD SUtw8CiJ8CoCg02It7ggMbc4Mx0idYpRUUqc9xBInwBIIqM0D64NFtyXGGWlhHkZgQ4R4ilIL crNLEGVf8UozsGoJMzLADKeJzOvBG76K6DFTECLfz6eBLK4JBEhJdXAyHVzWgZL24+ilY3vZC pkbBbIRjJ8zpS5xbb2h0qq8z6hCfJ6vrX1DfGlAr7F19QjDOQD4veVr1ITKL2/4ozueptD5/a d2PFoy7xTa9NbOc0Wp/QE7jEXjMhJX7pmg1/JzJ9L1rzeM+nP04va/ye0bVg2pVcrdEHS2+xf VWduCwrn5yVxata0KLEUZyQaajEXFScCAE902nBpAgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-14.tower-21.messagelabs.com!1486149550!50239653!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.1.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 3745 invoked from network); 3 Feb 2017 19:19:10 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-14.tower-21.messagelabs.com with SMTP; 3 Feb 2017 19:19:10 -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 4ECD6152B; Fri, 3 Feb 2017 11:19:10 -0800 (PST) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.218.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8E9FA3F242; Fri, 3 Feb 2017 11:19:09 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Fri, 3 Feb 2017 19:18:45 +0000 Message-Id: <1486149538-20432-2-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1486149538-20432-1-git-send-email-julien.grall@arm.com> References: <1486149538-20432-1-git-send-email-julien.grall@arm.com> Cc: Julien Grall , sstabellini@kernel.org, shankerd@codeaurora.org Subject: [Xen-devel] [PATCH 1/8] xen/arm: acpi: Handle correctly detection of GICv2 on GICv3 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" When the GICv3 is not GICv2 compatible, the associated field in the MADT will be zeroed. However, the rest of the code expects the variable to be set to INVALID_PADDR. This will result to false detection of GICv2 and give I/O access to page 0 for the hardware domain. Thankfully, it will fail because the size of GICV has not been set. Fix the detection by converting 0 to INVALID_PADDR for the GICC and GICV base. At the same time only set the size of each region when the base address is not 0. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- xen/arch/arm/gic-v3.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index 955591b..bb1861e 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c @@ -1356,7 +1356,6 @@ gic_acpi_parse_madt_cpu(struct acpi_subtable_header *header, if ( !cpu_base_assigned ) { cbase = processor->base_address; - csize = SZ_8K; vbase = processor->gicv_base_address; gicv3_info.maintenance_irq = processor->vgic_interrupt; @@ -1505,6 +1504,25 @@ static void __init gicv3_acpi_init(void) panic("GICv3: No valid GICC entries exists"); gicv3.rdist_stride = 0; + + /* + * In ACPI, 0 is considered as the invalid address. However the rest + * of the initialization rely on the invalid address to be + * INVALID_ADDR. + * + * Also set the size of the GICC and GICV when there base address + * is not invalid as those values are not present in ACPI. + */ + if ( !cbase ) + cbase = INVALID_PADDR; + else + csize = SZ_8K; + + if ( !vbase ) + vbase = INVALID_PADDR; + else + vsize = GUEST_GICC_SIZE; + } #else static void __init gicv3_acpi_init(void) { }