From patchwork Mon Apr 11 13:33:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 65520 Delivered-To: patch@linaro.org Received: by 10.112.43.237 with SMTP id z13csp1477848lbl; Mon, 11 Apr 2016 06:36:29 -0700 (PDT) X-Received: by 10.31.146.5 with SMTP id u5mr9816736vkd.19.1460381779479; Mon, 11 Apr 2016 06:36:19 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id f38si5870938uaf.117.2016.04.11.06.36.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Apr 2016 06:36:19 -0700 (PDT) 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 1apbzd-0005D1-5c; Mon, 11 Apr 2016 13:35:05 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1apbzb-0005C8-LG for xen-devel@lists.xen.org; Mon, 11 Apr 2016 13:35:03 +0000 Received: from [85.158.139.211] by server-4.bemta-5.messagelabs.com id CD/19-18387-608AB075; Mon, 11 Apr 2016 13:35:02 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrCLMWRWlGSWpSXmKPExsVysyfVTZdtBXe 4wcb1khZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8bE3+dYCtYKVPRMcWpg3MLTxcjFISSwiVFi zeRbLBDOaUaJx49eADmcHGwCmhJ3Pn9iArFFBKQlrn2+zAhiMwtESazf1M0KYgsLpEtcmfIJL M4ioCpx8WQfUC8HB6+As8STlQ4gYQkBOYmTxyaDlXMKuEgsPP+JFaRECKikeVbwBEbuBYwMqx g1ilOLylKLdA1N9ZKKMtMzSnITM3N0DQ1M9XJTi4sT01NzEpOK9ZLzczcxAn3LAAQ7GBu2ex5 ilORgUhLl3TmfO1yILyk/pTIjsTgjvqg0J7X4EKMMB4eSBK/WcqCcYFFqempFWmYOMMhg0hIc PEoivEEgad7igsTc4sx0iNQpRkUpcd4skIQASCKjNA+uDRbYlxhlpYR5GYEOEeIpSC3KzSxBl X/FKM7BqCTMGwkyhSczrwRu+iugxUxAi5/94wRZXJKIkJJqYGQIrbtySTV2oiR/WGJk3+UnNr HVpgfifOwYJ51e+E+6s0+MYfqvdble372+eUa8+XZlIUNvPk+IlJh6ZVxFxpLN3Cskb27PWrx 9+8nOV38m39e54poY/5R7xadurXyDOQe5ptw5ytmo8fS78PxzDLbri6u28dfsvrNu/8Z++UAn hjeqM1oYJyqxFGckGmoxFxUnAgCuXNgbZwIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-2.tower-206.messagelabs.com!1460381701!18046266!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.28; banners=-,-,- X-VirusChecked: Checked Received: (qmail 29104 invoked from network); 11 Apr 2016 13:35:02 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-2.tower-206.messagelabs.com with SMTP; 11 Apr 2016 13:35:02 -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 BDF5D4A7; Mon, 11 Apr 2016 06:32:31 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.215.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E3AFA3F21A; Mon, 11 Apr 2016 06:33:43 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 11 Apr 2016 14:33:34 +0100 Message-Id: <1460381617-5786-3-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1460381617-5786-1-git-send-email-julien.grall@arm.com> References: <1460381617-5786-1-git-send-email-julien.grall@arm.com> Cc: Julien Grall , sstabellini@kernel.org, shannon.zhao@linaro.org Subject: [Xen-devel] [for-4.7 v2 2/5] xen/arm: acpi: The boot CPU does not always match the first entry in the MADT 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" Since the ACPI 6.0 errata document [1], the first entry in the MADT does not have to correspond to the boot CPU. Introduce a new variable to know if a MADT entry matching the boot CPU is found. Furthermore, it's not necessary to check if the MPIDR is duplicated for the boot CPU. So the rest of the function can be skipped. [1] 1380 Unnecessary restrictions to FW vendors in ordering of GIC structures in MADT Signed-off-by: Julien Grall --- Changes in v2: - Modify the loop to start to 1 and not 0 --- xen/arch/arm/acpi/boot.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/xen/arch/arm/acpi/boot.c b/xen/arch/arm/acpi/boot.c index 859aa86..1bba1cf 100644 --- a/xen/arch/arm/acpi/boot.c +++ b/xen/arch/arm/acpi/boot.c @@ -37,7 +37,8 @@ #include /* Processors with enabled flag and sane MPIDR */ -static unsigned int enabled_cpus; +static unsigned int enabled_cpus = 1; +static bool __initdata bootcpu_valid; /* total number of cpus in this system */ static unsigned int __initdata total_cpus; @@ -71,10 +72,15 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor) } /* Check if GICC structure of boot CPU is available in the MADT */ - if ( (enabled_cpus == 0) && (cpu_logical_map(0) != mpidr) ) + if ( cpu_logical_map(0) == mpidr ) { - printk("Firmware bug, invalid CPU MPIDR for cpu0: 0x%"PRIx64" in MADT\n", - mpidr); + if ( bootcpu_valid ) + { + printk("Firmware bug, duplicate boot CPU MPIDR: 0x%"PRIx64" in MADT\n", + mpidr); + return; + } + bootcpu_valid = true; return; } @@ -83,7 +89,7 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor) * all initialized entries and check for * duplicates. If any is found just ignore the CPU. */ - for ( i = 0; i < enabled_cpus; i++ ) + for ( i = 1; i < enabled_cpus; i++ ) { if ( cpu_logical_map(i) == mpidr ) {