On 2024-12-26 11:57, Daniel P. Smith wrote:
Add three properties, memory, mem-min, and mem-max, to the domain node device
tree parsing to define the memory allocation for a domain. All three fields are
expressed in kb and written as a u64 in the device tree entries.
Signed-off-by: Daniel P. Smith <dpsm...@apertussolutions.com>
diff --git a/xen/arch/x86/domain-builder/fdt.c
b/xen/arch/x86/domain-builder/fdt.c
index db584ba78e92..aff1b8c3235d 100644
--- a/xen/arch/x86/domain-builder/fdt.c
+++ b/xen/arch/x86/domain-builder/fdt.c
@@ -6,6 +6,7 @@
#include <xen/init.h>
#include <xen/lib.h>
#include <xen/libfdt/libfdt.h>
+#include <xen/sizes.h>
#include <asm/bootinfo.h>
#include <asm/guest.h>
@@ -113,6 +114,39 @@ static int __init process_domain_node(
else
printk("PV\n");
}
+ else if ( strncmp(prop_name, "memory", name_len) == 0 )
+ {
+ uint64_t kb;
+ if ( fdt_prop_as_u64(prop, &kb) != 0 )
+ {
+ printk(" failed processing memory for domain %s\n", name);
+ return -EINVAL;
+ }
+ bd->mem_pages = PFN_DOWN(kb * SZ_1K);
+ printk(" memory: %ld kb\n", kb);
+ }
+ else if ( strncmp(prop_name, "mem-min", name_len) == 0 )
+ {
+ uint64_t kb;
+ if ( fdt_prop_as_u64(prop, &kb) != 0 )
+ {
+ printk(" failed processing memory for domain %s\n", name);
s/memory/mem-min/
+ return -EINVAL;
+ }
+ bd->min_pages = PFN_DOWN(kb * SZ_1K);
+ printk(" min memory: %ld kb\n", kb);
+ }
+ else if ( strncmp(prop_name, "mem-max", name_len) == 0 )
+ {
+ uint64_t kb;
+ if ( fdt_prop_as_u64(prop, &kb) != 0 )
+ {
+ printk(" failed processing memory for domain %s\n", name);
s/memory/mem-max/
With that,
Reviewed-by: Jason Andryuk <jason.andr...@amd.com>
+ return -EINVAL;
+ }
+ bd->max_pages = PFN_DOWN(kb * SZ_1K);
+ printk(" max memory: %ld kb\n", kb);
+ }
}
fdt_for_each_subnode(node, fdt, dom_node)