From patchwork Wed Mar 8 17:54:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 95051 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp22453obz; Wed, 8 Mar 2017 09:56:51 -0800 (PST) X-Received: by 10.36.169.12 with SMTP id r12mr7781820ite.69.1488995811397; Wed, 08 Mar 2017 09:56:51 -0800 (PST) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id r69si639963ita.60.2017.03.08.09.56.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Mar 2017 09:56:51 -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 1clfnX-0005wv-19; Wed, 08 Mar 2017 17:54:51 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1clfnV-0005wM-Ky for xen-devel@lists.xen.org; Wed, 08 Mar 2017 17:54:49 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id 22/F4-19731-86540C85; Wed, 08 Mar 2017 17:54:48 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKLMWRWlGSWpSXmKPExsVysyfVTTfD9UC EweWrbBZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8bTD/2MBZcFKt5cu8bYwLiXp4uRi0NIYDOj xLVlR9i7GDmBnNOMEhPmaILYbAKaEnc+f2ICsUUEpCWufb7MCGIzCzhIvPl4jwXEFhZIlmhc/ ZIZxGYRUJV4vmcnWA2vgKXE9ZNTwGwJAXmJXW0XWUFsTgEribdNX1kgdllKfJ/zkW0CI/cCRo ZVjOrFqUVlqUW6FnpJRZnpGSW5iZk5uoYGZnq5qcXFiempOYlJxXrJ+bmbGIHeZQCCHYyzL/s fYpTkYFIS5b2qeiBCiC8pP6UyI7E4I76oNCe1+BCjDAeHkgRvtAtQTrAoNT21Ii0zBxhmMGkJ Dh4lEd59IGne4oLE3OLMdIjUKUZFKXFeX5CEAEgiozQPrg0W2pcYZaWEeRmBDhHiKUgtys0sQ ZV/xSjOwagkzNsFMoUnM68EbvoroMVMQIu1XfeCLC5JREhJNTDuvP3twLtFYjMWbNAujS//Ef GPY+oWVtmmJRtmPmxetqf374V91/J0V2cX3Veav+uOhdHBN7e2qSdwLqwyuVmUppbaprU9yDC 3/l/eklW3RLnljwcFFTR47FrhkM68YJv58p6Uvg2imw32zVKS3bcjyelGg8Wtjyt7lbdU3VzE oLzjzv23/hvclFiKMxINtZiLihMB381F3WgCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-7.tower-21.messagelabs.com!1488995687!61367555!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.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 64299 invoked from network); 8 Mar 2017 17:54:47 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-7.tower-21.messagelabs.com with SMTP; 8 Mar 2017 17:54:47 -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 6591B1515; Wed, 8 Mar 2017 09:54:47 -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 BB8633F23B; Wed, 8 Mar 2017 09:54:46 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 8 Mar 2017 17:54:35 +0000 Message-Id: <20170308175436.24001-4-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170308175436.24001-1-julien.grall@arm.com> References: <20170308175436.24001-1-julien.grall@arm.com> Cc: Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 3/4] 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 --- Changes in v2: - Add Stefano's reviewed-by --- 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 f307f26bf6..f0ceaa6cae 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