All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] board_r: Relocate OF_EMBED if NEEDS_MANUAL_RELOC only
@ 2022-09-09 20:16 Pierre-Clément Tosi
  2022-09-29 20:07 ` Tom Rini
  0 siblings, 1 reply; 6+ messages in thread
From: Pierre-Clément Tosi @ 2022-09-09 20:16 UTC (permalink / raw)
  To: u-boot; +Cc: Pierre-Clément Tosi, Simon Glass

When the embedded device tree is pointed to by the __dtb_dt_*begin
symbols, it seems to be covered by the early relocation code and doesn't
need to be manually patched.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
---
 common/board_r.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/board_r.c b/common/board_r.c
index 56eb60fa27..00926dcb1e 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -150,13 +150,13 @@ static int initr_reloc_global_data(void)
 	 */
 	gd->env_addr += gd->reloc_off;
 #endif
-#ifdef CONFIG_OF_EMBED
 	/*
 	 * The fdt_blob needs to be moved to new relocation address
 	 * incase of FDT blob is embedded with in image
 	 */
-	gd->fdt_blob += gd->reloc_off;
-#endif
+	if (CONFIG_IS_ENABLED(OF_EMBED) && CONFIG_IS_ENABLED(NEEDS_MANUAL_RELOC))
+		gd->fdt_blob += gd->reloc_off;
+
 #ifdef CONFIG_EFI_LOADER
 	/*
 	 * On the ARM architecture gd is mapped to a fixed register (r9 or x18).
-- 
2.37.2.789.g6183377224-goog


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

* Re: [PATCH] board_r: Relocate OF_EMBED if NEEDS_MANUAL_RELOC only
  2022-09-09 20:16 [PATCH] board_r: Relocate OF_EMBED if NEEDS_MANUAL_RELOC only Pierre-Clément Tosi
@ 2022-09-29 20:07 ` Tom Rini
  2023-03-15 19:24   ` Ajay Kaher
  0 siblings, 1 reply; 6+ messages in thread
From: Tom Rini @ 2022-09-29 20:07 UTC (permalink / raw)
  To: Pierre-Clément Tosi; +Cc: u-boot, Simon Glass

[-- Attachment #1: Type: text/plain, Size: 400 bytes --]

On Fri, Sep 09, 2022 at 09:16:18PM +0100,  Pierre-Clément Tosi  wrote:

> When the embedded device tree is pointed to by the __dtb_dt_*begin
> symbols, it seems to be covered by the early relocation code and doesn't
> need to be manually patched.
> 
> Cc: Simon Glass <sjg@chromium.org>
> Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH] board_r: Relocate OF_EMBED if NEEDS_MANUAL_RELOC only
  2022-09-29 20:07 ` Tom Rini
@ 2023-03-15 19:24   ` Ajay Kaher
  2023-03-15 19:42     ` Simon Glass
  2023-03-16 19:25     ` Tom Rini
  0 siblings, 2 replies; 6+ messages in thread
From: Ajay Kaher @ 2023-03-15 19:24 UTC (permalink / raw)
  To: trini, mbrugger, ptosi
  Cc: sjg, u-boot, amakhalov, vbrahmajosyula, vsirnapalli, tkundu,
	akaher, er.ajay.kaher

> On Fri, Sep 09, 2022 at 09:16:18PM +0100,  Pierre-Clément Tosi  wrote:
>
>> When the embedded device tree is pointed to by the __dtb_dt_*begin
>> symbols, it seems to be covered by the early relocation code and doesn't
>> need to be manually patched.
>>
>> Cc: Simon Glass <sjg@chromium.org>
>> Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
>
> Applied to u-boot/master, thanks!

Getting following error on Rpi3 board and fail to boot with u-boot upstream
commit 76f921eb95d5b814f973a263187db509d6f03903:

ERROR: invalid device tree
EFI LOAD FAILED: continuing...

As per bdinfo:
fdt_blob    = 0x00000000000f4b00

Would like to understand the reasoning of this upstream commit
76f921eb95d5b814f973a263187db509d6f03903 and looking for proper fix for Rpi3.

-Ajay

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

* Re: [PATCH] board_r: Relocate OF_EMBED if NEEDS_MANUAL_RELOC only
  2023-03-15 19:24   ` Ajay Kaher
@ 2023-03-15 19:42     ` Simon Glass
  2023-03-16  5:51       ` Ajay Kaher
  2023-03-16 19:25     ` Tom Rini
  1 sibling, 1 reply; 6+ messages in thread
From: Simon Glass @ 2023-03-15 19:42 UTC (permalink / raw)
  To: Ajay Kaher
  Cc: trini, mbrugger, ptosi, u-boot, amakhalov, vbrahmajosyula,
	vsirnapalli, tkundu, er.ajay.kaher

Hi Ajay,

On Wed, 15 Mar 2023 at 13:24, Ajay Kaher <akaher@vmware.com> wrote:
>
> > On Fri, Sep 09, 2022 at 09:16:18PM +0100,  Pierre-Clément Tosi  wrote:
> >
> >> When the embedded device tree is pointed to by the __dtb_dt_*begin
> >> symbols, it seems to be covered by the early relocation code and doesn't
> >> need to be manually patched.
> >>
> >> Cc: Simon Glass <sjg@chromium.org>
> >> Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
> >
> > Applied to u-boot/master, thanks!
>
> Getting following error on Rpi3 board and fail to boot with u-boot upstream
> commit 76f921eb95d5b814f973a263187db509d6f03903:
>
> ERROR: invalid device tree
> EFI LOAD FAILED: continuing...
>
> As per bdinfo:
> fdt_blob    = 0x00000000000f4b00
>
> Would like to understand the reasoning of this upstream commit
> 76f921eb95d5b814f973a263187db509d6f03903 and looking for proper fix for Rpi3.
>
> -Ajay

Did you bisect to that patch?

The proper fix would be to get away from OF_EMBED which is not allowed
in production boards. Can you post the full console log so I can see
what happens before the error?

The commit does not look correct to me. This is nothing to do with the
horrible NEEDS_MANUAL_RELOC which is only needed on m68k I think now.
It is because we have moved the executable containing the DT. The DT
in the old position may be overwritten by loading something.

Regards,
Simon

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

* Re: [PATCH] board_r: Relocate OF_EMBED if NEEDS_MANUAL_RELOC only
  2023-03-15 19:42     ` Simon Glass
