From patchwork Fri Feb 3 19:18:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 93311 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp738159qgi; Fri, 3 Feb 2017 11:21:08 -0800 (PST) X-Received: by 10.107.163.194 with SMTP id m185mr11066400ioe.222.1486149668912; 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 l2si1936363itl.60.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 1cZjOG-0004Re-T9; Fri, 03 Feb 2017 19:19:24 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cZjOG-0004PD-Bv for xen-devel@lists.xen.org; Fri, 03 Feb 2017 19:19:24 +0000 Received: from [193.109.254.147] by server-1.bemta-6.messagelabs.com id 72/94-27678-BB7D4985; Fri, 03 Feb 2017 19:19:23 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTXf39Sk RBg3XmS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oxFtx6wFVznr1i37QNrA+Mt7i5GLg4hgc2M Eqvv3mGDcE4zSjx8eJu1i5GTg01AU+LO509MILaIgLTEtc+XGUFsZoEoiTsXd7KA2MICCRIfJ 94Gq2ERUJV4vOcyWC+vgKvE5tarYLaEgJzEyWOTwWxOoPj3c+vA6oUEXCQWt3ewTGDkXsDIsI pRvTi1qCy1SNdCL6koMz2jJDcxM0fX0MBMLze1uDgxPTUnMalYLzk/dxMj0L8MQLCDcfZl/0O MkhxMSqK8RdemRAjxJeWnVGYkFmfEF5XmpBYfYpTh4FCS4NUHyQkWpaanVqRl5gADDSYtwcGj JMK7EiTNW1yQmFucmQ6ROsWoKCXOawySEABJZJTmwbXBgvsSo6yUMC8j0CFCPAWpRbmZJajyr xjFORiVhHlrQabwZOaVwE1/BbSYCWjxz8eTQBaXJCKkpBoYHX4s37wusXlLzcWojRV8csIxi2 ySeta35i5McWhiT308WYTFmu/AI1G28zr89xaITs6SXvdzRfQ7G9GsUx3zxayZ72i+WMXLPPO zwh2xA7WvdeoWrZN4s6+iwNO4M/PEHT/7r7bTaxTO7Hl1Me+njUjqu027c4IuPz7S9Cl2hYCH 6eYvf1ZuUWIpzkg01GIuKk4EACt8iO1pAgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-2.tower-27.messagelabs.com!1486149562!32845631!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 46920 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-2.tower-27.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 577CC154D; Fri, 3 Feb 2017 11:19:22 -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 993D43F242; Fri, 3 Feb 2017 11:19:21 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Fri, 3 Feb 2017 19:18:57 +0000 Message-Id: <1486149538-20432-14-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/8] 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 Reviewed-by: Stefano Stabellini --- 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