Skip to contentSkip to conversation

xen: move declarations of device_tree_get_{reg,u32}() to xen/device_tree.h

PATCH Superseded Oleksii Kurochko 2 participants 3 messages Jun 11, 2025 – Jun 12, 2025

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: move declarations of device_tree_get_{reg,u32}() to xen/device_tree.h

There is nothing Arm specific for these functions thereby it makes sense to move their declarations to common header: xen/device_tree.h.

---
 xen/arch/arm/include/asm/setup.h | 6 ------
 xen/include/xen/device_tree.h    | 6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)
xen/arch/arm/include/asm/setup.h +0 -6
index 6cf272c160..2b58549c1a 100644
@@ -53,12 +53,6 @@ void setup_mm(void);
 extern uint32_t hyp_traps_vector[];
 void init_traps(void);
 
-void device_tree_get_reg(const __be32 **cell, uint32_t address_cells,
-                         uint32_t size_cells, paddr_t *start, paddr_t *size);
-
-u32 device_tree_get_u32(const void *fdt, int node,
-                        const char *prop_name, u32 dflt);
-
 int handle_device(struct domain *d, struct dt_device_node *dev, p2m_type_t p2mt,
                   struct rangeset *iomem_ranges, struct rangeset *irq_ranges);
 
xen/include/xen/device_tree.h +6 -0
index 6dc1fb5159..75017e4266 100644
@@ -949,6 +949,12 @@ int dt_get_pci_domain_nr(struct dt_device_node *node);
 
 struct dt_device_node *dt_find_node_by_phandle(dt_phandle handle);
 
+void device_tree_get_reg(const __be32 **cell, uint32_t address_cells,
+                         uint32_t size_cells, paddr_t *start, paddr_t *size);
+
+u32 device_tree_get_u32(const void *fdt, int node,
+                        const char *prop_name, u32 dflt);
+
 #ifdef CONFIG_DEVICE_TREE_DEBUG
 #define dt_dprintk(fmt, args...)  \
     printk(XENLOG_DEBUG fmt, ## args)
Signature · 1 line
2.49.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Oleksii Kurochko

There is nothing Arm specific for these functions thereby it makes sense to move their declarations to common header: xen/device_tree.h.

I find it a bit odd that you don't mention that the definitions are already in common and therefore the prototypes should be too. For me that's the main reason (in fact the prototypes should have been moved together with definitions).

Quoted 2 lines

~Michal

Quoted 39 lines
---
 xen/arch/arm/include/asm/setup.h | 6 ------
 xen/include/xen/device_tree.h    | 6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)
xen/arch/arm/include/asm/setup.h +0 -6
index 6cf272c160..2b58549c1a 100644
@@ -53,12 +53,6 @@ void setup_mm(void);
 extern uint32_t hyp_traps_vector[];
 void init_traps(void);
 
-void device_tree_get_reg(const __be32 **cell, uint32_t address_cells,
-                         uint32_t size_cells, paddr_t *start, paddr_t *size);
-
-u32 device_tree_get_u32(const void *fdt, int node,
-                        const char *prop_name, u32 dflt);
-
 int handle_device(struct domain *d, struct dt_device_node *dev, p2m_type_t p2mt,
                   struct rangeset *iomem_ranges, struct rangeset *irq_ranges);
 
xen/include/xen/device_tree.h +6 -0
index 6dc1fb5159..75017e4266 100644
@@ -949,6 +949,12 @@ int dt_get_pci_domain_nr(struct dt_device_node *node);
 
 struct dt_device_node *dt_find_node_by_phandle(dt_phandle handle);
 
+void device_tree_get_reg(const __be32 **cell, uint32_t address_cells,
+                         uint32_t size_cells, paddr_t *start, paddr_t *size);
+
+u32 device_tree_get_u32(const void *fdt, int node,
+                        const char *prop_name, u32 dflt);
+
 #ifdef CONFIG_DEVICE_TREE_DEBUG
 #define dt_dprintk(fmt, args...)  \
     printk(XENLOG_DEBUG fmt, ## args)
#2 lore raw
Quoted 7 lines · Michal
Quoted 2 lines · Oleksii Kurochko

There is nothing Arm specific for these functions thereby it makes sense to move their declarations to common header: xen/device_tree.h.

I find it a bit odd that you don't mention that the definitions are already in common and therefore the prototypes should be too. For me that's the main reason (in fact the prototypes should have been moved together with definitions).

Initially I mentioned that they are used in common code:https://gitlab.com/xen-project/people/olkur/xen/-/commit/db46a683342421375c01a71317deb5a8840ae624 and by that I also mean that they are defined. But then decicded to re-write a commit
message.

I will send a v2 with updated commit message:
The definitions of|device_tree_get_reg()| and|device_tree_get_u32()| are already in common code, so move their prototypes there as well.

Quoted 2 lines
Quoted 1 line

Thanks.

~ Oleksii

Quoted 39 lines
Quoted 39 lines
---
  xen/arch/arm/include/asm/setup.h | 6 ------
  xen/include/xen/device_tree.h    | 6 ++++++
  2 files changed, 6 insertions(+), 6 deletions(-)
xen/arch/arm/include/asm/setup.h +0 -6
index 6cf272c160..2b58549c1a 100644
@@ -53,12 +53,6 @@ void setup_mm(void);
  extern uint32_t hyp_traps_vector[];
  void init_traps(void);
 
-void device_tree_get_reg(const __be32 **cell, uint32_t address_cells,
-                         uint32_t size_cells, paddr_t *start, paddr_t *size);
-
-u32 device_tree_get_u32(const void *fdt, int node,
-                        const char *prop_name, u32 dflt);
-
  int handle_device(struct domain *d, struct dt_device_node *dev, p2m_type_t p2mt,
                    struct rangeset *iomem_ranges, struct rangeset *irq_ranges);
 
xen/include/xen/device_tree.h +6 -0
index 6dc1fb5159..75017e4266 100644
@@ -949,6 +949,12 @@ int dt_get_pci_domain_nr(struct dt_device_node *node);
 
  struct dt_device_node *dt_find_node_by_phandle(dt_phandle handle);
 
+void device_tree_get_reg(const __be32 **cell, uint32_t address_cells,
+                         uint32_t size_cells, paddr_t *start, paddr_t *size);
+
+u32 device_tree_get_u32(const void *fdt, int node,
+                        const char *prop_name, u32 dflt);
+
  #ifdef CONFIG_DEVICE_TREE_DEBUG
  #define dt_dprintk(fmt, args...)  \
      printk(XENLOG_DEBUG fmt, ## args)