xen/arm: Convert DEBUG_DT to Kconfig
cover xen/arm: Convert DEBUG_DT to Kconfig
Hello all,
This small patch series converts DEBUG_DT to Kconfig. This is easier to enable than having to modify the code when the user wants to debug the device tree parsing.
This series is based on the version 4 of "Kconfig debug options" [1].
Yours sincerely,
Julien Grall (2):
xen/arm: Convert DEBUG_DT to Kconfig
xen/arm: Provide device tree debugging helper in a single place
xen/Kconfig.debug | 7 +++++ xen/arch/arm/domain_build.c | 73 ++++++++++++++++++++----------------------- xen/common/device_tree.c | 6 +--- xen/include/xen/device_tree.h | 9 ++++++ 4 files changed, 51 insertions(+), 44 deletions(-)
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH 1/2 xen/arm: Convert DEBUG_DT to Kconfig
Convert device-tree debugging to 'Kconfig' as CONFIG_DEBUG_TREE_DEBUG.
The option is not enabled by default because the output is very verbose.
---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Doug Goldstein <[email protected]>
--- xen/Kconfig.debug | 7 +++++++ xen/arch/arm/domain_build.c | 4 +--- xen/common/device_tree.c | 4 +--- 3 files changed, 9 insertions(+), 6 deletions(-)
xen/Kconfig.debug +7 -0
@@ -55,6 +55,13 @@ config VERBOSE_DEBUG Guest output from HYPERVISOR_console_io and hypervisor parsing ELF images (dom0) is logged in the Xen ring buffer. +config DEVICE_TREE_DEBUG + bool "Device tree debug messages" + depends on HAS_DEVICE_TREE + ---help--- + Device tree parsing and DOM0 device tree building messages is + logged in the Xen ring buffer + endif # DEBUG || EXPERT endmenu
xen/arch/arm/domain_build.c +1 -3
@@ -42,9 +42,7 @@ static void __init parse_dom0_mem(const char *s) }custom_param ("dom0_mem" , parse_dom0_mem); -//#define DEBUG_DT - -#ifdef DEBUG_DT +#ifdef CONFIG_DEVICE_TREE_DEBUG # define DPRINT(fmt, args...) printk(XENLOG_DEBUG fmt, ##args)#else # define DPRINT(fmt, args...) do {} while ( 0 )
xen/common/device_tree.c +1 -3
@@ -54,9 +54,7 @@ struct dt_alias_prop {static LIST_HEAD (aliases_lookup); -// #define DEBUG_DT - -#ifdef DEBUG_DT +#ifdef CONFIG_DEVICE_TREE_DEBUG # define dt_dprintk(fmt, args...) printk(XENLOG_DEBUG fmt, ##args)static void dt_dump_addr (const char *s,const __be32 *addr,int na) {
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 29 lines · Julien Grall
Convert device-tree debugging to '
Kconfig' asCONFIG_DEBUG_TREE_DEBUG.The option is not enabled by default because the output is very verbose.
Signed-off-by Julien Grall <[email protected]>---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Doug Goldstein <[email protected]>--- xen/Kconfig.debug | 7 +++++++ xen/arch/arm/domain_build.c | 4 +--- xen/common/device_tree.c | 4 +--- 3 files changed, 9 insertions(+), 6 deletions(-)xen/Kconfig.debug +0
-0
xen/Kconfig.debug config VERBOSE_DEBUG · line 63
Quoted 9 lines
xen/Kconfig.debug +6
-0@@ -55,6 +55,13 @@ config VERBOSE_DEBUG Guest output from HYPERVISOR_console_io and hypervisor parsing ELF images (dom0) is logged in the Xen ring buffer. +config DEVICE_TREE_DEBUG + bool "Device tree debug messages" + depends on HAS_DEVICE_TREE + ---help--- + Device tree parsing and DOM0 device tree building messages is + logged in the Xen ring buffer
s/is logged/are logged/
Also missing stop at the end.
Perhaps also add:
"If unsure, say N here."
Or could this be part of the VERBOSE one (which spews out data about ELF parsing and allows guests to do the console_io_write hypercalls?).
Quoted 37 lines
xen/Kconfig.debug +1
-0+ endif # DEBUG || EXPERT endmenuxen/arch/arm/domain_build.c +1
-3@@ -42,9 +42,7 @@ static void __init parse_dom0_mem(const char *s) }custom_param ("dom0_mem" , parse_dom0_mem); -//#define DEBUG_DT - -#ifdef DEBUG_DT +#ifdef CONFIG_DEVICE_TREE_DEBUG # define DPRINT(fmt, args...) printk(XENLOG_DEBUG fmt, ##args)#else # define DPRINT(fmt, args...) do {} while ( 0 )xen/common/device_tree.c +1
-3@@ -54,9 +54,7 @@ struct dt_alias_prop {static LIST_HEAD (aliases_lookup); -// #define DEBUG_DT - -#ifdef DEBUG_DT +#ifdef CONFIG_DEVICE_TREE_DEBUG # define dt_dprintk(fmt, args...) printk(XENLOG_DEBUG fmt, ##args)static void dt_dump_addr (const char *s,const __be32 *addr,int na) {Signature · 1 line
1.9.1
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Hi Konrad,
Quoted 42 lines · Konrad Rzeszutek Wilk
Quoted 29 lines · Julien Grall
Convert device-tree debugging to '
Kconfig' asCONFIG_DEBUG_TREE_DEBUG.The option is not enabled by default because the output is very verbose.
Signed-off-by Julien Grall <[email protected]>---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Doug Goldstein <[email protected]>--- xen/Kconfig.debug | 7 +++++++ xen/arch/arm/domain_build.c | 4 +--- xen/common/device_tree.c | 4 +--- 3 files changed, 9 insertions(+), 6 deletions(-)xen/Kconfig.debug +0
-0xen/Kconfig.debug config VERBOSE_DEBUG · line 63
Quoted 9 lines
xen/Kconfig.debug +6
-0@@ -55,6 +55,13 @@ config VERBOSE_DEBUG Guest output from HYPERVISOR_console_io and hypervisor parsing ELF images (dom0) is logged in the Xen ring buffer. +config DEVICE_TREE_DEBUG + bool "Device tree debug messages" + depends on HAS_DEVICE_TREE + ---help--- + Device tree parsing and DOM0 device tree building messages is + logged in the Xen ring buffers/is logged/are logged/
Quoted 5 lines
Also missing stop at the end.
Perhaps also add:
"If unsure, say N here."
I will do all the 3 changes in the next version.
Quoted 3 lines
Or could this be part of the VERBOSE one (which spews out data about ELF parsing and allows guests to do the
console_io_writehypercalls?).
The debug messages from the device tree is really verbose (it will obscure useful boot messages). So it should only be enabled when Xen does not parse correctly the device tree.
Regards,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 2 lines · Julien Grall
Convert device-tree debugging to '
Kconfig' asCONFIG_DEBUG_TREE_DEBUG.
^^^^^
Hi Julien,
You've got a typo in the commit message, other than that:
Cheers,
Edgar
Quoted 78 lines
The option is not enabled by default because the output is very verbose.
Signed-off-by Julien Grall <[email protected]>---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Doug Goldstein <[email protected]>--- xen/Kconfig.debug | 7 +++++++ xen/arch/arm/domain_build.c | 4 +--- xen/common/device_tree.c | 4 +--- 3 files changed, 9 insertions(+), 6 deletions(-)xen/Kconfig.debug +7
-0@@ -55,6 +55,13 @@ config VERBOSE_DEBUG Guest output from HYPERVISOR_console_io and hypervisor parsing ELF images (dom0) is logged in the Xen ring buffer. +config DEVICE_TREE_DEBUG + bool "Device tree debug messages" + depends on HAS_DEVICE_TREE + ---help--- + Device tree parsing and DOM0 device tree building messages is + logged in the Xen ring buffer + endif # DEBUG || EXPERT endmenuxen/arch/arm/domain_build.c +1
-3@@ -42,9 +42,7 @@ static void __init parse_dom0_mem(const char *s) }custom_param ("dom0_mem" , parse_dom0_mem); -//#define DEBUG_DT - -#ifdef DEBUG_DT +#ifdef CONFIG_DEVICE_TREE_DEBUG # define DPRINT(fmt, args...) printk(XENLOG_DEBUG fmt, ##args)#else # define DPRINT(fmt, args...) do {} while ( 0 )xen/common/device_tree.c +1
-3@@ -54,9 +54,7 @@ struct dt_alias_prop {static LIST_HEAD (aliases_lookup); -// #define DEBUG_DT - -#ifdef DEBUG_DT +#ifdef CONFIG_DEVICE_TREE_DEBUG # define dt_dprintk(fmt, args...) printk(XENLOG_DEBUG fmt, ##args)static void dt_dump_addr (const char *s,const __be32 *addr,int na) {Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH 2/2 xen/arm: Provide device tree debugging helper in a single place
In reply to Julien GrallProvide helper to debug the device tree in device_tree.h. This will avoid to have to redeclare helper for each file requiring debug.
Also replace DPRINT by the new helper dt_dprintk in domain_build.c
--- xen/arch/arm/domain_build.c | 71 +++++++++++++++++++++---------------------- xen/common/device_tree.c | 2 -- xen/include/xen/device_tree.h | 9 ++++++ 3 files changed, 43 insertions(+), 39 deletions(-)
xen/arch/arm/domain_build.c +34 -37
@@ -42,12 +42,6 @@ static void __init parse_dom0_mem(const char *s) }custom_param ("dom0_mem" , parse_dom0_mem); -#ifdef CONFIG_DEVICE_TREE_DEBUG -# define DPRINT(fmt, args...) printk(XENLOG_DEBUG fmt, ##args) -#else -# define DPRINT(fmt, args...) do {} while ( 0 ) -#endif -//#define DEBUG_11_ALLOCATION #ifdef DEBUG_11_ALLOCATION # define D11PRINT(fmt, args...) printk(XENLOG_DEBUG fmt, ##args)
@@ -364,7 +358,7 @@ static void allocate_memory(struct domain *d, struct kernel_info *kinfo) {int l; -DPRINT ("memory node\n" ); +dt_dprintk ("memory node\n" ); reg_size =dt_cells_to_size (dt_n_addr_cells (memory) +dt_n_size_cells (memory));
@@ -571,7 +565,8 @@ static int make_memory_node(const struct domain *d,__be32 reg[nr_cells];__be32 *cells; -DPRINT ("Create memory node (reg size %d, nr cells %d)\n" , reg_size, nr_cells); +dt_dprintk ("Create memory node (reg size %d, nr cells %d)\n" , + reg_size, nr_cells);/* ePAPR 3.4 */ res =fdt_begin_node (fdt,"memory" );
@@ -588,8 +583,8 @@ static int make_memory_node(const struct domain *d,u64 start = kinfo->mem.bank[i].start;u64 size = kinfo->mem.bank[i].size; -DPRINT (" Bank %d: %#" PRIx64"->%#" PRIx64"\n" , - i, start, start + size); +dt_dprintk (" Bank %d: %#" PRIx64"->%#" PRIx64"\n" , + i, start, start + size);dt_child_set_range (&cells, parent, start, size); }
@@ -618,7 +613,7 @@ static int make_hypervisor_node(const struct kernel_info *kinfo,int sizecells =dt_child_n_size_cells (parent);void *fdt = kinfo->fdt; -DPRINT ("Create hypervisor node\n" ); +dt_dprintk ("Create hypervisor node\n" );/* * Sanity-check address sizes, since addresses and sizes which do
@@ -667,7 +662,7 @@ static int make_psci_node(void *fdt, const struct dt_device_node *parent)"arm,psci-0.2""\0" "arm,psci" ; -DPRINT ("Create PSCI node\n" ); +dt_dprintk ("Create PSCI node\n" );/* See linux Documentation/devicetree/bindings/arm/psci.txt */ res =fdt_begin_node (fdt,"psci" );
@@ -710,7 +705,7 @@ static int make_cpus_node(const struct domain *d, void *fdt,bool_t clock_valid;uint64_t mpidr_aff; -DPRINT ("Create cpus node\n" ); +dt_dprintk ("Create cpus node\n" );if ( !cpus ) {
@@ -765,7 +760,8 @@ static int make_cpus_node(const struct domain *d, void *fdt,* is enough for the current max vcpu number. */ mpidr_aff =vcpuid_to_vaffinity (cpu); -DPRINT ("Create cpu@%" PRIx64" (logical CPUID: %d) node\n" , mpidr_aff, cpu); +dt_dprintk ("Create cpu@%" PRIx64" (logical CPUID: %d) node\n" , + mpidr_aff, cpu);snprintf (buf,sizeof (buf),"cpu@%" PRIx64, mpidr_aff); res =fdt_begin_node (fdt, buf);
@@ -821,11 +817,11 @@ static int make_gic_node(const struct domain *d, void *fdt,*/ if ( node != dt_interrupt_controller ) { -DPRINT (" Skipping (secondary GIC)\n" ); +dt_dprintk (" Skipping (secondary GIC)\n" );return 0 ; } -DPRINT ("Create gic node\n" ); +dt_dprintk ("Create gic node\n" ); res =fdt_begin_node (fdt,"interrupt-controller" );if ( res )
@@ -837,7 +833,7 @@ static int make_gic_node(const struct domain *d, void *fdt,*/ if ( gic->phandle ) { -DPRINT (" Set phandle = 0x%x\n" , gic->phandle); +dt_dprintk (" Set phandle = 0x%x\n" , gic->phandle); res =fdt_property_cell (fdt,"phandle" , gic->phandle);if ( res )return res;
@@ -894,7 +890,7 @@ static int make_timer_node(const struct domain *d, void *fdt,u32 clock_frequency;bool_t clock_valid; -DPRINT ("Create timer node\n" ); +dt_dprintk ("Create timer node\n" ); dev =dt_find_matching_node (NULL , timer_ids);if ( !dev )
@@ -922,15 +918,15 @@ static int make_timer_node(const struct domain *d, void *fdt,* level-sensitive interrupt */ irq =timer_get_irq (TIMER_PHYS_SECURE_PPI ); -DPRINT (" Secure interrupt %u\n" , irq); +dt_dprintk (" Secure interrupt %u\n" , irq);set_interrupt_ppi (intrs[0 ], irq,0xf ,IRQ_TYPE_LEVEL_LOW ); irq =timer_get_irq (TIMER_PHYS_NONSECURE_PPI ); -DPRINT (" Non secure interrupt %u\n" , irq); +dt_dprintk (" Non secure interrupt %u\n" , irq);set_interrupt_ppi (intrs[1 ], irq,0xf ,IRQ_TYPE_LEVEL_LOW ); irq =timer_get_irq (TIMER_VIRT_PPI ); -DPRINT (" Virt interrupt %u\n" , irq); +dt_dprintk (" Virt interrupt %u\n" , irq);set_interrupt_ppi (intrs[2 ], irq,0xf ,IRQ_TYPE_LEVEL_LOW ); res =fdt_property_interrupts (fdt, intrs,3 );
@@ -984,7 +980,7 @@ static int map_irq_to_domain(const struct dt_device_node *dev, } } -DPRINT (" - IRQ: %u\n" , irq); +dt_dprintk (" - IRQ: %u\n" , irq);return 0 ; }
@@ -1053,7 +1049,7 @@ static int map_range_to_domain(const struct dt_device_node *dev, } } -DPRINT (" - MMIO: %010" PRIx64" - %010" PRIx64"\n" , addr, addr + len); +dt_dprintk (" - MMIO: %010" PRIx64" - %010" PRIx64"\n" , addr, addr + len);return 0 ; }
@@ -1070,7 +1066,8 @@ static int map_device_children(struct domain *d,if (dt_device_type_is_equal (dev,"pci" ) ) { -DPRINT ("Mapping children of %s to guest\n" ,dt_node_full_name (dev)); +dt_dprintk ("Mapping children of %s to guest\n" , +dt_node_full_name (dev)); ret =dt_for_each_irq_map (dev, &map_dt_irq_to_domain, d);if ( ret <0 )
@@ -1105,12 +1102,12 @@ static int handle_device(struct domain *d, struct dt_device_node *dev) nirq =dt_number_of_irq (dev); naddr =dt_number_of_address (dev); -DPRINT ("%s passthrough = %d nirq = %d naddr = %u\n" ,dt_node_full_name (dev), - need_mapping, nirq, naddr); +dt_dprintk ("%s passthrough = %d nirq = %d naddr = %u\n" , +dt_node_full_name (dev), need_mapping, nirq, naddr);if (dt_device_is_protected (dev) && need_mapping ) { -DPRINT ("%s setup iommu\n" ,dt_node_full_name (dev)); +dt_dprintk ("%s setup iommu\n" ,dt_node_full_name (dev)); res =iommu_assign_dt_device (d, dev);if ( res ) {
@@ -1137,8 +1134,8 @@ static int handle_device(struct domain *d, struct dt_device_node *dev)*/ if ( rirq.controller != dt_interrupt_controller ) { -DPRINT ("irq %u not connected to primary controller." -"Connected to %s\n" , i,dt_node_full_name (rirq.controller)); +dt_dprintk ("irq %u not connected to primary controller. Connected to %s\n" , + i,dt_node_full_name (rirq.controller));continue ; }
@@ -1217,17 +1214,17 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo, path =dt_node_full_name (node); -DPRINT ("handle %s\n" , path); +dt_dprintk ("handle %s\n" , path);/* Skip theses nodes and the sub-nodes */ if (dt_match_node (skip_matches, node) ) { -DPRINT (" Skip it (matched)\n" ); +dt_dprintk (" Skip it (matched)\n" );return 0 ; }if (platform_device_is_blacklisted (node) ) { -DPRINT (" Skip it (blacklisted)\n" ); +dt_dprintk (" Skip it (blacklisted)\n" );return 0 ; }
@@ -1243,7 +1240,7 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo,/* Skip nodes used by Xen */ if (dt_device_used_by (node) ==DOMID_XEN ) { -DPRINT (" Skip it (used by Xen)\n" ); +dt_dprintk (" Skip it (used by Xen)\n" );return 0 ; }
@@ -1253,7 +1250,7 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo,*/ if (device_get_class (node) ==DEVICE_IOMMU ) { -DPRINT (" IOMMU, skip it\n" ); +dt_dprintk (" IOMMU, skip it\n" );return 0 ; }
@@ -1428,7 +1425,7 @@ static int acpi_make_chosen_node(const struct kernel_info *kinfo)const struct bootmodule *mod = kinfo->kernel_bootmodule;void *fdt = kinfo->fdt; -DPRINT ("Create chosen node\n" ); +dt_dprintk ("Create chosen node\n" ); res =fdt_begin_node (fdt,"chosen" );if ( res )return res;
@@ -1472,7 +1469,7 @@ static int acpi_make_hypervisor_node(const struct kernel_info *kinfo,/* Convenience alias */ void *fdt = kinfo->fdt; -DPRINT ("Create hypervisor node\n" ); +dt_dprintk ("Create hypervisor node\n" );/* See linux Documentation/devicetree/bindings/arm/xen.txt */ res =fdt_begin_node (fdt,"hypervisor" );
@@ -1502,7 +1499,7 @@ static int create_acpi_dtb(struct kernel_info *kinfo, struct membank tbl_add[])int new_size;int ret; -DPRINT ("Prepare a min DTB for DOM0\n" ); +dt_dprintk ("Prepare a min DTB for DOM0\n" );/* Allocate min size for DT */ new_size =ACPI_DOM0_FDT_MIN_SIZE ;
xen/common/device_tree.c +0 -2
@@ -55,7 +55,6 @@ struct dt_alias_prop {static LIST_HEAD (aliases_lookup);#ifdef CONFIG_DEVICE_TREE_DEBUG -# define dt_dprintk(fmt, args...) printk(XENLOG_DEBUG fmt, ##args)static void dt_dump_addr (const char *s,const __be32 *addr,int na) {dt_dprintk ("%s" , s);
@@ -64,7 +63,6 @@ static void dt_dump_addr(const char *s, const __be32 *addr, int na) dt_dprintk("\n"); }#else -# define dt_dprintk(fmt, args...) do {} while ( 0 )static void dt_dump_addr (const char *s,const __be32 *addr,int na) { }#endif
xen/include/xen/device_tree.h +9 -0
@@ -753,6 +753,15 @@ int dt_parse_phandle_with_args(const struct dt_device_node *np, const char *cells_name, int index, struct dt_phandle_args *out_args); +#ifdef CONFIG_DEVICE_TREE_DEBUG +#define dt_dprintk(fmt, args...) \ + printk(XENLOG_DEBUG fmt, ## args) +#else +static inline void +__attribute__ ((__format__ (__printf__,1 ,2 ))) +dt_dprintk (const char *fmt, ...) {} +#endif +#endif /* __XEN_DEVICE_TREE_H */ /*
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [for-4.8 2/2] xen/arm: Provide device tree debugging helper in a single place
Quoted 4 lines · Julien Grall
Provide helper to debug the device tree in
device_tree.h. This will avoid to have to redeclare helper for each file requiring debug.Also replace DPRINT by the new helper
dt_dprintkindomain_build.c
Quoted 312 lines
Signed-off-by Julien Grall <[email protected]>--- xen/arch/arm/domain_build.c | 71 +++++++++++++++++++++---------------------- xen/common/device_tree.c | 2 -- xen/include/xen/device_tree.h | 9 ++++++ 3 files changed, 43 insertions(+), 39 deletions(-)xen/arch/arm/domain_build.c +34
-37@@ -42,12 +42,6 @@ static void __init parse_dom0_mem(const char *s) }custom_param ("dom0_mem" , parse_dom0_mem); -#ifdef CONFIG_DEVICE_TREE_DEBUG -# define DPRINT(fmt, args...) printk(XENLOG_DEBUG fmt, ##args) -#else -# define DPRINT(fmt, args...) do {} while ( 0 ) -#endif -//#define DEBUG_11_ALLOCATION #ifdef DEBUG_11_ALLOCATION # define D11PRINT(fmt, args...) printk(XENLOG_DEBUG fmt, ##args)@@ -364,7 +358,7 @@ static void allocate_memory(struct domain *d, struct kernel_info *kinfo) {int l; -DPRINT ("memory node\n" ); +dt_dprintk ("memory node\n" ); reg_size =dt_cells_to_size (dt_n_addr_cells (memory) +dt_n_size_cells (memory));@@ -571,7 +565,8 @@ static int make_memory_node(const struct domain *d,__be32 reg[nr_cells];__be32 *cells; -DPRINT ("Create memory node (reg size %d, nr cells %d)\n" , reg_size, nr_cells); +dt_dprintk ("Create memory node (reg size %d, nr cells %d)\n" , + reg_size, nr_cells);/* ePAPR 3.4 */ res =fdt_begin_node (fdt,"memory" );@@ -588,8 +583,8 @@ static int make_memory_node(const struct domain *d,u64 start = kinfo->mem.bank[i].start;u64 size = kinfo->mem.bank[i].size; -DPRINT (" Bank %d: %#" PRIx64"->%#" PRIx64"\n" , - i, start, start + size); +dt_dprintk (" Bank %d: %#" PRIx64"->%#" PRIx64"\n" , + i, start, start + size);dt_child_set_range (&cells, parent, start, size); }@@ -618,7 +613,7 @@ static int make_hypervisor_node(const struct kernel_info *kinfo,int sizecells =dt_child_n_size_cells (parent);void *fdt = kinfo->fdt; -DPRINT ("Create hypervisor node\n" ); +dt_dprintk ("Create hypervisor node\n" );/* * Sanity-check address sizes, since addresses and sizes which do @@ -667,7 +662,7 @@ static int make_psci_node(void *fdt, const struct dt_device_node *parent)"arm,psci-0.2""\0" "arm,psci" ; -DPRINT ("Create PSCI node\n" ); +dt_dprintk ("Create PSCI node\n" );/* See linux Documentation/devicetree/bindings/arm/psci.txt */ res =fdt_begin_node (fdt,"psci" );@@ -710,7 +705,7 @@ static int make_cpus_node(const struct domain *d, void *fdt,bool_t clock_valid;uint64_t mpidr_aff; -DPRINT ("Create cpus node\n" ); +dt_dprintk ("Create cpus node\n" );if ( !cpus ) {@@ -765,7 +760,8 @@ static int make_cpus_node(const struct domain *d, void *fdt,* is enough for the current max vcpu number. */ mpidr_aff =vcpuid_to_vaffinity (cpu); -DPRINT ("Create cpu@%" PRIx64" (logical CPUID: %d) node\n" , mpidr_aff, cpu); +dt_dprintk ("Create cpu@%" PRIx64" (logical CPUID: %d) node\n" , + mpidr_aff, cpu);snprintf (buf,sizeof (buf),"cpu@%" PRIx64, mpidr_aff); res =fdt_begin_node (fdt, buf);@@ -821,11 +817,11 @@ static int make_gic_node(const struct domain *d, void *fdt,*/ if ( node != dt_interrupt_controller ) { -DPRINT (" Skipping (secondary GIC)\n" ); +dt_dprintk (" Skipping (secondary GIC)\n" );return 0 ; } -DPRINT ("Create gic node\n" ); +dt_dprintk ("Create gic node\n" ); res =fdt_begin_node (fdt,"interrupt-controller" );if ( res )@@ -837,7 +833,7 @@ static int make_gic_node(const struct domain *d, void *fdt,*/ if ( gic->phandle ) { -DPRINT (" Set phandle = 0x%x\n" , gic->phandle); +dt_dprintk (" Set phandle = 0x%x\n" , gic->phandle); res =fdt_property_cell (fdt,"phandle" , gic->phandle);if ( res )return res;@@ -894,7 +890,7 @@ static int make_timer_node(const struct domain *d, void *fdt,u32 clock_frequency;bool_t clock_valid; -DPRINT ("Create timer node\n" ); +dt_dprintk ("Create timer node\n" ); dev =dt_find_matching_node (NULL , timer_ids);if ( !dev )@@ -922,15 +918,15 @@ static int make_timer_node(const struct domain *d, void *fdt,* level-sensitive interrupt */ irq =timer_get_irq (TIMER_PHYS_SECURE_PPI ); -DPRINT (" Secure interrupt %u\n" , irq); +dt_dprintk (" Secure interrupt %u\n" , irq);set_interrupt_ppi (intrs[0 ], irq,0xf ,IRQ_TYPE_LEVEL_LOW ); irq =timer_get_irq (TIMER_PHYS_NONSECURE_PPI ); -DPRINT (" Non secure interrupt %u\n" , irq); +dt_dprintk (" Non secure interrupt %u\n" , irq);set_interrupt_ppi (intrs[1 ], irq,0xf ,IRQ_TYPE_LEVEL_LOW ); irq =timer_get_irq (TIMER_VIRT_PPI ); -DPRINT (" Virt interrupt %u\n" , irq); +dt_dprintk (" Virt interrupt %u\n" , irq);set_interrupt_ppi (intrs[2 ], irq,0xf ,IRQ_TYPE_LEVEL_LOW ); res =fdt_property_interrupts (fdt, intrs,3 );@@ -984,7 +980,7 @@ static int map_irq_to_domain(const struct dt_device_node *dev, } } -DPRINT (" - IRQ: %u\n" , irq); +dt_dprintk (" - IRQ: %u\n" , irq);return 0 ; }@@ -1053,7 +1049,7 @@ static int map_range_to_domain(const struct dt_device_node *dev, } } -DPRINT (" - MMIO: %010" PRIx64" - %010" PRIx64"\n" , addr, addr + len); +dt_dprintk (" - MMIO: %010" PRIx64" - %010" PRIx64"\n" , addr, addr + len);return 0 ; }@@ -1070,7 +1066,8 @@ static int map_device_children(struct domain *d,if (dt_device_type_is_equal (dev,"pci" ) ) { -DPRINT ("Mapping children of %s to guest\n" ,dt_node_full_name (dev)); +dt_dprintk ("Mapping children of %s to guest\n" , +dt_node_full_name (dev)); ret =dt_for_each_irq_map (dev, &map_dt_irq_to_domain, d);if ( ret <0 )@@ -1105,12 +1102,12 @@ static int handle_device(struct domain *d, struct dt_device_node *dev) nirq =dt_number_of_irq (dev); naddr =dt_number_of_address (dev); -DPRINT ("%s passthrough = %d nirq = %d naddr = %u\n" ,dt_node_full_name (dev), - need_mapping, nirq, naddr); +dt_dprintk ("%s passthrough = %d nirq = %d naddr = %u\n" , +dt_node_full_name (dev), need_mapping, nirq, naddr);if (dt_device_is_protected (dev) && need_mapping ) { -DPRINT ("%s setup iommu\n" ,dt_node_full_name (dev)); +dt_dprintk ("%s setup iommu\n" ,dt_node_full_name (dev)); res =iommu_assign_dt_device (d, dev);if ( res ) {@@ -1137,8 +1134,8 @@ static int handle_device(struct domain *d, struct dt_device_node *dev)*/ if ( rirq.controller != dt_interrupt_controller ) { -DPRINT ("irq %u not connected to primary controller." -"Connected to %s\n" , i,dt_node_full_name (rirq.controller)); +dt_dprintk ("irq %u not connected to primary controller. Connected to %s\n" , + i,dt_node_full_name (rirq.controller));continue ; }@@ -1217,17 +1214,17 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo, path =dt_node_full_name (node); -DPRINT ("handle %s\n" , path); +dt_dprintk ("handle %s\n" , path);/* Skip theses nodes and the sub-nodes */ if (dt_match_node (skip_matches, node) ) { -DPRINT (" Skip it (matched)\n" ); +dt_dprintk (" Skip it (matched)\n" );return 0 ; }if (platform_device_is_blacklisted (node) ) { -DPRINT (" Skip it (blacklisted)\n" ); +dt_dprintk (" Skip it (blacklisted)\n" );return 0 ; }@@ -1243,7 +1240,7 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo,/* Skip nodes used by Xen */ if (dt_device_used_by (node) ==DOMID_XEN ) { -DPRINT (" Skip it (used by Xen)\n" ); +dt_dprintk (" Skip it (used by Xen)\n" );return 0 ; }@@ -1253,7 +1250,7 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo,*/ if (device_get_class (node) ==DEVICE_IOMMU ) { -DPRINT (" IOMMU, skip it\n" ); +dt_dprintk (" IOMMU, skip it\n" );return 0 ; }@@ -1428,7 +1425,7 @@ static int acpi_make_chosen_node(const struct kernel_info *kinfo)const struct bootmodule *mod = kinfo->kernel_bootmodule;void *fdt = kinfo->fdt; -DPRINT ("Create chosen node\n" ); +dt_dprintk ("Create chosen node\n" ); res =fdt_begin_node (fdt,"chosen" );if ( res )return res;@@ -1472,7 +1469,7 @@ static int acpi_make_hypervisor_node(const struct kernel_info *kinfo,/* Convenience alias */ void *fdt = kinfo->fdt; -DPRINT ("Create hypervisor node\n" ); +dt_dprintk ("Create hypervisor node\n" );/* See linux Documentation/devicetree/bindings/arm/xen.txt */ res =fdt_begin_node (fdt,"hypervisor" );@@ -1502,7 +1499,7 @@ static int create_acpi_dtb(struct kernel_info *kinfo, struct membank tbl_add[])int new_size;int ret; -DPRINT ("Prepare a min DTB for DOM0\n" ); +dt_dprintk ("Prepare a min DTB for DOM0\n" );/* Allocate min size for DT */ new_size =ACPI_DOM0_FDT_MIN_SIZE ;xen/common/device_tree.c +0
-2@@ -55,7 +55,6 @@ struct dt_alias_prop {static LIST_HEAD (aliases_lookup);#ifdef CONFIG_DEVICE_TREE_DEBUG -# define dt_dprintk(fmt, args...) printk(XENLOG_DEBUG fmt, ##args)static void dt_dump_addr (const char *s,const __be32 *addr,int na) {dt_dprintk ("%s" , s);@@ -64,7 +63,6 @@ static void dt_dump_addr(const char *s, const __be32 *addr, int na) dt_dprintk("\n"); }#else -# define dt_dprintk(fmt, args...) do {} while ( 0 )static void dt_dump_addr (const char *s,const __be32 *addr,int na) { }#endif xen/include/xen/device_tree.h +9
-0@@ -753,6 +753,15 @@ int dt_parse_phandle_with_args(const struct dt_device_node *np, const char *cells_name, int index, struct dt_phandle_args *out_args); +#ifdef CONFIG_DEVICE_TREE_DEBUG +#define dt_dprintk(fmt, args...) \ + printk(XENLOG_DEBUG fmt, ## args) +#else +static inline void +__attribute__ ((__format__ (__printf__,1 ,2 ))) +dt_dprintk (const char *fmt, ...) {} +#endif +#endif /* __XEN_DEVICE_TREE_H */ /* Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [for-4.8 2/2] xen/arm: Provide device tree debugging helper in a single place
In reply to Julien GrallQuoted 4 lines · Julien Grall
Provide helper to debug the device tree in
device_tree.h. This will avoid to have to redeclare helper for each file requiring debug.Also replace DPRINT by the new helper
dt_dprintkindomain_build.c
Quoted 312 lines
Signed-off-by Julien Grall <[email protected]>--- xen/arch/arm/domain_build.c | 71 +++++++++++++++++++++---------------------- xen/common/device_tree.c | 2 -- xen/include/xen/device_tree.h | 9 ++++++ 3 files changed, 43 insertions(+), 39 deletions(-)xen/arch/arm/domain_build.c +34
-37@@ -42,12 +42,6 @@ static void __init parse_dom0_mem(const char *s) }custom_param ("dom0_mem" , parse_dom0_mem); -#ifdef CONFIG_DEVICE_TREE_DEBUG -# define DPRINT(fmt, args...) printk(XENLOG_DEBUG fmt, ##args) -#else -# define DPRINT(fmt, args...) do {} while ( 0 ) -#endif -//#define DEBUG_11_ALLOCATION #ifdef DEBUG_11_ALLOCATION # define D11PRINT(fmt, args...) printk(XENLOG_DEBUG fmt, ##args)@@ -364,7 +358,7 @@ static void allocate_memory(struct domain *d, struct kernel_info *kinfo) {int l; -DPRINT ("memory node\n" ); +dt_dprintk ("memory node\n" ); reg_size =dt_cells_to_size (dt_n_addr_cells (memory) +dt_n_size_cells (memory));@@ -571,7 +565,8 @@ static int make_memory_node(const struct domain *d,__be32 reg[nr_cells];__be32 *cells; -DPRINT ("Create memory node (reg size %d, nr cells %d)\n" , reg_size, nr_cells); +dt_dprintk ("Create memory node (reg size %d, nr cells %d)\n" , + reg_size, nr_cells);/* ePAPR 3.4 */ res =fdt_begin_node (fdt,"memory" );@@ -588,8 +583,8 @@ static int make_memory_node(const struct domain *d,u64 start = kinfo->mem.bank[i].start;u64 size = kinfo->mem.bank[i].size; -DPRINT (" Bank %d: %#" PRIx64"->%#" PRIx64"\n" , - i, start, start + size); +dt_dprintk (" Bank %d: %#" PRIx64"->%#" PRIx64"\n" , + i, start, start + size);dt_child_set_range (&cells, parent, start, size); }@@ -618,7 +613,7 @@ static int make_hypervisor_node(const struct kernel_info *kinfo,int sizecells =dt_child_n_size_cells (parent);void *fdt = kinfo->fdt; -DPRINT ("Create hypervisor node\n" ); +dt_dprintk ("Create hypervisor node\n" );/* * Sanity-check address sizes, since addresses and sizes which do @@ -667,7 +662,7 @@ static int make_psci_node(void *fdt, const struct dt_device_node *parent)"arm,psci-0.2""\0" "arm,psci" ; -DPRINT ("Create PSCI node\n" ); +dt_dprintk ("Create PSCI node\n" );/* See linux Documentation/devicetree/bindings/arm/psci.txt */ res =fdt_begin_node (fdt,"psci" );@@ -710,7 +705,7 @@ static int make_cpus_node(const struct domain *d, void *fdt,bool_t clock_valid;uint64_t mpidr_aff; -DPRINT ("Create cpus node\n" ); +dt_dprintk ("Create cpus node\n" );if ( !cpus ) {@@ -765,7 +760,8 @@ static int make_cpus_node(const struct domain *d, void *fdt,* is enough for the current max vcpu number. */ mpidr_aff =vcpuid_to_vaffinity (cpu); -DPRINT ("Create cpu@%" PRIx64" (logical CPUID: %d) node\n" , mpidr_aff, cpu); +dt_dprintk ("Create cpu@%" PRIx64" (logical CPUID: %d) node\n" , + mpidr_aff, cpu);snprintf (buf,sizeof (buf),"cpu@%" PRIx64, mpidr_aff); res =fdt_begin_node (fdt, buf);@@ -821,11 +817,11 @@ static int make_gic_node(const struct domain *d, void *fdt,*/ if ( node != dt_interrupt_controller ) { -DPRINT (" Skipping (secondary GIC)\n" ); +dt_dprintk (" Skipping (secondary GIC)\n" );return 0 ; } -DPRINT ("Create gic node\n" ); +dt_dprintk ("Create gic node\n" ); res =fdt_begin_node (fdt,"interrupt-controller" );if ( res )@@ -837,7 +833,7 @@ static int make_gic_node(const struct domain *d, void *fdt,*/ if ( gic->phandle ) { -DPRINT (" Set phandle = 0x%x\n" , gic->phandle); +dt_dprintk (" Set phandle = 0x%x\n" , gic->phandle); res =fdt_property_cell (fdt,"phandle" , gic->phandle);if ( res )return res;@@ -894,7 +890,7 @@ static int make_timer_node(const struct domain *d, void *fdt,u32 clock_frequency;bool_t clock_valid; -DPRINT ("Create timer node\n" ); +dt_dprintk ("Create timer node\n" ); dev =dt_find_matching_node (NULL , timer_ids);if ( !dev )@@ -922,15 +918,15 @@ static int make_timer_node(const struct domain *d, void *fdt,* level-sensitive interrupt */ irq =timer_get_irq (TIMER_PHYS_SECURE_PPI ); -DPRINT (" Secure interrupt %u\n" , irq); +dt_dprintk (" Secure interrupt %u\n" , irq);set_interrupt_ppi (intrs[0 ], irq,0xf ,IRQ_TYPE_LEVEL_LOW ); irq =timer_get_irq (TIMER_PHYS_NONSECURE_PPI ); -DPRINT (" Non secure interrupt %u\n" , irq); +dt_dprintk (" Non secure interrupt %u\n" , irq);set_interrupt_ppi (intrs[1 ], irq,0xf ,IRQ_TYPE_LEVEL_LOW ); irq =timer_get_irq (TIMER_VIRT_PPI ); -DPRINT (" Virt interrupt %u\n" , irq); +dt_dprintk (" Virt interrupt %u\n" , irq);set_interrupt_ppi (intrs[2 ], irq,0xf ,IRQ_TYPE_LEVEL_LOW ); res =fdt_property_interrupts (fdt, intrs,3 );@@ -984,7 +980,7 @@ static int map_irq_to_domain(const struct dt_device_node *dev, } } -DPRINT (" - IRQ: %u\n" , irq); +dt_dprintk (" - IRQ: %u\n" , irq);return 0 ; }@@ -1053,7 +1049,7 @@ static int map_range_to_domain(const struct dt_device_node *dev, } } -DPRINT (" - MMIO: %010" PRIx64" - %010" PRIx64"\n" , addr, addr + len); +dt_dprintk (" - MMIO: %010" PRIx64" - %010" PRIx64"\n" , addr, addr + len);return 0 ; }@@ -1070,7 +1066,8 @@ static int map_device_children(struct domain *d,if (dt_device_type_is_equal (dev,"pci" ) ) { -DPRINT ("Mapping children of %s to guest\n" ,dt_node_full_name (dev)); +dt_dprintk ("Mapping children of %s to guest\n" , +dt_node_full_name (dev)); ret =dt_for_each_irq_map (dev, &map_dt_irq_to_domain, d);if ( ret <0 )@@ -1105,12 +1102,12 @@ static int handle_device(struct domain *d, struct dt_device_node *dev) nirq =dt_number_of_irq (dev); naddr =dt_number_of_address (dev); -DPRINT ("%s passthrough = %d nirq = %d naddr = %u\n" ,dt_node_full_name (dev), - need_mapping, nirq, naddr); +dt_dprintk ("%s passthrough = %d nirq = %d naddr = %u\n" , +dt_node_full_name (dev), need_mapping, nirq, naddr);if (dt_device_is_protected (dev) && need_mapping ) { -DPRINT ("%s setup iommu\n" ,dt_node_full_name (dev)); +dt_dprintk ("%s setup iommu\n" ,dt_node_full_name (dev)); res =iommu_assign_dt_device (d, dev);if ( res ) {@@ -1137,8 +1134,8 @@ static int handle_device(struct domain *d, struct dt_device_node *dev)*/ if ( rirq.controller != dt_interrupt_controller ) { -DPRINT ("irq %u not connected to primary controller." -"Connected to %s\n" , i,dt_node_full_name (rirq.controller)); +dt_dprintk ("irq %u not connected to primary controller. Connected to %s\n" , + i,dt_node_full_name (rirq.controller));continue ; }@@ -1217,17 +1214,17 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo, path =dt_node_full_name (node); -DPRINT ("handle %s\n" , path); +dt_dprintk ("handle %s\n" , path);/* Skip theses nodes and the sub-nodes */ if (dt_match_node (skip_matches, node) ) { -DPRINT (" Skip it (matched)\n" ); +dt_dprintk (" Skip it (matched)\n" );return 0 ; }if (platform_device_is_blacklisted (node) ) { -DPRINT (" Skip it (blacklisted)\n" ); +dt_dprintk (" Skip it (blacklisted)\n" );return 0 ; }@@ -1243,7 +1240,7 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo,/* Skip nodes used by Xen */ if (dt_device_used_by (node) ==DOMID_XEN ) { -DPRINT (" Skip it (used by Xen)\n" ); +dt_dprintk (" Skip it (used by Xen)\n" );return 0 ; }@@ -1253,7 +1250,7 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo,*/ if (device_get_class (node) ==DEVICE_IOMMU ) { -DPRINT (" IOMMU, skip it\n" ); +dt_dprintk (" IOMMU, skip it\n" );return 0 ; }@@ -1428,7 +1425,7 @@ static int acpi_make_chosen_node(const struct kernel_info *kinfo)const struct bootmodule *mod = kinfo->kernel_bootmodule;void *fdt = kinfo->fdt; -DPRINT ("Create chosen node\n" ); +dt_dprintk ("Create chosen node\n" ); res =fdt_begin_node (fdt,"chosen" );if ( res )return res;@@ -1472,7 +1469,7 @@ static int acpi_make_hypervisor_node(const struct kernel_info *kinfo,/* Convenience alias */ void *fdt = kinfo->fdt; -DPRINT ("Create hypervisor node\n" ); +dt_dprintk ("Create hypervisor node\n" );/* See linux Documentation/devicetree/bindings/arm/xen.txt */ res =fdt_begin_node (fdt,"hypervisor" );@@ -1502,7 +1499,7 @@ static int create_acpi_dtb(struct kernel_info *kinfo, struct membank tbl_add[])int new_size;int ret; -DPRINT ("Prepare a min DTB for DOM0\n" ); +dt_dprintk ("Prepare a min DTB for DOM0\n" );/* Allocate min size for DT */ new_size =ACPI_DOM0_FDT_MIN_SIZE ;xen/common/device_tree.c +0
-2@@ -55,7 +55,6 @@ struct dt_alias_prop {static LIST_HEAD (aliases_lookup);#ifdef CONFIG_DEVICE_TREE_DEBUG -# define dt_dprintk(fmt, args...) printk(XENLOG_DEBUG fmt, ##args)static void dt_dump_addr (const char *s,const __be32 *addr,int na) {dt_dprintk ("%s" , s);@@ -64,7 +63,6 @@ static void dt_dump_addr(const char *s, const __be32 *addr, int na) dt_dprintk("\n"); }#else -# define dt_dprintk(fmt, args...) do {} while ( 0 )static void dt_dump_addr (const char *s,const __be32 *addr,int na) { }#endif xen/include/xen/device_tree.h +9
-0@@ -753,6 +753,15 @@ int dt_parse_phandle_with_args(const struct dt_device_node *np, const char *cells_name, int index, struct dt_phandle_args *out_args); +#ifdef CONFIG_DEVICE_TREE_DEBUG +#define dt_dprintk(fmt, args...) \ + printk(XENLOG_DEBUG fmt, ## args) +#else +static inline void +__attribute__ ((__format__ (__printf__,1 ,2 ))) +dt_dprintk (const char *fmt, ...) {} +#endif +#endif /* __XEN_DEVICE_TREE_H */ /* Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 7 lines · Julien Grall
Hello all,
This small patch series converts
DEBUG_DTtoKconfig. This is easier to enable than having to modify the code when the user wants to debug the device tree parsing.This series is based on the version 4 of "
Kconfigdebug options" [1].
I forgot to add a link to Doug's series:
http://lists.xen.org/archives/html/xen-devel/2016-05/msg02093.html
Quoted 13 lines
Yours sincerely,
Julien Grall (2):
xen/arm: ConvertDEBUG_DTtoKconfig
xen/arm: Provide device tree debugging helper in a single placexen/Kconfig.debug | 7 +++++ xen/arch/arm/domain_build.c | 73 ++++++++++++++++++++----------------------- xen/common/device_tree.c | 6 +--- xen/include/xen/device_tree.h | 9 ++++++ 4 files changed, 51 insertions(+), 44 deletions(-)
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel