X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_config.c;h=e4c9b4fabc6e3bc89256fb3976ce2e61c12c7340;hp=7987957ee02d40c83f1571db073a4fdf5848a07a;hb=88a3605446744969abe6f193a7bc20e62d5aa555;hpb=3650bf4aaa4f83afae52c8fee98fce6e3ee68deb diff --git a/palacios/src/palacios/vmm_config.c b/palacios/src/palacios/vmm_config.c index 7987957..e4c9b4f 100644 --- a/palacios/src/palacios/vmm_config.c +++ b/palacios/src/palacios/vmm_config.c @@ -229,6 +229,7 @@ static struct v3_config * parse_config(void * cfg_blob) { V3_Print(VM_NONE, VCORE_NONE, "File index=%d id=%s\n", idx, id); strncpy(file->tag, id, V3_MAX_TAG_LEN); + file->tag[V3_MAX_TAG_LEN-1] = 0 ; if (version==0) { struct file_hdr_v0 * hdr = &(files_v0->hdrs[idx]); @@ -293,6 +294,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 @@ -324,6 +326,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)) { @@ -585,6 +592,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) { @@ -596,6 +607,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; @@ -603,11 +615,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) { @@ -626,10 +640,20 @@ struct v3_vm_info * v3_config_guest(void * cfg_blob, void * priv_data) { vm = allocate_guest(num_cores); if (!vm) { - PrintError(VM_NONE, VCORE_NONE, "Could not allocate %d core guest\n", vm->num_cores); + PrintError(VM_NONE, VCORE_NONE, "Could not allocate %d core guest\n", num_cores); 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;