diff mbox

[1/3] arm64/efi: set EFI_MEMMAP bit only after mapping the memory map

Message ID 1446126059-25336-2-git-send-email-ard.biesheuvel@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Ard Biesheuvel Oct. 29, 2015, 1:40 p.m. UTC
In an upcoming patch, we will wire up page_is_ram() to the UEFI memory
map, so make sure the EFI_MEMMAP bit accurately reflects whether the
UEFI memory map is available via its permanent mapping.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 arch/arm64/kernel/efi.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

Comments

Matt Fleming Nov. 12, 2015, 3:14 p.m. UTC | #1
On Thu, 29 Oct, at 02:40:57PM, Ard Biesheuvel wrote:
> In an upcoming patch, we will wire up page_is_ram() to the UEFI memory
> map, so make sure the EFI_MEMMAP bit accurately reflects whether the
> UEFI memory map is available via its permanent mapping.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  arch/arm64/kernel/efi.c | 17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
> index 852eb927ea85..11b59e9a5954 100644
> --- a/arch/arm64/kernel/efi.c
> +++ b/arch/arm64/kernel/efi.c
> @@ -191,8 +191,6 @@ static __init void reserve_regions(void)
>  		if (efi_enabled(EFI_DBG))
>  			pr_cont("\n");
>  	}
> -
> -	set_bit(EFI_MEMMAP, &efi.flags);
>  }
>  
>  void __init efi_init(void)
> @@ -291,13 +289,6 @@ static int __init arm64_enable_runtime_services(void)
>  		return -1;
>  	}
>  
> -	if (efi_runtime_disabled()) {
> -		pr_info("EFI runtime services will be disabled.\n");
> -		return -1;
> -	}
> -
> -	pr_info("Remapping and enabling EFI services.\n");
> -
>  	mapsize = memmap.map_end - memmap.map;
>  	memmap.map = (__force void *)ioremap_cache((phys_addr_t)memmap.phys_map,
>  						   mapsize);
> @@ -307,6 +298,14 @@ static int __init arm64_enable_runtime_services(void)
>  	}
>  	memmap.map_end = memmap.map + mapsize;
>  	efi.memmap = &memmap;
> +	set_bit(EFI_MEMMAP, &efi.flags);
> +
> +	if (efi_runtime_disabled()) {
> +		pr_info("EFI runtime services will be disabled.\n");
> +		return -1;
> +	}
> +
> +	pr_info("Remapping and enabling EFI services.\n");
>  
>  	efi.systab = (__force void *)ioremap_cache(efi_system_table,
>  						   sizeof(efi_system_table_t));

Looks pretty straight forward to me (and a good change).

Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
diff mbox

Patch

diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index 852eb927ea85..11b59e9a5954 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -191,8 +191,6 @@  static __init void reserve_regions(void)
 		if (efi_enabled(EFI_DBG))
 			pr_cont("\n");
 	}
-
-	set_bit(EFI_MEMMAP, &efi.flags);
 }
 
 void __init efi_init(void)
@@ -291,13 +289,6 @@  static int __init arm64_enable_runtime_services(void)
 		return -1;
 	}
 
-	if (efi_runtime_disabled()) {
-		pr_info("EFI runtime services will be disabled.\n");
-		return -1;
-	}
-
-	pr_info("Remapping and enabling EFI services.\n");
-
 	mapsize = memmap.map_end - memmap.map;
 	memmap.map = (__force void *)ioremap_cache((phys_addr_t)memmap.phys_map,
 						   mapsize);
@@ -307,6 +298,14 @@  static int __init arm64_enable_runtime_services(void)
 	}
 	memmap.map_end = memmap.map + mapsize;
 	efi.memmap = &memmap;
+	set_bit(EFI_MEMMAP, &efi.flags);
+
+	if (efi_runtime_disabled()) {
+		pr_info("EFI runtime services will be disabled.\n");
+		return -1;
+	}
+
+	pr_info("Remapping and enabling EFI services.\n");
 
 	efi.systab = (__force void *)ioremap_cache(efi_system_table,
 						   sizeof(efi_system_table_t));