[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [RFC 09/10] hyperlaunch: add domain creation logic
This commit introduces the skeleton of hyperlaunch domain construction mechanics and adds the preliminary ability to construct dom0. Signed-off-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx> Reviewed-by: Christopher Clark <christopher.clark@xxxxxxxxxx> --- xen/common/setup.c | 77 +++++++++++++++++++++++++++++++++++++++++ xen/include/xen/setup.h | 16 +++++++++ 2 files changed, 93 insertions(+) diff --git a/xen/common/setup.c b/xen/common/setup.c index af2b1a422d..cd24f60297 100644 --- a/xen/common/setup.c +++ b/xen/common/setup.c @@ -1,3 +1,4 @@ +#include <asm/bzimage.h> /* for bzimage_headroom */ #include <xen/pci.h> /* needed by device_tree.h */ #include <xen/device_tree.h> #include <xen/init.h> @@ -368,6 +369,82 @@ bool __init hyperlaunch_mb_init(module_t *mods) return ret; } + +void __init hyperlaunch_mb_headroom(void) +{ + int i,j; + + for( i = 0; i < hl_config.nr_doms; i++ ) + { + for ( j = 0; j < hl_config.domains[i].nr_mods; j++ ) + { + if ( hl_config.domains[i].modules[j].kind == BOOTMOD_KERNEL ) + { + module_t *kern = + (module_t *)_p(hl_config.domains[i].modules[j].start); + + kern->headroom = bzimage_headroom(bootstrap_map(kern), + kern->mod_end); + bootstrap_map(NULL); + } + } + } +} #endif +uint32_t __init hyperlaunch_create_domains( + struct domain **hwdom, const char *kextra, const char *loader) +{ + uint32_t dom_count = 0, functions_used = 0; + int i; + + *hwdom = NULL; + + for ( i = 0; i < hl_config.nr_doms; i++ ) + { + struct bootdomain *d = &(hl_config.domains[i]); + + /* build a legacy dom0 and set it as the hwdom */ + if ( (d->functions & HL_FUNCTION_LEGACY_DOM0) && + !(functions_used & HL_FUNCTION_LEGACY_DOM0) ) + { + module_t *image = NULL, *initrd = NULL; + int j; + + for ( j = 0; j < d->nr_mods; j++ ) + { + if ( d->modules[j].kind == BOOTMOD_KERNEL ) + image = (module_t *)_p(d->modules[j].start); + + if ( d->modules[j].kind == BOOTMOD_RAMDISK ) + initrd = (module_t *)_p(d->modules[j].start); + + if ( image && initrd ) + break; + } + + if ( image == NULL ) + return 0; + +#ifdef CONFIG_MULTIBOOT + *hwdom = create_dom0(image, image->headroom, initrd, kextra, + loader); +#endif + if ( *hwdom ) + { + functions_used |= HL_FUNCTION_LEGACY_DOM0; + dom_count++; + } + else + panic("HYPERLAUNCH: " + "Dom0 config present but dom0 construction failed\n"); + } + else + printk(XENLOG_WARNING "hyperlaunch: " + "currently only supports classic dom0 construction"); + } + + return dom_count; +} + #endif diff --git a/xen/include/xen/setup.h b/xen/include/xen/setup.h index fd4c23c08f..3833867470 100644 --- a/xen/include/xen/setup.h +++ b/xen/include/xen/setup.h @@ -93,8 +93,12 @@ int __init hyperlaunch_init(const void *fdt); #ifdef CONFIG_MULTIBOOT bool __init hyperlaunch_mb_init(module_t *mods); +void __init hyperlaunch_mb_headroom(void); #endif +uint32_t __init hyperlaunch_create_domains( + struct domain **hwdom, const char *kextra, const char *loader); + #else /* CONFIG_HYPERLAUNCH */ #define hyperlaunch_enabled false @@ -109,7 +113,19 @@ static inline bool __init hyperlaunch_mb_init(module_t *mods) { return false; } + +void __init hyperlaunch_mb_headroom(void) +{ + return; +} #endif +static inline uint32_t __init hyperlaunch_create_domains( + struct domain **hwdom, const char *kextra, const char *loader) +{ + return 0; +} + #endif /* CONFIG_HYPERLAUNCH */ + #endif /* XEN_SETUP_H */ -- 2.20.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |