Re: [PATCH 09/20] of/fdt: create common debugfs
On 04/07/2014 02:42 AM, Rob Herring wrote: On Fri, Apr 4, 2014 at 9:11 AM, Michal Simek mon...@monstr.eu wrote: On 04/04/2014 03:32 PM, Rob Herring wrote: On Fri, Apr 4, 2014 at 8:22 AM, Michal Simek mon...@monstr.eu wrote: On 04/04/2014 03:00 PM, Rob Herring wrote: On Fri, Apr 4, 2014 at 7:16 AM, Michal Simek mon...@monstr.eu wrote: On 04/04/2014 12:16 AM, Rob Herring wrote: From: Rob Herring r...@kernel.org Both powerpc and microblaze have the same FDT blob in debugfs feature. Move this to common location and remove the powerpc and microblaze implementations. This feature could become more useful when FDT overlay support is added. [snip] Anyway I am testing it for microblaze and getting problem caused by this patch: commit 3d2ee8571ac0580d49c3f41fa28336289934900a Author: Rob Herring r...@kernel.org Date: Wed Apr 2 15:10:14 2014 -0500 of/fdt: Convert FDT functions to use libfdt And reason is that in unflatten_dt_node() pathp = fdt_get_name(blob, *poffset, l); is returning NULL and here /* version 0x10 has a more compact unit name here instead of the full * path. we accumulate the full path size using fpsize, we'll rebuild * it later. We detect this because the first character of the name is * not '/'. */ if ((*pathp) != '/') { code is trying to read it which is causing this kernel bug: Oops: kernel access of bad area, sig: 11 It means fdt_next_node(is doing something wrong) Any easy way how to debug it? I didn't think fdt_get_path should fail. Can you add a print of *poffset and pathp values. I think I've fixed this now and updated the branch. Please test again when you have a chance. yep. The updated branch works for Microblaze. Thanks, Michal -- Michal Simek, Ing. (M.Eng), OpenPGP - KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform signature.asc Description: OpenPGP digital signature ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 09/20] of/fdt: create common debugfs
On Fri, Apr 4, 2014 at 9:11 AM, Michal Simek mon...@monstr.eu wrote: On 04/04/2014 03:32 PM, Rob Herring wrote: On Fri, Apr 4, 2014 at 8:22 AM, Michal Simek mon...@monstr.eu wrote: On 04/04/2014 03:00 PM, Rob Herring wrote: On Fri, Apr 4, 2014 at 7:16 AM, Michal Simek mon...@monstr.eu wrote: On 04/04/2014 12:16 AM, Rob Herring wrote: From: Rob Herring r...@kernel.org Both powerpc and microblaze have the same FDT blob in debugfs feature. Move this to common location and remove the powerpc and microblaze implementations. This feature could become more useful when FDT overlay support is added. [snip] Anyway I am testing it for microblaze and getting problem caused by this patch: commit 3d2ee8571ac0580d49c3f41fa28336289934900a Author: Rob Herring r...@kernel.org Date: Wed Apr 2 15:10:14 2014 -0500 of/fdt: Convert FDT functions to use libfdt And reason is that in unflatten_dt_node() pathp = fdt_get_name(blob, *poffset, l); is returning NULL and here /* version 0x10 has a more compact unit name here instead of the full * path. we accumulate the full path size using fpsize, we'll rebuild * it later. We detect this because the first character of the name is * not '/'. */ if ((*pathp) != '/') { code is trying to read it which is causing this kernel bug: Oops: kernel access of bad area, sig: 11 It means fdt_next_node(is doing something wrong) Any easy way how to debug it? I didn't think fdt_get_path should fail. Can you add a print of *poffset and pathp values. I think I've fixed this now and updated the branch. Please test again when you have a chance. Thanks, Rob ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 09/20] of/fdt: create common debugfs
On 04/04/2014 12:16 AM, Rob Herring wrote: From: Rob Herring r...@kernel.org Both powerpc and microblaze have the same FDT blob in debugfs feature. Move this to common location and remove the powerpc and microblaze implementations. This feature could become more useful when FDT overlay support is added. This changes the path of the blob from $arch/flat-device-tree to device-tree/flat-device-tree. Signed-off-by: Rob Herring r...@kernel.org Cc: Michal Simek mon...@monstr.eu Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Paul Mackerras pau...@samba.org Cc: linuxppc-dev@lists.ozlabs.org --- arch/microblaze/kernel/prom.c | 31 --- arch/powerpc/kernel/prom.c| 21 - drivers/of/fdt.c | 24 3 files changed, 24 insertions(+), 52 deletions(-) diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c index abdfb10..1312cd2 100644 --- a/arch/microblaze/kernel/prom.c +++ b/arch/microblaze/kernel/prom.c @@ -114,34 +114,3 @@ void __init early_init_devtree(void *params) pr_debug( - early_init_devtree()\n); } - -/*** - * - * New implementation of the OF find APIs, return a refcounted - * object, call of_node_put() when done. The device tree and list - * are protected by a rw_lock. - * - * Note that property management will need some locking as well, - * this isn't dealt with yet. - * - ***/ - -#if defined(CONFIG_DEBUG_FS) defined(DEBUG) -static struct debugfs_blob_wrapper flat_dt_blob; - -static int __init export_flat_device_tree(void) -{ - struct dentry *d; - - flat_dt_blob.data = initial_boot_params; - flat_dt_blob.size = initial_boot_params-totalsize; As I see even microblaze version was buggy. ... diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index fa16a91..2085d47 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -20,6 +20,7 @@ #include linux/string.h #include linux/errno.h #include linux/slab.h +#include linux/debugfs.h #include asm/setup.h /* for COMMAND_LINE_SIZE */ #ifdef CONFIG_PPC @@ -1084,4 +1085,27 @@ void __init unflatten_and_copy_device_tree(void) unflatten_device_tree(); } +#if defined(CONFIG_DEBUG_FS) defined(DEBUG) +static struct debugfs_blob_wrapper flat_dt_blob; + +static int __init of_flat_dt_debugfs_export_fdt(void) +{ + struct dentry *d = debugfs_create_dir(device-tree, NULL); + + if (!d) + return -ENOENT; + + flat_dt_blob.data = initial_boot_params; + flat_dt_blob.size = fdt_totalsize(initial_boot_params); Have you tried to compile this? From my tests fdt_totalsize is not available for target just for host from libfdt.h drivers/of/fdt.c: In function 'of_flat_dt_debugfs_export_fdt': drivers/of/fdt.c:957:2: error: implicit declaration of function 'fdt_totalsize' [-Werror=implicit-function-declaration] Thanks, Michal -- Michal Simek, Ing. (M.Eng), OpenPGP - KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform signature.asc Description: OpenPGP digital signature ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 09/20] of/fdt: create common debugfs
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index fa16a91..2085d47 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -20,6 +20,7 @@ #include linux/string.h #include linux/errno.h #include linux/slab.h +#include linux/debugfs.h #include asm/setup.h /* for COMMAND_LINE_SIZE */ #ifdef CONFIG_PPC @@ -1084,4 +1085,27 @@ void __init unflatten_and_copy_device_tree(void) unflatten_device_tree(); } +#if defined(CONFIG_DEBUG_FS) defined(DEBUG) +static struct debugfs_blob_wrapper flat_dt_blob; + +static int __init of_flat_dt_debugfs_export_fdt(void) +{ +struct dentry *d = debugfs_create_dir(device-tree, NULL); + +if (!d) +return -ENOENT; + +flat_dt_blob.data = initial_boot_params; +flat_dt_blob.size = fdt_totalsize(initial_boot_params); Have you tried to compile this? From my tests fdt_totalsize is not available for target just for host from libfdt.h drivers/of/fdt.c: In function 'of_flat_dt_debugfs_export_fdt': drivers/of/fdt.c:957:2: error: implicit declaration of function 'fdt_totalsize' [-Werror=implicit-function-declaration] Ignore this one - there is no compilation problem. Thanks, Michal -- Michal Simek, Ing. (M.Eng), OpenPGP - KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform signature.asc Description: OpenPGP digital signature ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 09/20] of/fdt: create common debugfs
On Fri, Apr 4, 2014 at 7:16 AM, Michal Simek mon...@monstr.eu wrote: On 04/04/2014 12:16 AM, Rob Herring wrote: From: Rob Herring r...@kernel.org Both powerpc and microblaze have the same FDT blob in debugfs feature. Move this to common location and remove the powerpc and microblaze implementations. This feature could become more useful when FDT overlay support is added. This changes the path of the blob from $arch/flat-device-tree to device-tree/flat-device-tree. [snip] -#if defined(CONFIG_DEBUG_FS) defined(DEBUG) -static struct debugfs_blob_wrapper flat_dt_blob; - -static int __init export_flat_device_tree(void) -{ - struct dentry *d; - - flat_dt_blob.data = initial_boot_params; - flat_dt_blob.size = initial_boot_params-totalsize; As I see even microblaze version was buggy. How so? ... diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index fa16a91..2085d47 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -20,6 +20,7 @@ #include linux/string.h #include linux/errno.h #include linux/slab.h +#include linux/debugfs.h #include asm/setup.h /* for COMMAND_LINE_SIZE */ #ifdef CONFIG_PPC @@ -1084,4 +1085,27 @@ void __init unflatten_and_copy_device_tree(void) unflatten_device_tree(); } +#if defined(CONFIG_DEBUG_FS) defined(DEBUG) +static struct debugfs_blob_wrapper flat_dt_blob; + +static int __init of_flat_dt_debugfs_export_fdt(void) +{ + struct dentry *d = debugfs_create_dir(device-tree, NULL); + + if (!d) + return -ENOENT; + + flat_dt_blob.data = initial_boot_params; + flat_dt_blob.size = fdt_totalsize(initial_boot_params); Have you tried to compile this? From my tests fdt_totalsize is not available for target just for host from libfdt.h drivers/of/fdt.c: In function 'of_flat_dt_debugfs_export_fdt': drivers/of/fdt.c:957:2: error: implicit declaration of function 'fdt_totalsize' [-Werror=implicit-function-declaration] Ah, it needs to be re-ordered after the libfdt conversion when libfdt.h gets added. Rob ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 09/20] of/fdt: create common debugfs
On 04/04/2014 03:00 PM, Rob Herring wrote: On Fri, Apr 4, 2014 at 7:16 AM, Michal Simek mon...@monstr.eu wrote: On 04/04/2014 12:16 AM, Rob Herring wrote: From: Rob Herring r...@kernel.org Both powerpc and microblaze have the same FDT blob in debugfs feature. Move this to common location and remove the powerpc and microblaze implementations. This feature could become more useful when FDT overlay support is added. This changes the path of the blob from $arch/flat-device-tree to device-tree/flat-device-tree. [snip] -#if defined(CONFIG_DEBUG_FS) defined(DEBUG) -static struct debugfs_blob_wrapper flat_dt_blob; - -static int __init export_flat_device_tree(void) -{ - struct dentry *d; - - flat_dt_blob.data = initial_boot_params; - flat_dt_blob.size = initial_boot_params-totalsize; As I see even microblaze version was buggy. How so? if you compare it with powerpc version here is missing be to cpu conversion. ... diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index fa16a91..2085d47 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -20,6 +20,7 @@ #include linux/string.h #include linux/errno.h #include linux/slab.h +#include linux/debugfs.h #include asm/setup.h /* for COMMAND_LINE_SIZE */ #ifdef CONFIG_PPC @@ -1084,4 +1085,27 @@ void __init unflatten_and_copy_device_tree(void) unflatten_device_tree(); } +#if defined(CONFIG_DEBUG_FS) defined(DEBUG) +static struct debugfs_blob_wrapper flat_dt_blob; + +static int __init of_flat_dt_debugfs_export_fdt(void) +{ + struct dentry *d = debugfs_create_dir(device-tree, NULL); + + if (!d) + return -ENOENT; + + flat_dt_blob.data = initial_boot_params; + flat_dt_blob.size = fdt_totalsize(initial_boot_params); Have you tried to compile this? From my tests fdt_totalsize is not available for target just for host from libfdt.h drivers/of/fdt.c: In function 'of_flat_dt_debugfs_export_fdt': drivers/of/fdt.c:957:2: error: implicit declaration of function 'fdt_totalsize' [-Werror=implicit-function-declaration] Ah, it needs to be re-ordered after the libfdt conversion when libfdt.h gets added. I just pick some of them not all of them and send email. :-( Anyway I am testing it for microblaze and getting problem caused by this patch: commit 3d2ee8571ac0580d49c3f41fa28336289934900a Author: Rob Herring r...@kernel.org Date: Wed Apr 2 15:10:14 2014 -0500 of/fdt: Convert FDT functions to use libfdt And reason is that in unflatten_dt_node() pathp = fdt_get_name(blob, *poffset, l); is returning NULL and here /* version 0x10 has a more compact unit name here instead of the full * path. we accumulate the full path size using fpsize, we'll rebuild * it later. We detect this because the first character of the name is * not '/'. */ if ((*pathp) != '/') { code is trying to read it which is causing this kernel bug: Oops: kernel access of bad area, sig: 11 It means fdt_next_node(is doing something wrong) Any easy way how to debug it? Thanks, Michal -- Michal Simek, Ing. (M.Eng), OpenPGP - KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform /* * Device Tree Generator version: 1.1 * * (C) Copyright 2007-2013 Xilinx, Inc. * (C) Copyright 2007-2013 Michal Simek * (C) Copyright 2007-2012 PetaLogix Qld Pty Ltd * * Michal SIMEK mon...@monstr.eu * * CAUTION: This file is automatically generated by libgen. * Version: Xilinx EDK 2013.3 EDK_P.20131013 * Today is: Thursday, the 21 of November, 2013; 19:47:51 * * XPS project directory: . */ /dts-v1/; / { #address-cells = 1; #size-cells = 1; compatible = xlnx,microblaze; hard-reset-gpios = reset_gpio 0 1; model = .; aliases { ethernet0 = axi_ethernet_eth_buf; serial0 = rs232_uart; } ; chosen { bootargs = console=ttyS0,115200 earlyprintk; linux,stdout-path = /axi@0/serial@4040; } ; cpus { #address-cells = 1; #cpus = 0x1; #size-cells = 0; microblaze_0: cpu@0 { bus-handle = microblaze_0_axi_periph_xbar; clock-frequency = 1; compatible = xlnx,microblaze-9.2; d-cache-baseaddr = 0x8000; d-cache-highaddr = 0xbfff; d-cache-line-size = 0x20; d-cache-size = 0x4000; device_type = cpu; i-cache-baseaddr = 0x8000; i-cache-highaddr = 0xbfff; i-cache-line-size = 0x10;
Re: [PATCH 09/20] of/fdt: create common debugfs
On Fri, Apr 4, 2014 at 8:22 AM, Michal Simek mon...@monstr.eu wrote: On 04/04/2014 03:00 PM, Rob Herring wrote: On Fri, Apr 4, 2014 at 7:16 AM, Michal Simek mon...@monstr.eu wrote: On 04/04/2014 12:16 AM, Rob Herring wrote: From: Rob Herring r...@kernel.org Both powerpc and microblaze have the same FDT blob in debugfs feature. Move this to common location and remove the powerpc and microblaze implementations. This feature could become more useful when FDT overlay support is added. [snip] Anyway I am testing it for microblaze and getting problem caused by this patch: commit 3d2ee8571ac0580d49c3f41fa28336289934900a Author: Rob Herring r...@kernel.org Date: Wed Apr 2 15:10:14 2014 -0500 of/fdt: Convert FDT functions to use libfdt And reason is that in unflatten_dt_node() pathp = fdt_get_name(blob, *poffset, l); is returning NULL and here /* version 0x10 has a more compact unit name here instead of the full * path. we accumulate the full path size using fpsize, we'll rebuild * it later. We detect this because the first character of the name is * not '/'. */ if ((*pathp) != '/') { code is trying to read it which is causing this kernel bug: Oops: kernel access of bad area, sig: 11 It means fdt_next_node(is doing something wrong) Any easy way how to debug it? I didn't think fdt_get_path should fail. Can you add a print of *poffset and pathp values. Rob ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 09/20] of/fdt: create common debugfs
On 04/04/2014 03:32 PM, Rob Herring wrote: On Fri, Apr 4, 2014 at 8:22 AM, Michal Simek mon...@monstr.eu wrote: On 04/04/2014 03:00 PM, Rob Herring wrote: On Fri, Apr 4, 2014 at 7:16 AM, Michal Simek mon...@monstr.eu wrote: On 04/04/2014 12:16 AM, Rob Herring wrote: From: Rob Herring r...@kernel.org Both powerpc and microblaze have the same FDT blob in debugfs feature. Move this to common location and remove the powerpc and microblaze implementations. This feature could become more useful when FDT overlay support is added. [snip] Anyway I am testing it for microblaze and getting problem caused by this patch: commit 3d2ee8571ac0580d49c3f41fa28336289934900a Author: Rob Herring r...@kernel.org Date: Wed Apr 2 15:10:14 2014 -0500 of/fdt: Convert FDT functions to use libfdt And reason is that in unflatten_dt_node() pathp = fdt_get_name(blob, *poffset, l); is returning NULL and here /* version 0x10 has a more compact unit name here instead of the full * path. we accumulate the full path size using fpsize, we'll rebuild * it later. We detect this because the first character of the name is * not '/'. */ if ((*pathp) != '/') { code is trying to read it which is causing this kernel bug: Oops: kernel access of bad area, sig: 11 It means fdt_next_node(is doing something wrong) Any easy way how to debug it? I didn't think fdt_get_path should fail. Can you add a print of *poffset and pathp values. Early console on uart16650 at 0x40401000 bootconsole [earlyser0] enabled Ramdisk addr 0x, FDT at 0x806b96d4 Linux version 3.14.0-rc8-next-20140331-12541-g43b5fdb-dirty (monstr@monstr-desktop) (gcc version 4.6.4 20120924 (prerelease) (crosstool-NG 1.18.0) ) #51 Fri Apr 4 16:09:17 CEST 2014 - unflatten_device_tree() Unflattening device tree: magic: d00dfeed size: 00014e20 version: 0011 unflatten_dt_node blob c0298b00, c0331f84 0 unflatten_dt_node 1a c0298b3c/ -- len 0 unflatten_dt_node 8 old offset 0 unflatten_dt_node 8 new offset 6c unflatten_dt_node blob c0298b00, c0331f84 6c unflatten_dt_node 1a c0298ba8/aliases -- len 7 unflatten_dt_node 8 old offset 6c unflatten_dt_node 8 new offset cc unflatten_dt_node blob c0298b00, c0331f84 cc unflatten_dt_node 1a c0298c08/chosen -- len 6 unflatten_dt_node 8 old offset cc unflatten_dt_node 8 new offset 130 unflatten_dt_node blob c0298b00, c0331f84 130 unflatten_dt_node 1a c0298c6c/cpus -- len 4 unflatten_dt_node 8 old offset 130 unflatten_dt_node 8 new offset 16c unflatten_dt_node blob c0298b00, c0331f84 16c unflatten_dt_node 1a c0298ca8/cpu@0 -- len 5 unflatten_dt_node 8 old offset 16c unflatten_dt_node 8 new offset 7bc unflatten_dt_node blob c0298b00, c0331f84 7bc unflatten_dt_node 1a (null)/NULL -- len fffc Below is the possition of debug messages. Thanks, Michal diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index ee8853c..5422e4e 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -8,6 +8,7 @@ * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. */ +#define DEBUG #include linux/kernel.h #include linux/initrd.h @@ -116,9 +117,15 @@ static void * unflatten_dt_node(struct boot_param_header *blob, int has_name = 0; int new_format = 0; +printk(%s blob %x, %x %x\n, __func__, blob, poffset, *poffset); + pathp = fdt_get_name(blob, *poffset, l); +printk(%s 1a %p/%s -- len %x\n, __func__, pathp, pathp ? pathp : NULL, l); + allocl = l++; + if (!pathp) + while (1); /* version 0x10 has a more compact unit name here instead of the full * path. we accumulate the full path size using fpsize, we'll rebuild * it later. We detect this because the first character of the name is @@ -267,7 +274,9 @@ static void * unflatten_dt_node(struct boot_param_header *blob, } old_depth = depth; +printk(%s 8 old offset %x\n, __func__, *poffset); *poffset = fdt_next_node(blob, *poffset, depth); +printk(%s 8 new offset %x\n, __func__, *poffset); while (*poffset 0 depth old_depth) { mem = unflatten_dt_node(blob, mem, poffset, np, allnextpp, fpsize); -- Michal Simek, Ing. (M.Eng), OpenPGP - KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform signature.asc Description: OpenPGP digital signature ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev