From: Erik van der Kouwe Date: Sat, 22 Jan 2011 00:56:28 +0000 (-0600) Subject: This patch adds a few compiler conditionals so that multi-thread-specific code is... X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=268cdc635ece417c3472295c4c81591564c6e0df;p=palacios.git This patch adds a few compiler conditionals so that multi-thread-specific code is not included if CONFIG_MULTITHREAD_OS is not set. --- diff --git a/palacios/include/palacios/vmm.h b/palacios/include/palacios/vmm.h index 9ee2bf8..c39d7a1 100644 --- a/palacios/include/palacios/vmm.h +++ b/palacios/include/palacios/vmm.h @@ -250,7 +250,9 @@ void v3_yield_cond(struct guest_info * info); void v3_print_cond(const char * fmt, ...); +#ifdef CONFIG_MULTITHREAD_OS void v3_interrupt_cpu(struct v3_vm_info * vm, int logical_cpu, int vector); +#endif v3_cpu_arch_t v3_get_cpu_type(int cpu_id); diff --git a/palacios/src/devices/8259a.c b/palacios/src/devices/8259a.c index 66b3768..0d5e5ff 100644 --- a/palacios/src/devices/8259a.c +++ b/palacios/src/devices/8259a.c @@ -216,7 +216,9 @@ static int pic_raise_intr(struct v3_vm_info * vm, void * private_data, int irq) return -1; } +#ifdef CONFIG_MULTITHREAD_OS v3_interrupt_cpu(vm, 0, 0); +#endif return 0; } diff --git a/palacios/src/devices/apic.c b/palacios/src/devices/apic.c index e7d0177..7f70d9c 100644 --- a/palacios/src/devices/apic.c +++ b/palacios/src/devices/apic.c @@ -599,7 +599,11 @@ static int deliver_ipi(struct apic_state * src_apic, // host maitains logical proc->phsysical proc PrintDebug(" non-local core, forcing it to exit\n"); +#ifdef CONFIG_MULTITHREAD_OS v3_interrupt_cpu(dst_core->vm_info, dst_core->cpu_id, 0); +#else + V3_ASSERT(0); +#endif } break; @@ -1321,7 +1325,11 @@ int v3_apic_raise_intr(struct v3_vm_info * vm, uint32_t irq, uint32_t dst, void activate_apic_irq(apic, irq); if (V3_Get_CPU() != dst) { +#ifdef CONFIG_MULTITHREAD_OS v3_interrupt_cpu(vm, dst, 0); +#else + V3_ASSERT(0); +#endif } return 0; diff --git a/palacios/src/palacios/vmm.c b/palacios/src/palacios/vmm.c index 9fc99fd..a7e83cc 100644 --- a/palacios/src/palacios/vmm.c +++ b/palacios/src/palacios/vmm.c @@ -240,12 +240,18 @@ 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 #define MAX_CORES 32 +#else +#define MAX_CORES 1 +#endif int v3_start_vm(struct v3_vm_info * vm, unsigned int cpu_mask) { uint32_t i; +#ifdef CONFIG_MULTITHREAD_OS int vcore_id = 0; +#endif uint8_t * core_mask = (uint8_t *)&cpu_mask; // This is to make future expansion easier uint32_t avail_cores = 0; @@ -273,6 +279,7 @@ int v3_start_vm(struct v3_vm_info * vm, unsigned int cpu_mask) { } +#ifdef 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 = i / 8; @@ -309,6 +316,7 @@ int v3_start_vm(struct v3_vm_info * vm, unsigned int cpu_mask) { vcore_id++; } +#endif sprintf(vm->cores[0].exec_name, "%s", vm->name);