From: Alejandro Vallejo <alejandro.garciavall...@amd.com>

Move the "memory" binding from dom0less-build to dom0less-bindings.

Signed-off-by: Alejandro Vallejo <alejandro.garciavall...@amd.com>
Signed-off-by: Grygorii Strashko <grygorii_stras...@epam.com>
---
 xen/common/device-tree/dom0less-bindings.c | 3 +++
 xen/common/device-tree/dom0less-build.c    | 8 +-------
 xen/include/xen/bootfdt.h                  | 2 ++
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/xen/common/device-tree/dom0less-bindings.c 
b/xen/common/device-tree/dom0less-bindings.c
index 41d72d0d580a..4513f03e367b 100644
--- a/xen/common/device-tree/dom0less-bindings.c
+++ b/xen/common/device-tree/dom0less-bindings.c
@@ -141,5 +141,8 @@ int __init parse_dom0less_node(struct dt_device_node *node,
         panic("'llc-colors' found, but LLC coloring is disabled\n");
 #endif
 
+    if ( !dt_property_read_u64(node, "memory", &bd->memory) )
+        panic("missing memory binding for %s.\n", dt_node_name(node));
+
     return arch_parse_dom0less_node(node, bd);
 }
diff --git a/xen/common/device-tree/dom0less-build.c 
b/xen/common/device-tree/dom0less-build.c
index 6bb038111de9..8906e35e6978 100644
--- a/xen/common/device-tree/dom0less-build.c
+++ b/xen/common/device-tree/dom0less-build.c
@@ -738,14 +738,8 @@ static int __init construct_domU(struct kernel_info *kinfo,
     struct domain *d = kinfo->bd.d;
     const char *dom0less_enhanced;
     int rc;
-    u64 mem;
+    uint64_t mem = kinfo->bd.memory;
 
-    rc = dt_property_read_u64(node, "memory", &mem);
-    if ( !rc )
-    {
-        printk("Error building DomU: cannot read \"memory\" property\n");
-        return -EINVAL;
-    }
     kinfo->unassigned_mem = (paddr_t)mem * SZ_1K;
 
     rc = domain_p2m_set_allocation(d, mem, node);
diff --git a/xen/include/xen/bootfdt.h b/xen/include/xen/bootfdt.h
index 0e82ccea2f84..0b73ed835000 100644
--- a/xen/include/xen/bootfdt.h
+++ b/xen/include/xen/bootfdt.h
@@ -121,6 +121,8 @@ struct boot_domain {
     struct boot_module *initrd;
 
     const char *cmdline;
+    /* Memory the domain is expected to have attached after creation */
+    uint64_t memory;
 
     /* Input arguments to create_domain() */
     struct xen_domctl_createdomain create_cfg;
-- 
2.34.1

Reply via email to