From: Jack Lange Date: Tue, 31 Mar 2009 20:42:42 +0000 (-0500) Subject: Merge branch 'devel' into ide X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=ee177da9b30ebf340c63fb5b9d535c729f90134d;hp=-c Merge branch 'devel' into ide Conflicts: misc/test_vm/build/Makefile palacios/build/Makefile --- ee177da9b30ebf340c63fb5b9d535c729f90134d diff --combined misc/test_vm/build/Makefile index 47bd48e,62c901d..c38b9f4 --- a/misc/test_vm/build/Makefile +++ b/misc/test_vm/build/Makefile @@@ -38,14 -38,12 +38,15 @@@ KERNEL_ENTRY = $(SYM_PFX)Mai PROJECT_ROOT := .. VPATH := $(PROJECT_ROOT)/src - #when -DNDEBUG is set the kassert functions are disabled - #JRLDEBUG=-DNDEBUG -ifeq ($(DEBUG_SERIAL),1) -JRL_DEBUG := -DDEBUG_SERIAL -endif + + +ifeq ($(SERIAL_DEBUG), 1) +JRLDEBUG= -DDEBUG_SERIAL +else +JRLDEBUG= +endif + + # Figure out if we're compiling with cygwin, http://cygwin.com SYSTEM_NAME := $(shell uname -s) ifeq ($(findstring CYGWIN,$(SYSTEM_NAME)),CYGWIN) @@@ -80,8 -78,6 +81,8 @@@ KERNEL_C_SRCS := idt.c int.c trap.c irq gdt.c tss.c segment.c \ bget.c malloc.c \ synch.c kthread.c \ + vm_cons.c debug.c \ + pci.c \ serial.c reboot.c \ paging.c \ main.c @@@ -178,7 -174,7 +179,8 @@@ NUMSECS := $(PERL) $(PROJECT_ROOT)/scri # ---------------------------------------------------------------------- # Flags used for all C source files -GENERAL_OPTS := -O -Wall $(EXTRA_C_OPTS) $(JRL_DEBUG) ++ +GENERAL_OPTS := -O -Wall $(EXTRA_C_OPTS) $(JRLDEBUG) CC_GENERAL_OPTS := $(GENERAL_OPTS) -Werror # Flags used for kernel C source files @@@ -239,6 -235,7 +241,6 @@@ guest-img: fd.im $(PAD) guest.img 1474560 guest-iso: guest-img - mkisofs -pad -b guest.img -R -o guest.iso guest.img diff --combined palacios/build/Makefile index 6d62c0b,9479e2b..f243949 --- a/palacios/build/Makefile +++ b/palacios/build/Makefile @@@ -62,8 -62,7 +62,8 @@@ endi ifeq ($(DEBUG_ALL),1) - DEBUG_SECTIONS:= $(DEBUG_SECTIONS) -DDEBUG_SHADOW_PAGING -DDEBUG_CTRL_REGS -DDEBUG_INTERRUPTS -DDEBUG_KEYBOARD -DDEBUG_PIC -DDEBUG_PIT -DDEBUG_NVRAM -DDEBUG_EMULATOR -DDEBUG_XED -DDEBUG_HALT -DDEBUG_DEV_MGR - DEBUG_SECTIONS:= $(DEBUG_SECTIONS) -DDEBUG_SHADOW_PAGING -DDEBUG_NESTED_PAGING -DDEBUG_CTRL_REGS -DDEBUG_INTERRUPTS -DDEBUG_KEYBOARD -DDEBUG_PIC -DDEBUG_PIT -DDEBUG_NVRAM -DDEBUG_EMULATOR -DDEBUG_XED -DDEBUG_HALT -DDEBUG_DEV_MGR -DDEBUG_IO -DDEBUG_GENERIC -DDEBUG_RAMDISK ++ DEBUG_SECTIONS:= $(DEBUG_SECTIONS) -DDEBUG_SHADOW_PAGING -DDEBUG_NESTED_PAGING -DDEBUG_CTRL_REGS -DDEBUG_INTERRUPTS -DDEBUG_KEYBOARD -DDEBUG_PIC -DDEBUG_PIT -DDEBUG_NVRAM -DDEBUG_EMULATOR -DDEBUG_XED -DDEBUG_HALT -DDEBUG_DEV_MGR +# -DDEBUG_IO -DDEBUG_GENERIC -DDEBUG_IDE endif @@@ -73,6 -72,14 +73,14 @@@ els ifeq ($(DEBUG_SHADOW_PAGING),0) DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_SHADOW_PAGING endif + + endif + ifeq ($(DEBUG_NESTED_PAGING),1) + DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_NESTED_PAGING + else + ifeq ($(DEBUG_NESTED_PAGING),0) + DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_NESTED_PAGING + endif endif ifeq ($(DEBUG_CTRL_REGS),1) @@@ -147,11 -154,19 +155,11 @@@ DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UD endif endif -ifeq ($(DEBUG_RAMDISK),1) -DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_RAMDISK +ifeq ($(DEBUG_IDE),1) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_IDE else -ifeq ($(DEBUG_RAMDISK),0) -DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_RAMDISK -endif -endif - -ifeq ($(TRACE_RAMDISK),1) -DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DTRACE_RAMDISK -else -ifeq ($(TRACE_RAMDSK),0) -DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UTRACE_RAMDISK +ifeq ($(DEBUG_IDE),0) +DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_IDE endif endif @@@ -263,6 -278,7 +271,7 @@@ VMM_OBJS := palacios/vmm_debug.o \ palacios/svm_io.o \ palacios/vmm_intr.o \ + palacios/vmm_excp.o \ palacios/vmm_time.o \ palacios/vmm_shadow_paging.o \ palacios/vm_guest_mem.o \ @@@ -314,17 -330,15 +323,17 @@@ DEVICES_OBJS := devices/8259a.o \ devices/8254.o \ devices/serial.o \ - devices/ramdisk.o \ - devices/cdrom.o \ devices/bochs_debug.o \ devices/os_debug.o \ devices/apic.o \ devices/io_apic.o \ devices/pci.o \ devices/para_net.o \ + devices/ide.o \ + devices/ram_cd.o \ +# devices/cdrom.o \ +# devices/ramdisk.o \ # devices/vnic.o \ $(DEVICES_OBJS) :: EXTRA_CFLAGS = \ @@@ -522,13 -536,7 +531,7 @@@ vgabios_link ln -s -f ../src/vmboot/vgabios/VGABIOS-lgpl-latest.bin vgabios - force_rombios: rombios_link - (cd ../src/vmboot/rombios; make clean; make) - - force_vgabios: vgabios_link - (cd ../src/vmboot/vgabios; make clean; make) - - force_payload: force_rombios force_vgabios + force_payload: rombios_link vgabios_link ../scripts/make_payload.pl payload_layout.txt vm_kernel inter1: force_payload diff --combined palacios/src/devices/apic.c index 13ead3c,407d3af..92e6683 --- a/palacios/src/devices/apic.c +++ b/palacios/src/devices/apic.c @@@ -168,6 -168,7 +168,7 @@@ struct apic_state uint32_t tmr_init_cnt; + struct local_vec_tbl_reg ext_intr_vec_tbl[4]; uint32_t rem_rd_data; @@@ -223,6 -224,7 +224,7 @@@ static void init_apic_state(struct apic apic->lint1_vec_tbl.val = 0x00010000; apic->err_vec_tbl.val = 0x00010000; apic->tmr_div_cfg.val = 0x00000000; + //apic->ext_apic_feature.val = 0x00000007; apic->ext_apic_feature.val = 0x00040007; apic->ext_apic_ctrl.val = 0x00000000; apic->spec_eoi.val = 0x00000000; @@@ -288,6 -290,8 +290,6 @@@ static int get_highest_isr(struct apic_ for (j = 7; j >= 0; j--) { uchar_t flag = 0x1 << j; if ((*svc_major) & flag) { - - return ((i * 8) + j); } } @@@ -310,6 -314,8 +312,6 @@@ static int get_highest_irr(struct apic_ for (j = 7; j >= 0; j--) { uchar_t flag = 0x1 << j; if ((*req_major) & flag) { - - return ((i * 8) + j); } } @@@ -337,12 -343,12 +339,12 @@@ static int apic_do_eoi(struct apic_stat #ifdef CRAY_XT - if ((((i * 8) + j) == 238) || - (((i * 8) + j) == 239)) { - PrintError("Acking IRQ %d\n", ((i * 8) + j)); + if ((isr_irq == 238) || + (isr_irq == 239)) { + PrintError("Acking IRQ %d\n", isr_irq); } - if (((i * 8) + j) == 238) { + if (isr_irq == 238) { V3_ACK_IRQ(238); } #endif @@@ -618,9 -624,19 +620,19 @@@ static int apic_read(addr_t guest_addr // Unhandled Registers case EXT_INT_LOC_VEC_TBL_OFFSET0: + val = apic->ext_intr_vec_tbl[0].val; + break; case EXT_INT_LOC_VEC_TBL_OFFSET1: + val = apic->ext_intr_vec_tbl[1].val; + break; case EXT_INT_LOC_VEC_TBL_OFFSET2: + val = apic->ext_intr_vec_tbl[2].val; + break; case EXT_INT_LOC_VEC_TBL_OFFSET3: + val = apic->ext_intr_vec_tbl[3].val; + break; + + case EXT_APIC_FEATURE_OFFSET: case EXT_APIC_CMD_OFFSET: case SEOI_OFFSET: @@@ -791,7 -807,20 +803,20 @@@ static int apic_write(addr_t guest_addr case IER_OFFSET7: *(uint32_t *)(apic->int_en_reg + 28) = op_val; break; - + + case EXT_INT_LOC_VEC_TBL_OFFSET0: + apic->ext_intr_vec_tbl[0].val = op_val; + break; + case EXT_INT_LOC_VEC_TBL_OFFSET1: + apic->ext_intr_vec_tbl[1].val = op_val; + break; + case EXT_INT_LOC_VEC_TBL_OFFSET2: + apic->ext_intr_vec_tbl[2].val = op_val; + break; + case EXT_INT_LOC_VEC_TBL_OFFSET3: + apic->ext_intr_vec_tbl[3].val = op_val; + break; + // Action Registers case EOI_OFFSET: @@@ -802,10 -831,7 +827,7 @@@ case INT_CMD_LO_OFFSET: case INT_CMD_HI_OFFSET: // Unhandled Registers - case EXT_INT_LOC_VEC_TBL_OFFSET0: - case EXT_INT_LOC_VEC_TBL_OFFSET1: - case EXT_INT_LOC_VEC_TBL_OFFSET2: - case EXT_INT_LOC_VEC_TBL_OFFSET3: + case EXT_APIC_CMD_OFFSET: case SEOI_OFFSET: default: diff --combined palacios/src/devices/ramdisk.c index c7668de,6c18c31..04602f7 --- a/palacios/src/devices/ramdisk.c +++ b/palacios/src/devices/ramdisk.c @@@ -498,13 -498,15 +498,13 @@@ static int read_data_port(ushort_t port case 0xec: // IDENTIFY DEVICE case 0xa1: { - - controller->status.busy = 0; controller->status.drive_ready = 1; controller->status.write_fault = 0; controller->status.seek_complete = 1; controller->status.corrected_data = 0; controller->status.err = 0; - + /* value32 = controller->buffer[index]; index++; @@@ -529,7 -531,7 +529,7 @@@ if (controller->buffer_index >= 512) { controller->status.drq = 0; } - + return length; } case 0xa0: //send packet cmd @@@ -2237,6 -2239,14 +2237,6 @@@ void rd_identify_ATAPI_drive(struct vm_ drive->id_drive[i] = 0; } - // now convert the id_drive array (native 256 word format) to - // the controller buffer (512 bytes) - Bit16u temp16; - for (i = 0; i <= 255; i++) { - temp16 = drive->id_drive[i]; - controller->buffer[i * 2] = temp16 & 0x00ff; - controller->buffer[i * 2 + 1] = temp16 >> 8; - } return; } @@@ -2438,29 -2448,8 +2438,8 @@@ static void rd_print_state(struct ramdi memset((char *)(channels + channel), 0, sizeof(struct channel_t)); } */ - PrintDebug("sizeof(*channels) = %d\n", sizeof(*channels)); - PrintDebug("sizeof(channles->drives[0].controller) = %d\n", sizeof((channels->drives[0].controller))); - PrintDebug("sizeof(channles->drives[0].cdrom) = %d\n", sizeof((channels->drives[0].cdrom))); - PrintDebug("sizeof(channles->drives[0].sense) = %d\n", sizeof((channels->drives[0].sense))); - PrintDebug("sizeof(channles->drives[0].atapi) = %d\n", sizeof((channels->drives[0].atapi))); - PrintDebug("sizeof(channles->drives[0].controller.status) = %d\n", - sizeof((channels->drives[0].controller.status))); - PrintDebug("sizeof(channles->drives[0].controller.sector_count) = %d\n", - sizeof((channels->drives[0].controller.sector_count))); - PrintDebug("sizeof(channles->drives[0].controller.interrupt_reason) = %d\n", - sizeof((channels->drives[0].controller.interrupt_reason))); - - PrintDebug("sizeof(channles->drives[0].controller.cylinder_no) = %d\n", - sizeof((channels->drives[0].controller.cylinder_no))); - PrintDebug("sizeof(channles->drives[0].controller.byte_count) = %d\n", - sizeof((channels->drives[0].controller.byte_count))); - - - PrintDebug("sizeof(channles->drives[0].controller.control) = %d\n", - sizeof((channels->drives[0].controller.control))); - for (channel = 0; channel < MAX_ATA_CHANNEL; channel++){ diff --combined palacios/src/palacios/vmm_config.c index a5ec77e,c0c713e..be73f33 --- a/palacios/src/palacios/vmm_config.c +++ b/palacios/src/palacios/vmm_config.c @@@ -33,8 -33,8 +33,8 @@@ #include #include #include -#include -#include +#include +#include #include #include #include @@@ -88,10 -88,12 +88,12 @@@ int v3_config_guest(struct guest_info v3_init_hypercall_map(info); - - if (v3_cpu_type == V3_SVM_REV3_CPU) { + if ((v3_cpu_type == V3_SVM_REV3_CPU) && + (config_ptr->enable_nested_paging == 1)) { + PrintDebug("Guest Page Mode: NESTED_PAGING\n"); info->shdw_pg_mode = NESTED_PAGING; } else { + PrintDebug("Guest Page Mode: SHADOW_PAGING\n"); v3_init_shadow_page_state(info); info->shdw_pg_mode = SHADOW_PAGING; } @@@ -277,9 -279,11 +279,9 @@@ static int setup_memory_map(struct gues static int setup_devices(struct guest_info * info, struct v3_vm_config * config_ptr) { - struct vm_device * ramdisk = NULL; - struct vm_device * cdrom = NULL; -#ifdef DEBUG_PCI + struct vm_device * ide = NULL; + struct vm_device * ram_cd = NULL; struct vm_device * pci = v3_create_pci(); -#endif struct vm_device * nvram = v3_create_nvram(); //struct vm_device * timer = v3_create_timer(); struct vm_device * pic = v3_create_pic(); @@@ -297,13 -301,11 +299,13 @@@ int use_ramdisk = config_ptr->use_ramdisk; int use_generic = USE_GENERIC; + ide = v3_create_ide(pci); if (use_ramdisk) { PrintDebug("Creating Ramdisk\n"); - ramdisk = v3_create_ramdisk(); - cdrom = v3_create_cdrom(ramdisk, config_ptr->ramdisk, config_ptr->ramdisk_size); + ram_cd = v3_create_ram_cd(ide, 0, 0, + (addr_t)(config_ptr->ramdisk), + config_ptr->ramdisk_size); } @@@ -311,8 -313,9 +313,8 @@@ generic = configure_generic(info, config_ptr); } -#ifdef DEBUG_PCI + v3_attach_device(info, pci); -#endif v3_attach_device(info, nvram); //v3_attach_device(info, timer); @@@ -328,10 -331,9 +330,10 @@@ v3_attach_device(info, para_net); + v3_attach_device(info, ide); + if (use_ramdisk) { - v3_attach_device(info, ramdisk); - v3_attach_device(info, cdrom); + v3_attach_device(info, ram_cd); } if (use_generic) {