Similar to construct_dom0, construct_domU creates a barebone DomU guest. The device tree node passed as argument is compatible "xen,domain", see docs/misc/arm/device-tree/booting.txt.
Signed-off-by: Stefano Stabellini <stefa...@xilinx.com> --- Changes in v2: - rename mem to memory - make cpus and memory mandatory - remove wront comment from commit message - cpus and memory are read as integers - read the vpl011 option --- xen/arch/arm/domain_build.c | 38 ++++++++++++++++++++++++++++++++++++++ xen/include/asm-arm/setup.h | 1 + 2 files changed, 39 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index ae3b16c..a4bc8fd 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -2223,6 +2223,44 @@ static int __init __construct_domain(struct domain *d, struct kernel_info *kinfo return 0; } +static int __init construct_domU(struct domain *d, struct dt_device_node *node) +{ + struct kernel_info kinfo = {}; + int rc; + u32 mem, vpl011 = 0; + + printk("*** LOADING DOMU ***\n"); + + rc = dt_property_read_u32(node, "cpus", &d->max_vcpus); + if ( !rc ) + return -EINVAL; + + rc = dt_property_read_u32(node, "memory", &mem); + if ( !rc ) + return -EINVAL; + kinfo.unassigned_mem = (paddr_t)mem << 20; + + dt_property_read_u32(node, "memory", &vpl011); + + 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(&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 d0e23f4..5ecfe27 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 -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel