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) { } From patchwork Fri Feb 3 19:18:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 93301 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp738102qgi; Fri, 3 Feb 2017 11:21:01 -0800 (PST) X-Received: by 10.36.77.149 with SMTP id l143mr2252656itb.19.1486149661252; Fri, 03 Feb 2017 11:21:01 -0800 (PST) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id z18si1936167ita.99.2017.02.03.11.21.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Feb 2017 11:21:01 -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 1cZjO7-0004CB-Fa; Fri, 03 Feb 2017 19:19:15 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cZjO6-00048x-RX for xen-devel@lists.xen.org; Fri, 03 Feb 2017 19:19:14 +0000 Received: from [193.109.254.147] by server-2.bemta-6.messagelabs.com id AE/86-22326-2B7D4985; Fri, 03 Feb 2017 19:19:14 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRWlGSWpSXmKPExsVysyfVTXfT9Sk RBgs2sFks+biYxYHR4+ju30wBjFGsmXlJ+RUJrBnX248yF1zgq5i06SdrA+N5ri5GLg4hgc2M Euf7PzBCOKcZJY7+nMjaxcjJwSagKXHn8ycmEFtEQFri2ufLjCA2s0CUxJ2LO1lAbGEBb4kz3 9eD1bMIqErM/L2YDcTmFXCR+PVxHZgtISAncfLYZLAaTgFXie/n1oHNFAKqWdzewTKBkXsBI8 MqRo3i1KKy1CJdI1O9pKLM9IyS3MTMHF1DAzO93NTi4sT01JzEpGK95PzcTYxADzMAwQ7GVQs CDzFKcjApifIWXZsSIcSXlJ9SmZFYnBFfVJqTWnyIUYaDQ0mCVx8kJ1iUmp5akZaZAww1mLQE B4+SCO9KkDRvcUFibnFmOkTqFKOilDivMUhCACSRUZoH1wYL70uMslLCvIxAhwjxFKQW5WaWo Mq/YhTnYFQS5rUHmcKTmVcCN/0V0GImoMU/H08CWVySiJCSamB0dF937HfNZL+Krya/Y3tWHv l4aGvHYa6p+rPuVExzup+29tnf6pOPH2x99f/+3yOl0+0y75e+z5h1q7nxup7LuVkHRQRWVwX u39RgtVdZ/BVjS7r5jRv/p549qh7rfXzS9B8HlnLxvzFgNun79mnWmtgVqzwcxC51bVpv0Gk0 JWk676fl90/8XajEUpyRaKjFXFScCAB1tlgyagIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-11.tower-27.messagelabs.com!1486149553!54820200!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 8430 invoked from network); 3 Feb 2017 19:19:13 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-11.tower-27.messagelabs.com with SMTP; 3 Feb 2017 19:19:13 -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 3E30C152B; Fri, 3 Feb 2017 11:19:13 -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 7DAF33F242; Fri, 3 Feb 2017 11:19:12 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Fri, 3 Feb 2017 19:18:48 +0000 Message-Id: <1486149538-20432-5-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 2/8] xen/arm: acpi: Rework acpi_boot_table_init error paths 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" There are multiple path disable ACPI on error. Consolidate in a single place, this will help in a follow-up patch to add more code on the error path. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- xen/arch/arm/acpi/boot.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/xen/arch/arm/acpi/boot.c b/xen/arch/arm/acpi/boot.c index c3242a0..889208a 100644 --- a/xen/arch/arm/acpi/boot.c +++ b/xen/arch/arm/acpi/boot.c @@ -234,7 +234,7 @@ static int __init dt_scan_depth1_nodes(const void *fdt, int node, */ int __init acpi_boot_table_init(void) { - int error; + int error = 0; /* * Enable ACPI instead of device tree unless @@ -245,10 +245,7 @@ int __init acpi_boot_table_init(void) if ( param_acpi_off || ( !param_acpi_force && device_tree_for_each_node(device_tree_flattened, dt_scan_depth1_nodes, NULL))) - { - disable_acpi(); - return 0; - } + goto disable; /* * ACPI is disabled at this point. Enable it in order to parse @@ -260,16 +257,22 @@ int __init acpi_boot_table_init(void) error = acpi_table_init(); if ( error ) { - disable_acpi(); - return error; + printk("%s: Unable to initialize table parser (%d)\n", + __FUNCTION__, error); + goto disable; } - if ( acpi_table_parse(ACPI_SIG_FADT, acpi_parse_fadt) ) + error = acpi_table_parse(ACPI_SIG_FADT, acpi_parse_fadt); + if ( error ) { - /* disable ACPI if no FADT is found */ - disable_acpi(); - printk("Can't find FADT\n"); + printk("%s: FADT not found (%d)\n", __FUNCTION__, error); + goto disable; } return 0; + +disable: + disable_acpi(); + + return error; } From patchwork Fri Feb 3 19:18:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 93300 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp738089qgi; Fri, 3 Feb 2017 11:20:59 -0800 (PST) X-Received: by 10.36.51.68 with SMTP id k65mr2264024itk.4.1486149659733; Fri, 03 Feb 2017 11:20:59 -0800 (PST) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id 203si1987308iti.26.2017.02.03.11.20.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Feb 2017 11:20:59 -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 1cZjOA-0004GN-VG; Fri, 03 Feb 2017 19:19:18 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cZjO9-0004Dn-2x for xen-devel@lists.xen.org; Fri, 03 Feb 2017 19:19:17 +0000 Received: from [193.109.254.147] by server-5.bemta-6.messagelabs.com id 6F/93-11476-4B7D4985; Fri, 03 Feb 2017 19:19:16 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVysyfVTXfz9Sk RBmtnWVgs+biYxYHR4+ju30wBjFGsmXlJ+RUJrBmrr11gLLjJWnF29jy2BsYLLF2MXBxCApsY JT5c+cUE4ZxmlHizcwlzFyMnB5uApsSdz5+YQGwRAWmJa58vM4LYzAJREncu7mQBsYUFvCX2/ VjMCmKzCKhK7F55gh3E5hVwkZh4eS3YHAkBOYmTxyaD1XAKuEp8P7cObKYQUM3i9g6WCYzcCx gZVjFqFKcWlaUW6Rob6CUVZaZnlOQmZuboGhqY6eWmFhcnpqfmJCYV6yXn525iBHqYAQh2MP5 dG3iIUZKDSUmUV/nylAghvqT8lMqMxOKM+KLSnNTiQ4wyHBxKErz614BygkWp6akVaZk5wFCD SUtw8CiJ8K4ESfMWFyTmFmemQ6ROMepynPp04SWTEEtefl6qlDivMUiRAEhRRmke3AhY2F9il JUS5mUEOkqIpyC1KDezBFX+FaM4B6OSMK89yBSezLwSuE2vgI5gAjri5+NJIEeUJCKkpBoYYw T7TZuSP5qcft5vsDCQveh1cEKg4dHEWLnA+PnpeoZMB967Zng5f90ZXs80Q0UhTFjvtxyPWFL w9LZMuya7Jr/piUkr15zqlz/R+Pn+9cR1MwpDzMvfX0+X2lpnczbX4MTP2l9F3Bwc/g2zV1rW pRWxcolsLfQXPbfIzfTQ0y/3u2YIP1BiKc5INNRiLipOBAC5KabOdgIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-14.tower-27.messagelabs.com!1486149555!72867816!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 24197 invoked from network); 3 Feb 2017 19:19:15 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-14.tower-27.messagelabs.com with SMTP; 3 Feb 2017 19:19:15 -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 372EEAD7; Fri, 3 Feb 2017 11:19:15 -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 79F2F3F242; Fri, 3 Feb 2017 11:19:14 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Fri, 3 Feb 2017 19:18:50 +0000 Message-Id: <1486149538-20432-7-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 3/7] xen/arm: Print whether Xen is booting using ACPI or DT 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" Make it easier to figure out whether Xen is booting using ACPI or DT by printing a message on the console. Signed-off-by: Julien Grall --- xen/arch/arm/setup.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 049e449..41aa1dd 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -753,6 +753,11 @@ void __init start_xen(unsigned long boot_phys_offset, /* Parse the ACPI tables for possible boot-time configuration */ acpi_boot_table_init(); + if ( acpi_disabled ) + printk("Booting using Device Tree\n"); + else + printk("Booting using ACPI\n"); + end_boot_allocator(); vm_init(); From patchwork Fri Feb 3 19:18:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 93306 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp738128qgi; Fri, 3 Feb 2017 11:21:04 -0800 (PST) X-Received: by 10.107.178.3 with SMTP id b3mr10845659iof.50.1486149664463; Fri, 03 Feb 2017 11:21:04 -0800 (PST) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id j74si4165732ioj.69.2017.02.03.11.21.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Feb 2017 11:21:04 -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 1cZjOC-0004IB-6Y; Fri, 03 Feb 2017 19:19:20 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cZjOA-0004FI-9t for xen-devel@lists.xen.org; Fri, 03 Feb 2017 19:19:18 +0000 Received: from [193.109.254.147] by server-7.bemta-6.messagelabs.com id A5/CC-29440-5B7D4985; Fri, 03 Feb 2017 19:19:17 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTXfL9Sk RBt0LzC2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oxvv7ewFEwXq5jZ8YalgfEcfxcjF4eQwGZG iaUnHjFDOKcZJS5NnQPkcHKwCWhK3Pn8iQnEFhGQlrj2+TIjiM0sECVx5+JOFhBbWMBf4uLhk 2A2i4CqxJ29W9lAbF4BF4njx3aA1UsIyEmcPDaZFcTmFHCV+H5uHdhMIaCaxe0dLBMYuRcwMq xiVC9OLSpLLdI11UsqykzPKMlNzMzRNTQw08tNLS5OTE/NSUwq1kvOz93ECPQvAxDsYJx+2f8 QoyQHk5Iob9G1KRFCfEn5KZUZicUZ8UWlOanFhxhlODiUJHj1QXKCRanpqRVpmTnAQINJS3Dw KInw6oGkeYsLEnOLM9MhUqcYFaXEeQ+BJARAEhmleXBtsOC+xCgrJczLCHSIEE9BalFuZgmq/ CtGcQ5GJWFee5ApPJl5JXDTXwEtZgJa/PPxJJDFJYkIKakGRuWXs8MEdrwsUQybeu/2SfM9tk suKu3+NU1n3z3r5kea6y6aLqj2XO/MfOjd75iEmFaPD9O4XCbyJ/mlZrhdY51ncv72XuVZX5b +XVC0LHH/B4Ogoy3Fkr6MwX/NZz6d8cL15cyS4PqTXJNjHAzW9e2dnmWX9dNaLfBQxUeTG9U1 eimucuK155RYijMSDbWYi4oTAYatxT1pAgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-4.tower-27.messagelabs.com!1486149556!84496856!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 17385 invoked from network); 3 Feb 2017 19:19:16 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-4.tower-27.messagelabs.com with SMTP; 3 Feb 2017 19:19:16 -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 326ED152B; Fri, 3 Feb 2017 11:19:16 -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 7218A3F242; Fri, 3 Feb 2017 11:19:15 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Fri, 3 Feb 2017 19:18:51 +0000 Message-Id: <1486149538-20432-8-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 4/7] xen/arm: efi: Avoid duplicating the addition of a new bank 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" The code to add a new bank is duplicated twice. Add a new helper that checks if the maximum of bank has not reached and adds the bank. Signed-off-by: Julien Grall --- xen/arch/arm/efi/efi-boot.h | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h index 045d6ce..757d9c6 100644 --- a/xen/arch/arm/efi/efi-boot.h +++ b/xen/arch/arm/efi/efi-boot.h @@ -124,15 +124,27 @@ static void __init *lookup_fdt_config_table(EFI_SYSTEM_TABLE *sys_table) return fdt; } +static bool meminfo_add_bank(struct meminfo *mem, EFI_MEMORY_DESCRIPTOR *desc) +{ + struct membank *bank; + + if ( mem->nr_banks > NR_MEM_BANKS ) + return false; + + bank = &mem->bank[mem->nr_banks]; + bank->start = desc->PhysicalStart; + bank->size = desc->NumberOfPages * EFI_PAGE_SIZE; + + mem->nr_banks++; + + return true; +} + static EFI_STATUS __init efi_process_memory_map_bootinfo(EFI_MEMORY_DESCRIPTOR *map, UINTN mmap_size, UINTN desc_size) { int Index; - int i = 0; -#ifdef CONFIG_ACPI - int j = 0; -#endif EFI_MEMORY_DESCRIPTOR *desc_ptr = map; for ( Index = 0; Index < (mmap_size / desc_size); Index++ ) @@ -142,37 +154,27 @@ static EFI_STATUS __init efi_process_memory_map_bootinfo(EFI_MEMORY_DESCRIPTOR * (desc_ptr->Type == EfiBootServicesCode || desc_ptr->Type == EfiBootServicesData)) ) { - if ( i >= NR_MEM_BANKS ) + if ( !meminfo_add_bank(&bootinfo.mem, desc_ptr) ) { PrintStr(L"Warning: All " __stringify(NR_MEM_BANKS) " bootinfo mem banks exhausted.\r\n"); break; } - bootinfo.mem.bank[i].start = desc_ptr->PhysicalStart; - bootinfo.mem.bank[i].size = desc_ptr->NumberOfPages * EFI_PAGE_SIZE; - ++i; } #ifdef CONFIG_ACPI else if ( desc_ptr->Type == EfiACPIReclaimMemory ) { - if ( j >= NR_MEM_BANKS ) + if ( !meminfo_add_bank(&acpi_mem, desc_ptr) ) { PrintStr(L"Error: All " __stringify(NR_MEM_BANKS) " acpi meminfo mem banks exhausted.\r\n"); return EFI_LOAD_ERROR; } - acpi_mem.bank[j].start = desc_ptr->PhysicalStart; - acpi_mem.bank[j].size = desc_ptr->NumberOfPages * EFI_PAGE_SIZE; - ++j; } #endif desc_ptr = NextMemoryDescriptor(desc_ptr, desc_size); } - bootinfo.mem.nr_banks = i; -#ifdef CONFIG_ACPI - acpi_mem.nr_banks = j; -#endif return EFI_SUCCESS; } From patchwork Fri Feb 3 19:18:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 93303 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp738108qgi; Fri, 3 Feb 2017 11:21:02 -0800 (PST) X-Received: by 10.36.57.10 with SMTP id l10mr2413812ita.8.1486149661989; Fri, 03 Feb 2017 11:21:01 -0800 (PST) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id z67si4168788ioi.19.2017.02.03.11.21.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Feb 2017 11:21:01 -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 1cZjOC-0004Jc-NA; Fri, 03 Feb 2017 19:19:20 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cZjOB-00048E-Or for xen-devel@lists.xen.org; Fri, 03 Feb 2017 19:19:19 +0000 Received: from [85.158.143.35] by server-9.bemta-6.messagelabs.com id 5D/A0-27165-7B7D4985; Fri, 03 Feb 2017 19:19:19 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTXfb9Sk RBgcXm1gs+biYxYHR4+ju30wBjFGsmXlJ+RUJrBnffm9hKZguVjGz4w1LA+M5/i5GLg4hgc2M Ev2Xl7J1MXICOacZJXpeGYPYbAKaEnc+f2ICsUUEpCWufb7MCGIzC0RJ3Lm4kwXEFhbwl/hz5 wlYDYuAqsTnf+dYQWxeAVeJzzcnM4PYEgJyEiePTQaLcwLFv59bxwSxy0VicXsHywRG7gWMDK sYNYpTi8pSi3QNjfSSijLTM0pyEzNzdA0NzPRyU4uLE9NTcxKTivWS83M3MQL9ywAEOxgvbww 4xCjJwaQkylt0bUqEEF9SfkplRmJxRnxRaU5q8SFGGQ4OJQneBSA5waLU9NSKtMwcYKDBpCU4 eJREePVA0rzFBYm5xZnpEKlTjIpS4rzGIAkBkERGaR5cGyy4LzHKSgnzMgIdIsRTkFqUm1mCK v+KUZyDUUmY1x5kCk9mXgnc9FdAi5mAFv98PAlkcUkiQkqqgXEl+5zTyXXhWnvWOLlN/9Bqr2 DGNUvH0OfZ1+kf7h2TWxx3JP3v6WK/t4t3LS2+f/Np2lrLuN55+1y3LT1b8dapOPSTtGBLSHl +qVvS7G8Wv7ubDzvM7jPpO/PtpMKDl3OSRSTDGAV5Cjc/e9LGvCL680eedc2J8fpnyow2qUcG 5abwPpw0b6YSS3FGoqEWc1FxIgDhbCLVaQIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-12.tower-21.messagelabs.com!1486149558!56015706!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 42122 invoked from network); 3 Feb 2017 19:19:18 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-12.tower-21.messagelabs.com with SMTP; 3 Feb 2017 19:19:18 -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 272D5152B; Fri, 3 Feb 2017 11:19:18 -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 6638B3F242; Fri, 3 Feb 2017 11:19:17 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Fri, 3 Feb 2017 19:18:53 +0000 Message-Id: <1486149538-20432-10-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 5/8] xen/arm: efi: Avoid duplicating the addition of a new bank 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" The code to add a new bank is duplicated twice. Add a new helper that checks if the maximum of bank has not reached and adds the bank. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- xen/arch/arm/efi/efi-boot.h | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h index 045d6ce..757d9c6 100644 --- a/xen/arch/arm/efi/efi-boot.h +++ b/xen/arch/arm/efi/efi-boot.h @@ -124,15 +124,27 @@ static void __init *lookup_fdt_config_table(EFI_SYSTEM_TABLE *sys_table) return fdt; } +static bool meminfo_add_bank(struct meminfo *mem, EFI_MEMORY_DESCRIPTOR *desc) +{ + struct membank *bank; + + if ( mem->nr_banks > NR_MEM_BANKS ) + return false; + + bank = &mem->bank[mem->nr_banks]; + bank->start = desc->PhysicalStart; + bank->size = desc->NumberOfPages * EFI_PAGE_SIZE; + + mem->nr_banks++; + + return true; +} + static EFI_STATUS __init efi_process_memory_map_bootinfo(EFI_MEMORY_DESCRIPTOR *map, UINTN mmap_size, UINTN desc_size) { int Index; - int i = 0; -#ifdef CONFIG_ACPI - int j = 0; -#endif EFI_MEMORY_DESCRIPTOR *desc_ptr = map; for ( Index = 0; Index < (mmap_size / desc_size); Index++ ) @@ -142,37 +154,27 @@ static EFI_STATUS __init efi_process_memory_map_bootinfo(EFI_MEMORY_DESCRIPTOR * (desc_ptr->Type == EfiBootServicesCode || desc_ptr->Type == EfiBootServicesData)) ) { - if ( i >= NR_MEM_BANKS ) + if ( !meminfo_add_bank(&bootinfo.mem, desc_ptr) ) { PrintStr(L"Warning: All " __stringify(NR_MEM_BANKS) " bootinfo mem banks exhausted.\r\n"); break; } - bootinfo.mem.bank[i].start = desc_ptr->PhysicalStart; - bootinfo.mem.bank[i].size = desc_ptr->NumberOfPages * EFI_PAGE_SIZE; - ++i; } #ifdef CONFIG_ACPI else if ( desc_ptr->Type == EfiACPIReclaimMemory ) { - if ( j >= NR_MEM_BANKS ) + if ( !meminfo_add_bank(&acpi_mem, desc_ptr) ) { PrintStr(L"Error: All " __stringify(NR_MEM_BANKS) " acpi meminfo mem banks exhausted.\r\n"); return EFI_LOAD_ERROR; } - acpi_mem.bank[j].start = desc_ptr->PhysicalStart; - acpi_mem.bank[j].size = desc_ptr->NumberOfPages * EFI_PAGE_SIZE; - ++j; } #endif desc_ptr = NextMemoryDescriptor(desc_ptr, desc_size); } - bootinfo.mem.nr_banks = i; -#ifdef CONFIG_ACPI - acpi_mem.nr_banks = j; -#endif return EFI_SUCCESS; } From patchwork Fri Feb 3 19:18:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 93312 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp738164qgi; Fri, 3 Feb 2017 11:21:09 -0800 (PST) X-Received: by 10.36.178.21 with SMTP id u21mr2262216ite.103.1486149669801; Fri, 03 Feb 2017 11:21:09 -0800 (PST) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id h130si4129336ioa.188.2017.02.03.11.21.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Feb 2017 11:21:09 -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 1cZjOG-0004Pr-CV; Fri, 03 Feb 2017 19:19:24 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cZjOE-0004Ll-EW for xen-devel@lists.xen.org; Fri, 03 Feb 2017 19:19:22 +0000 Received: from [85.158.139.211] by server-9.bemta-5.messagelabs.com id 8A/72-01948-9B7D4985; Fri, 03 Feb 2017 19:19:21 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKLMWRWlGSWpSXmKPExsVysyfVTXfH9Sk RBs9/cFss+biYxYHR4+ju30wBjFGsmXlJ+RUJrBk7zv1mLPgkXnFtRUoD4wPBLkYuDiGBTYwS reebWSCc04wSL0/vYupi5ORgE9CUuPP5E5gtIiAtce3zZUYQm1kgSuLOxZ0sILawQILEidmfg eIcHCwCqhKLJgaBhHkFXCUu7n/EDGJLCMhJnDw2mRXE5gSKfz+3DmykkICLxOL2DpYJjNwLGB lWMWoUpxaVpRbpGlrqJRVlpmeU5CZm5ugaGpjq5aYWFyemp+YkJhXrJefnbmIEereegYFxB+O jfr9DjJIcTEqivEXXpkQI8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuBdAJITLEpNT61Iy8wBhhlM WoKDR0mEVw8kzVtckJhbnJkOkTrFqCglzmsMkhAASWSU5sG1wUL7EqOslDAvIwMDgxBPQWpRb mYJqvwrRnEORiVh3lqQKTyZeSVw018BLWYCWvzz8SSQxSWJCCmpBsYAGbZJ4X4XRJY458+73m MmUvnmVZ1HDJOQU+CllGgl4yfO89fsSGWY+fz2lV06dQ/XMHNpLs/Ijvn689bq3AcffI5cb51 zUT/CdH/jn6mLr8rfvnW1Iz9cdvH9I073jzNf35TeYveZvd2nLFFFSsiJxd9KIUY76Pb2DW1v NmuVyB6d6JP144sSS3FGoqEWc1FxIgAGZZyLaAIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-12.tower-206.messagelabs.com!1486149559!46910621!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 5698 invoked from network); 3 Feb 2017 19:19:20 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-12.tower-206.messagelabs.com with SMTP; 3 Feb 2017 19:19:20 -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 68DE1AD7; Fri, 3 Feb 2017 11:19:19 -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 623ED3F242; Fri, 3 Feb 2017 11:19:18 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Fri, 3 Feb 2017 19:18:54 +0000 Message-Id: <1486149538-20432-11-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 6/8] xen/arm: efi: Avoid duplicating the addition of a new efi memory descriptor 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" The code to add a new memory descriptor is duplicated three times. Add a new helper that adds the descriptor. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- xen/arch/arm/efi/efi-dom0.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/xen/arch/arm/efi/efi-dom0.c b/xen/arch/arm/efi/efi-dom0.c index c40a7c5..f307f26 100644 --- a/xen/arch/arm/efi/efi-dom0.c +++ b/xen/arch/arm/efi/efi-dom0.c @@ -96,6 +96,18 @@ void __init acpi_create_efi_system_table(struct domain *d, tbl_add[TBL_EFIT].size = table_size; } +static void __init fill_efi_memory_descriptor(EFI_MEMORY_DESCRIPTOR *desc, + UINT32 type, + EFI_PHYSICAL_ADDRESS start, + UINT64 size) +{ + desc->Type = type; + desc->PhysicalStart = start; + BUG_ON(size & EFI_PAGE_MASK); + desc->NumberOfPages = EFI_SIZE_TO_PAGES(size); + desc->Attribute = EFI_MEMORY_WB; +} + void __init acpi_create_efi_mmap_table(struct domain *d, const struct meminfo *mem, struct membank tbl_add[]) @@ -110,28 +122,16 @@ void __init acpi_create_efi_mmap_table(struct domain *d, offset = 0; for( i = 0; i < mem->nr_banks; i++, offset++ ) - { - memory_map[offset].Type = EfiConventionalMemory; - memory_map[offset].PhysicalStart = mem->bank[i].start; - BUG_ON(mem->bank[i].size & EFI_PAGE_MASK); - memory_map[offset].NumberOfPages = EFI_SIZE_TO_PAGES(mem->bank[i].size); - memory_map[offset].Attribute = EFI_MEMORY_WB; - } + fill_efi_memory_descriptor(&memory_map[offset], EfiConventionalMemory, + mem->bank[i].start, mem->bank[i].size); for( i = 0; i < acpi_mem.nr_banks; i++, offset++ ) - { - memory_map[offset].Type = EfiACPIReclaimMemory; - memory_map[offset].PhysicalStart = acpi_mem.bank[i].start; - BUG_ON(acpi_mem.bank[i].size & EFI_PAGE_MASK); - memory_map[offset].NumberOfPages = EFI_SIZE_TO_PAGES(acpi_mem.bank[i].size); - memory_map[offset].Attribute = EFI_MEMORY_WB; - } - - memory_map[offset].Type = EfiACPIReclaimMemory; - memory_map[offset].PhysicalStart = d->arch.efi_acpi_gpa; - BUG_ON(d->arch.efi_acpi_len & EFI_PAGE_MASK); - memory_map[offset].NumberOfPages = EFI_SIZE_TO_PAGES(d->arch.efi_acpi_len); - memory_map[offset].Attribute = EFI_MEMORY_WB; + fill_efi_memory_descriptor(&memory_map[offset], EfiACPIReclaimMemory, + acpi_mem.bank[i].start, + acpi_mem.bank[i].size); + + fill_efi_memory_descriptor(&memory_map[offset], EfiACPIReclaimMemory, + d->arch.efi_acpi_gpa, d->arch.efi_acpi_len); tbl_add[TBL_MMAP].start = d->arch.efi_acpi_gpa + acpi_get_table_offset(tbl_add, TBL_MMAP); From patchwork Fri Feb 3 19:18:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 93299 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp738055qgi; Fri, 3 Feb 2017 11:20:54 -0800 (PST) X-Received: by 10.107.132.81 with SMTP id g78mr11813181iod.227.1486149654333; Fri, 03 Feb 2017 11:20:54 -0800 (PST) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id p200si4149768ioe.86.2017.02.03.11.20.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Feb 2017 11:20:54 -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 1cZjOG-0004Qo-Kq; Fri, 03 Feb 2017 19:19:24 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cZjOF-0004O3-OJ for xen-devel@lists.xen.org; Fri, 03 Feb 2017 19:19:23 +0000 Received: from [85.158.137.68] by server-1.bemta-3.messagelabs.com id F7/D1-20518-AB7D4985; Fri, 03 Feb 2017 19:19:22 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTXfX9Sk RBvu/Clss+biYxYHR4+ju30wBjFGsmXlJ+RUJrBmfnn9iKVitWPFs7V3GBsYWqS5GTg4hgU2M EqvOOnYxcgHZpxklFnyYwQSSYBPQlLjz+ROYLSIgLXHt82VGEJtZIErizsWdLCC2sICzxMzj2 9hAbBYBVYlJ+7+B1fAKuEosXjwTzJYQkJM4eWwyK4jNCRT/fm4dE8RiF4nF7R0sExi5FzAyrG LUKE4tKkst0jU010sqykzPKMlNzMzRNTQw1stNLS5OTE/NSUwq1kvOz93ECPQvAxDsYHx52vM QoyQHk5Iob9G1KRFCfEn5KZUZicUZ8UWlOanFhxhlODiUJHgXgOQEi1LTUyvSMnOAgQaTluDg URLhXQmS5i0uSMwtzkyHSJ1iVJQS5z0EkhAASWSU5sG1wYL7EqOslDAvI9AhQjwFqUW5mSWo8 q8YxTkYlYR5a0Gm8GTmlcBNfwW0mAlo8c/Hk0AWlyQipKQaGO/meb/fsvNp+qFaCSfjEpVzPf lmxU1hN/X/818KYVnMUjxLR+GX8+M11k9CfvvOei/4atr1lx8Djpza2yoyf9XGG5kr/br3dWx Zt+pPZLixuiHno6JXS5dL8WzRS65ctWPnX+34h2lP2H47Zjcsik2Xj35Vqx/8aVtmZ2CrvGYJ xzZmrWdvryixFGckGmoxFxUnAgAZzXXNaQIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-6.tower-31.messagelabs.com!1486149561!57556746!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 29915 invoked from network); 3 Feb 2017 19:19:22 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-6.tower-31.messagelabs.com with SMTP; 3 Feb 2017 19:19:22 -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 5BD19AD7; Fri, 3 Feb 2017 11:19:21 -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 9CC2D3F242; Fri, 3 Feb 2017 11:19:20 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Fri, 3 Feb 2017 19:18:56 +0000 Message-Id: <1486149538-20432-13-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 7/7] xen/arm: acpi: Move the ACPI banks in bootinfo 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" Currently the acpi banks are stored in a separate variable and have an header just for them. This variable can be moved in the structure bootinfo removing an header and a global variable. Signed-off-by: Julien Grall --- xen/arch/arm/efi/efi-boot.h | 3 +-- xen/arch/arm/efi/efi-dom0.c | 12 +++++------- xen/arch/arm/efi/efi-dom0.h | 8 -------- xen/include/asm-arm/setup.h | 3 +++ 4 files changed, 9 insertions(+), 17 deletions(-) delete mode 100644 xen/arch/arm/efi/efi-dom0.h diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h index 757d9c6..2e3e169 100644 --- a/xen/arch/arm/efi/efi-boot.h +++ b/xen/arch/arm/efi/efi-boot.h @@ -7,7 +7,6 @@ #include #include #include -#include "efi-dom0.h" void noreturn efi_xen_start(void *fdt_ptr, uint32_t fdt_size); void __flush_dcache_area(const void *vaddr, unsigned long size); @@ -164,7 +163,7 @@ static EFI_STATUS __init efi_process_memory_map_bootinfo(EFI_MEMORY_DESCRIPTOR * #ifdef CONFIG_ACPI else if ( desc_ptr->Type == EfiACPIReclaimMemory ) { - if ( !meminfo_add_bank(&acpi_mem, desc_ptr) ) + if ( !meminfo_add_bank(&bootinfo.acpi, desc_ptr) ) { PrintStr(L"Error: All " __stringify(NR_MEM_BANKS) " acpi meminfo mem banks exhausted.\r\n"); diff --git a/xen/arch/arm/efi/efi-dom0.c b/xen/arch/arm/efi/efi-dom0.c index f0ceaa6..1c35654 100644 --- a/xen/arch/arm/efi/efi-dom0.c +++ b/xen/arch/arm/efi/efi-dom0.c @@ -22,7 +22,6 @@ */ #include "efi.h" -#include "efi-dom0.h" #include #include #include @@ -32,7 +31,6 @@ #define XZ_EXTERN STATIC #include "../../../common/xz/crc32.c" -struct meminfo __initdata acpi_mem; /* Constant to indicate "Xen" in unicode u16 format */ static const CHAR16 xen_efi_fw_vendor[] = {0x0058, 0x0065, 0x006E, 0x0000}; @@ -46,7 +44,7 @@ size_t __init estimate_efi_size(int mem_nr_banks) int acpi_mem_nr_banks = 0; if ( !acpi_disabled ) - acpi_mem_nr_banks = acpi_mem.nr_banks; + acpi_mem_nr_banks = bootinfo.acpi.nr_banks; size = ROUNDUP(est_size + ect_size + fw_vendor_size, 8); /* plus 1 for new created tables */ @@ -124,10 +122,10 @@ void __init acpi_create_efi_mmap_table(struct domain *d, fill_efi_memory_descriptor(desc, EfiConventionalMemory, mem->bank[i].start, mem->bank[i].size); - for ( i = 0; i < acpi_mem.nr_banks; i++, desc++ ) + for ( i = 0; i < bootinfo.acpi.nr_banks; i++, desc++ ) fill_efi_memory_descriptor(desc, EfiACPIReclaimMemory, - acpi_mem.bank[i].start, - acpi_mem.bank[i].size); + bootinfo.acpi.bank[i].start, + bootinfo.acpi.bank[i].size); fill_efi_memory_descriptor(desc, EfiACPIReclaimMemory, d->arch.efi_acpi_gpa, d->arch.efi_acpi_len); @@ -135,7 +133,7 @@ void __init acpi_create_efi_mmap_table(struct domain *d, tbl_add[TBL_MMAP].start = d->arch.efi_acpi_gpa + acpi_get_table_offset(tbl_add, TBL_MMAP); tbl_add[TBL_MMAP].size = sizeof(EFI_MEMORY_DESCRIPTOR) - * (mem->nr_banks + acpi_mem.nr_banks + 1); + * (mem->nr_banks + bootinfo.acpi.nr_banks + 1); } /* Create /hypervisor/uefi node for efi properties. */ diff --git a/xen/arch/arm/efi/efi-dom0.h b/xen/arch/arm/efi/efi-dom0.h deleted file mode 100644 index 3cd4caa..0000000 --- a/xen/arch/arm/efi/efi-dom0.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __ARM_EFI_DOM0_H__ -#define __ARM_EFI_DOM0_H__ - -#include - -extern struct meminfo acpi_mem; - -#endif diff --git a/xen/include/asm-arm/setup.h b/xen/include/asm-arm/setup.h index 3da7a49..7c76185 100644 --- a/xen/include/asm-arm/setup.h +++ b/xen/include/asm-arm/setup.h @@ -43,6 +43,9 @@ struct bootmodules { struct bootinfo { struct meminfo mem; struct bootmodules modules; +#ifdef CONFIG_ACPI + struct meminfo acpi; +#endif }; extern struct bootinfo bootinfo; From patchwork Fri Feb 3 19:18:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 93310 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp738157qgi; Fri, 3 Feb 2017 11:21:08 -0800 (PST) X-Received: by 10.107.47.195 with SMTP id v64mr11100212iov.85.1486149668797; Fri, 03 Feb 2017 11:21:08 -0800 (PST) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id 19si4147180ioj.58.2017.02.03.11.21.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Feb 2017 11:21:08 -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 1cZjOI-0004Tu-4f; Fri, 03 Feb 2017 19:19:26 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cZjOH-0004Rs-CI for xen-devel@lists.xen.org; Fri, 03 Feb 2017 19:19:25 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id 45/C6-22326-CB7D4985; Fri, 03 Feb 2017 19:19:24 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTXfP9Sk RBgcbeCyWfFzM4sDocXT3b6YAxijWzLyk/IoE1oxPzz+xFKxWrHi29i5jA2OLVBcjF4eQwCZG iWnTbjBBOKcZJa7ue8TSxcjJwSagKXHn8ycmEFtEQFri2ufLjCA2s0CUxJ2LO8FqhAWcJTrOr GUDsVkEVCWebPkDZHNw8Aq4SlyarA4SlhCQkzh5bDIriM0JFP5+bh3YSCEBF4nF7R0sExi5Fz AyrGLUKE4tKkst0jU21EsqykzPKMlNzMzRNTQw08tNLS5OTE/NSUwq1kvOz93ECPQvAxDsYGx aFHiIUZKDSUmUt+jalAghvqT8lMqMxOKM+KLSnNTiQ4wyHBxKErz6IDnBotT01Iq0zBxgoMGk JTh4lER49UDSvMUFibnFmekQqVOMilLivMYgCQGQREZpHlwbLLgvMcpKCfMyAh0ixFOQWpSbW YIq/4pRnINRSZjXHmQKT2ZeCdz0V0CLmYAW/3w8CWRxSSJCSqqB0d99jd4i0xNr+K8tOLRl7p XT/gVT7863iL2RPTcw9YL4kac5e8569xy5tp9vRpZPSPPyRec19zzN37LTYZLu5xUFFosS/Xh Pf/h/ZOuN7aFnL+kznzwv5tQyVXPu5/zwyPaNJhl8T9o3VHCuEqq8vmlCQtWsuwv+adv475zh NJPr109mQVWZlKtKLMUZiYZazEXFiQAIyvXlaQIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-8.tower-21.messagelabs.com!1486149563!55910134!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 22120 invoked from network); 3 Feb 2017 19:19:23 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-8.tower-21.messagelabs.com with SMTP; 3 Feb 2017 19:19:23 -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 5031AAD7; Fri, 3 Feb 2017 11:19:23 -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 923CE3F242; Fri, 3 Feb 2017 11:19:22 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Fri, 3 Feb 2017 19:18:58 +0000 Message-Id: <1486149538-20432-15-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 8/8] xen/arm: acpi: Move the ACPI banks in bootinfo 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" Currently the acpi banks are stored in a separate variable and have an header just for them. This variable can be moved in the structure bootinfo removing an header and a global variable. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- xen/arch/arm/efi/efi-boot.h | 3 +-- xen/arch/arm/efi/efi-dom0.c | 12 +++++------- xen/arch/arm/efi/efi-dom0.h | 8 -------- xen/include/asm-arm/setup.h | 3 +++ 4 files changed, 9 insertions(+), 17 deletions(-) delete mode 100644 xen/arch/arm/efi/efi-dom0.h diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h index 757d9c6..2e3e169 100644 --- a/xen/arch/arm/efi/efi-boot.h +++ b/xen/arch/arm/efi/efi-boot.h @@ -7,7 +7,6 @@ #include #include #include -#include "efi-dom0.h" void noreturn efi_xen_start(void *fdt_ptr, uint32_t fdt_size); void __flush_dcache_area(const void *vaddr, unsigned long size); @@ -164,7 +163,7 @@ static EFI_STATUS __init efi_process_memory_map_bootinfo(EFI_MEMORY_DESCRIPTOR * #ifdef CONFIG_ACPI else if ( desc_ptr->Type == EfiACPIReclaimMemory ) { - if ( !meminfo_add_bank(&acpi_mem, desc_ptr) ) + if ( !meminfo_add_bank(&bootinfo.acpi, desc_ptr) ) { PrintStr(L"Error: All " __stringify(NR_MEM_BANKS) " acpi meminfo mem banks exhausted.\r\n"); diff --git a/xen/arch/arm/efi/efi-dom0.c b/xen/arch/arm/efi/efi-dom0.c index f0ceaa6..1c35654 100644 --- a/xen/arch/arm/efi/efi-dom0.c +++ b/xen/arch/arm/efi/efi-dom0.c @@ -22,7 +22,6 @@ */ #include "efi.h" -#include "efi-dom0.h" #include #include #include @@ -32,7 +31,6 @@ #define XZ_EXTERN STATIC #include "../../../common/xz/crc32.c" -struct meminfo __initdata acpi_mem; /* Constant to indicate "Xen" in unicode u16 format */ static const CHAR16 xen_efi_fw_vendor[] = {0x0058, 0x0065, 0x006E, 0x0000}; @@ -46,7 +44,7 @@ size_t __init estimate_efi_size(int mem_nr_banks) int acpi_mem_nr_banks = 0; if ( !acpi_disabled ) - acpi_mem_nr_banks = acpi_mem.nr_banks; + acpi_mem_nr_banks = bootinfo.acpi.nr_banks; size = ROUNDUP(est_size + ect_size + fw_vendor_size, 8); /* plus 1 for new created tables */ @@ -124,10 +122,10 @@ void __init acpi_create_efi_mmap_table(struct domain *d, fill_efi_memory_descriptor(desc, EfiConventionalMemory, mem->bank[i].start, mem->bank[i].size); - for ( i = 0; i < acpi_mem.nr_banks; i++, desc++ ) + for ( i = 0; i < bootinfo.acpi.nr_banks; i++, desc++ ) fill_efi_memory_descriptor(desc, EfiACPIReclaimMemory, - acpi_mem.bank[i].start, - acpi_mem.bank[i].size); + bootinfo.acpi.bank[i].start, + bootinfo.acpi.bank[i].size); fill_efi_memory_descriptor(desc, EfiACPIReclaimMemory, d->arch.efi_acpi_gpa, d->arch.efi_acpi_len); @@ -135,7 +133,7 @@ void __init acpi_create_efi_mmap_table(struct domain *d, tbl_add[TBL_MMAP].start = d->arch.efi_acpi_gpa + acpi_get_table_offset(tbl_add, TBL_MMAP); tbl_add[TBL_MMAP].size = sizeof(EFI_MEMORY_DESCRIPTOR) - * (mem->nr_banks + acpi_mem.nr_banks + 1); + * (mem->nr_banks + bootinfo.acpi.nr_banks + 1); } /* Create /hypervisor/uefi node for efi properties. */ diff --git a/xen/arch/arm/efi/efi-dom0.h b/xen/arch/arm/efi/efi-dom0.h deleted file mode 100644 index 3cd4caa..0000000 --- a/xen/arch/arm/efi/efi-dom0.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __ARM_EFI_DOM0_H__ -#define __ARM_EFI_DOM0_H__ - -#include - -extern struct meminfo acpi_mem; - -#endif diff --git a/xen/include/asm-arm/setup.h b/xen/include/asm-arm/setup.h index 3da7a49..7c76185 100644 --- a/xen/include/asm-arm/setup.h +++ b/xen/include/asm-arm/setup.h @@ -43,6 +43,9 @@ struct bootmodules { struct bootinfo { struct meminfo mem; struct bootmodules modules; +#ifdef CONFIG_ACPI + struct meminfo acpi; +#endif }; extern struct bootinfo bootinfo;