X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_config.c;h=7897f3e5781a43b0b479864a7f4bc7e7e8d1bb48;hb=de5c2110458436a9300aa0a171dbbe83e415ee4d;hp=374c1a511d53d8480b2bd0f4a21100e7a6027012;hpb=1c5bf75232c70f01570ddc8b075f9455b7c6ba34;p=palacios.git diff --git a/palacios/src/palacios/vmm_config.c b/palacios/src/palacios/vmm_config.c index 374c1a5..7897f3e 100644 --- a/palacios/src/palacios/vmm_config.c +++ b/palacios/src/palacios/vmm_config.c @@ -37,6 +37,10 @@ #include #endif +#ifdef V3_CONFIG_MULTIBOOT +#include +#endif + #ifdef V3_CONFIG_HVM #include #endif @@ -289,6 +293,7 @@ static inline uint32_t get_alignment(char * align_str) { if (alignment != PAGE_SIZE_4KB) { PrintError(VM_NONE, VCORE_NONE, "Aligned page allocations are not supported in this host (requested alignment=%d)\n", alignment); PrintError(VM_NONE, VCORE_NONE, "Ignoring alignment request\n"); + alignment = PAGE_SIZE_4KB; } #endif @@ -320,6 +325,11 @@ static int pre_config_vm(struct v3_vm_info * vm, v3_cfg_tree_t * vm_cfg) { // Amount of ram the Guest will have, always in MB vm->mem_size = (addr_t)atoi(memory_str) * 1024 * 1024; vm->mem_align = get_alignment(align_str); + + // set up defaults for memory management for threads associated + // with this VM + vm->resource_control.pg_alignment=vm->mem_align; + vm->resource_control.pg_node_id=-1; #ifdef V3_CONFIG_SWAPPING if (v3_init_swapping_vm(vm,vm_cfg)) { @@ -355,6 +365,17 @@ static int pre_config_vm(struct v3_vm_info * vm, v3_cfg_tree_t * vm_cfg) { } #endif + if (v3_init_vm(vm) == -1) { + PrintError(VM_NONE, VCORE_NONE, "Failed to initialize VM\n"); + return -1; + } + +#ifdef V3_CONFIG_MULTIBOOT + if (v3_init_multiboot_vm(vm,vm_cfg)) { + PrintError(vm,VCORE_NONE,"Cannot initialize Multiboot for VM\n"); + return -1; + } +#endif #ifdef V3_CONFIG_HVM if (v3_init_hvm_vm(vm,vm_cfg)) { PrintError(vm,VCORE_NONE,"Cannot initialize HVM for VM\n"); @@ -362,14 +383,6 @@ static int pre_config_vm(struct v3_vm_info * vm, v3_cfg_tree_t * vm_cfg) { } #endif - - if (v3_init_vm(vm) == -1) { - PrintError(VM_NONE, VCORE_NONE, "Failed to initialize VM\n"); - return -1; - } - - - if (schedule_hz_str) { sched_hz = atoi(schedule_hz_str); } @@ -437,6 +450,12 @@ static int pre_config_core(struct guest_info * info, v3_cfg_tree_t * core_cfg) { return -1; } +#ifdef V3_CONFIG_MULTIBOOT + if (v3_init_multiboot_core(info)) { + PrintError(info->vm_info, info, "Error Initializing Multiboot Core\n"); + return -1; + } +#endif #ifdef V3_CONFIG_HVM if (v3_init_hvm_core(info)) { PrintError(info->vm_info, info, "Error Initializing HVM Core\n"); @@ -572,6 +591,10 @@ static struct v3_vm_info * allocate_guest(int num_cores) { return vm; } +/* + + +*/ struct v3_vm_info * v3_config_guest(void * cfg_blob, void * priv_data) { @@ -583,6 +606,7 @@ struct v3_vm_info * v3_config_guest(void * cfg_blob, void * priv_data) { v3_cfg_tree_t * cores_cfg = NULL; v3_cfg_tree_t * per_core_cfg = NULL; + if (v3_mach_type == V3_INVALID_CPU) { PrintError(VM_NONE, VCORE_NONE, "Configuring guest on invalid CPU\n"); return NULL; @@ -590,11 +614,13 @@ struct v3_vm_info * v3_config_guest(void * cfg_blob, void * priv_data) { cfg_data = parse_config(cfg_blob); + if (!cfg_data) { PrintError(VM_NONE, VCORE_NONE, "Could not parse configuration\n"); return NULL; } + cores_cfg = v3_cfg_subtree(cfg_data->cfg, "cores"); if (!cores_cfg) { @@ -617,6 +643,16 @@ struct v3_vm_info * v3_config_guest(void * cfg_blob, void * priv_data) { return NULL; } +#ifdef V3_CONFIG_CACHEPART + // Need to initialize cache management and resource control + // as early as possible so that allocations are done accordingly + if (v3_init_cachepart_vm(vm,cfg_data->cfg)) { + PrintError(VM_NONE, VCORE_NONE, "Could not initialize cache partioning\n"); + V3_Free(vm); + return NULL; + } +#endif + vm->host_priv_data = priv_data; vm->cfg_data = cfg_data;