From patchwork Wed Mar 8 17:54:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 95052 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp22454obz; Wed, 8 Mar 2017 09:56:51 -0800 (PST) X-Received: by 10.107.164.204 with SMTP id d73mr7435848ioj.182.1488995811384; 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 a203si657304itg.7.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 1clfnV-0005wN-J3; Wed, 08 Mar 2017 17:54:49 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1clfnU-0005vz-EO for xen-devel@lists.xen.org; Wed, 08 Mar 2017 17:54:48 +0000 Received: from [85.158.143.35] by server-9.bemta-6.messagelabs.com id 3B/BB-13095-76540C85; Wed, 08 Mar 2017 17:54:47 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTTfN9UC EQXuLkMWSj4tZHBg9ju7+zRTAGMWamZeUX5HAmrG94zFjwTPxig13e1kaGC8KdDFycQgJbGaU uPB6PQuEc5pR4tvte0AOJwebgKbEnc+fmEBsEQFpiWufLzOC2MwCDhJvPkLUCAsESXx494Edx GYRUJU4cKwXLM4rYCmx6/d+sLiEgLzErraLrCA2p4CVxNumr2A1QkA13+d8ZJvAyL2AkWEVo3 pxalFZapGuuV5SUWZ6RkluYmaOrqGBmV5uanFxYnpqTmJSsV5yfu4mRqB/GYBgB+PMy/6HGCU 5mJREea+qHogQ4kvKT6nMSCzOiC8qzUktPsQow8GhJMEb7QKUEyxKTU+tSMvMAQYaTFqCg0dJ hJcTJM1bXJCYW5yZDpE6xagoJc7rC5IQAElklObBtcGC+xKjrJQwLyPQIUI8BalFuZklqPKvG MU5GJWEebtApvBk5pXATX8FtJgJaLG2616QxSWJCCmpBsaEzfLsXz3/PTBbdv2SgtgiC67ZW7 axnN41Rcec28Bk+eZcz5UTS29dta7oOdF48aNsgEJO6C4u1X5tXcnbSw7WVJ+Krjsg27hzm3C 2QRh3s+mNVr9r3J2/jcL/SAXtDgt6vbF3zsTPyruUr21rU1j7Q3x9oqCJ5cIdnJGvZuzVcw07 1sN5Q0mJpTgj0VCLuag4EQDAohwWaQIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-11.tower-21.messagelabs.com!1488995685!61243581!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 47520 invoked from network); 8 Mar 2017 17:54:46 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-11.tower-21.messagelabs.com with SMTP; 8 Mar 2017 17:54:46 -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 8A68F14F6; Wed, 8 Mar 2017 09:54:45 -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 DF5BE3F23B; Wed, 8 Mar 2017 09:54:44 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 8 Mar 2017 17:54:33 +0000 Message-Id: <20170308175436.24001-2-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 1/4] 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 --- Changes in v2: - Add Stefano's reviewed-by - Mark the function as __init --- xen/arch/arm/efi/efi-boot.h | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h index 045d6ce976..4877e6714d 100644 --- a/xen/arch/arm/efi/efi-boot.h +++ b/xen/arch/arm/efi/efi-boot.h @@ -124,15 +124,28 @@ static void __init *lookup_fdt_config_table(EFI_SYSTEM_TABLE *sys_table) return fdt; } +static bool __init 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 +155,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 Wed Mar 8 17:54:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 95050 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp22452obz; Wed, 8 Mar 2017 09:56:51 -0800 (PST) X-Received: by 10.36.1.208 with SMTP id 199mr20712670itk.20.1488995811373; 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 v83si4590164iod.67.2017.03.08.09.56.50 (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 1clfnV-0005wd-QD; Wed, 08 Mar 2017 17:54:49 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1clfnU-0005w0-P5 for xen-devel@lists.xen.org; Wed, 08 Mar 2017 17:54:48 +0000 Received: from [85.158.137.68] by server-16.bemta-3.messagelabs.com id FD/AE-06437-86540C85; Wed, 08 Mar 2017 17:54:48 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKLMWRWlGSWpSXmKPExsVysyfVTTfd9UC EwdaX0hZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa0br3gusBe8kKvpntLE1MB4W6mLk5BAS2Mwo 8WKXRBcjF5B9mlHi/c0frCAJNgFNiTufPzGB2CIC0hLXPl9mBLGZBRwk3ny8xwJiCwskS7Q2v gKLswioSux7/outi5GDg1fAUmL9WweQsISAvMSutotgIzkFrCTeNn1lgdhrKfF9zke2CYzcCx gZVjFqFKcWlaUW6RoZ6iUVZaZnlOQmZuboGhoY6+WmFhcnpqfmJCYV6yXn525iBHq3noGBcQd jz16/Q4ySHExKorxXVQ9ECPEl5adUZiQWZ8QXleakFh9ilOHgUJLgjXYBygkWpaanVqRl5gDD DCYtwcGjJMK7DyTNW1yQmFucmQ6ROsWoKCXO6wuSEABJZJTmwbXBQvsSo6yUMC8jAwODEE9Ba lFuZgmq/CtGcQ5GJWHeq85AU3gy80rgpr8CWswEtFjbdS/I4pJEhJRUA6PPS/1mw0Zb58nLpS Kjcv7Uck5O/7/iUlfM0pai0j+9dfxSRQ5GRQXJPTynHlb8t5J7qW63foelU1GUbcSq4uV70ln SzkcdjZd4I/bkZtXTWw4b/63ffKogzFC4JqXz9pamLN8PG3sK8zU3XOXZGrj5bNoHnz6xppdJ akLJ6f7sF8+ffvd3kRJLcUaioRZzUXEiAA3dRJRoAgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-11.tower-31.messagelabs.com!1488995686!58387098!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 3797 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-11.tower-31.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 798AA1500; Wed, 8 Mar 2017 09:54:46 -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 CBDF63F23B; Wed, 8 Mar 2017 09:54:45 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 8 Mar 2017 17:54:34 +0000 Message-Id: <20170308175436.24001-3-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 2/4] 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 --- Changes in v2: - Add Stefano's reviewed-by --- 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 c40a7c50f3..f307f26bf6 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 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 From patchwork Wed Mar 8 17:54:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 95049 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp22443obz; Wed, 8 Mar 2017 09:56:50 -0800 (PST) X-Received: by 10.36.54.149 with SMTP id l143mr7291353itl.38.1488995810237; Wed, 08 Mar 2017 09:56:50 -0800 (PST) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id 70si4564915ioo.245.2017.03.08.09.56.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Mar 2017 09:56:50 -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 1clfnZ-0005xW-8Q; Wed, 08 Mar 2017 17:54:53 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1clfnX-0005wo-CN for xen-devel@lists.xen.org; Wed, 08 Mar 2017 17:54:51 +0000 Received: from [85.158.143.35] by server-6.bemta-6.messagelabs.com id 3C/63-15112-A6540C85; Wed, 08 Mar 2017 17:54:50 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTTfT9UC EwYJPPBZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8bkjU9YCnYqVazecpClgfGnVBcjF4eQwGZG iXe/t7NDOKcZJX48fMTWxcjJwSagKXHn8ycmEFtEQFri2ufLjCA2s4CDxJuP91hAbGEBN4lJa 16wg9gsAqoSVz58Barn4OAVsJS4ciQPJCwhIC+xq+0iK4jNKWAl8bbpK1irEFDJ9zkf2SYwci 9gZFjFqFGcWlSWWqRrZKaXVJSZnlGSm5iZo2toYKaXm1pcnJiempOYVKyXnJ+7iRHoXwYg2MF 4ZkHgIUZJDiYlUd6rqgcihPiS8lMqMxKLM+KLSnNSiw8xynBwKEnwRrsA5QSLUtNTK9Iyc4CB BpOW4OBREuHlBEnzFhck5hZnpkOkTjEqSonz+oIkBEASGaV5cG2w4L7EKCslzMsIdIgQT0FqU W5mCar8K0ZxDkYlYd4ukCk8mXklcNNfAS1mAlqs7boXZHFJIkJKqoEx9qzRdeV5j9NzFTqnXy i4baMsemWjROo2Vp3dKxbZlS3NN3k0/UVY8LaOzfXfH/7sKxZX67yS9u7Ty5Sle9f8MPKd2P9 k1sTF719WG39Jb5n9JdMk98juBkGdfw+mKGhfzbjpy2Bu8eZWoGD1hMLEBI03CfOPrHE5ft/A PU89stXR5aBzw3JXJZbijERDLeai4kQAdYrhI2kCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-3.tower-21.messagelabs.com!1488995688!57836726!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 50877 invoked from network); 8 Mar 2017 17:54:48 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-3.tower-21.messagelabs.com with SMTP; 8 Mar 2017 17:54:48 -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 539D514F6; Wed, 8 Mar 2017 09:54:48 -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 A86233F23B; Wed, 8 Mar 2017 09:54:47 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 8 Mar 2017 17:54:36 +0000 Message-Id: <20170308175436.24001-5-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 4/4] 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 --- Changes in v2: - Add Stefano's reviewed-by --- 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 4877e6714d..e1e447ac8e 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); @@ -165,7 +164,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 f0ceaa6cae..1c356540f7 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 3cd4caad2a..0000000000 --- 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 3da7a4904a..7c761851d2 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;