* [PATCH 0/2] FDT fixes for running on native Open Firmware
@ 2017-05-13 10:22 Sascha Silbe
2017-05-13 10:22 ` [PATCH 1/2] fdt: correctly handle uncompressed node names Sascha Silbe
2017-05-13 10:22 ` [PATCH 2/2] of: fdt: fix unflattening of FDTs containing uncompressed paths Sascha Silbe
0 siblings, 2 replies; 6+ messages in thread
From: Sascha Silbe @ 2017-05-13 10:22 UTC (permalink / raw)
To: Rob Herring, Frank Rowand; +Cc: devicetree, linux-kernel
Two fixes for bugs in the FDT code I discovered while trying to get
the mainline kernel to run on OLPC XO-1.75. XOs are running Open
Firmware natively, not just passing down some blob.
Sascha Silbe (2):
fdt: correctly handle uncompressed node names
of: fdt: fix unflattening of FDTs containing uncompressed paths
drivers/of/fdt.c | 2 ++
scripts/dtc/libfdt/fdt_ro.c | 3 +++
2 files changed, 5 insertions(+)
--
2.11.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] fdt: correctly handle uncompressed node names
2017-05-13 10:22 [PATCH 0/2] FDT fixes for running on native Open Firmware Sascha Silbe
@ 2017-05-13 10:22 ` Sascha Silbe
2017-05-13 12:35 ` kbuild test robot
` (2 more replies)
2017-05-13 10:22 ` [PATCH 2/2] of: fdt: fix unflattening of FDTs containing uncompressed paths Sascha Silbe
1 sibling, 3 replies; 6+ messages in thread
From: Sascha Silbe @ 2017-05-13 10:22 UTC (permalink / raw)
To: Rob Herring, Frank Rowand; +Cc: devicetree, linux-kernel
When handling uncompressed node names, we need to compare the last
component rather than the entire string.
Signed-off-by: Sascha Silbe <x-linux@infra-silbe.de>
---
scripts/dtc/libfdt/fdt_ro.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/scripts/dtc/libfdt/fdt_ro.c b/scripts/dtc/libfdt/fdt_ro.c
index 3d00d2eee0e3..ca03ff87429c 100644
--- a/scripts/dtc/libfdt/fdt_ro.c
+++ b/scripts/dtc/libfdt/fdt_ro.c
@@ -64,6 +64,9 @@ static int _fdt_nodename_eq(const void *fdt, int offset,
/* short match */
return 0;
+ if (*p == '/')
+ /* Uncompressed node name. Only compare the last part. */
+ p = strrchr(p, '/') + 1;
if (memcmp(p, s, len) != 0)
return 0;
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] of: fdt: fix unflattening of FDTs containing uncompressed paths
2017-05-13 10:22 [PATCH 0/2] FDT fixes for running on native Open Firmware Sascha Silbe
2017-05-13 10:22 ` [PATCH 1/2] fdt: correctly handle uncompressed node names Sascha Silbe
@ 2017-05-13 10:22 ` Sascha Silbe
1 sibling, 0 replies; 6+ messages in thread
From: Sascha Silbe @ 2017-05-13 10:22 UTC (permalink / raw)
To: Rob Herring, Frank Rowand; +Cc: devicetree, linux-kernel
Probably since commit dfbd4c6eff35 ("drivers/of: Split
unflatten_dt_node()"), unflattening an FDT containing uncompressed
node names (e.g. "/gpio@d4019000/gpio@0") will abort after scanning
the root node because fpsize wasn't updated to include the path len.
Signed-off-by: Sascha Silbe <x-linux@infra-silbe.de>
---
drivers/of/fdt.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index e5ce4b59e162..2d5414e644b3 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -309,6 +309,8 @@ static unsigned int populate_node(const void *blob,
fpsize += l;
allocl = fpsize;
}
+ } else {
+ fpsize += allocl;
}
np = unflatten_dt_alloc(mem, sizeof(struct device_node) + allocl,
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] fdt: correctly handle uncompressed node names
2017-05-13 10:22 ` [PATCH 1/2] fdt: correctly handle uncompressed node names Sascha Silbe
@ 2017-05-13 12:35 ` kbuild test robot
2017-05-13 13:07 ` kbuild test robot
2017-05-15 15:19 ` Rob Herring
2 siblings, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2017-05-13 12:35 UTC (permalink / raw)
To: Sascha Silbe
Cc: kbuild-all, Rob Herring, Frank Rowand, devicetree, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1327 bytes --]
Hi Sascha,
[auto build test ERROR on robh/for-next]
[also build test ERROR on v4.11 next-20170512]
[cannot apply to glikely/devicetree/next]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Sascha-Silbe/fdt-correctly-handle-uncompressed-node-names/20170513-184012
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: arm64-alldefconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm64
All errors (new ones prefixed by >>):
./drivers/firmware/efi/libstub/lib.a(lib-fdt_ro.stub.o): In function `__efistub_fdt_subnode_offset_namelen':
>> __efistub_fdt_ro.c:(.init.text+0x248): undefined reference to `__efistub_strrchr'
__efistub_fdt_ro.c:(.init.text+0x248): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `__efistub_strrchr'
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 8703 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] fdt: correctly handle uncompressed node names
2017-05-13 10:22 ` [PATCH 1/2] fdt: correctly handle uncompressed node names Sascha Silbe
2017-05-13 12:35 ` kbuild test robot
@ 2017-05-13 13:07 ` kbuild test robot
2017-05-15 15:19 ` Rob Herring
2 siblings, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2017-05-13 13:07 UTC (permalink / raw)
To: Sascha Silbe
Cc: kbuild-all, Rob Herring, Frank Rowand, devicetree, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1245 bytes --]
Hi Sascha,
[auto build test ERROR on robh/for-next]
[also build test ERROR on v4.11 next-20170512]
[cannot apply to glikely/devicetree/next]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Sascha-Silbe/fdt-correctly-handle-uncompressed-node-names/20170513-184012
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: arm-omap2plus_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm
All errors (new ones prefixed by >>):
arch/arm/boot/compressed/fdt_ro.o: In function `fdt_subnode_offset_namelen':
>> arch/arm/boot/compressed/fdt_ro.c:69: undefined reference to `strrchr'
>> arch/arm/boot/compressed/fdt_ro.o:(.debug_addr+0x364): undefined reference to `strrchr'
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 29326 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] fdt: correctly handle uncompressed node names
2017-05-13 10:22 ` [PATCH 1/2] fdt: correctly handle uncompressed node names Sascha Silbe
2017-05-13 12:35 ` kbuild test robot
2017-05-13 13:07 ` kbuild test robot
@ 2017-05-15 15:19 ` Rob Herring
2 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2017-05-15 15:19 UTC (permalink / raw)
To: Sascha Silbe; +Cc: Frank Rowand, devicetree, linux-kernel
On Sat, May 13, 2017 at 5:22 AM, Sascha Silbe <x-linux@infra-silbe.de> wrote:
> When handling uncompressed node names, we need to compare the last
> component rather than the entire string.
>
> Signed-off-by: Sascha Silbe <x-linux@infra-silbe.de>
> ---
> scripts/dtc/libfdt/fdt_ro.c | 3 +++
> 1 file changed, 3 insertions(+)
This needs to be a patch against dtc, sent to devicetree-compiler list
and accepted there, then I can pick it up.
>
> diff --git a/scripts/dtc/libfdt/fdt_ro.c b/scripts/dtc/libfdt/fdt_ro.c
> index 3d00d2eee0e3..ca03ff87429c 100644
> --- a/scripts/dtc/libfdt/fdt_ro.c
> +++ b/scripts/dtc/libfdt/fdt_ro.c
> @@ -64,6 +64,9 @@ static int _fdt_nodename_eq(const void *fdt, int offset,
> /* short match */
> return 0;
>
> + if (*p == '/')
> + /* Uncompressed node name. Only compare the last part. */
> + p = strrchr(p, '/') + 1;
However, you are changing behavior here that I'd guess has existed for
some time. This makes me suspicious that this is correct especially
when it is non-FDT DT you are trying to fix.
Given that 0-day reports an error with EFI stub, you also have to
consider if u-boot, barebox, grub, and all the other libfdt users
provide strrchr.
Rob
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-05-15 15:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-13 10:22 [PATCH 0/2] FDT fixes for running on native Open Firmware Sascha Silbe
2017-05-13 10:22 ` [PATCH 1/2] fdt: correctly handle uncompressed node names Sascha Silbe
2017-05-13 12:35 ` kbuild test robot
2017-05-13 13:07 ` kbuild test robot
2017-05-15 15:19 ` Rob Herring
2017-05-13 10:22 ` [PATCH 2/2] of: fdt: fix unflattening of FDTs containing uncompressed paths Sascha Silbe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).