diff mbox series

[XEN,v6,08/12] xen: dt: Replace u64 with uint64_t as the callback function parameters for dt_for_each_range()

Message ID 20230428175543.11902-9-ayan.kumar.halder@amd.com (mailing list archive)
State Superseded
Headers show
Series Add support for 32-bit physical address | expand

Commit Message

Ayan Kumar Halder April 28, 2023, 5:55 p.m. UTC
In the callback functions invoked by dt_for_each_range() ie handle_pci_range(),
map_range_to_domain(), 'u64' should be replaced with 'uint64_t' as the data type
for the parameters. Also dt_for_each_range() invokes the callback functions with
'uint64_t' arguments.

There is another callback function ie is_bar_valid() which uses 'paddr_t'
instead of 'u64' or 'uint64_t'. We will change it in the subsequent commit.

Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
---
Changes from :-

v1-v5 - New patch introduced in v6.

 xen/arch/arm/domain_build.c      | 4 ++--
 xen/arch/arm/include/asm/setup.h | 2 +-
 xen/common/device_tree.c         | 4 ++--
 xen/include/xen/device_tree.h    | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

Comments

Julien Grall May 3, 2023, 12:08 p.m. UTC | #1
Hi,

On 28/04/2023 18:55, Ayan Kumar Halder wrote:
> In the callback functions invoked by dt_for_each_range() ie handle_pci_range(),
> map_range_to_domain(), 'u64' should be replaced with 'uint64_t' as the data type
> for the parameters.

Please explain why this needs to be replaced. I.e. Xen coding style 
mention that u32 should be avoided.

> Also dt_for_each_range() invokes the callback functions with
> 'uint64_t' arguments.
> 
> There is another callback function ie is_bar_valid() which uses 'paddr_t'
> instead of 'u64' or 'uint64_t'. We will change it in the subsequent commit.

I would rather prefer if this is folded in this patch.