@ 2023-03-16  5:51       ` Ajay Kaher
  0 siblings, 0 replies; 6+ messages in thread
From: Ajay Kaher @ 2023-03-16  5:51 UTC (permalink / raw)
  To: Simon Glass
  Cc: trini, mbrugger, ptosi, u-boot, Alexey Makhalov,
	Vamsi Krishna Brahmajosyula, Vasavi Sirnapalli, Tapas Kundu,
	er.ajay.kaher



> On 16-Mar-2023, at 1:12 AM, Simon Glass <sjg@chromium.org> wrote:
> 
> !! External Email
> 
> Hi Ajay,
> 
> On Wed, 15 Mar 2023 at 13:24, Ajay Kaher <akaher@vmware.com> wrote:
>> 
>>> On Fri, Sep 09, 2022 at 09:16:18PM +0100,  Pierre-Clément Tosi  wrote:
>>> 
>>>> When the embedded device tree is pointed to by the __dtb_dt_*begin
>>>> symbols, it seems to be covered by the early relocation code and doesn't
>>>> need to be manually patched.
>>>> 
>>>> Cc: Simon Glass <sjg@chromium.org>
>>>> Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
>>> 
>>> Applied to u-boot/master, thanks!
>> 
>> Getting following error on Rpi3 board and fail to boot with u-boot upstream
>> commit 76f921eb95d5b814f973a263187db509d6f03903:
>> 
>> ERROR: invalid device tree
>> EFI LOAD FAILED: continuing...
>> 
>> As per bdinfo:
>> fdt_blob    = 0x00000000000f4b00
>> 
>> Would like to understand the reasoning of this upstream commit
>> 76f921eb95d5b814f973a263187db509d6f03903 and looking for proper fix for Rpi3.
>> 
>> -Ajay
> 
> Did you bisect to that patch?

Yes, between v2022.07 and v2022.10.

> 
> The proper fix would be to get away from OF_EMBED which is not allowed
> in production boards. Can you post the full console log so I can see
> what happens before the error?

Here are the logs:

U-Boot 2022.10 (Mar 15 2023 - 07:10:46 +0000)

DRAM:  948 MiB
RPI 3 Model B (0xa02082)
Core:  66 devices, 14 uclasses, devicetree: embed
MMC:   mmc@7e202000: 0, mmc@7e300000: 1
Loading Environment from FAT... OK
In:    serial
Out:   vidconsole
Err:   vidconsole
Net:   No ethernet found.
starting USB...
Bus usb@7e980000: USB DWC2
scanning bus usb@7e980000 for devices... 4 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  0
Saving Environment to FAT... OK
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found EFI removable media binary efi/boot/bootaa64.efi
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Card did not respond to voltage select! : -110
No EFI system partition
BootOrder not defined
EFI boot manager: Cannot load any image
1146880 bytes read in 50 ms (21.9 MiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
ERROR: invalid device tree
EFI LOAD FAILED: continuing...
Card did not respond to voltage select! : -110

Device 0: unknown device
Waiting for Ethernet connection... unable to connect.
missing environment variable: pxeuuid
Retrieving file: pxelinux.cfg/01-b8-27-eb-4d-9e-e9
Waiting for Ethernet connection... unable to connect.
Retrieving file: pxelinux.cfg/00000000
Waiting for Ethernet connection... unable to connect.
Retrieving file: pxelinux.cfg/0000000
Waiting for Ethernet connection... unable to connect.
Retrieving file: pxelinux.cfg/000000
Waiting for Ethernet connection... unable to connect.
Retrieving file: pxelinux.cfg/00000
Waiting for Ethernet connection... unable to connect.
Retrieving file: pxelinux.cfg/0000
Waiting for Ethernet connection... unable to connect.
Retrieving file: pxelinux.cfg/000
Waiting for Ethernet connection... unable to connect.
Retrieving file: pxelinux.cfg/00
Waiting for Ethernet connection... unable to connect.
Retrieving file: pxelinux.cfg/0
Waiting for Ethernet connection... unable to connect.
Retrieving file: pxelinux.cfg/default-arm-bcm283x-rpi
Waiting for Ethernet connection... unable to connect.
Retrieving file: pxelinux.cfg/default-arm-bcm283x
Waiting for Ethernet connection... unable to connect.
Retrieving file: pxelinux.cfg/default-arm
Waiting for Ethernet connection... unable to connect.
Retrieving file: pxelinux.cfg/default
Waiting for Ethernet connection... unable to connect.
Config file not found
Waiting for Ethernet connection... unable to connect.
Waiting for Ethernet connection... unable to connect.
U-Boot>


> The commit does not look correct to me. This is nothing to do with the
> horrible NEEDS_MANUAL_RELOC which is only needed on m68k I think now.
> It is because we have moved the executable containing the DT. The DT
> in the old position may be overwritten by loading something.

Seems like your observations are correct and may be need to revert
76f921eb95d5b814f973a263187db509d6f03903. And handle m68k
case separately.

Thanks Simon for your response.

- Ajay


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

* Re: [PATCH] board_r: Relocate OF_EMBED if NEEDS_MANUAL_RELOC only
  2023-03-15 19:24   ` Ajay Kaher
  2023-03-15 19:42     ` Simon Glass
@ 2023-03-16 19:25     ` Tom Rini
  1 sibling, 0 replies; 6+ messages in thread
From: Tom Rini @ 2023-03-16 19:25 UTC (permalink / raw)
  To: Ajay Kaher
  Cc: mbrugger, ptosi, sjg, u-boot, amakhalov, vbrahmajosyula,
	vsirnapalli, tkundu, er.ajay.kaher

[-- Attachment #1: Type: text/plain, Size: 791 bytes --]

On Thu, Mar 16, 2023 at 12:54:10AM +0530, Ajay Kaher wrote:
> > On Fri, Sep 09, 2022 at 09:16:18PM +0100,  Pierre-Clément Tosi  wrote:
> >
> >> When the embedded device tree is pointed to by the __dtb_dt_*begin
> >> symbols, it seems to be covered by the early relocation code and doesn't
> >> need to be manually patched.
> >>
> >> Cc: Simon Glass <sjg@chromium.org>
> >> Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
> >
> > Applied to u-boot/master, thanks!
> 
> Getting following error on Rpi3 board and fail to boot with u-boot upstream
> commit 76f921eb95d5b814f973a263187db509d6f03903:

Please give
https://patchwork.ozlabs.org/project/uboot/patch/20230228155605.1209559-1-pbrobinson@gmail.com/
a try and see if things act as you expect, thanks.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

end of thread, other threads:[~2023-03-16 19:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-09 20:16 [PATCH] board_r: Relocate OF_EMBED if NEEDS_MANUAL_RELOC only Pierre-Clément Tosi
2022-09-29 20:07 ` Tom Rini
2023-03-15 19:24   ` Ajay Kaher
2023-03-15 19:42     ` Simon Glass
2023-03-16  5:51       ` Ajay Kaher
2023-03-16 19:25     ` Tom Rini

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.