OpenSBI Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] docs: Correct FW_JUMP_FDT_ADDR calculation example
@ 2023-03-22 17:04 Gabriel Somlo
  2023-03-23 17:18 ` Andrew Jones
  0 siblings, 1 reply; 3+ messages in thread
From: Gabriel Somlo @ 2023-03-22 17:04 UTC (permalink / raw)
  To: opensbi

When using `PLATFORM=generic` defaults, the kernel is loaded at
`FW_JUMP_ADDR = FW_TEXT_START + 0x200000`, and the FDT is loaded at
`FW_JUMP_FDT_ADDR = FW_TEXT_START + 0x2200000`.

Therefore, the maximum kernel size before `FW_JUMP_FDT_ADDR` must
be increased is the difference, or `0x2000000`.

Update the example calculation to reflect this, and avoid confusion.

Signed-off-by: Gabriel Somlo <gsomlo@gmail.com>
---
 docs/firmware/fw_jump.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/firmware/fw_jump.md b/docs/firmware/fw_jump.md
index 956897e..d1b07b9 100644
--- a/docs/firmware/fw_jump.md
+++ b/docs/firmware/fw_jump.md
@@ -48,12 +48,12 @@ follows:
   ```
   ${CROSS_COMPILE}objdump -h $KERNEL_ELF | sort -k 5,5 | awk -n '/^ +[0-9]+ /\
   {addr="0x"$3; size="0x"$5; printf "0x""%x\n",addr+size}' \
-  | (( `tail -1` > 0x2200000 )) && echo fdt overlaps kernel,\
+  | (( `tail -1` > 0x2000000 )) && echo fdt overlaps kernel,\
   increase FW_JUMP_FDT_ADDR
 
   ${LLVM}objdump -h --show-lma $KERNEL_ELF | sort -k 5,5 | \
   awk -n '/^ +[0-9]+ / {addr="0x"$3; size="0x"$5; printf "0x""%x\n",addr+size}'\
-  | (( `tail -1` > 0x2200000 )) && echo fdt overlaps kernel,\
+  | (( `tail -1` > 0x2000000 )) && echo fdt overlaps kernel,\
   increase FW_JUMP_FDT_ADDR
   ```
 
-- 
2.39.2



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

* [PATCH v1] docs: Correct FW_JUMP_FDT_ADDR calculation example
  2023-03-22 17:04 [PATCH v1] docs: Correct FW_JUMP_FDT_ADDR calculation example Gabriel Somlo
@ 2023-03-23 17:18 ` Andrew Jones
  2023-03-24  0:39   ` Gabriel Somlo
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Jones @ 2023-03-23 17:18 UTC (permalink / raw)
  To: opensbi

On Wed, Mar 22, 2023 at 01:04:48PM -0400, Gabriel Somlo wrote:
> When using `PLATFORM=generic` defaults, the kernel is loaded at
> `FW_JUMP_ADDR = FW_TEXT_START + 0x200000`, and the FDT is loaded at
> `FW_JUMP_FDT_ADDR = FW_TEXT_START + 0x2200000`.
> 
> Therefore, the maximum kernel size before `FW_JUMP_FDT_ADDR` must
> be increased is the difference, or `0x2000000`.

Sounds good, but this is only correct for RV64. For RV32 it should be
0x1e00000. I wonder if we should do something like

   ```
   ${CROSS_COMPILE}objdump -h $KERNEL_ELF | sort -k 5,5 | awk -n '/^ +[0-9]+ /\
   {addr="0x"$3; size="0x"$5; printf "0x""%x\n",addr+size}' \
-  | (( `tail -1` > 0x2200000 )) && echo fdt overlaps kernel,\
-  increase FW_JUMP_FDT_ADDR
+  | (( `tail -1` > (FW_JUMP_FDT_ADDR - FW_JUMP_ADDR) )) && echo fdt overlaps \
+  kernel, increase FW_JUMP_FDT_ADDR

   ${LLVM}objdump -h --show-lma $KERNEL_ELF | sort -k 5,5 | \
   awk -n '/^ +[0-9]+ / {addr="0x"$3; size="0x"$5; printf "0x""%x\n",addr+size}'\
-  | (( `tail -1` > 0x2200000 )) && echo fdt overlaps kernel,\
-  increase FW_JUMP_FDT_ADDR
+  | (( `tail -1` > (FW_JUMP_FDT_ADDR - FW_JUMP_ADDR) )) && echo fdt overlaps \
+  kernel, increase FW_JUMP_FDT_ADDR
   ```

instead?

Thanks,
drew

> 
> Update the example calculation to reflect this, and avoid confusion.
> 
> Signed-off-by: Gabriel Somlo <gsomlo@gmail.com>
> ---
>  docs/firmware/fw_jump.md | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/docs/firmware/fw_jump.md b/docs/firmware/fw_jump.md
> index 956897e..d1b07b9 100644
> --- a/docs/firmware/fw_jump.md
> +++ b/docs/firmware/fw_jump.md
> @@ -48,12 +48,12 @@ follows:
>    ```
>    ${CROSS_COMPILE}objdump -h $KERNEL_ELF | sort -k 5,5 | awk -n '/^ +[0-9]+ /\
>    {addr="0x"$3; size="0x"$5; printf "0x""%x\n",addr+size}' \
> -  | (( `tail -1` > 0x2200000 )) && echo fdt overlaps kernel,\
> +  | (( `tail -1` > 0x2000000 )) && echo fdt overlaps kernel,\
>    increase FW_JUMP_FDT_ADDR
>  
>    ${LLVM}objdump -h --show-lma $KERNEL_ELF | sort -k 5,5 | \
>    awk -n '/^ +[0-9]+ / {addr="0x"$3; size="0x"$5; printf "0x""%x\n",addr+size}'\
> -  | (( `tail -1` > 0x2200000 )) && echo fdt overlaps kernel,\
> +  | (( `tail -1` > 0x2000000 )) && echo fdt overlaps kernel,\
>    increase FW_JUMP_FDT_ADDR
>    ```
>  
> -- 
> 2.39.2
> 
> 
> -- 
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi


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

* [PATCH v1] docs: Correct FW_JUMP_FDT_ADDR calculation example
  2023-03-23 17:18 ` Andrew Jones
@ 2023-03-24  0:39   ` Gabriel Somlo
  0 siblings, 0 replies; 3+ messages in thread
From: Gabriel Somlo @ 2023-03-24  0:39 UTC (permalink / raw)
  To: opensbi

On Thu, Mar 23, 2023 at 06:18:00PM +0100, Andrew Jones wrote:
> On Wed, Mar 22, 2023 at 01:04:48PM -0400, Gabriel Somlo wrote:
> > When using `PLATFORM=generic` defaults, the kernel is loaded at
> > `FW_JUMP_ADDR = FW_TEXT_START + 0x200000`, and the FDT is loaded at
> > `FW_JUMP_FDT_ADDR = FW_TEXT_START + 0x2200000`.
> > 
> > Therefore, the maximum kernel size before `FW_JUMP_FDT_ADDR` must
> > be increased is the difference, or `0x2000000`.
> 
> Sounds good, but this is only correct for RV64. For RV32 it should be
> 0x1e00000. I wonder if we should do something like
> 
>    ```
>    ${CROSS_COMPILE}objdump -h $KERNEL_ELF | sort -k 5,5 | awk -n '/^ +[0-9]+ /\
>    {addr="0x"$3; size="0x"$5; printf "0x""%x\n",addr+size}' \
> -  | (( `tail -1` > 0x2200000 )) && echo fdt overlaps kernel,\
> -  increase FW_JUMP_FDT_ADDR
> +  | (( `tail -1` > (FW_JUMP_FDT_ADDR - FW_JUMP_ADDR) )) && echo fdt overlaps \
> +  kernel, increase FW_JUMP_FDT_ADDR
> 
>    ${LLVM}objdump -h --show-lma $KERNEL_ELF | sort -k 5,5 | \
>    awk -n '/^ +[0-9]+ / {addr="0x"$3; size="0x"$5; printf "0x""%x\n",addr+size}'\
> -  | (( `tail -1` > 0x2200000 )) && echo fdt overlaps kernel,\
> -  increase FW_JUMP_FDT_ADDR
> +  | (( `tail -1` > (FW_JUMP_FDT_ADDR - FW_JUMP_ADDR) )) && echo fdt overlaps \
> +  kernel, increase FW_JUMP_FDT_ADDR
>    ```
> 
> instead?

Yeah, v2 (with a commit blurb updated to match) should be on its way.

Thanks,
--Gabriel


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

end of thread, other threads:[~2023-03-24  0:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-22 17:04 [PATCH v1] docs: Correct FW_JUMP_FDT_ADDR calculation example Gabriel Somlo
2023-03-23 17:18 ` Andrew Jones
2023-03-24  0:39   ` Gabriel Somlo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox