All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] stm32mp: correctly handle board_get_usable_ram_top(0)
@ 2021-07-26  9:55 Patrick Delaunay
  2021-08-16  7:26 ` Patrice CHOTARD
  0 siblings, 1 reply; 3+ messages in thread
From: Patrick Delaunay @ 2021-07-26  9:55 UTC (permalink / raw)
  To: u-boot
  Cc: Heinrich Schuchardt, Alexander Graf, Patrick Delaunay,
	Patrice Chotard, U-Boot STM32

The function board_get_usable_ram_top can to called after relocation
with total_size = 0 to get the uppermost pointer that is valid to access
in U-Boot.

When total_size = 0, the reserved memory should be not take in account
with lmb library and 'gd->ram_base + gd->ram_size' can be used.

It is the case today in lib/efi_loader/efi_memory.c:efi_add_known_memory()
and this patch avoids that the reserved memory for OP-TEE is not part of
the EFI available memory regions.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---
Patch to correct the UEFI support for STM32MP platform
after Heinrich's remark on patch [1].

[1] efi_loader: replace board_get_usable_ram_top by gd->ram_top
http://patchwork.ozlabs.org/project/uboot/patch/20210709124630.1.I212e7cd96724368b8272300c59c2a1c1f227ed67@changeid/

 arch/arm/mach-stm32mp/dram_init.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/mach-stm32mp/dram_init.c b/arch/arm/mach-stm32mp/dram_init.c
index 3c097029bd..94f25f34e0 100644
--- a/arch/arm/mach-stm32mp/dram_init.c
+++ b/arch/arm/mach-stm32mp/dram_init.c
@@ -46,6 +46,9 @@ ulong board_get_usable_ram_top(ulong total_size)
 	phys_addr_t reg;
 	struct lmb lmb;
 
+	if (!total_size)
+		return gd->ram_base + gd->ram_size;
+
 	/* found enough not-reserved memory to relocated U-Boot */
 	lmb_init(&lmb);
 	lmb_add(&lmb, gd->ram_base, gd->ram_size);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] stm32mp: correctly handle board_get_usable_ram_top(0)
  2021-07-26  9:55 [PATCH] stm32mp: correctly handle board_get_usable_ram_top(0) Patrick Delaunay
@ 2021-08-16  7:26 ` Patrice CHOTARD
  2021-08-16 11:29   ` [Uboot-stm32] " Patrice CHOTARD
  0 siblings, 1 reply; 3+ messages in thread
From: Patrice CHOTARD @ 2021-08-16  7:26 UTC (permalink / raw)
  To: Patrick Delaunay, u-boot
  Cc: Heinrich Schuchardt, Alexander Graf, U-Boot STM32

Hi Patrick

On 7/26/21 11:55 AM, Patrick Delaunay wrote:
> The function board_get_usable_ram_top can to called after relocation
> with total_size = 0 to get the uppermost pointer that is valid to access
> in U-Boot.
> 
> When total_size = 0, the reserved memory should be not take in account
> with lmb library and 'gd->ram_base + gd->ram_size' can be used.
> 
> It is the case today in lib/efi_loader/efi_memory.c:efi_add_known_memory()
> and this patch avoids that the reserved memory for OP-TEE is not part of
> the EFI available memory regions.
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
> Patch to correct the UEFI support for STM32MP platform
> after Heinrich's remark on patch [1].
> 
> [1] efi_loader: replace board_get_usable_ram_top by gd->ram_top
> http://patchwork.ozlabs.org/project/uboot/patch/20210709124630.1.I212e7cd96724368b8272300c59c2a1c1f227ed67@changeid/
> 
>  arch/arm/mach-stm32mp/dram_init.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/arch/arm/mach-stm32mp/dram_init.c b/arch/arm/mach-stm32mp/dram_init.c
> index 3c097029bd..94f25f34e0 100644
> --- a/arch/arm/mach-stm32mp/dram_init.c
> +++ b/arch/arm/mach-stm32mp/dram_init.c
> @@ -46,6 +46,9 @@ ulong board_get_usable_ram_top(ulong total_size)
>  	phys_addr_t reg;
>  	struct lmb lmb;
>  
> +	if (!total_size)
> +		return gd->ram_base + gd->ram_size;
> +
>  	/* found enough not-reserved memory to relocated U-Boot */
>  	lmb_init(&lmb);
>  	lmb_add(&lmb, gd->ram_base, gd->ram_size);
> 

Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Uboot-stm32] [PATCH] stm32mp: correctly handle board_get_usable_ram_top(0)
  2021-08-16  7:26 ` Patrice CHOTARD
@ 2021-08-16 11:29   ` Patrice CHOTARD
  0 siblings, 0 replies; 3+ messages in thread
From: Patrice CHOTARD @ 2021-08-16 11:29 UTC (permalink / raw)
  To: Patrick Delaunay, u-boot
  Cc: U-Boot STM32, Heinrich Schuchardt, Alexander Graf

Hi Patrick

On 8/16/21 9:26 AM, Patrice CHOTARD wrote:
> Hi Patrick
> 
> On 7/26/21 11:55 AM, Patrick Delaunay wrote:
>> The function board_get_usable_ram_top can to called after relocation
>> with total_size = 0 to get the uppermost pointer that is valid to access
>> in U-Boot.
>>
>> When total_size = 0, the reserved memory should be not take in account
>> with lmb library and 'gd->ram_base + gd->ram_size' can be used.
>>
>> It is the case today in lib/efi_loader/efi_memory.c:efi_add_known_memory()
>> and this patch avoids that the reserved memory for OP-TEE is not part of
>> the EFI available memory regions.
>>
>> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
>> ---
>> Patch to correct the UEFI support for STM32MP platform
>> after Heinrich's remark on patch [1].
>>
>> [1] efi_loader: replace board_get_usable_ram_top by gd->ram_top
>> http://patchwork.ozlabs.org/project/uboot/patch/20210709124630.1.I212e7cd96724368b8272300c59c2a1c1f227ed67@changeid/
>>
>>  arch/arm/mach-stm32mp/dram_init.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/arch/arm/mach-stm32mp/dram_init.c b/arch/arm/mach-stm32mp/dram_init.c
>> index 3c097029bd..94f25f34e0 100644
>> --- a/arch/arm/mach-stm32mp/dram_init.c
>> +++ b/arch/arm/mach-stm32mp/dram_init.c
>> @@ -46,6 +46,9 @@ ulong board_get_usable_ram_top(ulong total_size)
>>  	phys_addr_t reg;
>>  	struct lmb lmb;
>>  
>> +	if (!total_size)
>> +		return gd->ram_base + gd->ram_size;
>> +
>>  	/* found enough not-reserved memory to relocated U-Boot */
>>  	lmb_init(&lmb);
>>  	lmb_add(&lmb, gd->ram_base, gd->ram_size);
>>
> 
> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
> 
> Thanks
> Patrice
> _______________________________________________
> Uboot-stm32 mailing list
> Uboot-stm32@st-md-mailman.stormreply.com
> https://st-md-mailman.stormreply.com/mailman/listinfo/uboot-stm32
> 
Applied to u-boot-stm/master

Thanks
Patrice

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-16 11:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-26  9:55 [PATCH] stm32mp: correctly handle board_get_usable_ram_top(0) Patrick Delaunay
2021-08-16  7:26 ` Patrice CHOTARD
2021-08-16 11:29   ` [Uboot-stm32] " Patrice CHOTARD

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.