Skip to contentSkip to conversation

xen/arm: change DomU memory property size from u64 to u32

PATCH In review Viktor Mitin 2 participants 3 messages Jul 9, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: change DomU memory property size from u64 to u32

While checking xen dom0less documentation it has been found that domU memory property requires extra 0x0 in case of arm64.

There is no need to keep memory size in u64, 32 bits is enough for domU memory size.

Tested that in case of arm64 dom0less domU works without adding extra 0x0 to domU memory property with this patch.

---
 xen/arch/arm/domain_build.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
xen/arch/arm/domain_build.c +3 -3
index d9836779d1..2c1a8c243e 100644
@@ -2012,9 +2012,9 @@ static int __init construct_domU(struct domain *d,
 {
     struct kernel_info kinfo = {};
     int rc;
-    u64 mem;
+    u32 mem;
 
-    rc = dt_property_read_u64(node, "memory", &mem);
+    rc = dt_property_read_u32(node, "memory", &mem);
     if ( !rc )
     {
         printk("Error building DomU: cannot read \"memory\" property\n");
@@ -2022,7 +2022,7 @@ static int __init construct_domU(struct domain *d,
     }
     kinfo.unassigned_mem = (paddr_t)mem * SZ_1K;
 
-    printk("*** LOADING DOMU cpus=%u memory=%"PRIx64"KB ***\n", d->max_vcpus, mem);
+    printk("*** LOADING DOMU cpus=%u memory=%"PRIx32"KB ***\n", d->max_vcpus, mem);
 
     kinfo.vpl011 = dt_property_read_bool(node, "vpl011");
 
Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

Hi Viktor,

Quoted 2 lines · Viktor Mitin

While checking xen dom0less documentation it has been found that domU memory property requires extra 0x0 in case of arm64.

And this matches the binding docs/misc/arm/device-tree/booting.txt which requires a 64-bit value.

Quoted 3 lines

There is no need to keep memory size in u64, 32 bits is enough for domU memory size.

Definitely not. The memory is given in KB so 32-bits only allows to cover 4TB. While I agree that none of the DomU created by Xen will be bigger than a few gigabytes today, user exposed interfaces should always cater for the future.

In any case, the interface changes you suggest is going to break user properly using the bindings.

Regards,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#2 lore raw

Hi Julien,

Quoted 13 lines · Julien Grall

Hi Viktor,

Quoted 2 lines · Viktor Mitin

While checking xen dom0less documentation it has been found that domU memory property requires extra 0x0 in case of arm64.

And this matches the binding docs/misc/arm/device-tree/booting.txt which requires a 64-bit value.

Quoted 3 lines

There is no need to keep memory size in u64, 32 bits is enough for domU memory size.

Quoted 8 lines

Definitely not. The memory is given in KB so 32-bits only allows to cover 4TB. While I agree that none of the DomU created by Xen will be bigger than a few gigabytes today, user exposed interfaces should always cater for the future.

In any case, the interface changes you suggest is going to break user properly using the bindings.

You are right. Please ignore this patch.
I will add extra 0x0 to dom0less documentation instead.

Thanks

Quoted 4 lines

Regards,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel