From: Jack Lange Date: Thu, 13 Aug 2009 22:36:54 +0000 (-0500) Subject: fixed configuration macro checks and a few configuration bugs X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=82b8b87c344fcd1eab22e3f3be5ad54cbb3f8f68 fixed configuration macro checks and a few configuration bugs --- diff --git a/Kconfig b/Kconfig index 00edbc3..1ad2ad9 100644 --- a/Kconfig +++ b/Kconfig @@ -1,12 +1,5 @@ mainmenu "Palacios VMM Configuration" -config x86_64 - bool - default y - help - Support for the x86-64 architecture. - - menu "Target Configuration" config CRAY_XT @@ -25,16 +18,47 @@ config VMX default y help Compile with support for Intel VMX -endmenu -menu "Virtual Devices" +config SOCKET + bool "Include Network Socket Support" + default y + help + Enable networking support in Palacios + + -config APIC - bool "APIC" +config PROFILE_VMM + bool "Enable VMM profiling support" default y help - "Includes the Virtual APIC device" + Enable the profiling framework in Palacios + ----- + This is a framwork that allows components of palacios to record + information that is periodically reported to the log file + +config INSTRUMENT_VMM + bool "Enable VMM instrumentation" + default n + help + Enable the instrumentation framework + -------- + This is much heavier weight than profiling + + +endmenu + + + + +menu "Symbiotic Functions" + +config SYMBIOTIC + bool "Enable Symbiotic Functionality" + default n + help + Enable Symbiotic components of the VMM + endmenu @@ -58,20 +82,75 @@ config DEBUG_ON This turns on debugging support - +config DEBUG_SHADOW_PAGING + bool "Shadow paging" + default n + depends on DEBUG_ON + help + This turns on debugging for the shadow paging system + + +config DEBUG_NESTED_PAGING + bool "Nested paging" + default n + depends on DEBUG_ON + help + This turns on debugging for the nested paging system + + +config DEBUG_CTRL_REGS + bool "Control registers" + default n + depends on DEBUG_ON + help + This turns on debugging for the control register handlers -config DEBUG_PIC - bool "PIC" +config DEBUG_INTERRUPTS + bool "Interrupts" + default n depends on DEBUG_ON help - Enable debugging for the PIC + This turns on debugging for the interrupt system + + -config DEBUG_APIC - bool "APIC" - depends on DEBUG_ON && APIC +config DEBUG_IO + bool "IO" + default n + depends on DEBUG_ON help - Enable debugging for the APIC + This turns on debugging for the IO handlers + + +config DEBUG_EMULATOR + bool "Instruction Emulator" + default n + depends on DEBUG_ON + help + This turns on debugging for the Instruction Emulator + + +config DEBUG_XED + bool "XED" + default n + depends on DEBUG_ON + help + This turns on debugging for the Xed Decoder + +config DEBUG_HALT + bool "Halt" + default n + depends on DEBUG_ON + help + This turns on debugging for the halt instruction handler + +config DEBUG_DEV_MGR + bool "Device Manager" + default n + depends on DEBUG_ON + help + This turns on debugging for the device manager @@ -93,7 +172,16 @@ config VGABIOS_PATH help This is the vgabios that will be used for the guests +config VMXASSIST_PATH + string "Path to pre-built VMXASSIST binary" + depends on VMX + default "./bios/vmxassist/vmxassist.bin" + help + This is vmxassist image to boot real mode guests on + Intel VMX Platforms + endmenu -#source "net/Kconfig" + +source "palacios/src/devices/Kconfig" diff --git a/palacios/include/palacios/vm_guest.h b/palacios/include/palacios/vm_guest.h index eb85d7d..bbfc22d 100644 --- a/palacios/include/palacios/vm_guest.h +++ b/palacios/include/palacios/vm_guest.h @@ -110,8 +110,10 @@ struct v3_segments { struct shadow_page_state; struct v3_intr_state; -struct v3_profiler; +#ifdef CONFIG_PROFILE_VMM +struct v3_profiler; +#endif @@ -167,9 +169,10 @@ struct guest_info { uint64_t yield_start_cycle; - +#ifdef CONFIG_PROFILE_VMM uint_t enable_profiler; struct v3_profiler profiler; +#endif void * decoder_state; }; diff --git a/palacios/include/palacios/vmm_instrument.h b/palacios/include/palacios/vmm_instrument.h index b59eac0..63b2be2 100644 --- a/palacios/include/palacios/vmm_instrument.h +++ b/palacios/include/palacios/vmm_instrument.h @@ -22,7 +22,7 @@ #ifdef __V3VEE__ -#ifdef INSTRUMENT_VMM +#ifdef CONFIG_INSTRUMENT_VMM #include #include diff --git a/palacios/include/palacios/vmm_profiler.h b/palacios/include/palacios/vmm_profiler.h index 75722b8..9787db0 100644 --- a/palacios/include/palacios/vmm_profiler.h +++ b/palacios/include/palacios/vmm_profiler.h @@ -22,6 +22,8 @@ #ifdef __V3VEE__ +#ifdef CONFIG_PROFILE_VMM + #include struct guest_info; @@ -45,6 +47,7 @@ void v3_profile_exit(struct guest_info * info, uint_t exit_code); void v3_print_profile(struct guest_info * info); +#endif #endif diff --git a/palacios/src/devices/8254.c b/palacios/src/devices/8254.c index 7d1acfe..c205752 100644 --- a/palacios/src/devices/8254.c +++ b/palacios/src/devices/8254.c @@ -26,7 +26,7 @@ -#ifndef DEBUG_PIT +#ifndef CONFIG_DEBUG_PIT #undef PrintDebug #define PrintDebug(fmt, args...) #endif @@ -653,7 +653,7 @@ static int pit_init(struct guest_info * info, void * cfg_data) { v3_dev_hook_io(dev, CHANNEL2_PORT, &pit_read_channel, &pit_write_channel); v3_dev_hook_io(dev, COMMAND_PORT, NULL, &pit_write_command); -#ifdef DEBUG_PIT +#ifdef CONFIG_DEBUG_PIT PrintDebug("8254 PIT: OSC_HZ=%d, reload_val=", OSC_HZ); PrintTraceLL(reload_val); PrintDebug("\n"); @@ -673,7 +673,7 @@ static int pit_init(struct guest_info * info, void * cfg_data) { init_channel(&(pit_state->ch_1)); init_channel(&(pit_state->ch_2)); -#ifdef DEBUG_PIT +#ifdef CONFIG_DEBUG_PIT PrintDebug("8254 PIT: CPU MHZ=%d -- pit count=", cpu_khz / 1000); PrintTraceLL(pit_state->pit_counter); PrintDebug("\n"); diff --git a/palacios/src/devices/8259a.c b/palacios/src/devices/8259a.c index 336c0d7..1d47e73 100644 --- a/palacios/src/devices/8259a.c +++ b/palacios/src/devices/8259a.c @@ -24,7 +24,7 @@ #include #include -#ifndef DEBUG_PIC +#ifndef CONFIG_DEBUG_PIC #undef PrintDebug #define PrintDebug(fmt, args...) #endif diff --git a/palacios/src/devices/Makefile b/palacios/src/devices/Makefile index 3938c7c..44c4b91 100644 --- a/palacios/src/devices/Makefile +++ b/palacios/src/devices/Makefile @@ -1,25 +1,24 @@ -obj-y := \ - 8254.o \ - 8259a.o \ - apic.o \ - bochs_debug.o \ - generic.o \ - i440fx.o \ - ide.o \ - io_apic.o \ - keyboard.o \ - lnx_virtio_balloon.o \ - lnx_virtio_blk.o \ - lnx_virtio_sym.o \ - nvram.o \ - os_debug.o \ - pci.o \ - piix3.o \ - ram_cd.o \ - ram_hd.o \ - sym_swap.o +obj-$(CONFIG_APIC) += apic.o +obj-$(CONFIG_PIT) += 8254.o +obj-$(CONFIG_PIC) += 8259a.o +obj-$(CONFIG_BOCHS_DEBUG) += bochs_debug.o +obj-$(CONFIG_GENERIC) += generic.o +obj-$(CONFIG_I440FX) += i440fx.o +obj-$(CONFIG_IDE) += ide.o +obj-$(CONFIG_IO_APIC) += io_apic.o +obj-$(CONFIG_KEYBOARD) += keyboard.o +obj-$(CONFIG_LINUX_VIRTIO_BALLOON) += lnx_virtio_balloon.o +obj-$(CONFIG_LINUX_VIRTIO_BLOCK) += lnx_virtio_blk.o +obj-$(CONFIG_LINUX_VIRTIO_SYM) += lnx_virtio_sym.o +obj-$(CONFIG_NVRAM) += nvram.o +obj-$(CONFIG_OS_DEBUG) += os_debug.o +obj-$(CONFIG_PCI) += pci.o +obj-$(CONFIG_PIIX3) += piix3.o +obj-$(CONFIG_RAM_CD) += ram_cd.o +obj-$(CONFIG_RAM_HD) += ram_hd.o +obj-$(CONFIG_SYM_SWAP) += sym_swap.o -# ne2k.o \ +obj-$(CONFIG_NE2K) += ne2k.o -obj-$(CONFIG_SOCKET) += net_cd.o \ - net_hd.o +obj-$(CONFIG_NET_CD) += net_cd.o +obj-$(CONFIG_NET_HD) += net_hd.o diff --git a/palacios/src/devices/apic.c b/palacios/src/devices/apic.c index 2ce9225..2d95008 100644 --- a/palacios/src/devices/apic.c +++ b/palacios/src/devices/apic.c @@ -24,7 +24,7 @@ #include -#ifndef DEBUG_APIC +#ifndef CONFIG_DEBUG_APIC #undef PrintDebug #define PrintDebug(fmt, args...) #endif diff --git a/palacios/src/devices/generic.c b/palacios/src/devices/generic.c index 7a70e5d..fbeff20 100644 --- a/palacios/src/devices/generic.c +++ b/palacios/src/devices/generic.c @@ -26,7 +26,7 @@ -#ifndef DEBUG_GENERIC +#ifndef CONFIG_DEBUG_GENERIC #undef PrintDebug #define PrintDebug(fmt, args...) #endif diff --git a/palacios/src/devices/ide.c b/palacios/src/devices/ide.c index 8349f70..3138c64 100644 --- a/palacios/src/devices/ide.c +++ b/palacios/src/devices/ide.c @@ -26,7 +26,7 @@ #include "ide-types.h" #include "atapi-types.h" -#ifndef DEBUG_IDE +#ifndef CONFIG_DEBUG_IDE #undef PrintDebug #define PrintDebug(fmt, args...) #endif @@ -353,7 +353,7 @@ static int dma_write(struct vm_device * dev, struct ide_channel * channel); #include "ata.h" -#ifdef DEBUG_IDE +#ifdef CONFIG_DEBUG_IDE static void print_prd_table(struct vm_device * dev, struct ide_channel * channel) { struct ide_dma_prd prd_entry; int index = 0; @@ -395,7 +395,7 @@ static int dma_read(struct vm_device * dev, struct ide_channel * channel) { // Read in the data buffer.... // Read a sector/block at a time until the prd entry is full. -#ifdef DEBUG_IDE +#ifdef CONFIG_DEBUG_IDE print_prd_table(dev, channel); #endif diff --git a/palacios/src/devices/io_apic.c b/palacios/src/devices/io_apic.c index 5b840d5..860cf8d 100644 --- a/palacios/src/devices/io_apic.c +++ b/palacios/src/devices/io_apic.c @@ -23,7 +23,7 @@ #include -#ifndef DEBUG_IO_APIC +#ifndef CONFIG_DEBUG_IO_APIC #undef PrintDebug #define PrintDebug(fmt, args...) #endif diff --git a/palacios/src/devices/keyboard.c b/palacios/src/devices/keyboard.c index 0fcdc90..e9fff1f 100644 --- a/palacios/src/devices/keyboard.c +++ b/palacios/src/devices/keyboard.c @@ -25,7 +25,7 @@ #include -#ifndef DEBUG_KEYBOARD +#ifndef CONFIG_DEBUG_KEYBOARD #undef PrintDebug #define PrintDebug(fmt, args...) #endif diff --git a/palacios/src/devices/lnx_virtio_blk.c b/palacios/src/devices/lnx_virtio_blk.c index 0720e93..e58ec10 100644 --- a/palacios/src/devices/lnx_virtio_blk.c +++ b/palacios/src/devices/lnx_virtio_blk.c @@ -27,12 +27,12 @@ #include -/* -#ifndef DEBUG_VIRTIO_BLK + +#ifndef CONFIG_DEBUG_VIRTIO_BLK #undef PrintDebug #define PrintDebug(fmt, args...) #endif -*/ + #define BLK_CAPACITY_PORT 20 #define BLK_MAX_SIZE_PORT 28 diff --git a/palacios/src/devices/ne2k.c b/palacios/src/devices/ne2k.c index e535a1c..9df0871 100644 --- a/palacios/src/devices/ne2k.c +++ b/palacios/src/devices/ne2k.c @@ -29,7 +29,7 @@ #include #include -#ifndef DEBUG_NE2K +#ifndef CONFIG_DEBUG_NE2K #undef PrintDebug #define PrintDebug(fmts, args...) #endif @@ -333,7 +333,7 @@ struct ne2k_context { #define compare_mac(src, dst) !memcmp(src, dst, 6) -#ifdef DEBUG_NE2K +#ifdef CONFIG_DEBUG_NE2K static void dump_state(struct vm_device * dev) { struct ne2k_context *nic_state = (struct ne2k_context *)dev->private_data; int i; @@ -413,7 +413,7 @@ static void ne2k_init_state(struct vm_device * dev) { nic_state->mem[14] = 0x57; nic_state->mem[15] = 0x57; -#ifdef DEBUG_NE2K +#ifdef CONFIG_DEBUG_NE2K dump_state(dev); #endif @@ -558,7 +558,7 @@ static int netif_input(uchar_t *pkt, uint_t size) { static const uchar_t brocast_mac[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; int i; -#ifdef DEBUG_NE2K +#ifdef CONFIG_DEBUG_NE2K PrintDebug("\nNe2k: Packet Received:\nSource:"); for (i = 6; i < 12; i++) { PrintDebug("%x ", pkt[i]); @@ -1146,7 +1146,7 @@ static int ne2k_init_device(struct vm_device * dev) { } -#ifdef DEBUG_NE2K +#ifdef CONFIG_DEBUG_NE2K dump_state(dev); #endif diff --git a/palacios/src/devices/net_cd.c b/palacios/src/devices/net_cd.c index d8ea73e..f980bab 100644 --- a/palacios/src/devices/net_cd.c +++ b/palacios/src/devices/net_cd.c @@ -22,7 +22,7 @@ #include #include -#ifndef DEBUG_IDE +#ifndef CONFIG_DEBUG_IDE #undef PrintDebug #define PrintDebug(fmt, args...) #endif diff --git a/palacios/src/devices/net_hd.c b/palacios/src/devices/net_hd.c index 8db6b97..0894797 100644 --- a/palacios/src/devices/net_hd.c +++ b/palacios/src/devices/net_hd.c @@ -22,7 +22,7 @@ #include #include -#ifndef DEBUG_IDE +#ifndef CONFIG_DEBUG_IDE #undef PrintDebug #define PrintDebug(fmt, args...) #endif diff --git a/palacios/src/devices/nvram.c b/palacios/src/devices/nvram.c index 5c70d3b..36da2aa 100644 --- a/palacios/src/devices/nvram.c +++ b/palacios/src/devices/nvram.c @@ -26,7 +26,7 @@ #include -#ifndef DEBUG_NVRAM +#ifndef CONFIG_DEBUG_NVRAM #undef PrintDebug #define PrintDebug(fmt, args...) #endif diff --git a/palacios/src/devices/pci.c b/palacios/src/devices/pci.c index 7cd1147..2e7044f 100644 --- a/palacios/src/devices/pci.c +++ b/palacios/src/devices/pci.c @@ -32,7 +32,7 @@ #include #include -#ifndef DEBUG_PCI +#ifndef CONFIG_DEBUG_PCI #undef PrintDebug #define PrintDebug(fmt, args...) #endif @@ -99,7 +99,7 @@ struct pci_internal { -#ifdef DEBUG_PCI +#ifdef CONFIG_DEBUG_PCI static void pci_dump_state(struct pci_internal * pci_state) { struct rb_node * node = v3_rb_first(&(pci_state->bus_list[0].devices)); @@ -875,7 +875,7 @@ struct pci_device * v3_pci_register_device(struct vm_device * pci, // add the device add_device_to_bus(bus, pci_dev); -#ifdef DEBUG_PCI +#ifdef CONFIG_DEBUG_PCI pci_dump_state(pci_state); #endif diff --git a/palacios/src/devices/ram_cd.c b/palacios/src/devices/ram_cd.c index a139fc0..87670c7 100644 --- a/palacios/src/devices/ram_cd.c +++ b/palacios/src/devices/ram_cd.c @@ -22,7 +22,7 @@ #include #include -#ifndef DEBUG_IDE +#ifndef CONFIG_DEBUG_IDE #undef PrintDebug #define PrintDebug(fmt, args...) #endif diff --git a/palacios/src/devices/ram_hd.c b/palacios/src/devices/ram_hd.c index 6c61ad4..6a5730c 100644 --- a/palacios/src/devices/ram_hd.c +++ b/palacios/src/devices/ram_hd.c @@ -23,7 +23,7 @@ -#ifndef DEBUG_IDE +#ifndef CONFIG_DEBUG_IDE #undef PrintDebug #define PrintDebug(fmt, args...) #endif diff --git a/palacios/src/palacios/Makefile b/palacios/src/palacios/Makefile index 826c405..c0b20f8 100644 --- a/palacios/src/palacios/Makefile +++ b/palacios/src/palacios/Makefile @@ -28,9 +28,6 @@ obj-y := \ vmm_time.o \ vmm_util.o \ vmm_xed.o \ - vmm_instrument.o \ - vmm_profiler.o \ - vmm_socket.o \ vmm_binaries.o @@ -48,10 +45,11 @@ obj-$(CONFIG_VMX) += vmx.o \ vmx_handler.o \ vmx_io.o \ vmx_lowlevel.o \ - vmx_msr.o + vmx_msr.o \ + vmcs.o -#obj-$(CONFIG_INSTRUMENT) += vmm_instrument.o \ -# vmm_profiler -#obj-$(CONFIG_SOCKET) += vmm_socket.o +obj-$(CONFIG_INSTRUMENT_VMM) += vmm_instrument.o +obj-$(CONFIG_PROFILE_VMM) += vmm_profiler.o +obj-$(CONFIG_SOCKET) += vmm_socket.o diff --git a/palacios/src/palacios/svm.c b/palacios/src/palacios/svm.c index d2444ac..4a1b404 100644 --- a/palacios/src/palacios/svm.c +++ b/palacios/src/palacios/svm.c @@ -321,9 +321,11 @@ static int start_svm_guest(struct guest_info *info) { if ((num_exits % 5000) == 0) { PrintDebug("SVM Exit number %d\n", num_exits); +#ifdef CONFIG_PROFILE_VMM if (info->enable_profiler) { v3_print_profile(info); } +#endif } if (v3_handle_svm_exit(info) != 0) { diff --git a/palacios/src/palacios/svm_halt.c b/palacios/src/palacios/svm_halt.c index 2e6f9e2..a8bf0b9 100644 --- a/palacios/src/palacios/svm_halt.c +++ b/palacios/src/palacios/svm_halt.c @@ -22,7 +22,7 @@ #include -#ifndef DEBUG_HALT +#ifndef CONFIG_DEBUG_HALT #undef PrintDebug #define PrintDebug(fmt, args...) #endif diff --git a/palacios/src/palacios/svm_handler.c b/palacios/src/palacios/svm_handler.c index f7fd96e..a70b0dd 100644 --- a/palacios/src/palacios/svm_handler.c +++ b/palacios/src/palacios/svm_handler.c @@ -72,7 +72,7 @@ int v3_handle_svm_exit(struct guest_info * info) { if ((info->intr_state.irq_pending == 1) && (guest_ctrl->guest_ctrl.V_IRQ == 0)) { -#ifdef DEBUG_INTERRUPTS +#ifdef CONFIG_DEBUG_INTERRUPTS PrintDebug("INTAK cycle completed for irq %d\n", info->intr_state.irq_vector); #endif @@ -83,7 +83,7 @@ int v3_handle_svm_exit(struct guest_info * info) { } if ((info->intr_state.irq_started == 1) && (guest_ctrl->exit_int_info.valid == 0)) { -#ifdef DEBUG_INTERRUPTS +#ifdef CONFIG_DEBUG_INTERRUPTS PrintDebug("Interrupt %d taken by guest\n", info->intr_state.irq_vector); #endif @@ -91,16 +91,17 @@ int v3_handle_svm_exit(struct guest_info * info) { info->intr_state.irq_started = 0; } else { -#ifdef DEBUG_INTERRUPTS +#ifdef CONFIG_DEBUG_INTERRUPTS PrintDebug("EXIT INT INFO is set (vec=%d)\n", guest_ctrl->exit_int_info.vector); #endif } - +#ifdef CONFIG_PROFILE_VMM if (info->enable_profiler) { rdtscll(info->profiler.start_time); } +#endif //PrintDebug("SVM Returned: Exit Code: %x\n",exit_code); @@ -151,7 +152,7 @@ int v3_handle_svm_exit(struct guest_info * info) { break; case VMEXIT_CR0_WRITE: -#ifdef DEBUG_CTRL_REGS +#ifdef CONFIG_DEBUG_CTRL_REGS PrintDebug("CR0 Write\n"); #endif if (v3_handle_cr0_write(info) == -1) { @@ -159,7 +160,7 @@ int v3_handle_svm_exit(struct guest_info * info) { } break; case VMEXIT_CR0_READ: -#ifdef DEBUG_CTRL_REGS +#ifdef CONFIG_DEBUG_CTRL_REGS PrintDebug("CR0 Read\n"); #endif if (v3_handle_cr0_read(info) == -1) { @@ -167,7 +168,7 @@ int v3_handle_svm_exit(struct guest_info * info) { } break; case VMEXIT_CR3_WRITE: -#ifdef DEBUG_CTRL_REGS +#ifdef CONFIG_DEBUG_CTRL_REGS PrintDebug("CR3 Write\n"); #endif if (v3_handle_cr3_write(info) == -1) { @@ -175,7 +176,7 @@ int v3_handle_svm_exit(struct guest_info * info) { } break; case VMEXIT_CR3_READ: -#ifdef DEBUG_CTRL_REGS +#ifdef CONFIG_DEBUG_CTRL_REGS PrintDebug("CR3 Read\n"); #endif if (v3_handle_cr3_read(info) == -1) { @@ -183,7 +184,7 @@ int v3_handle_svm_exit(struct guest_info * info) { } break; case VMEXIT_CR4_WRITE: -#ifdef DEBUG_CTRL_REGS +#ifdef CONFIG_DEBUG_CTRL_REGS PrintDebug("CR4 Write\n"); #endif if (v3_handle_cr4_write(info) == -1) { @@ -191,7 +192,7 @@ int v3_handle_svm_exit(struct guest_info * info) { } break; case VMEXIT_CR4_READ: -#ifdef DEBUG_CTRL_REGS +#ifdef CONFIG_DEBUG_CTRL_REGS PrintDebug("CR4 Read\n"); #endif if (v3_handle_cr4_read(info) == -1) { @@ -201,7 +202,7 @@ int v3_handle_svm_exit(struct guest_info * info) { case VMEXIT_EXCP14: { addr_t fault_addr = guest_ctrl->exit_info2; pf_error_t * error_code = (pf_error_t *)&(guest_ctrl->exit_info1); -#ifdef DEBUG_SHADOW_PAGING +#ifdef CONFIG_DEBUG_SHADOW_PAGING PrintDebug("PageFault at %p (error=%d)\n", (void *)fault_addr, *(uint_t *)error_code); #endif @@ -231,7 +232,7 @@ int v3_handle_svm_exit(struct guest_info * info) { } case VMEXIT_INVLPG: if (info->shdw_pg_mode == SHADOW_PAGING) { -#ifdef DEBUG_SHADOW_PAGING +#ifdef CONFIG_DEBUG_SHADOW_PAGING PrintDebug("Invlpg\n"); #endif if (v3_handle_shadow_invlpg(info) == -1) { @@ -258,7 +259,7 @@ int v3_handle_svm_exit(struct guest_info * info) { // handle_svm_smi(info); // ignored for now break; case VMEXIT_HLT: -#ifdef DEBUG_HALT +#ifdef CONFIG_DEBUG_HALT PrintDebug("Guest halted\n"); #endif if (v3_handle_svm_halt(info) == -1) { @@ -272,7 +273,7 @@ int v3_handle_svm_exit(struct guest_info * info) { } break; case VMEXIT_WBINVD: -#ifdef DEBUG_EMULATOR +#ifdef CONFIG_DEBUG_EMULATOR PrintDebug("WBINVD\n"); #endif if (v3_handle_svm_wbinvd(info) == -1) { @@ -319,11 +320,12 @@ int v3_handle_svm_exit(struct guest_info * info) { } // END OF SWITCH (EXIT_CODE) - +#ifdef CONFIG_PROFILE_VMM if (info->enable_profiler) { rdtscll(info->profiler.end_time); v3_profile_exit(info, exit_code); } +#endif if (v3_excp_pending(info)) { @@ -334,7 +336,7 @@ int v3_handle_svm_exit(struct guest_info * info) { if (info->excp_state.excp_error_code_valid) { guest_ctrl->EVENTINJ.error_code = info->excp_state.excp_error_code; guest_ctrl->EVENTINJ.ev = 1; -#ifdef DEBUG_INTERRUPTS +#ifdef CONFIG_DEBUG_INTERRUPTS PrintDebug("Injecting exception %d with error code %x\n", excp, guest_ctrl->EVENTINJ.error_code); #endif } @@ -342,14 +344,14 @@ int v3_handle_svm_exit(struct guest_info * info) { guest_ctrl->EVENTINJ.vector = excp; guest_ctrl->EVENTINJ.valid = 1; -#ifdef DEBUG_INTERRUPTS +#ifdef CONFIG_DEBUG_INTERRUPTS PrintDebug("Injecting Exception %d (EIP=%p)\n", guest_ctrl->EVENTINJ.vector, (void *)(addr_t)info->rip); #endif v3_injecting_excp(info, excp); } else if (info->intr_state.irq_started == 1) { -#ifdef DEBUG_INTERRUPTS +#ifdef CONFIG_DEBUG_INTERRUPTS PrintDebug("IRQ pending from previous injection\n"); #endif guest_ctrl->guest_ctrl.V_IRQ = 1; @@ -367,7 +369,7 @@ int v3_handle_svm_exit(struct guest_info * info) { guest_ctrl->guest_ctrl.V_IGN_TPR = 1; guest_ctrl->guest_ctrl.V_INTR_PRIO = 0xf; -#ifdef DEBUG_INTERRUPTS +#ifdef CONFIG_DEBUG_INTERRUPTS PrintDebug("Injecting Interrupt %d (EIP=%p)\n", guest_ctrl->guest_ctrl.V_INTR_VECTOR, (void *)(addr_t)info->rip); diff --git a/palacios/src/palacios/svm_io.c b/palacios/src/palacios/svm_io.c index 3f71bc1..c009a25 100644 --- a/palacios/src/palacios/svm_io.c +++ b/palacios/src/palacios/svm_io.c @@ -23,7 +23,7 @@ #include #include -#ifndef DEBUG_IO +#ifndef CONFIG_DEBUG_IO #undef PrintDebug #define PrintDebug(fmt, args...) #endif diff --git a/palacios/src/palacios/vmm_config.c b/palacios/src/palacios/vmm_config.c index e01eee7..7ec24c6 100644 --- a/palacios/src/palacios/vmm_config.c +++ b/palacios/src/palacios/vmm_config.c @@ -97,12 +97,14 @@ int v3_pre_config_guest(struct guest_info * info, struct v3_vm_config * config_p info->shdw_pg_mode = SHADOW_PAGING; } +#ifdef CONFIG_PROFILE_VMM if (config_ptr->enable_profiling) { info->enable_profiler = 1; v3_init_profiler(info); } else { info->enable_profiler = 0; } +#endif if (config_ptr->schedule_freq == 0) { // set the schedule frequency to 100 HZ diff --git a/palacios/src/palacios/vmm_ctrl_regs.c b/palacios/src/palacios/vmm_ctrl_regs.c index 5975daf..ba6e9c5 100644 --- a/palacios/src/palacios/vmm_ctrl_regs.c +++ b/palacios/src/palacios/vmm_ctrl_regs.c @@ -25,7 +25,7 @@ #include #include -#ifndef DEBUG_CTRL_REGS +#ifndef CONFIG_DEBUG_CTRL_REGS #undef PrintDebug #define PrintDebug(fmt, args...) #endif diff --git a/palacios/src/palacios/vmm_dev_mgr.c b/palacios/src/palacios/vmm_dev_mgr.c index 3492f7c..c212958 100644 --- a/palacios/src/palacios/vmm_dev_mgr.c +++ b/palacios/src/palacios/vmm_dev_mgr.c @@ -23,7 +23,7 @@ #include -#ifndef DEBUG_DEV_MGR +#ifndef CONFIG_DEBUG_DEV_MGR #undef PrintDebug #define PrintDebug(fmt, args...) #endif @@ -50,7 +50,7 @@ int v3_init_devices() { struct v3_device_info * tmp_dev = __start__v3_devices; int i = 0; -#ifdef DEBUG_DEV_MGR +#ifdef CONFIG_DEBUG_DEV_MGR { int num_devices = (__stop__v3_devices - __start__v3_devices) / sizeof(struct v3_device_info); PrintDebug("%d Virtual devices registered with Palacios\n", num_devices); @@ -213,7 +213,7 @@ int v3_attach_device(struct guest_info * vm, struct vm_device * dev ) { } -#ifdef DEBUG_DEV_MGR +#ifdef CONFIG_DEBUG_DEV_MGR void PrintDebugDevMgr(struct guest_info * info) { struct vmm_dev_mgr * mgr = &(info->dev_mgr); diff --git a/palacios/src/palacios/vmm_direct_paging.c b/palacios/src/palacios/vmm_direct_paging.c index 674fc56..f3ef009 100644 --- a/palacios/src/palacios/vmm_direct_paging.c +++ b/palacios/src/palacios/vmm_direct_paging.c @@ -25,7 +25,7 @@ #include -#ifndef DEBUG_NESTED_PAGING +#ifndef CONFIG_DEBUG_NESTED_PAGING #undef PrintDebug #define PrintDebug(fmt, args...) #endif diff --git a/palacios/src/palacios/vmm_emulator.c b/palacios/src/palacios/vmm_emulator.c index 024620e..5fb9226 100644 --- a/palacios/src/palacios/vmm_emulator.c +++ b/palacios/src/palacios/vmm_emulator.c @@ -24,7 +24,7 @@ #include #include -#ifndef DEBUG_EMULATOR +#ifndef CONFIG_DEBUG_EMULATOR #undef PrintDebug #define PrintDebug(fmt, args...) #endif diff --git a/palacios/src/palacios/vmm_instrument.c b/palacios/src/palacios/vmm_instrument.c index f7478f7..8146338 100644 --- a/palacios/src/palacios/vmm_instrument.c +++ b/palacios/src/palacios/vmm_instrument.c @@ -17,7 +17,7 @@ * redistribute, and modify it as specified in the file "V3VEE_LICENSE". */ -#ifdef INSTRUMENT_VMM + #include #include @@ -133,4 +133,3 @@ static void print_instrumentation() { -#endif diff --git a/palacios/src/palacios/vmm_intr.c b/palacios/src/palacios/vmm_intr.c index 358b307..b823c8c 100644 --- a/palacios/src/palacios/vmm_intr.c +++ b/palacios/src/palacios/vmm_intr.c @@ -26,7 +26,7 @@ #include -#ifndef DEBUG_INTERRUPTS +#ifndef CONFIG_DEBUG_INTERRUPTS #undef PrintDebug #define PrintDebug(fmt, args...) #endif @@ -288,7 +288,7 @@ intr_type_t v3_get_intr_type(struct guest_info * info) { } } -#ifdef DEBUG_INTERRUPTS +#ifdef CONFIG_DEBUG_INTERRUPTS if (type == V3_INVALID_INTR) { PrintError("[get_intr_type] Invalid_Intr\n"); } diff --git a/palacios/src/palacios/vmm_io.c b/palacios/src/palacios/vmm_io.c index 793a0f3..4dbd61d 100644 --- a/palacios/src/palacios/vmm_io.c +++ b/palacios/src/palacios/vmm_io.c @@ -24,7 +24,7 @@ -#ifndef DEBUG_IO +#ifndef CONFIG_DEBUG_IO #undef PrintDebug #define PrintDebug(fmt, args...) #endif diff --git a/palacios/src/palacios/vmm_paging.c b/palacios/src/palacios/vmm_paging.c index 97a094b..b4ba9ee 100644 --- a/palacios/src/palacios/vmm_paging.c +++ b/palacios/src/palacios/vmm_paging.c @@ -46,7 +46,7 @@ static pt_entry_type_t pte64_lookup(pte64_t * pt, addr_t addr, addr_t * entry); -#ifndef DEBUG_SHADOW_PAGING +#ifndef CONFIG_DEBUG_SHADOW_PAGING #undef PrintDebug #define PrintDebug(fmt, args...) #endif diff --git a/palacios/src/palacios/vmm_shadow_paging.c b/palacios/src/palacios/vmm_shadow_paging.c index 3f12f05..4a4e719 100644 --- a/palacios/src/palacios/vmm_shadow_paging.c +++ b/palacios/src/palacios/vmm_shadow_paging.c @@ -30,7 +30,7 @@ #include -#ifndef DEBUG_SHADOW_PAGING +#ifndef CONFIG_DEBUG_SHADOW_PAGING #undef PrintDebug #define PrintDebug(fmt, args...) #endif @@ -237,11 +237,15 @@ static struct shadow_page_data * create_new_shadow_pt(struct guest_info * info) static int inject_guest_pf(struct guest_info * info, addr_t fault_addr, pf_error_t error_code) { + +#ifdef CONFIG_PROFILE_VMM if (info->enable_profiler) { info->profiler.guest_pf_cnt++; } +#endif info->ctrl_regs.cr2 = fault_addr; + return v3_raise_exception_with_error(info, PF_EXCEPTION, *(uint_t *)&error_code); } diff --git a/palacios/src/palacios/vmm_ss_emulator.c b/palacios/src/palacios/vmm_ss_emulator.c index 329ee0f..de50876 100644 --- a/palacios/src/palacios/vmm_ss_emulator.c +++ b/palacios/src/palacios/vmm_ss_emulator.c @@ -26,7 +26,7 @@ #include -#ifndef DEBUG_EMULATOR +#ifndef CONFIG_DEBUG_EMULATOR #undef PrintDebug #define PrintDebug(fmt, args...) #endif @@ -97,7 +97,7 @@ int v3_emulate_memory_read(struct guest_info * info, addr_t read_gva, return -1; } -#ifdef DEBUG_EMULATOR +#ifdef CONFIG_DEBUG_EMULATOR PrintDebug("Instr (15 bytes) at %p:\n", (void *)(addr_t)instr); PrintTraceMemDump(instr, 15); #endif diff --git a/palacios/src/palacios/vmm_xed.c b/palacios/src/palacios/vmm_xed.c index 24bac95..bd0d4f0 100644 --- a/palacios/src/palacios/vmm_xed.c +++ b/palacios/src/palacios/vmm_xed.c @@ -35,7 +35,7 @@ -#ifndef DEBUG_XED +#ifndef CONFIG_DEBUG_XED #undef PrintDebug #define PrintDebug(fmt, args...) #endif @@ -325,7 +325,7 @@ int v3_decode(struct guest_info * info, addr_t instr_ptr, struct x86_instr * ins xed_iform_enum_t iform = xed_decoded_inst_get_iform_enum(&xed_instr); -#ifdef DEBUG_XED +#ifdef CONFIG_DEBUG_XED xed_iclass_enum_t iclass = xed_decoded_inst_get_iclass(&xed_instr); PrintDebug("iform=%s, iclass=%s\n", xed_iform_enum_t2str(iform), xed_iclass_enum_t2str(iclass)); diff --git a/palacios/src/palacios/vmx.c b/palacios/src/palacios/vmx.c index 445c416..9a1ed31 100644 --- a/palacios/src/palacios/vmx.c +++ b/palacios/src/palacios/vmx.c @@ -682,15 +682,15 @@ static int init_vmx_guest(struct guest_info * info, struct v3_vm_config * config #define VMXASSIST_START 0x000d0000 - extern uint8_t vmxassist_start[]; - extern uint8_t vmxassist_end[]; + extern uint8_t v3_vmxassist_start[]; + extern uint8_t v3_vmxassist_end[]; addr_t vmxassist_dst = 0; if(guest_pa_to_host_va(info, VMXASSIST_START, &vmxassist_dst) == -1) { PrintError("Could not find VMXASSIST destination\n"); return -1; } - memcpy((void*)vmxassist_dst, vmxassist_start, vmxassist_end-vmxassist_start); + memcpy((void*)vmxassist_dst, v3_vmxassist_start, v3_vmxassist_end - v3_vmxassist_start); /*** Write all the info to the VMCS ***/ if(update_vmcs_ctrl_fields(info)) {