From: Jack Lange Date: Thu, 20 Jan 2011 21:50:59 +0000 (-0600) Subject: added initial global shutdown functionality X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=c0e8207d10b6b077c3fac4fb013ba7485f3a6391 added initial global shutdown functionality --- diff --git a/palacios/include/palacios/vmm_dev_mgr.h b/palacios/include/palacios/vmm_dev_mgr.h index ea45784..f7f511b 100644 --- a/palacios/include/palacios/vmm_dev_mgr.h +++ b/palacios/include/palacios/vmm_dev_mgr.h @@ -99,7 +99,7 @@ int v3_free_vm_devices(struct v3_vm_info * vm); int V3_init_devices(); - +int V3_deinit_devices(); struct v3_device_ops { diff --git a/palacios/include/palacios/vmm_shadow_paging.h b/palacios/include/palacios/vmm_shadow_paging.h index 4c191df..b619a04 100644 --- a/palacios/include/palacios/vmm_shadow_paging.h +++ b/palacios/include/palacios/vmm_shadow_paging.h @@ -99,6 +99,7 @@ int v3_is_guest_pf(pt_access_status_t guest_access, pt_access_status_t shadow_ac int V3_init_shdw_paging(); +int V3_deinit_shdw_paging(); #define register_shdw_pg_impl(impl) \ static struct v3_shdw_pg_impl * _v3_shdw_pg_impl \ diff --git a/palacios/src/palacios/vmm.c b/palacios/src/palacios/vmm.c index 0e1b905..9fc99fd 100644 --- a/palacios/src/palacios/vmm.c +++ b/palacios/src/palacios/vmm.c @@ -67,6 +67,29 @@ static void init_cpu(void * arg) { } } +#if 0 +static void deinit_cpu(void * arg) { +// uint32_t cpu_id = (uint32_t)(addr_t)arg; + + #ifdef CONFIG_SVM + if (v3_is_svm_capable()) { + PrintDebug("Machine is SVM Capable\n"); + //v3_deinit_svm_cpu(cpu_id); + + } else +#endif +#ifdef CONFIG_VMX + if (v3_is_vmx_capable()) { + PrintDebug("Machine is VMX Capable\n"); + //v3_deinit_vmx_cpu(cpu_id); + + } else +#endif + { + PrintError("CPU has no virtualization Extensions\n"); + } +} +#endif void Init_V3(struct v3_os_hooks * hooks, int num_cpus) { @@ -118,8 +141,39 @@ void Init_V3(struct v3_os_hooks * hooks, int num_cpus) { } -void Deinit_V3() { - +void Shutdown_V3() { + // int i; + + V3_deinit_devices(); + V3_deinit_shdw_paging(); + +#if 0 + +#ifdef CONFIG_SYMMOD + V3_deinit_symmod(); +#endif + +#ifdef CONFIG_INSTRUMENT_VMM + v3_deinit_instrumentation(); +#endif + +#ifdef CONFIG_VNET + v3_deinit_vnet(); +#endif + +#ifdef CONFIG_MULTITHREAD_OS + if ((hooks) && (hooks->call_on_cpu)) { + for (i = 0; i < CONFIG_MAX_CPUS; i++) { + if (v3_cpu_types[i] != V3_INVALID_CPU) { + deinit_cpu(i); + } + } + } +#else + deinit_cpu(0); +#endif + +#endif } diff --git a/palacios/src/palacios/vmm_config.c b/palacios/src/palacios/vmm_config.c index 572f01a..50e3b1c 100644 --- a/palacios/src/palacios/vmm_config.c +++ b/palacios/src/palacios/vmm_config.c @@ -166,7 +166,6 @@ static struct v3_config * parse_config(void * cfg_blob) { return NULL; } - V3_Print("File index=%d id=%s\n", idx, id); strncpy(file->tag, id, 256); @@ -212,9 +211,9 @@ static inline uint32_t get_alignment(char * align_str) { return alignment; } -static int pre_config_vm(struct v3_vm_info * vm, v3_cfg_tree_t * vm_cfg) { +static int pre_config_vm(struct v3_vm_info * vm, v3_cfg_tree_t * vm_cfg) { char * memory_str = v3_cfg_val(vm_cfg, "memory"); char * schedule_hz_str = v3_cfg_val(vm_cfg, "schedule_hz"); char * vm_class = v3_cfg_val(vm_cfg, "class"); @@ -279,8 +278,8 @@ static int pre_config_vm(struct v3_vm_info * vm, v3_cfg_tree_t * vm_cfg) { return 0; } -static int determine_paging_mode(struct guest_info *info, v3_cfg_tree_t * core_cfg) -{ + +static int determine_paging_mode(struct guest_info * info, v3_cfg_tree_t * core_cfg) { extern v3_cpu_arch_t v3_cpu_types[]; v3_cfg_tree_t * vm_tree = info->vm_info->cfg_data->cfg; diff --git a/palacios/src/palacios/vmm_dev_mgr.c b/palacios/src/palacios/vmm_dev_mgr.c index f578f02..f0554ea 100644 --- a/palacios/src/palacios/vmm_dev_mgr.c +++ b/palacios/src/palacios/vmm_dev_mgr.c @@ -86,6 +86,12 @@ int V3_init_devices() { } +int V3_deinit_devices() { + v3_free_htable(master_dev_table, 0, 0); + return 0; +} + + int v3_init_dev_mgr(struct v3_vm_info * vm) { struct vmm_dev_mgr * mgr = &(vm->dev_mgr); diff --git a/palacios/src/palacios/vmm_shadow_paging.c b/palacios/src/palacios/vmm_shadow_paging.c index 4f8804e..b46469c 100644 --- a/palacios/src/palacios/vmm_shadow_paging.c +++ b/palacios/src/palacios/vmm_shadow_paging.c @@ -95,6 +95,11 @@ int V3_init_shdw_paging() { return 0; } +int V3_deinit_shdw_paging() { + v3_free_htable(master_shdw_pg_table, 0, 0); + return 0; +} + /***