public inbox for opensbi@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] platform: generic: Keep some empty space in FDT passed to next stage
@ 2025-11-05 16:01 Anup Patel
  2025-11-05 16:14 ` Andrew Jones
  0 siblings, 1 reply; 3+ messages in thread
From: Anup Patel @ 2025-11-05 16:01 UTC (permalink / raw)
  To: Atish Patra; +Cc: Andrew Jones, Anup Patel, opensbi, Anup Patel

Leaving no empty space in the FDT passed to the next booting stage
causes the following U-Boot crash on Ventana internal platforms:

Unhandled exception: Load access fault
EPC: 00000000fffa6372 RA: 00000000fffa7418 TVAL: 0001746174730068
EPC: 0000000080245372 RA: 0000000080246418 reloc adjusted

SP:  00000000fef38440 GP:  00000000fef40e60 TP:  0000000000000000
T0:  00000000fef40a70 T1:  000000000000ff00 T2:  0000000000000000
S0:  00000000fffc17a8 S1:  00000000fef38d40 A0:  7375746174730068
A1:  00000000fffc17a8 A2:  0000000000000010 A3:  0000000000000010
A4:  0000000000000000 A5:  00000000fffc17b8 A6:  0000000000ff0000
A7:  000000000000b100 S2:  0000000000000000 S3:  0000000000000001
S4:  00000000fef38d40 S5:  7375746174730068 S6:  0000000000000000
S7:  00000000fef4eef0 S8:  00000000fef4ef90 S9:  0000000000000000
S10: 0000000000000000 S11: 00000000fef4efc0 T3:  00000000fef40ea8
T4:  0000000000ff0000 T5:  00000000fef40a60 T6:  00000000fef40a6c

To address the above issue, keep some minimal empty space in the
FDT instead of no empty space.

Fixes: bbe9a23060e9 ("platform: generic: Pack the FDT after applying fixups")
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
---
 platform/generic/platform.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/platform/generic/platform.c b/platform/generic/platform.c
index e66f99fa..ea44676b 100644
--- a/platform/generic/platform.c
+++ b/platform/generic/platform.c
@@ -245,7 +245,9 @@ int generic_final_init(bool cold_boot)
 	fdt_fixups(fdt);
 	fdt_domain_fixup(fdt);
 
+	/* Minimize the empty space in FDT to 4KB */
 	fdt_pack(fdt);
+	fdt_open_into(fdt, fdt, fdt_totalsize(fdt) + 4096);
 
 	return 0;
 }
-- 
2.43.0


-- 
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi

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

* Re: [PATCH] platform: generic: Keep some empty space in FDT passed to next stage
  2025-11-05 16:01 [PATCH] platform: generic: Keep some empty space in FDT passed to next stage Anup Patel
@ 2025-11-05 16:14 ` Andrew Jones
  2025-12-01  4:59   ` Anup Patel
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Jones @ 2025-11-05 16:14 UTC (permalink / raw)
  To: Anup Patel; +Cc: Atish Patra, Anup Patel, opensbi

On Wed, Nov 05, 2025 at 09:31:45PM +0530, Anup Patel wrote:
> Leaving no empty space in the FDT passed to the next booting stage
> causes the following U-Boot crash on Ventana internal platforms:
> 
> Unhandled exception: Load access fault
> EPC: 00000000fffa6372 RA: 00000000fffa7418 TVAL: 0001746174730068
> EPC: 0000000080245372 RA: 0000000080246418 reloc adjusted
> 
> SP:  00000000fef38440 GP:  00000000fef40e60 TP:  0000000000000000
> T0:  00000000fef40a70 T1:  000000000000ff00 T2:  0000000000000000
> S0:  00000000fffc17a8 S1:  00000000fef38d40 A0:  7375746174730068
> A1:  00000000fffc17a8 A2:  0000000000000010 A3:  0000000000000010
> A4:  0000000000000000 A5:  00000000fffc17b8 A6:  0000000000ff0000
> A7:  000000000000b100 S2:  0000000000000000 S3:  0000000000000001
> S4:  00000000fef38d40 S5:  7375746174730068 S6:  0000000000000000
> S7:  00000000fef4eef0 S8:  00000000fef4ef90 S9:  0000000000000000
> S10: 0000000000000000 S11: 00000000fef4efc0 T3:  00000000fef40ea8
> T4:  0000000000ff0000 T5:  00000000fef40a60 T6:  00000000fef40a6c
> 
> To address the above issue, keep some minimal empty space in the
> FDT instead of no empty space.
> 
> Fixes: bbe9a23060e9 ("platform: generic: Pack the FDT after applying fixups")
> Signed-off-by: Anup Patel <apatel@ventanamicro.com>
> ---
>  platform/generic/platform.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/platform/generic/platform.c b/platform/generic/platform.c
> index e66f99fa..ea44676b 100644
> --- a/platform/generic/platform.c
> +++ b/platform/generic/platform.c
> @@ -245,7 +245,9 @@ int generic_final_init(bool cold_boot)
>  	fdt_fixups(fdt);
>  	fdt_domain_fixup(fdt);
>  
> +	/* Minimize the empty space in FDT to 4KB */
>  	fdt_pack(fdt);
> +	fdt_open_into(fdt, fdt, fdt_totalsize(fdt) + 4096);
>  
>  	return 0;
>  }
> -- 
> 2.43.0
>

I agree opensbi needs to workaround uboot issues in order to ensure it
doesn't break current configurations, but maybe we should make the
extra space added be a Kconfig managed define, rather than a hard 4096.
The main reason would be to enable setting it to zero so issues with
second stage loaders like this one can be flushed out and fixed.

Thanks,
drew

-- 
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi

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

* Re: [PATCH] platform: generic: Keep some empty space in FDT passed to next stage
  2025-11-05 16:14 ` Andrew Jones
@ 2025-12-01  4:59   ` Anup Patel
  0 siblings, 0 replies; 3+ messages in thread
From: Anup Patel @ 2025-12-01  4:59 UTC (permalink / raw)
  To: Andrew Jones; +Cc: Atish Patra, Anup Patel, opensbi

On Wed, Nov 5, 2025 at 9:44 PM Andrew Jones <ajones@ventanamicro.com> wrote:
>
> On Wed, Nov 05, 2025 at 09:31:45PM +0530, Anup Patel wrote:
> > Leaving no empty space in the FDT passed to the next booting stage
> > causes the following U-Boot crash on Ventana internal platforms:
> >
> > Unhandled exception: Load access fault
> > EPC: 00000000fffa6372 RA: 00000000fffa7418 TVAL: 0001746174730068
> > EPC: 0000000080245372 RA: 0000000080246418 reloc adjusted
> >
> > SP:  00000000fef38440 GP:  00000000fef40e60 TP:  0000000000000000
> > T0:  00000000fef40a70 T1:  000000000000ff00 T2:  0000000000000000
> > S0:  00000000fffc17a8 S1:  00000000fef38d40 A0:  7375746174730068
> > A1:  00000000fffc17a8 A2:  0000000000000010 A3:  0000000000000010
> > A4:  0000000000000000 A5:  00000000fffc17b8 A6:  0000000000ff0000
> > A7:  000000000000b100 S2:  0000000000000000 S3:  0000000000000001
> > S4:  00000000fef38d40 S5:  7375746174730068 S6:  0000000000000000
> > S7:  00000000fef4eef0 S8:  00000000fef4ef90 S9:  0000000000000000
> > S10: 0000000000000000 S11: 00000000fef4efc0 T3:  00000000fef40ea8
> > T4:  0000000000ff0000 T5:  00000000fef40a60 T6:  00000000fef40a6c
> >
> > To address the above issue, keep some minimal empty space in the
> > FDT instead of no empty space.
> >
> > Fixes: bbe9a23060e9 ("platform: generic: Pack the FDT after applying fixups")
> > Signed-off-by: Anup Patel <apatel@ventanamicro.com>
> > ---
> >  platform/generic/platform.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/platform/generic/platform.c b/platform/generic/platform.c
> > index e66f99fa..ea44676b 100644
> > --- a/platform/generic/platform.c
> > +++ b/platform/generic/platform.c
> > @@ -245,7 +245,9 @@ int generic_final_init(bool cold_boot)
> >       fdt_fixups(fdt);
> >       fdt_domain_fixup(fdt);
> >
> > +     /* Minimize the empty space in FDT to 4KB */
> >       fdt_pack(fdt);
> > +     fdt_open_into(fdt, fdt, fdt_totalsize(fdt) + 4096);
> >
> >       return 0;
> >  }
> > --
> > 2.43.0
> >
>
> I agree opensbi needs to workaround uboot issues in order to ensure it
> doesn't break current configurations, but maybe we should make the
> extra space added be a Kconfig managed define, rather than a hard 4096.
> The main reason would be to enable setting it to zero so issues with
> second stage loaders like this one can be flushed out and fixed.
>

Adding a Kconfig option for the amount of extra space should be fine,
I will update and send v2.

Thanks,
Anup

-- 
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi

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

end of thread, other threads:[~2025-12-01  4:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-05 16:01 [PATCH] platform: generic: Keep some empty space in FDT passed to next stage Anup Patel
2025-11-05 16:14 ` Andrew Jones
2025-12-01  4:59   ` Anup Patel

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