X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_config.c;h=f24dc3832e5cb9612ca0b45d8131d6105ef4fa6a;hb=bdbff6b6e5f78f5a1689f5d77814196ee2e4f6cb;hp=789f399051fe4616de23ab2112cfe28386c0d508;hpb=d54fc24e6cfb62cc2fedfb63d3ae68ff636e3a01;p=palacios.git diff --git a/palacios/src/palacios/vmm_config.c b/palacios/src/palacios/vmm_config.c index 789f399..f24dc38 100644 --- a/palacios/src/palacios/vmm_config.c +++ b/palacios/src/palacios/vmm_config.c @@ -58,6 +58,7 @@ struct file_idx_table { static int setup_memory_map(struct v3_vm_info * vm, v3_cfg_tree_t * cfg); +static int setup_extensions(struct v3_vm_info * vm, v3_cfg_tree_t * cfg); static int setup_devices(struct v3_vm_info * vm, v3_cfg_tree_t * cfg); @@ -292,7 +293,8 @@ static int determine_paging_mode(struct guest_info * info, v3_cfg_tree_t * core_ if (pg_mode) { if ((strcasecmp(pg_mode, "nested") == 0)) { - if (v3_cpu_types[info->host_cpu_id] == V3_SVM_REV3_CPU) { + // we assume symmetric cores, so if core 0 has nested paging they all do + if (v3_cpu_types[0] == V3_SVM_REV3_CPU) { info->shdw_pg_mode = NESTED_PAGING; } else { PrintError("Nested paging not supported on this hardware. Defaulting to shadow paging\n"); @@ -338,21 +340,9 @@ static int determine_paging_mode(struct guest_info * info, v3_cfg_tree_t * core_ } static int pre_config_core(struct guest_info * info, v3_cfg_tree_t * core_cfg) { - char *hcpu; - if (determine_paging_mode(info, core_cfg)) + if (determine_paging_mode(info, core_cfg) != 0) { return -1; - - hcpu = v3_cfg_val(core_cfg, "hostcpu"); - if (hcpu) { - int req_id = atoi(hcpu); - if (req_id < 0) { - PrintError("Invalid host core %d requested by" - " virtual cpu %d - ignored.\n", req_id, info->cpu_id); - } else { - PrintDebug("Assigned host core %d to virtual core %d.\n", info->cpu_id, req_id, hcpu); - info->host_cpu_id = req_id; - } - } + } v3_init_core(info); @@ -380,9 +370,18 @@ static int post_config_vm(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) { PrintError("Setting up guest memory map failed...\n"); return -1; } - - //v3_hook_io_port(info, 1234, &IO_Read, NULL, info); - + + /* + * Initialize configured extensions + */ + if (setup_extensions(vm, cfg) == -1) { + PrintError("Failed to setup extensions\n"); + return -1; + } + + /* + * Initialize configured devices + */ if (setup_devices(vm, cfg) == -1) { PrintError("Failed to setup devices\n"); return -1; @@ -505,7 +504,6 @@ struct v3_vm_info * v3_config_guest(void * cfg_blob, void * priv_data) { info->cpu_id = i; info->vm_info = vm; info->core_cfg_data = per_core_cfg; - info->host_cpu_id = i; // may be overriden by core config if (pre_config_core(info, per_core_cfg) == -1) { PrintError("Error in core %d preconfiguration\n", i); @@ -577,6 +575,24 @@ static int setup_memory_map(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) { } +static int setup_extensions(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) { + v3_cfg_tree_t * extension = v3_cfg_subtree(v3_cfg_subtree(cfg, "extensions"), "extension"); + + while (extension) { + char * ext_name = v3_cfg_val(extension, "name"); + + V3_Print("Configuring extension %s\n", ext_name); + + if (v3_add_extension(vm, ext_name, extension) == -1) { + PrintError("Error adding extension %s\n", ext_name); + return -1; + } + + extension = v3_cfg_next_branch(extension); + } + + return 0; +} static int setup_devices(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) { @@ -603,4 +619,3 @@ static int setup_devices(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) { -