> 
> Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
> ---
> Changes from :-
> 
> v1-v5 - New patch introduced in v6.
> 
>   xen/arch/arm/domain_build.c      | 4 ++--
>   xen/arch/arm/include/asm/setup.h | 2 +-
>   xen/common/device_tree.c         | 4 ++--
>   xen/include/xen/device_tree.h    | 2 +-
>   4 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index 1c558fca0c..9865340eac 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -1637,7 +1637,7 @@ out:
>   }
>   
>   static int __init handle_pci_range(const struct dt_device_node *dev,
> -                                   u64 addr, u64 len, void *data)
> +                                   uint64_t addr, uint64_t len, void *data)
>   {
>       struct rangeset *mem_holes = data;
>       paddr_t start, end;
> @@ -2331,7 +2331,7 @@ static int __init map_dt_irq_to_domain(const struct dt_device_node *dev,
>   }
>   
>   int __init map_range_to_domain(const struct dt_device_node *dev,
> -                               u64 addr, u64 len, void *data)
> +                               uint64_t addr, uint64_t len, void *data)
>   {
>       struct map_range_data *mr_data = data;
>       struct domain *d = mr_data->d;
> diff --git a/xen/arch/arm/include/asm/setup.h b/xen/arch/arm/include/asm/setup.h
> index 47ce565d87..fe17cb0a4a 100644
> --- a/xen/arch/arm/include/asm/setup.h
> +++ b/xen/arch/arm/include/asm/setup.h
> @@ -166,7 +166,7 @@ u32 device_tree_get_u32(const void *fdt, int node,
>                           const char *prop_name, u32 dflt);
>   
>   int map_range_to_domain(const struct dt_device_node *dev,
> -                        u64 addr, u64 len, void *data);
> +                        uint64_t addr, uint64_t len, void *data);
>   
>   extern DEFINE_BOOT_PAGE_TABLE(boot_pgtable);
>   
> diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
> index 2163cf26d0..ab5f8df66c 100644
> --- a/xen/common/device_tree.c
> +++ b/xen/common/device_tree.c
> @@ -997,7 +997,7 @@ int dt_device_get_paddr(const struct dt_device_node *dev, unsigned int index,
>   
>   int dt_for_each_range(const struct dt_device_node *dev,
>                         int (*cb)(const struct dt_device_node *,
> -                                u64 addr, u64 length,
> +                                uint64_t addr, uint64_t length,
>                                   void *),
>                         void *data)
>   {
> @@ -1060,7 +1060,7 @@ int dt_for_each_range(const struct dt_device_node *dev,
>   
>       for ( ; rlen >= rone; rlen -= rone, ranges += rone )
>       {
> -        u64 a, s;
> +        uint64_t a, s;
>           int ret;
>   
>           memcpy(addr, ranges + na, 4 * pna);
> diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
> index ce25b89c4b..b3888c1b96 100644
> --- a/xen/include/xen/device_tree.h
> +++ b/xen/include/xen/device_tree.h
> @@ -681,7 +681,7 @@ int dt_for_each_irq_map(const struct dt_device_node *dev,
>    */
>   int dt_for_each_range(const struct dt_device_node *dev,
>                         int (*cb)(const struct dt_device_node *,
> -                                u64 addr, u64 length,
> +                                uint64_t addr, uint64_t length,
>                                   void *),
>                         void *data);
>   

Cheers,
Michal Orzel May 4, 2023, 2 p.m. UTC | #2
On 03/05/2023 14:08, Julien Grall wrote:
> 
> 
> Hi,
> 
> On 28/04/2023 18:55, Ayan Kumar Halder wrote:
>> In the callback functions invoked by dt_for_each_range() ie handle_pci_range(),
>> map_range_to_domain(), 'u64' should be replaced with 'uint64_t' as the data type
>> for the parameters.
> 
> Please explain why this needs to be replaced. I.e. Xen coding style
> mention that u32 should be avoided.
> 
>> Also dt_for_each_range() invokes the callback functions with
>> 'uint64_t' arguments.
>>
>> There is another callback function ie is_bar_valid() which uses 'paddr_t'
>> instead of 'u64' or 'uint64_t'. We will change it in the subsequent commit.
> 
> I would rather prefer if this is folded in this patch.
> 
With the Julien's comments fixed:
Reviewed-by: Michal Orzel <michal.orzel@amd.com>

~Michal
diff mbox series

Patch

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 1c558fca0c..9865340eac 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1637,7 +1637,7 @@  out:
 }
 
 static int __init handle_pci_range(const struct dt_device_node *dev,
-                                   u64 addr, u64 len, void *data)
+                                   uint64_t addr, uint64_t len, void *data)
 {
     struct rangeset *mem_holes = data;
     paddr_t start, end;
@@ -2331,7 +2331,7 @@  static int __init map_dt_irq_to_domain(const struct dt_device_node *dev,
 }
 
 int __init map_range_to_domain(const struct dt_device_node *dev,
-                               u64 addr, u64 len, void *data)
+                               uint64_t addr, uint64_t len, void *data)
 {
     struct map_range_data *mr_data = data;
     struct domain *d = mr_data->d;
diff --git a/xen/arch/arm/include/asm/setup.h b/xen/arch/arm/include/asm/setup.h
index 47ce565d87..fe17cb0a4a 100644
--- a/xen/arch/arm/include/asm/setup.h
+++ b/xen/arch/arm/include/asm/setup.h
@@ -166,7 +166,7 @@  u32 device_tree_get_u32(const void *fdt, int node,
                         const char *prop_name, u32 dflt);
 
 int map_range_to_domain(const struct dt_device_node *dev,
-                        u64 addr, u64 len, void *data);
+                        uint64_t addr, uint64_t len, void *data);
 
 extern DEFINE_BOOT_PAGE_TABLE(boot_pgtable);
 
diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
index 2163cf26d0..ab5f8df66c 100644
--- a/xen/common/device_tree.c
+++ b/xen/common/device_tree.c
@@ -997,7 +997,7 @@  int dt_device_get_paddr(const struct dt_device_node *dev, unsigned int index,
 
 int dt_for_each_range(const struct dt_device_node *dev,
                       int (*cb)(const struct dt_device_node *,
-                                u64 addr, u64 length,
+                                uint64_t addr, uint64_t length,
                                 void *),
                       void *data)
 {
@@ -1060,7 +1060,7 @@  int dt_for_each_range(const struct dt_device_node *dev,
 
     for ( ; rlen >= rone; rlen -= rone, ranges += rone )
     {
-        u64 a, s;
+        uint64_t a, s;
         int ret;
 
         memcpy(addr, ranges + na, 4 * pna);
diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
index ce25b89c4b..b3888c1b96 100644
--- a/xen/include/xen/device_tree.h
+++ b/xen/include/xen/device_tree.h
@@ -681,7 +681,7 @@  int dt_for_each_irq_map(const struct dt_device_node *dev,
  */
 int dt_for_each_range(const struct dt_device_node *dev,
                       int (*cb)(const struct dt_device_node *,
-                                u64 addr, u64 length,
+                                uint64_t addr, uint64_t length,
                                 void *),
                       void *data);