Skip to contentSkip to conversation

cmd: fdt: skip board specific fixup using env variable

PATCH New Wasim Khan 2 participants 6 messages Jan 27, 2021 – Feb 4, 2021

lore
Share & tools
lore

Wasim Khan

author
#0 lore raw

PATCH 1/1 cmd: fdt: skip board specific fixup using env variable

From: Wasim Khan <[email protected]>

Sometimes it is useful to boot OS with already fixed-up device tree. Check for env variable 'skip_board_fixup' before calling ft_board_setup().
Current behaviour is unchanged, additionally user can set skip_board_fixup to 1 to skip the fixup.

---
 common/image-fdt.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
common/image-fdt.c +12 -5
index 327a8c4c39..0435176863 100644
@@ -572,11 +572,18 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
 	fdt_fixup_pstore(blob);
 #endif
 	if (IMAGE_OF_BOARD_SETUP) {
-		fdt_ret = ft_board_setup(blob, gd->bd);
-		if (fdt_ret) {
-			printf("ERROR: board-specific fdt fixup failed: %s\n",
-			       fdt_strerror(fdt_ret));
-			goto err;
+		const char *skip_board_fixup;
+
+		skip_board_fixup = env_get("skip_board_fixup");
+		if (skip_board_fixup && ((int)simple_strtol(skip_board_fixup, NULL, 10) == 1)) {
+			printf("skip board fdt fixup\n");
+		} else {
+			fdt_ret = ft_board_setup(blob, gd->bd);
+			if (fdt_ret) {
+				printf("ERROR: board-specific fdt fixup failed: %s\n",
+				       fdt_strerror(fdt_ret));
+				goto err;
+			}
 		}
 	}
 	if (IMAGE_OF_SYSTEM_SETUP) {
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 cmd: fdt: skip board specific fixup using env variable

Quoted 8 lines · Wasim Khan

From: Wasim Khan <[email protected]>

Sometimes it is useful to boot OS with already fixed-up device tree. Check for env variable 'skip_board_fixup' before calling ft_board_setup().
Current behaviour is unchanged, additionally user can set skip_board_fixup to 1 to skip the fixup.

Quoted 4 lines
---
 common/image-fdt.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

Can you provide a specific example or two here? Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210127/f60db30f/attachment.sig>
#2 lore raw

PATCH 1/1 cmd: fdt: skip board specific fixup using env variable

Hi Tom,

Quoted 18 lines

-----Original Message-----
From: Tom Rini <[email protected]>
Sent: Wednesday, January 27, 2021 7:41 PM
To: Wasim Khan (OSS) <[email protected]>
Cc: sjg at chromium.org; t-kristo at ti.com; Varun Sethi <[email protected]>; u- boot at lists.denx.de; Wasim Khan <[email protected]>
Subject: Re: [PATCH] cmd: fdt: skip board specific fixup using env variable

Quoted 8 lines · Wasim Khan

From: Wasim Khan <[email protected]>

Sometimes it is useful to boot OS with already fixed-up device tree. Check for env variable 'skip_board_fixup'
before calling ft_board_setup().
Current behaviour is unchanged, additionally user can set skip_board_fixup to 1 to skip the fixup.

Quoted 6 lines
Quoted 4 lines
---
 common/image-fdt.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

Can you provide a specific example or two here? Thanks!

Thank you for your comments.

Recently I faced issue where Linux crash in PCIe was observed in customer's env.
Whereas same Linux was booting fine in my environment. After debugging we found that U-boot was doing fixup based on SVR value. SVR check was failing in customer's env because of different SoC personality which was causing the crash in OS. So I thought it is good idea to have an option to bypass U-boot fixup and use an already fixed-up device tree so that we can quickly check if the problem is in OS or it is caused because of missed/wrong fixup from Uboot.

Another use case I can think of is suppose if we want to introduce a new dtb fixup , we can directly add the change in a fixed-up device tree, do all experiments and once validated thoroughly , we can do the same change via Uboot fixup.

#3 lore raw

PATCH 1/1 cmd: fdt: skip board specific fixup using env variable

Quoted 27 lines · Wasim Khan (OSS)

Hi Tom,

Quoted 18 lines

-----Original Message-----
From: Tom Rini <[email protected]>
Sent: Wednesday, January 27, 2021 7:41 PM
To: Wasim Khan (OSS) <[email protected]>
Cc: sjg at chromium.org; t-kristo at ti.com; Varun Sethi <[email protected]>; u- boot at lists.denx.de; Wasim Khan <[email protected]>
Subject: Re: [PATCH] cmd: fdt: skip board specific fixup using env variable

Quoted 8 lines · Wasim Khan

From: Wasim Khan <[email protected]>

Sometimes it is useful to boot OS with already fixed-up device tree. Check for env variable 'skip_board_fixup'
before calling ft_board_setup().
Current behaviour is unchanged, additionally user can set skip_board_fixup to 1 to skip the fixup.

Quoted 6 lines
Quoted 4 lines
---
 common/image-fdt.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

Can you provide a specific example or two here? Thanks!

Quoted 7 lines

Thank you for your comments.

Recently I faced issue where Linux crash in PCIe was observed in customer's env.
Whereas same Linux was booting fine in my environment. After debugging we found that U-boot was doing fixup based on SVR value. SVR check was failing in customer's env because of different SoC personality which was causing the crash in OS. So I thought it is good idea to have an option to bypass U-boot fixup and use an already fixed-up device tree so that we can quickly check if the problem is in OS or it is caused because of missed/wrong fixup from Uboot.

Another use case I can think of is suppose if we want to introduce a new dtb fixup , we can directly add the change in a fixed-up device tree, do all experiments and once validated thoroughly , we can do the same change via Uboot fixup.

OK, I can see how this can be useful in some circumstances, thanks. What I'd like to see is updating checkpatch.pl to have a check that we aren't setting this by default in environments (something like the check that exists now for (fdt|initrd)_high=0xffffffff should be a good reference) as my worry is that someone will decide that's how to work-around some issue and we'll end up in another nightmare down the road of uncorrected dtbs causing other problems. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210129/d2c37157/attachment.sig>
#4 lore raw

PATCH 1/1 cmd: fdt: skip board specific fixup using env variable

Hi Tom,

Quoted 63 lines

-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Tom Rini
Sent: Saturday, January 30, 2021 12:53 AM
To: Wasim Khan (OSS) <[email protected]>
Cc: sjg at chromium.org; t-kristo at ti.com; Varun Sethi <[email protected]>; u- boot at lists.denx.de
Subject: Re: [PATCH] cmd: fdt: skip board specific fixup using env variable

Quoted 27 lines · Wasim Khan (OSS)

Hi Tom,

Quoted 25 lines

-----Original Message-----
From: Tom Rini <[email protected]>
Sent: Wednesday, January 27, 2021 7:41 PM
To: Wasim Khan (OSS) <[email protected]>
Cc: sjg at chromium.org; t-kristo at ti.com; Varun Sethi <[email protected]>; u- boot at lists.denx.de; Wasim Khan <[email protected]>
Subject: Re: [PATCH] cmd: fdt: skip board specific fixup using env variable

Quoted 12 lines · Wasim Khan

From: Wasim Khan <[email protected]>

Sometimes it is useful to boot OS with already fixed-up device tree. Check for env variable 'skip_board_fixup'
before calling ft_board_setup().
Current behaviour is unchanged, additionally user can set skip_board_fixup to 1 to skip the fixup.

---
 common/image-fdt.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
Quoted 5 lines
Quoted 1 line

Can you provide a specific example or two here? Thanks!

Thank you for your comments.

Recently I faced issue where Linux crash in PCIe was observed in customer's

env.

Quoted 1 line

Whereas same Linux was booting fine in my environment. After debugging

we found that U-boot was doing fixup based on SVR value. SVR check was failing in customer's env because of different SoC personality which was causing the crash in OS.

Quoted 1 line

So I thought it is good idea to have an option to bypass U-boot fixup and use

an already fixed-up device tree so that we can quickly check if the problem is in OS or it is caused because of missed/wrong fixup from Uboot.

Quoted 2 lines

Another use case I can think of is suppose if we want to introduce a new dtb

fixup , we can directly add the change in a fixed-up device tree, do all experiments and once validated thoroughly , we can do the same change via Uboot fixup.

OK, I can see how this can be useful in some circumstances, thanks. What I'd like to see is updating checkpatch.pl to have a check that we aren't setting this by default in environments (something like the check that exists now for (fdt|initrd)_high=0xffffffff should be a good
reference) as my worry is that someone will decide that's how to work-around some issue and we'll end up in another nightmare down the road of uncorrected dtbs causing other problems. Thanks!

Quoted 2 lines

--
Tom

Thanks, If I understood your comment correctly, you suggesting to add 'skip_board_fixup' to CONFIG_EXTRA_ENV_SETTINGS for all of our platforms and check its default value in checkpatch.pl , which must be 0 ?

#5 lore raw

PATCH 1/1 cmd: fdt: skip board specific fixup using env variable

Quoted 65 lines · Wasim Khan (OSS)

Hi Tom,

Quoted 55 lines

-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Tom Rini
Sent: Saturday, January 30, 2021 12:53 AM
To: Wasim Khan (OSS) <[email protected]>
Cc: sjg at chromium.org; t-kristo at ti.com; Varun Sethi <[email protected]>; u- boot at lists.denx.de
Subject: Re: [PATCH] cmd: fdt: skip board specific fixup using env variable

Quoted 27 lines · Wasim Khan (OSS)

Hi Tom,

Quoted 25 lines

-----Original Message-----
From: Tom Rini <[email protected]>
Sent: Wednesday, January 27, 2021 7:41 PM
To: Wasim Khan (OSS) <[email protected]>
Cc: sjg at chromium.org; t-kristo at ti.com; Varun Sethi <[email protected]>; u- boot at lists.denx.de; Wasim Khan <[email protected]>
Subject: Re: [PATCH] cmd: fdt: skip board specific fixup using env variable

Quoted 12 lines · Wasim Khan

From: Wasim Khan <[email protected]>

Sometimes it is useful to boot OS with already fixed-up device tree. Check for env variable 'skip_board_fixup'
before calling ft_board_setup().
Current behaviour is unchanged, additionally user can set skip_board_fixup to 1 to skip the fixup.

---
 common/image-fdt.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
Quoted 5 lines
Quoted 1 line

Can you provide a specific example or two here? Thanks!

Thank you for your comments.

Recently I faced issue where Linux crash in PCIe was observed in customer's

env.

Quoted 1 line

Whereas same Linux was booting fine in my environment. After debugging

we found that U-boot was doing fixup based on SVR value. SVR check was failing in customer's env because of different SoC personality which was causing the crash in OS.

Quoted 1 line

So I thought it is good idea to have an option to bypass U-boot fixup and use

an already fixed-up device tree so that we can quickly check if the problem is in OS or it is caused because of missed/wrong fixup from Uboot.

Quoted 2 lines

Another use case I can think of is suppose if we want to introduce a new dtb

fixup , we can directly add the change in a fixed-up device tree, do all experiments and once validated thoroughly , we can do the same change via Uboot fixup.

Quoted 7 lines

OK, I can see how this can be useful in some circumstances, thanks. What I'd like to see is updating checkpatch.pl to have a check that we aren't setting this by default in environments (something like the check that exists now for (fdt|initrd)_high=0xffffffff should be a good
reference) as my worry is that someone will decide that's how to work-around some issue and we'll end up in another nightmare down the road of uncorrected dtbs causing other problems. Thanks!

Quoted 4 lines

Thanks, If I understood your comment correctly, you suggesting to add 'skip_board_fixup' to CONFIG_EXTRA_ENV_SETTINGS for all of our platforms and check its default value in checkpatch.pl , which must be 0 ?

I'm saying it can't be in CONFIG_EXTRA_ENV_SETTINGS by default, and checkpatch.pl needs a test to complain if it's found.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210204/5edad9bc/attachment.sig>