From: Jack Lange Date: Thu, 23 Apr 2009 00:38:11 +0000 (-0500) Subject: updated the configuration/init process X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=e3a2ad0c26462c45cf0a7f1ccc8f0042abbbd776 updated the configuration/init process --- diff --git a/palacios/include/palacios/vmm.h b/palacios/include/palacios/vmm.h index f5bad18..347157f 100644 --- a/palacios/include/palacios/vmm.h +++ b/palacios/include/palacios/vmm.h @@ -290,8 +290,7 @@ struct v3_vm_config { struct v3_ctrl_ops { struct guest_info *(*allocate_guest)(void); - int (*config_guest)(struct guest_info * info, struct v3_vm_config * config_ptr); - int (*init_guest)(struct guest_info * info); + int (*init_guest)(struct guest_info * info, struct v3_vm_config * config_ptr); int (*start_guest)(struct guest_info * info); // int (*stop_vm)(uint_t vm_id); diff --git a/palacios/include/palacios/vmm_config.h b/palacios/include/palacios/vmm_config.h index 328a221..5b614e9 100644 --- a/palacios/include/palacios/vmm_config.h +++ b/palacios/include/palacios/vmm_config.h @@ -30,6 +30,7 @@ int v3_config_guest(struct guest_info * info, struct v3_vm_config * config_ptr); +int v3_config_devices(struct guest_info * info, struct v3_vm_config * config_ptr); #endif // ! __V3VEE__ diff --git a/palacios/src/palacios/svm.c b/palacios/src/palacios/svm.c index 3707d1f..0a9dc55 100644 --- a/palacios/src/palacios/svm.c +++ b/palacios/src/palacios/svm.c @@ -41,6 +41,7 @@ #include #include +#include extern void v3_stgi(); @@ -277,14 +278,19 @@ static void Init_VMCB_BIOS(vmcb_t * vmcb, struct guest_info *vm_info) { } -static int init_svm_guest(struct guest_info *info) { +static int init_svm_guest(struct guest_info *info, struct v3_vm_config * config_ptr) { + v3_config_guest(info, config_ptr); + PrintDebug("Allocating VMCB\n"); info->vmm_data = (void*)Allocate_VMCB(); + v3_config_devices(info, config_ptr); + PrintDebug("Initializing VMCB (addr=%p)\n", (void *)info->vmm_data); Init_VMCB_BIOS((vmcb_t*)(info->vmm_data), info); + info->run_state = VM_STOPPED; // info->rip = 0; diff --git a/palacios/src/palacios/vmm.c b/palacios/src/palacios/vmm.c index 5525d65..c07476f 100644 --- a/palacios/src/palacios/vmm.c +++ b/palacios/src/palacios/vmm.c @@ -56,7 +56,6 @@ void Init_V3(struct v3_os_hooks * hooks, struct v3_ctrl_ops * vmm_ops) { PrintDebug("Machine is SVM Capable\n"); vmm_ops->allocate_guest = &allocate_guest; - vmm_ops->config_guest = &v3_config_guest; v3_init_SVM(vmm_ops); /* diff --git a/palacios/src/palacios/vmm_config.c b/palacios/src/palacios/vmm_config.c index 89a3f6c..4fbd7a9 100644 --- a/palacios/src/palacios/vmm_config.c +++ b/palacios/src/palacios/vmm_config.c @@ -55,7 +55,6 @@ static int setup_memory_map(struct guest_info * info, struct v3_vm_config * config_ptr); -static int setup_devices(struct guest_info * info, struct v3_vm_config * config_ptr); static struct vm_device * configure_generic(struct guest_info * info, struct v3_vm_config * config_ptr); @@ -79,6 +78,7 @@ int v3_config_guest(struct guest_info * info, struct v3_vm_config * config_ptr) // Amount of ram the Guest will have, rounded to a 4K page boundary info->mem_size = config_ptr->mem_size & ~(addr_t)0xfff; + // Initialize the subsystem data strutures v3_init_time(info); v3_init_io_map(info); @@ -91,7 +91,7 @@ int v3_config_guest(struct guest_info * info, struct v3_vm_config * config_ptr) v3_init_hypercall_map(info); - + // Initialize the memory map v3_init_shadow_map(info); @@ -116,9 +116,7 @@ int v3_config_guest(struct guest_info * info, struct v3_vm_config * config_ptr) return -1; } - // Configure the devices for the guest - setup_devices(info, config_ptr); - + if (config_ptr->enable_profiling) { info->enable_profiler = 1; v3_init_profiler(info); @@ -137,6 +135,9 @@ int v3_config_guest(struct guest_info * info, struct v3_vm_config * config_ptr) } + + + /* TODO: * The amount of guest memory is stored in info->mem_size * We need to make sure the memory map extends to cover it @@ -188,7 +189,7 @@ static int setup_memory_map(struct guest_info * info, struct v3_vm_config * conf -static int setup_devices(struct guest_info * info, struct v3_vm_config * config_ptr) { +int v3_config_devices(struct guest_info * info, struct v3_vm_config * config_ptr) { struct vm_device * ide = NULL; struct vm_device * ramdisk = NULL; @@ -295,6 +296,10 @@ static struct vm_device * configure_generic(struct guest_info * info, struct v3 PrintDebug("Creating Generic Device\n"); struct vm_device * generic = v3_create_generic(); + + // port 0x92: A20 enable/disable (bit 2) (This causes an MMU flush) + + // Make the DMA controller invisible v3_generic_add_port_range(generic, 0x00, 0x07, GENERIC_PRINT_AND_IGNORE); // DMA 1 channels 0,1,2,3 (address, counter) v3_generic_add_port_range(generic, 0xc0, 0xc7, GENERIC_PRINT_AND_IGNORE); // DMA 2 channels 4,5,6,7 (address, counter)