[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH RFC 10/15] xen/arm: introduce construct_domU
Hi, On 13/06/18 23:15, Stefano Stabellini wrote: 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. I don't think this comment is true. __construct_domain will allocate vCPUs in cycle. 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); allocate_memory() will allocate direct mapped memory but you impose a static memory layout for the guest. Both are not going to work very well together. So you probably want to extend allocate_memory to support allocating memory for a given region. + + 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, Cheers, -- Julien Grall _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |