X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm.c;h=ebcdfb85579d76be006d987dad7432d2d9cf62ec;hb=fc220749dd74a84f222b4a60c69a47e6ae743990;hp=c5a7eb9f7a82c770a75f5ee70127dd2a1bf09aec;hpb=e874305a90a64fc14c06c00c8d57f8019709c19f;p=palacios.git diff --git a/palacios/src/palacios/vmm.c b/palacios/src/palacios/vmm.c index c5a7eb9..ebcdfb8 100644 --- a/palacios/src/palacios/vmm.c +++ b/palacios/src/palacios/vmm.c @@ -26,19 +26,19 @@ #include #include -#ifdef CONFIG_SVM +#ifdef V3_CONFIG_SVM #include #endif -#ifdef CONFIG_VMX +#ifdef V3_CONFIG_VMX #include #endif -#ifdef CONFIG_VNET +#ifdef V3_CONFIG_VNET #include #endif -v3_cpu_arch_t v3_cpu_types[CONFIG_MAX_CPUS]; +v3_cpu_arch_t v3_cpu_types[V3_CONFIG_MAX_CPUS]; struct v3_os_hooks * os_hooks = NULL; int v3_dbg_enable = 0; @@ -47,14 +47,14 @@ int v3_dbg_enable = 0; static void init_cpu(void * arg) { uint32_t cpu_id = (uint32_t)(addr_t)arg; -#ifdef CONFIG_SVM +#ifdef V3_CONFIG_SVM if (v3_is_svm_capable()) { PrintDebug("Machine is SVM Capable\n"); v3_init_svm_cpu(cpu_id); } else #endif -#ifdef CONFIG_VMX +#ifdef V3_CONFIG_VMX if (v3_is_vmx_capable()) { PrintDebug("Machine is VMX Capable\n"); v3_init_vmx_cpu(cpu_id); @@ -72,17 +72,18 @@ static void deinit_cpu(void * arg) { switch (v3_cpu_types[cpu_id]) { - #ifdef CONFIG_SVM - case V3_VMX_CPU: - case V3_VMX_EPT_CPU: - PrintDebug("Machine is SVM Capable\n"); +#ifdef V3_CONFIG_SVM + case V3_SVM_CPU: + case V3_SVM_REV3_CPU: + PrintDebug("Deinitializing SVM CPU %d\n", cpu_id); v3_deinit_svm_cpu(cpu_id); break; #endif -#ifdef CONFIG_VMX - case V3_SVM_CPU: - case V3_SVM_REV3_CPU: - PrintDebug("Machine is VMX Capable\n"); +#ifdef V3_CONFIG_VMX + case V3_VMX_CPU: + case V3_VMX_EPT_CPU: + case V3_VMX_EPT_UG_CPU: + PrintDebug("Deinitializing VMX CPU %d\n", cpu_id); v3_deinit_vmx_cpu(cpu_id); break; #endif @@ -103,7 +104,7 @@ void Init_V3(struct v3_os_hooks * hooks, int num_cpus) { // Set global variables. os_hooks = hooks; - for (i = 0; i < CONFIG_MAX_CPUS; i++) { + for (i = 0; i < V3_CONFIG_MAX_CPUS; i++) { v3_cpu_types[i] = V3_INVALID_CPU; } @@ -117,17 +118,17 @@ void Init_V3(struct v3_os_hooks * hooks, int num_cpus) { V3_init_extensions(); -#ifdef CONFIG_SYMMOD +#ifdef V3_CONFIG_SYMMOD V3_init_symmod(); #endif -#ifdef CONFIG_VNET +#ifdef V3_CONFIG_VNET v3_init_vnet(); #endif -#ifdef CONFIG_MULTITHREAD_OS +#ifdef V3_CONFIG_MULTITHREAD_OS if ((hooks) && (hooks->call_on_cpu)) { for (i = 0; i < num_cpus; i++) { @@ -151,18 +152,18 @@ void Shutdown_V3() { V3_deinit_extensions(); -#ifdef CONFIG_SYMMOD +#ifdef V3_CONFIG_SYMMOD V3_deinit_symmod(); #endif -#ifdef CONFIG_VNET +#ifdef V3_CONFIG_VNET v3_deinit_vnet(); #endif -#ifdef CONFIG_MULTITHREAD_OS +#ifdef V3_CONFIG_MULTITHREAD_OS if ((os_hooks) && (os_hooks->call_on_cpu)) { - for (i = 0; i < CONFIG_MAX_CPUS; i++) { + for (i = 0; i < V3_CONFIG_MAX_CPUS; i++) { if (v3_cpu_types[i] != V3_INVALID_CPU) { deinit_cpu((void *)(addr_t)i); } @@ -183,14 +184,13 @@ v3_cpu_arch_t v3_get_cpu_type(int cpu_id) { struct v3_vm_info * v3_create_vm(void * cfg, void * priv_data, char * name) { struct v3_vm_info * vm = v3_config_guest(cfg, priv_data); - V3_Print("CORE 0 RIP=%p\n", (void *)(addr_t)(vm->cores[0].rip)); - - if (vm == NULL) { PrintError("Could not configure guest\n"); return NULL; } + V3_Print("CORE 0 RIP=%p\n", (void *)(addr_t)(vm->cores[0].rip)); + if (name == NULL) { name = "[V3_VM]"; } else if (strlen(name) >= 128) { @@ -213,15 +213,16 @@ static int start_core(void * p) core->cpu_id, (void *)(addr_t)core->rip); switch (v3_cpu_types[0]) { -#ifdef CONFIG_SVM +#ifdef V3_CONFIG_SVM case V3_SVM_CPU: case V3_SVM_REV3_CPU: return v3_start_svm_guest(core); break; #endif -#if CONFIG_VMX +#if V3_CONFIG_VMX case V3_VMX_CPU: case V3_VMX_EPT_CPU: + case V3_VMX_EPT_UG_CPU: return v3_start_vmx_guest(core); break; #endif @@ -235,7 +236,7 @@ static int start_core(void * p) // For the moment very ugly. Eventually we will shift the cpu_mask to an arbitrary sized type... -#ifdef CONFIG_MULTITHREAD_OS +#ifdef V3_CONFIG_MULTITHREAD_OS #define MAX_CORES 32 #else #define MAX_CORES 1 @@ -271,7 +272,7 @@ int v3_start_vm(struct v3_vm_info * vm, unsigned int cpu_mask) { return -1; } -#ifdef CONFIG_MULTITHREAD_OS +#ifdef V3_CONFIG_MULTITHREAD_OS // spawn off new threads, for other cores for (i = 0, vcore_id = 1; (i < MAX_CORES) && (vcore_id < vm->num_cores); i++) { int major = 0; @@ -304,7 +305,6 @@ int v3_start_vm(struct v3_vm_info * vm, unsigned int cpu_mask) { minor = core_idx % 8; - if ((core_mask[major] & (0x1 << minor)) == 0) { PrintError("Logical CPU %d not available for virtual core %d; not started\n", core_idx, vcore_id); @@ -375,8 +375,6 @@ int v3_stop_vm(struct v3_vm_info * vm) { break; } - V3_Print("Yielding\n"); - v3_yield(NULL); } @@ -494,7 +492,7 @@ void v3_print_cond(const char * fmt, ...) { } -#ifdef CONFIG_MULTITHREAD_OS +#ifdef V3_CONFIG_MULTITHREAD_OS void v3_interrupt_cpu(struct v3_vm_info * vm, int logical_cpu, int vector) { extern struct v3_os_hooks * os_hooks; @@ -509,15 +507,16 @@ void v3_interrupt_cpu(struct v3_vm_info * vm, int logical_cpu, int vector) { int v3_vm_enter(struct guest_info * info) { switch (v3_cpu_types[0]) { -#ifdef CONFIG_SVM +#ifdef V3_CONFIG_SVM case V3_SVM_CPU: case V3_SVM_REV3_CPU: return v3_svm_enter(info); break; #endif -#if CONFIG_VMX +#if V3_CONFIG_VMX case V3_VMX_CPU: case V3_VMX_EPT_CPU: + case V3_VMX_EPT_UG_CPU: return v3_vmx_enter(info); break; #endif