diff mbox series

[3/4] fsl-layerscape: align first parameter of efi_add_memory_map()

Message ID 20200514123831.30157-4-michael@walle.cc
State New
Headers show
Series bootefi fixes for aarch64/layerscape | expand

Commit Message

Michael Walle May 14, 2020, 12:38 p.m. UTC
The start parameter must be aligned to EFI_PAGE_SIZE.

Fixes: 5a37a2f0140c ("armv8: ls2080a: Declare spin tables as reserved for efi loader")
Signed-off-by: Michael Walle <michael at walle.cc>
---
 arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Heinrich Schuchardt May 14, 2020, 6:39 p.m. UTC | #1
On 5/14/20 2:38 PM, Michael Walle wrote:
> The start parameter must be aligned to EFI_PAGE_SIZE.
>
> Fixes: 5a37a2f0140c ("armv8: ls2080a: Declare spin tables as reserved for efi loader")
> Signed-off-by: Michael Walle <michael at walle.cc>
> ---
>  arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
> index 3bbad827cb..fc65ad6c1e 100644
> --- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
> +++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
> @@ -146,7 +146,7 @@ remove_psci_node:
>  	fdt_add_mem_rsv(blob, (uintptr_t)&secondary_boot_code,
>  			*boot_code_size);
>  #if CONFIG_IS_ENABLED(EFI_LOADER)
> -	efi_add_memory_map((uintptr_t)&secondary_boot_code,
> +	efi_add_memory_map(ALIGN_DOWN((uintptr_t)&secondary_boot_code, EFI_PAGE_SIZE),
>  			   ALIGN(*boot_code_size, EFI_PAGE_SIZE) >> EFI_PAGE_SHIFT,

If secondary_boot_code is not EFI_PAGE_SIZE aligned, your code gets the
number of pages wrong.

Your code exceeds 80 characters per line.

Best regards

Heinrich

>  			   EFI_RESERVED_MEMORY_TYPE, false);
>  #endif
>
diff mbox series

Patch

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
index 3bbad827cb..fc65ad6c1e 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
@@ -146,7 +146,7 @@  remove_psci_node:
 	fdt_add_mem_rsv(blob, (uintptr_t)&secondary_boot_code,
 			*boot_code_size);
 #if CONFIG_IS_ENABLED(EFI_LOADER)
-	efi_add_memory_map((uintptr_t)&secondary_boot_code,
+	efi_add_memory_map(ALIGN_DOWN((uintptr_t)&secondary_boot_code, EFI_PAGE_SIZE),
 			   ALIGN(*boot_code_size, EFI_PAGE_SIZE) >> EFI_PAGE_SHIFT,
 			   EFI_RESERVED_MEMORY_TYPE, false);
 #endif