All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
To: <xen-devel@lists.xenproject.org>
Cc: <sstabellini@kernel.org>, <stefano.stabellini@amd.com>,
	<julien@xen.org>, <Volodymyr_Babchuk@epam.com>,
	<bertrand.marquis@arm.com>,
	Ayan Kumar Halder <ayan.kumar.halder@amd.com>
Subject: [XEN v1 3/9] xen/arm: Always use 'u64' instead of 'paddr_t' for address and size in DT
Date: Thu, 15 Dec 2022 19:32:39 +0000	[thread overview]
Message-ID: <20221215193245.48314-4-ayan.kumar.halder@amd.com> (raw)
In-Reply-To: <20221215193245.48314-1-ayan.kumar.halder@amd.com>

device_tree_get_reg(), dt_next_cell() uses u64 for address and size.
Thus, the caller needs to be fixed to pass u64 values and then invoke
translate_dt_address_size() to do the translation between u64 and paddr_t.

Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
---
 xen/arch/arm/bootfdt.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
index 0085c28d74..835bb5feb9 100644
--- a/xen/arch/arm/bootfdt.c
+++ b/xen/arch/arm/bootfdt.c
@@ -14,6 +14,7 @@
 #include <xen/libfdt/libfdt.h>
 #include <xen/sort.h>
 #include <xsm/xsm.h>
+#include <asm/platform.h>
 #include <asm/setup.h>
 
 static bool __init device_tree_node_matches(const void *fdt, int node,
@@ -68,7 +69,7 @@ static int __init device_tree_get_meminfo(const void *fdt, int node,
     unsigned int i, banks;
     const __be32 *cell;
     u32 reg_cells = address_cells + size_cells;
-    paddr_t start, size;
+    u64 start, size;
     struct meminfo *mem = data;
 
     if ( address_cells < 1 || size_cells < 1 )
@@ -219,7 +220,7 @@ static void __init process_multiboot_node(const void *fdt, int node,
     const struct fdt_property *prop;
     const __be32 *cell;
     bootmodule_kind kind;
-    paddr_t start, size;
+    u64 start, size;
     int len;
     /* sizeof("/chosen/") + DT_MAX_NAME + '/' + DT_MAX_NAME + '/0' => 92 */
     char path[92];
@@ -379,7 +380,8 @@ static int __init process_shm_node(const void *fdt, int node,
 {
     const struct fdt_property *prop, *prop_id, *prop_role;
     const __be32 *cell;
-    paddr_t paddr, gaddr, size;
+    paddr_t paddr = 0, gaddr = 0, size = 0;
+    u64 dt_paddr, dt_gaddr, dt_size;
     struct meminfo *mem = &bootinfo.reserved_mem;
     unsigned int i;
     int len;
@@ -443,10 +445,14 @@ static int __init process_shm_node(const void *fdt, int node,
     }
 
     cell = (const __be32 *)prop->data;
-    device_tree_get_reg(&cell, address_cells, address_cells, &paddr, &gaddr);
-    size = dt_next_cell(size_cells, &cell);
+    device_tree_get_reg(&cell, address_cells, address_cells, &dt_paddr,
+                        &dt_gaddr);
+    translate_dt_address_size(&dt_paddr, &dt_gaddr, &paddr, &gaddr);
 
-    if ( !size )
+    dt_size = dt_next_cell(size_cells, &cell);
+    translate_dt_address_size(NULL, &dt_size, NULL, &size);
+
+    if ( !dt_size )
     {
         printk("fdt: the size for static shared memory region can not be zero\n");
         return -EINVAL;
@@ -593,12 +599,12 @@ static void __init early_print_info(void)
     nr_rsvd = fdt_num_mem_rsv(device_tree_flattened);
     for ( i = 0; i < nr_rsvd; i++ )
     {
-        paddr_t s, e;
+        u64 s, e;
         if ( fdt_get_mem_rsv(device_tree_flattened, i, &s, &e) < 0 )
             continue;
         /* fdt_get_mem_rsv returns length */
         e += s;
-        printk(" RESVD[%u]: %"PRIpaddr" - %"PRIpaddr"\n", i, s, e);
+        printk(" RESVD[%u]: %"PRIx64" - %"PRIx64"\n", i, s, e);
     }
     for ( j = 0; j < mem_resv->nr_banks; j++, i++ )
     {
-- 
2.17.1



  parent reply	other threads:[~2022-12-15 19:33 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-15 19:32 [XEN v1 0/9] Add support for 32 bit physical address Ayan Kumar Halder
2022-12-15 19:32 ` [XEN v1 1/9] xen/arm: Remove the extra assignment Ayan Kumar Halder
2022-12-16  7:56   ` Jan Beulich
2022-12-16  9:41   ` Julien Grall
2022-12-15 19:32 ` [XEN v1 2/9] xen/arm: Define translate_dt_address_size() for the translation between u64 and paddr_t Ayan Kumar Halder
2022-12-16  9:51   ` Julien Grall
2022-12-17  0:46     ` Stefano Stabellini
2022-12-17  8:42       ` Julien Grall
2022-12-22 23:20         ` Stefano Stabellini
2022-12-23 10:01           ` Ayan Kumar Halder
2022-12-23 10:17             ` Julien Grall
2023-01-04 23:56               ` Stefano Stabellini
2022-12-15 19:32 ` Ayan Kumar Halder [this message]
2022-12-16  9:57   ` [XEN v1 3/9] xen/arm: Always use 'u64' instead of 'paddr_t' for address and size in DT Julien Grall
2022-12-16 10:49     ` Ayan Kumar Halder
2022-12-16 11:12       ` Julien Grall
2022-12-16 11:13         ` Julien Grall
2022-12-15 19:32 ` [XEN v1 4/9] xen/arm: Use translate_dt_address_size() to translate between device tree addr/size and paddr_t Ayan Kumar Halder
2022-12-15 19:32 ` [XEN v1 5/9] xen/arm: Use 'PRIpaddr' to display 'paddr_t' variable Ayan Kumar Halder
2022-12-15 19:32 ` [XEN v1 6/9] xen/arm: Use 'u64' to represent 'unsigned long long' Ayan Kumar Halder
2022-12-16 10:04   ` Julien Grall
2022-12-15 19:32 ` [XEN v1 7/9] xen/arm: Restrict zeroeth_table_offset for ARM_64 Ayan Kumar Halder
2022-12-15 22:08   ` Julien Grall
2022-12-15 19:32 ` [XEN v1 8/9] xen/arm: Other adaptations required to support 32bit paddr Ayan Kumar Halder
2022-12-16 10:23   ` Julien Grall
2022-12-20 15:24     ` Ayan Kumar Halder
2022-12-20 16:22       ` Julien Grall
2022-12-15 19:32 ` [XEN v1 9/9] xen/arm: Introduce ARM_PA_32 to support 32 bit physical address Ayan Kumar Halder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221215193245.48314-4-ayan.kumar.halder@amd.com \
    --to=ayan.kumar.halder@amd.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=bertrand.marquis@arm.com \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=stefano.stabellini@amd.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.