[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH RFC 10/15] xen/arm: introduce construct_domU



Similar to construct_dom0, construct_domU creates a barebone DomU guest.
Default to 1 max vcpu and 64MB of memory if not specified otherwise.

The device tree node passed as argument is compatible "xen,domU", see
docs/misc/arm/device-tree/booting.txt.

Allocate all vcpus on cpu0 initially.

Signed-off-by: Stefano Stabellini <stefanos@xxxxxxxxxx>
---
 xen/arch/arm/domain_build.c | 37 +++++++++++++++++++++++++++++++++++++
 xen/include/asm-arm/setup.h |  2 ++
 2 files changed, 39 insertions(+)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index b31c563..02a7f94 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2187,6 +2187,43 @@ int __init __construct_domain(struct domain *d, struct 
kernel_info *kinfo)
     return 0;
 }
 
+int __init construct_domU(struct domain *d, struct dt_device_node *node)
+{
+    struct kernel_info kinfo = {};
+    int rc;
+    const char *cpus = NULL, *mem = NULL;
+
+    printk("*** LOADING DOMU ***\n");
+
+    d->max_vcpus = 1;
+    rc = dt_property_read_string(node, "cpus", &cpus);
+    if ( !rc )
+        d->max_vcpus = simple_strtoul(cpus, &cpus, 0);
+
+    kinfo.unassigned_mem = MB(64);
+    rc = dt_property_read_string(node, "mem", &mem);
+    if ( !rc )
+        kinfo.unassigned_mem = parse_size_and_unit(mem, &mem);
+
+    d->vcpu = xzalloc_array(struct vcpu *, d->max_vcpus);
+    if ( !d->vcpu )
+        return -ENOMEM;;
+    if ( alloc_vcpu(d, 0, 0) == NULL )
+        return -ENOMEM;
+    d->max_pages = ~0U;
+
+    kinfo.d = d;
+
+    rc = kernel_probe_domU(&kinfo, node);
+    if ( rc < 0 )
+        return rc;
+
+    d->arch.type = kinfo.type;
+    allocate_memory(d, &kinfo);
+
+    return __construct_domain(d, &kinfo);
+}
+
 int __init construct_dom0(struct domain *d)
 {
     struct kernel_info kinfo = {};
diff --git a/xen/include/asm-arm/setup.h b/xen/include/asm-arm/setup.h
index 903782f..e9f9905 100644
--- a/xen/include/asm-arm/setup.h
+++ b/xen/include/asm-arm/setup.h
@@ -2,6 +2,7 @@
 #define __ARM_SETUP_H_
 
 #include <public/version.h>
+#include <xen/device_tree.h>
 
 #define MIN_FDT_ALIGN 8
 #define MAX_FDT_SIZE SZ_2M
@@ -71,6 +72,7 @@ void acpi_create_efi_mmap_table(struct domain *d,
 int acpi_make_efi_nodes(void *fdt, struct membank tbl_add[]);
 
 int construct_dom0(struct domain *d);
+int construct_domU(struct domain *d, struct dt_device_node *node);
 
 void discard_initial_modules(void);
 void dt_unreserved_regions(paddr_t s, paddr_t e,
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.