From patchwork Fri Feb 3 19:18:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 93313 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp738172qgi; Fri, 3 Feb 2017 11:21:10 -0800 (PST) X-Received: by 10.36.94.21 with SMTP id h21mr2384707itb.78.1486149670837; Fri, 03 Feb 2017 11:21:10 -0800 (PST) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id i184si1982597itf.8.2017.02.03.11.21.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Feb 2017 11:21:10 -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 1cZjOF-0004NZ-3F; Fri, 03 Feb 2017 19:19:23 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cZjOE-0004LP-98 for xen-devel@lists.xen.org; Fri, 03 Feb 2017 19:19:22 +0000 Received: from [193.109.254.147] by server-8.bemta-6.messagelabs.com id 77/4F-21675-9B7D4985; Fri, 03 Feb 2017 19:19:21 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTXfn9Sk RBpd/sFos+biYxYHR4+ju30wBjFGsmXlJ+RUJrBmLbj1gK7jOX7Fu2wfWBsZb3F2MXBxCApsZ JeY9XswI4ZxmlLjduJO1i5GTg01AU+LO509MILaIgLTEtc+XGUFsZoEoiTsXd7KA2MICCRJtW 3aA2SwCqhLrHz5kB7F5BVwlHk7byQxiSwjISZw8NhlsJidQ/Pu5dWAzhQRcJBa3d7BMYORewM iwilG9OLWoLLVI11gvqSgzPaMkNzEzR9fQwEwvN7W4ODE9NScxqVgvOT93EyPQvwxAsIOx45/ TIUZJDiYlUd6ia1MihPiS8lMqMxKLM+KLSnNSiw8xynBwKEnwLgDJCRalpqdWpGXmAAMNJi3B waMkwrsSJM1bXJCYW5yZDpE6xagoJc57CCQhAJLIKM2Da4MF9yVGWSlhXkagQ4R4ClKLcjNLU OVfMYpzMCoJ8zIAY0WIJzOvBG76K6DFTECLfz6eBLK4JBEhJdXAqP9g/yJVRkHDYsfC5r/Lmf /9NJGukHLO9Jyw0YYjKnPTctktCssLmO1O+oZuftT7zO+OgdKXwOP2q06VbFNa9+w997Wg80s bOrc/MLihnmewmT3kQ/iiv4ksuntvRhsvTbLLjRGb9oNti+Lph5xvJsnwsWzf7r2cb31eIHt8 8J9O6SSXI7rnlViKMxINtZiLihMBnFb9tWkCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-3.tower-27.messagelabs.com!1486149560!85008090!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 47719 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-3.tower-27.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 62020152B; Fri, 3 Feb 2017 11:19:20 -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 A3FE53F242; Fri, 3 Feb 2017 11:19:19 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Fri, 3 Feb 2017 19:18:55 +0000 Message-Id: <1486149538-20432-12-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/7] xen/arm: efi: Rework acpi_create_efi_mmap_table to avoid memory_map[offset] 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 contains a lot of memory_map[offset]. This could be simplified by incrementing the descriptor pointer every time. Signed-off-by: Julien Grall --- xen/arch/arm/efi/efi-dom0.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/xen/arch/arm/efi/efi-dom0.c b/xen/arch/arm/efi/efi-dom0.c index f307f26..f0ceaa6 100644 --- a/xen/arch/arm/efi/efi-dom0.c +++ b/xen/arch/arm/efi/efi-dom0.c @@ -112,25 +112,24 @@ void __init acpi_create_efi_mmap_table(struct domain *d, const struct meminfo *mem, struct membank tbl_add[]) { - EFI_MEMORY_DESCRIPTOR *memory_map; - unsigned int i, offset; + EFI_MEMORY_DESCRIPTOR *desc; + unsigned int i; u8 *base_ptr; base_ptr = d->arch.efi_acpi_table + acpi_get_table_offset(tbl_add, TBL_MMAP); - memory_map = (EFI_MEMORY_DESCRIPTOR *)base_ptr; + desc = (EFI_MEMORY_DESCRIPTOR *)base_ptr; - offset = 0; - for( i = 0; i < mem->nr_banks; i++, offset++ ) - fill_efi_memory_descriptor(&memory_map[offset], EfiConventionalMemory, + for ( i = 0; i < mem->nr_banks; i++, desc++ ) + fill_efi_memory_descriptor(desc, EfiConventionalMemory, mem->bank[i].start, mem->bank[i].size); - for( i = 0; i < acpi_mem.nr_banks; i++, offset++ ) - fill_efi_memory_descriptor(&memory_map[offset], EfiACPIReclaimMemory, + for ( i = 0; i < acpi_mem.nr_banks; i++, desc++ ) + fill_efi_memory_descriptor(desc, EfiACPIReclaimMemory, acpi_mem.bank[i].start, acpi_mem.bank[i].size); - fill_efi_memory_descriptor(&memory_map[offset], EfiACPIReclaimMemory, + fill_efi_memory_descriptor(desc, EfiACPIReclaimMemory, d->arch.efi_acpi_gpa, d->arch.efi_acpi_len); tbl_add[TBL_MMAP].start = d->arch.efi_acpi_gpa