ia64/xen-unstable
changeset 5608:6daf7357a9df
bitkeeper revision 1.1773 (42c3a841nLib9kdSmthr05jouqiNeg)
[PATCH] Device model cleanup.
Device model cleanup.
- Single config file for xen and device models
(Shell script doesn't source xmdefconfig anymore)
- No more device-model shell script by default. You can
have one if needed (qemu-dm.debug)
- All logic in the script device-model is moved to python
- $DISPLAY is passed from xm to xend
- Don't fork vncviewer on dryruns
- Add support for killing device models on domain destroy
- info vmxiopage command added to the monitor
- Refactor shared io page into global and per vcpu state
- Remove the hard coding of IOPACKET_PORT
- move the virtual_platform_def up to domain struct from vcpu
- xm create -n:
(vm
(name ExampleVMXDomain)
(memory 128)
(ssidref -1)
(image
(vmx
(kernel /usr/lib/xen/boot/vmxloader)
(root '/dev/hda1 ro')
(vcpus 1)
)
)
(memmap )
(device_model /tmp/foo)
(hda /var/images/min-el3-i386.img)
(hdb )
(hdc )
(hdd )
(cdrom )
(boot c)
(fda )
(fdb )
(localtime 0)
(serial )
(macaddr )
(stdvga 0)
(isa 0)
(nographic 0)
(vnc 0)
(sdl 0)
(display localhost:10.0)
)
Signed-off-by: Edwin Zhai <edwin.zhai@intel.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
[PATCH] Device model cleanup.
Device model cleanup.
- Single config file for xen and device models
(Shell script doesn't source xmdefconfig anymore)
- No more device-model shell script by default. You can
have one if needed (qemu-dm.debug)
- All logic in the script device-model is moved to python
- $DISPLAY is passed from xm to xend
- Don't fork vncviewer on dryruns
- Add support for killing device models on domain destroy
- info vmxiopage command added to the monitor
- Refactor shared io page into global and per vcpu state
- Remove the hard coding of IOPACKET_PORT
- move the virtual_platform_def up to domain struct from vcpu
- xm create -n:
(vm
(name ExampleVMXDomain)
(memory 128)
(ssidref -1)
(image
(vmx
(kernel /usr/lib/xen/boot/vmxloader)
(root '/dev/hda1 ro')
(vcpus 1)
)
)
(memmap )
(device_model /tmp/foo)
(hda /var/images/min-el3-i386.img)
(hdb )
(hdc )
(hdd )
(cdrom )
(boot c)
(fda )
(fdb )
(localtime 0)
(serial )
(macaddr )
(stdvga 0)
(isa 0)
(nographic 0)
(vnc 0)
(sdl 0)
(display localhost:10.0)
)
Signed-off-by: Edwin Zhai <edwin.zhai@intel.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
author | arun.sharma@intel.com[kaf24] |
---|---|
date | Thu Jun 30 08:07:29 2005 +0000 (2005-06-30) |
parents | ce4bb67cb308 |
children | e5a99f9dc34d |
files | .rootkeys tools/examples/xmexample.vmx tools/ioemu/exec.c tools/ioemu/hw/i8254.c tools/ioemu/monitor.c tools/ioemu/target-i386-dm/Makefile tools/ioemu/target-i386-dm/device-model tools/ioemu/target-i386-dm/helper2.c tools/ioemu/target-i386-dm/qemu-dm.debug tools/ioemu/vl.c tools/ioemu/vl.h tools/libxc/xc_vmx_build.c tools/python/xen/xend/image.py tools/python/xen/xm/create.py xen/arch/x86/domain.c xen/arch/x86/vmx.c xen/arch/x86/vmx_intercept.c xen/arch/x86/vmx_io.c xen/arch/x86/vmx_platform.c xen/arch/x86/vmx_vmcs.c xen/include/asm-x86/domain.h xen/include/asm-x86/vmx.h xen/include/asm-x86/vmx_intercept.h xen/include/asm-x86/vmx_platform.h xen/include/asm-x86/vmx_vmcs.h xen/include/public/io/ioreq.h |
line diff
1.1 --- a/.rootkeys Wed Jun 29 21:53:07 2005 +0000 1.2 +++ b/.rootkeys Thu Jun 30 08:07:29 2005 +0000 1.3 @@ -738,8 +738,8 @@ 428d0d89taY6NPlnIyOAMQd_Ww5qUw tools/ioe 1.4 428d0d89FY-g4UPH-ZW7t5ZCqvQVTQ tools/ioemu/readline.c 1.5 428d0d89dLURbktZFufDKSHan01GFg tools/ioemu/sdl.c 1.6 428d0d82dUmXkgIy11G-hoKTkhvkfQ tools/ioemu/target-i386-dm/Makefile 1.7 -428d0d8atdIE_8ACJPPii5_asQNafw tools/ioemu/target-i386-dm/device-model 1.8 428d0d8ahpRAYl6s_itBxnTcxyMHaQ tools/ioemu/target-i386-dm/helper2.c 1.9 +42c3a83bi-eu2QI4iQLkImYUVs0H6w tools/ioemu/target-i386-dm/qemu-dm.debug 1.10 428d0d8aU3Moaq4zNW5QMV_NxD-4XA tools/ioemu/target-i386-dm/qemu-ifup 1.11 428d0d8aqidj8n5H2_2qhBV0mIIJzA tools/ioemu/target-i386-dm/qemu-vgaram-bin.gz 1.12 428d0d8bMq0ZpccpHb1iVvSNbJjRxg tools/ioemu/thunk.c
2.1 --- a/tools/examples/xmexample.vmx Wed Jun 29 21:53:07 2005 +0000 2.2 +++ b/tools/examples/xmexample.vmx Thu Jun 30 08:07:29 2005 +0000 2.3 @@ -87,18 +87,12 @@ root = "/dev/hda1 ro" 2.4 2.5 #============================================================================ 2.6 2.7 -# New stuff 2.8 -memmap = '/etc/xen/mem-map.sxp' 2.9 -device_model = '/usr/bin/device-model' 2.10 -device_config = '/etc/xen/xmexample.vmx' 2.11 2.12 -#============================================================================ 2.13 -# 2.14 -# config item for qemu device model 2.15 -# Note: no space between = 2.16 -#----------------------------------------------------------------------------- 2.17 -# Qemu binary path 2.18 -qemubin='/usr/bin/qemu-dm' 2.19 +# New stuff 2.20 +device_model = '/usr/bin/qemu-dm' 2.21 + 2.22 +# Advanced users only. Don't touch if you don't know what you're doing 2.23 +memmap = '/etc/xen/mem-map.sxp' 2.24 2.25 #----------------------------------------------------------------------------- 2.26 # Disk image for
3.1 --- a/tools/ioemu/exec.c Wed Jun 29 21:53:07 2005 +0000 3.2 +++ b/tools/ioemu/exec.c Thu Jun 30 08:07:29 2005 +0000 3.3 @@ -127,7 +127,7 @@ void cpu_exec_init(void) 3.4 void cpu_set_log(int log_flags) 3.5 { 3.6 loglevel = log_flags; 3.7 - if (loglevel && !logfile) { 3.8 + if (!logfile) { 3.9 logfile = fopen(logfilename, "w"); 3.10 if (!logfile) { 3.11 perror(logfilename);
4.1 --- a/tools/ioemu/hw/i8254.c Wed Jun 29 21:53:07 2005 +0000 4.2 +++ b/tools/ioemu/hw/i8254.c Thu Jun 30 08:07:29 2005 +0000 4.3 @@ -217,7 +217,7 @@ int pit_get_gate(PITState *pit, int chan 4.4 4.5 void pit_reset_vmx_vectors() 4.6 { 4.7 - extern void *shared_page; 4.8 + extern shared_iopage_t *shared_page; 4.9 ioreq_t *req; 4.10 int irq, i; 4.11 PITChannelState *s; 4.12 @@ -239,7 +239,7 @@ void pit_reset_vmx_vectors() 4.13 s = &pit_state.channels[vmx_channel]; 4.14 fprintf(logfile, 4.15 "VMX_PIT:guest init pit channel %d!\n", vmx_channel); 4.16 - req = &((vcpu_iodata_t *) shared_page)->vp_ioreq; 4.17 + req = &shared_page->vcpu_iodata[0].vp_ioreq; 4.18 4.19 req->state = STATE_IORESP_HOOK; 4.20 /*
5.1 --- a/tools/ioemu/monitor.c Wed Jun 29 21:53:07 2005 +0000 5.2 +++ b/tools/ioemu/monitor.c Thu Jun 30 08:07:29 2005 +0000 5.3 @@ -353,6 +353,8 @@ static term_cmd_t info_cmds[] = { 5.4 "", "show i8259 (PIC) state", }, 5.5 { "pci", "", pci_info, 5.6 "", "show PCI info", }, 5.7 + { "vmxiopage", "", sp_info, 5.8 + "", "show VMX device model shared page info", }, 5.9 { NULL, NULL, }, 5.10 }; 5.11
6.1 --- a/tools/ioemu/target-i386-dm/Makefile Wed Jun 29 21:53:07 2005 +0000 6.2 +++ b/tools/ioemu/target-i386-dm/Makefile Thu Jun 30 08:07:29 2005 +0000 6.3 @@ -390,7 +390,7 @@ install: all 6.4 ifneq ($(PROGS),) 6.5 install -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)" 6.6 endif 6.7 - install -m 755 device-model "$(DESTDIR)$(bindir)" 6.8 + install -m 755 qemu-dm.debug "$(DESTDIR)$(bindir)" 6.9 install -m 755 qemu-ifup "$(DESTDIR)$(configdir)" 6.10 gunzip -c qemu-vgaram-bin.gz >qemu-vgaram-bin 6.11 install -m 755 qemu-vgaram-bin "$(DESTDIR)$(configdir)"
7.1 --- a/tools/ioemu/target-i386-dm/device-model Wed Jun 29 21:53:07 2005 +0000 7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 7.3 @@ -1,91 +0,0 @@ 7.4 -#!/bin/sh 7.5 - 7.6 -. /etc/rc.d/init.d/functions 7.7 - 7.8 -qemubin=/usr/bin/qemu-dm 7.9 - 7.10 -ulimit -c unlimited 7.11 - 7.12 -# Use this for debugging: 7.13 -#gdb --args /usr/sbin/qemu-dm -hda /var/images/qemu-linux.img -nographic \ 7.14 -# -serial pty -l 'ioport,int' $* 7.15 - 7.16 -# XXX this is a bit skanky. we assume an order of arguments here. 7.17 -# namely to have configfile and vncconnect argument as the first 7.18 -# two arguments. 7.19 - 7.20 -while getopts ":f:v:d:" opt; 7.21 -do 7.22 - case $opt in 7.23 - f) QEMUCONFIGFILE=$OPTARG;; 7.24 - v) VNCCONNECT=$OPTARG;; 7.25 - d) DOMAIN=$OPTARG;; 7.26 - \?) echo;; 7.27 - esac 7.28 -done 7.29 -if [ "x$QEMUCONFIGFILE" != "x" ]; then shift; shift; fi 7.30 -if [ "x$VNCCONNECT" != "x" ]; then shift; shift; fi 7.31 - 7.32 - 7.33 -echo $QEMUCONFIGFILE 7.34 -if [ ! -z $QEMUCONFIGFILE ];then 7.35 - . $QEMUCONFIGFILE 7.36 -else 7.37 - echo "no config file specified!" > /dev/tty 7.38 - echo "no config file specified!" >> /tmp/qemustart.log 7.39 - exit 7.40 -fi 7.41 - 7.42 -PARMETER="" 7.43 - 7.44 -if [ ! -z $hda ];then 7.45 -PARMETER="$PARMETER -hda $hda" 7.46 -fi 7.47 - 7.48 -if [ ! -z $hdb ];then 7.49 -PARMETER="$PARMETER -hdb $hdb" 7.50 -fi 7.51 - 7.52 -if [ ! -z $hdc ];then 7.53 -PARMETER="$PARMETER -hdc $hdc" 7.54 -fi 7.55 - 7.56 -if [ ! -z $hdd ];then 7.57 -PARMETER="$PARMETER -hdd $hdd" 7.58 -fi 7.59 - 7.60 -if [ ! -z $cdrom ];then 7.61 -PARMETER="$PARMETER -cdrom $cdrom" 7.62 -fi 7.63 - 7.64 -if [ ! -z $boot ];then 7.65 -PARMETER="$PARMETER -boot $boot" 7.66 -fi 7.67 - 7.68 -if [ ! -z $nographic ] && [ $nographic -eq 1 ];then 7.69 -PARMETER="$PARMETER -nographic" 7.70 -fi 7.71 - 7.72 -vnc=${vnc:=1} 7.73 -sdl=${sdl:=0} 7.74 -if qemu-dm 2>&1 |grep vnc > /dev/null;then 7.75 - if [ $vnc -eq 1 ] && [ $sdl -eq 1 ];then 7.76 - PARMETER="$PARMETER -vnc-and-sdl -k en-us" 7.77 - elif [ $vnc -eq 1 ];then 7.78 - PARMETER="$PARMETER -vnc -k en-us" 7.79 - fi 7.80 - VNCPORT=`expr 5900 + $DOMAIN` 7.81 - PARMETER="$PARMETER -vncport $VNCPORT" 7.82 - if [ "x$VNCCONNECT" != "x" ]; then 7.83 - PARMETER="$PARMETER -vncconnect $VNCCONNECT" 7.84 - fi 7.85 -fi 7.86 - 7.87 -#optional cmdline for qemu 7.88 -# -nographic \ 7.89 -# -serial pty \ 7.90 - 7.91 - 7.92 -PARMETER="$PARMETER -l int $*"; 7.93 -echo "$qemubin $PARMETER" >>/tmp/qemustart.log 7.94 -$qemubin $PARMETER &
8.1 --- a/tools/ioemu/target-i386-dm/helper2.c Wed Jun 29 21:53:07 2005 +0000 8.2 +++ b/tools/ioemu/target-i386-dm/helper2.c Thu Jun 30 08:07:29 2005 +0000 8.3 @@ -45,14 +45,16 @@ 8.4 8.5 #include <limits.h> 8.6 #include <fcntl.h> 8.7 +#include <sys/ioctl.h> 8.8 8.9 #include "xc.h" 8.10 #include <io/ioreq.h> 8.11 8.12 #include "cpu.h" 8.13 #include "exec-all.h" 8.14 +#include "vl.h" 8.15 8.16 -void *shared_page; 8.17 +shared_iopage_t *shared_page = NULL; 8.18 8.19 CPUX86State *cpu_86_init(void) 8.20 { 8.21 @@ -116,19 +118,27 @@ int evtchn_fd = -1; 8.22 //the evtchn port for polling the notification, should be inputed as bochs's parameter 8.23 u16 ioreq_port = 0; 8.24 8.25 -void *shared_page = NULL; 8.26 +//some functions to handle the io req packet 8.27 +void 8.28 +sp_info() 8.29 +{ 8.30 + ioreq_t *req; 8.31 8.32 -//some functions to handle the io req packet 8.33 + req = &(shared_page->vcpu_iodata[0].vp_ioreq); 8.34 + term_printf("event port: %d\n", shared_page->sp_global.eport); 8.35 + term_printf("req state: %x, pvalid: %x, addr: %llx, data: %llx, count: %llx, size: %llx\n", req->state, req->pdata_valid, req->addr, req->u.data, req->count, req->size); 8.36 +} 8.37 8.38 //get the ioreq packets from share mem 8.39 ioreq_t* __cpu_get_ioreq(void) 8.40 { 8.41 ioreq_t *req; 8.42 - req = &((vcpu_iodata_t *) shared_page)->vp_ioreq; 8.43 + 8.44 + req = &(shared_page->vcpu_iodata[0].vp_ioreq); 8.45 if (req->state == STATE_IOREQ_READY) { 8.46 req->state = STATE_IOREQ_INPROCESS; 8.47 } else { 8.48 - fprintf(logfile, "False I/O requrest ... in-service already: %x, pvalid: %x,port: %llx, data: %llx, count: %llx, size: %llx\n", req->state, req->pdata_valid, req->addr, req->u.data, req->count, req->size); 8.49 + fprintf(logfile, "False I/O request ... in-service already: %x, pvalid: %x,port: %llx, data: %llx, count: %llx, size: %llx\n", req->state, req->pdata_valid, req->addr, req->u.data, req->count, req->size); 8.50 req = NULL; 8.51 } 8.52 8.53 @@ -310,8 +320,7 @@ do_interrupt(CPUState *env, int vector) 8.54 8.55 // Send a message on the event channel. Add the vector to the shared mem 8.56 // page. 8.57 - 8.58 - intr = &(((vcpu_iodata_t *) shared_page)->vp_intr[0]); 8.59 + intr = &(shared_page->vcpu_iodata[0].vp_intr[0]); 8.60 atomic_set_bit(vector, intr); 8.61 if (loglevel & CPU_LOG_INT) 8.62 fprintf(logfile, "injecting vector: %x\n", vector);
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/tools/ioemu/target-i386-dm/qemu-dm.debug Thu Jun 30 08:07:29 2005 +0000 9.3 @@ -0,0 +1,5 @@ 9.4 +#!/bin/sh 9.5 + 9.6 +echo $* > /tmp/args 9.7 +echo $DISPLAY >> /tmp/args 9.8 +exec /usr/bin/qemu-dm $*
10.1 --- a/tools/ioemu/vl.c Wed Jun 29 21:53:07 2005 +0000 10.2 +++ b/tools/ioemu/vl.c Thu Jun 30 08:07:29 2005 +0000 10.3 @@ -116,7 +116,7 @@ const char* keyboard_layout = 0; 10.4 int64_t ticks_per_sec; 10.5 int boot_device = 'c'; 10.6 int ram_size; 10.7 -int domid; 10.8 +int domid = -1; 10.9 static char network_script[1024]; 10.10 int pit_min_timer_count = 0; 10.11 int nb_nics; 10.12 @@ -2402,6 +2402,9 @@ int main(int argc, char **argv) 10.13 macaddr[4] = 0x34; 10.14 macaddr[5] = 0x56; 10.15 10.16 + /* init debug */ 10.17 + cpu_set_log(0); 10.18 + 10.19 optind = 1; 10.20 for(;;) { 10.21 if (optind >= argc) 10.22 @@ -2808,11 +2811,14 @@ int main(int argc, char **argv) 10.23 exit(-1); 10.24 } 10.25 10.26 - 10.27 shared_page = xc_map_foreign_range(xc_handle, domid, PAGE_SIZE, 10.28 PROT_READ|PROT_WRITE, 10.29 page_array[nr_pages - 1]); 10.30 10.31 + 10.32 + fprintf(logfile, "shared page at pfn:%lx, mfn: %lx\n", (nr_pages-1), 10.33 + (page_array[nr_pages - 1])); 10.34 + 10.35 /* we always create the cdrom drive, even if no disk is there */ 10.36 bdrv_init(); 10.37 if (has_cdrom) {
11.1 --- a/tools/ioemu/vl.h Wed Jun 29 21:53:07 2005 +0000 11.2 +++ b/tools/ioemu/vl.h Thu Jun 30 08:07:29 2005 +0000 11.3 @@ -624,6 +624,7 @@ void pic_init(void); 11.4 uint32_t pic_intack_read(CPUState *env); 11.5 void pic_info(void); 11.6 void irq_info(void); 11.7 +void sp_info(void); 11.8 int pic_irq2vec(int irq); 11.9 11.10 /* i8254.c */
12.1 --- a/tools/libxc/xc_vmx_build.c Wed Jun 29 21:53:07 2005 +0000 12.2 +++ b/tools/libxc/xc_vmx_build.c Thu Jun 30 08:07:29 2005 +0000 12.3 @@ -8,6 +8,7 @@ 12.4 #include "xc_elf.h" 12.5 #include <stdlib.h> 12.6 #include <zlib.h> 12.7 +#include <xen/io/ioreq.h> 12.8 #include "linux_boot_params.h" 12.9 12.10 #define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_USER) 12.11 @@ -174,6 +175,9 @@ static int setup_guest(int xc_handle, 12.12 unsigned long vpt_end; 12.13 unsigned long v_end; 12.14 12.15 + unsigned long shared_page_frame = 0; 12.16 + shared_iopage_t *sp; 12.17 + 12.18 memset(&dsi, 0, sizeof(struct domain_setup_info)); 12.19 12.20 if ( (rc = parseelfimage(image, image_size, &dsi)) != 0 ) 12.21 @@ -382,6 +386,8 @@ static int setup_guest(int xc_handle, 12.22 boot_paramsp->e820_map[i].addr = mem_mapp->map[i].addr; 12.23 boot_paramsp->e820_map[i].size = mem_mapp->map[i].size; 12.24 boot_paramsp->e820_map[i].type = mem_mapp->map[i].type; 12.25 + if (mem_mapp->map[i].type == E820_SHARED) 12.26 + shared_page_frame = (mem_mapp->map[i].addr >> PAGE_SHIFT); 12.27 } 12.28 munmap(boot_paramsp, PAGE_SIZE); 12.29 12.30 @@ -407,6 +413,15 @@ static int setup_guest(int xc_handle, 12.31 shared_info->vcpu_data[i].evtchn_upcall_mask = 1; 12.32 munmap(shared_info, PAGE_SIZE); 12.33 12.34 + /* Populate the event channel port in the shared page */ 12.35 + if ((sp = (shared_iopage_t *) xc_map_foreign_range( 12.36 + xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE, 12.37 + page_array[shared_page_frame])) == 0) 12.38 + goto error_out; 12.39 + memset(sp, 0, PAGE_SIZE); 12.40 + sp->sp_global.eport = control_evtchn; 12.41 + munmap(sp, PAGE_SIZE); 12.42 + 12.43 /* 12.44 * Pin down l2tab addr as page dir page - causes hypervisor to provide 12.45 * correct protection for the page
13.1 --- a/tools/python/xen/xend/image.py Wed Jun 29 21:53:07 2005 +0000 13.2 +++ b/tools/python/xen/xend/image.py Thu Jun 30 08:07:29 2005 +0000 13.3 @@ -231,7 +231,7 @@ class VmxImageHandler(ImageHandler): 13.4 13.5 ostype = "vmx" 13.6 memmap = None 13.7 - memmap_value = None 13.8 + memmap_value = [] 13.9 device_channel = None 13.10 13.11 def createImage(self): 13.12 @@ -242,9 +242,12 @@ class VmxImageHandler(ImageHandler): 13.13 self.createDomain() 13.14 13.15 def buildDomain(self): 13.16 + # Create an event channel 13.17 + self.device_channel = channel.eventChannel(0, self.vm.getDomain()) 13.18 + log.info("VMX device model port: %d", self.device_channel.port2) 13.19 return xc.vmx_build(dom = self.vm.getDomain(), 13.20 image = self.kernel, 13.21 - control_evtchn = 0, 13.22 + control_evtchn = self.device_channel.port2, 13.23 memsize = self.vm.memory, 13.24 memmap = self.memmap_value, 13.25 cmdline = self.cmdline, 13.26 @@ -254,51 +257,74 @@ class VmxImageHandler(ImageHandler): 13.27 def parseMemmap(self): 13.28 self.memmap = sxp.child_value(self.vm.config, "memmap") 13.29 if self.memmap is None: 13.30 - raise VmError("missing memmap") 13.31 + return 13.32 memmap = sxp.parse(open(self.memmap))[0] 13.33 from xen.util.memmap import memmap_parse 13.34 self.memmap_value = memmap_parse(memmap) 13.35 13.36 - def createDeviceModel_old(self): 13.37 - device_model = sxp.child_value(self.vm.config, 'device_model') 13.38 - if not device_model: 13.39 - raise VmError("vmx: missing device model") 13.40 - device_config = sxp.child_value(self.vm.config, 'device_config') 13.41 - if not device_config: 13.42 - raise VmError("vmx: missing device config") 13.43 - # Create an event channel. 13.44 - self.device_channel = channel.eventChannel(0, self.vm.getDomain()) 13.45 - # Execute device model. 13.46 - #todo: Error handling 13.47 - os.system(device_model 13.48 - + " -f %s" % device_config 13.49 - + " -d %d" % self.vm.getDomain() 13.50 - + " -p %d" % self.device_channel['port1'] 13.51 - + " -m %s" % self.vm.memory) 13.52 + # Return a list of cmd line args to the device models based on the 13.53 + # xm config file 13.54 + def parseDeviceModelArgs(self): 13.55 + dmargs = [ 'hda', 'hdb', 'hdc', 'hdd', 'cdrom', 'boot', 'fda', 'fdb', 13.56 + 'localtime', 'serial', 'macaddr', 'stdvga', 'isa' ] 13.57 + ret = [] 13.58 + for a in dmargs: 13.59 + v = sxp.child_value(self.vm.config, a) 13.60 + 13.61 + # python doesn't allow '-' in variable names 13.62 + if a == 'stdvga': a = 'std-vga' 13.63 + 13.64 + # Handle booleans gracefully 13.65 + if a in ['localtime', 'std-vga', 'isa']: 13.66 + v = int(v) 13.67 13.68 + log.debug("args: %s, val: %s" % (a,v)) 13.69 + if v: 13.70 + ret.append("-%s" % a) 13.71 + ret.append("%s" % v) 13.72 + 13.73 + # Handle graphics library related options 13.74 + vnc = int(sxp.child_value(self.vm.config, 'vnc')) 13.75 + sdl = int(sxp.child_value(self.vm.config, 'sdl')) 13.76 + nographic = int(sxp.child_value(self.vm.config, 'nographic')) 13.77 + if nographic: 13.78 + ret.append('-nographic') 13.79 + return ret 13.80 + 13.81 + if vnc and sdl: 13.82 + ret = ret + ['-vnc-and-sdl', '-k', 'en-us'] 13.83 + elif vnc: 13.84 + ret = ret + ['-vnc', '-k', 'en-us'] 13.85 + if vnc: 13.86 + vncport = int(self.vm.getDomain()) + 5900 13.87 + ret = ret + ['-vncport', '%d' % vncport] 13.88 + return ret 13.89 + 13.90 def createDeviceModel(self): 13.91 device_model = sxp.child_value(self.vm.config, 'device_model') 13.92 if not device_model: 13.93 raise VmError("vmx: missing device model") 13.94 - device_config = sxp.child_value(self.vm.config, 'device_config') 13.95 - if not device_config: 13.96 - raise VmError("vmx: missing device config") 13.97 - # Create an event channel 13.98 - self.device_channel = channel.eventChannel(0, self.vm.getDomain()) 13.99 # Execute device model. 13.100 #todo: Error handling 13.101 # XXX RN: note that the order of args matter! 13.102 - os.system(device_model 13.103 - + " -f %s" % device_config 13.104 - + self.vncParams() 13.105 - + " -d %d" % self.vm.getDomain() 13.106 - + " -p %d" % (int(self.device_channel.port1)-1) 13.107 - + " -m %s" % self.vm.memory) 13.108 + args = [device_model] 13.109 + vnc = self.vncParams() 13.110 + if len(vnc): 13.111 + args = args + vnc 13.112 + args = args + ([ "-d", "%d" % self.vm.getDomain(), 13.113 + "-p", "%d" % self.device_channel.port1, 13.114 + "-m", "%s" % self.vm.memory ]) 13.115 + args = args + self.parseDeviceModelArgs() 13.116 + env = dict(os.environ) 13.117 + env['DISPLAY'] = sxp.child_value(self.vm.config, 'display') 13.118 + log.info("spawning device models: %s %s", device_model, args) 13.119 + self.pid = os.spawnve(os.P_NOWAIT, device_model, args, env) 13.120 + log.info("device model pid: %d", self.pid) 13.121 13.122 def vncParams(self): 13.123 # see if a vncviewer was specified 13.124 # XXX RN: bit of a hack. should unify this, maybe stick in config space 13.125 - vncconnect="" 13.126 + vncconnect=[] 13.127 image = self.config 13.128 args = sxp.child_value(image, "args") 13.129 if args: 13.130 @@ -306,12 +332,14 @@ class VmxImageHandler(ImageHandler): 13.131 for arg in arg_list: 13.132 al = string.split(arg, '=') 13.133 if al[0] == "VNC_VIEWER": 13.134 - vncconnect=" -v %s" % al[1] 13.135 + vncconnect=["-vncconnect", "%s" % al[1]] 13.136 break 13.137 return vncconnect 13.138 13.139 def destroy(self): 13.140 channel.eventChannelClose(self.device_channel) 13.141 + os.system("kill -KILL" 13.142 + + " %d" % self.pid) 13.143 13.144 def getDomainMemory(self, mem_mb): 13.145 return (mem_mb * 1024) + self.getPageTableSize(mem_mb)
14.1 --- a/tools/python/xen/xm/create.py Wed Jun 29 21:53:07 2005 +0000 14.2 +++ b/tools/python/xen/xm/create.py Thu Jun 30 08:07:29 2005 +0000 14.3 @@ -254,9 +254,69 @@ gopts.var('device_model', val='FILE', 14.4 fn=set_value, default='', 14.5 use="Path to device model program.") 14.6 14.7 -gopts.var('device_config', val='FILE', 14.8 +gopts.var('hda', val='FILE', 14.9 + fn=set_value, default='', 14.10 + use="Path to hda") 14.11 + 14.12 +gopts.var('hdb', val='FILE', 14.13 + fn=set_value, default='', 14.14 + use="Path to hdb") 14.15 + 14.16 +gopts.var('hdc', val='FILE', 14.17 + fn=set_value, default='', 14.18 + use="Path to hdc") 14.19 + 14.20 +gopts.var('hdd', val='FILE', 14.21 + fn=set_value, default='', 14.22 + use="Path to hdd") 14.23 + 14.24 +gopts.var('fda', val='FILE', 14.25 + fn=set_value, default='', 14.26 + use="Path to fda") 14.27 + 14.28 +gopts.var('fdb', val='FILE', 14.29 + fn=set_value, default='', 14.30 + use="Path to fdb") 14.31 + 14.32 +gopts.var('serial', val='FILE', 14.33 fn=set_value, default='', 14.34 - use="Path to device model configuration.") 14.35 + use="Path to serial or pty or vc") 14.36 + 14.37 +gopts.var('localtime', val='no|yes', 14.38 + fn=set_bool, default=0, 14.39 + use="Is RTC set to localtime?") 14.40 + 14.41 +gopts.var('stdvga', val='no|yes', 14.42 + fn=set_bool, default=0, 14.43 + use="Use std vga or cirrhus logic graphics") 14.44 + 14.45 +gopts.var('isa', val='no|yes', 14.46 + fn=set_bool, default=0, 14.47 + use="Simulate an ISA only system?") 14.48 + 14.49 +gopts.var('cdrom', val='FILE', 14.50 + fn=set_value, default='', 14.51 + use="Path to cdrom") 14.52 + 14.53 +gopts.var('macaddr', val='MACADDR', 14.54 + fn=set_value, default='', 14.55 + use="Macaddress of the first network interface") 14.56 + 14.57 +gopts.var('boot', val="a|b|c|d", 14.58 + fn=set_value, default='c', 14.59 + use="Default boot device") 14.60 + 14.61 +gopts.var('nographic', val='no|yes', 14.62 + fn=set_bool, default=0, 14.63 + use="Should device models use graphics?") 14.64 + 14.65 +gopts.var('sdl', val='', 14.66 + fn=set_value, default=None, 14.67 + use="""Should the device model use SDL?""") 14.68 + 14.69 +gopts.var('display', val='DISPLAY', 14.70 + fn=set_value, default='localhost:0', 14.71 + use="X11 display to use") 14.72 14.73 def strip(pre, s): 14.74 """Strip prefix 'pre' if present. 14.75 @@ -382,12 +442,11 @@ def configure_vfr(opts, config, vals): 14.76 def configure_vmx(opts, config_devs, vals): 14.77 """Create the config for VMX devices. 14.78 """ 14.79 - memmap = vals.memmap 14.80 - device_model = vals.device_model 14.81 - device_config = vals.device_config 14.82 - config_devs.append(['memmap', memmap]) 14.83 - config_devs.append(['device_model', device_model]) 14.84 - config_devs.append(['device_config', device_config]) 14.85 + args = [ 'memmap', 'device_model', 'hda', 'hdb', 'hdc', 'hdd', 'cdrom', 14.86 + 'boot', 'fda', 'fdb', 'localtime', 'serial', 'macaddr', 'stdvga', 14.87 + 'isa', 'nographic', 'vnc', 'sdl', 'display'] 14.88 + for a in args: 14.89 + config_devs.append([a, vals.__dict__[a]]) 14.90 14.91 def run_bootloader(opts, config, vals): 14.92 if not os.access(vals.bootloader, os.X_OK): 14.93 @@ -614,10 +673,13 @@ def main(argv): 14.94 if '=' in arg: 14.95 (var, val) = arg.strip().split('=', 1) 14.96 gopts.setvar(var.strip(), val.strip()) 14.97 + opts.vals.display = os.getenv("DISPLAY") 14.98 if opts.vals.config: 14.99 config = opts.vals.config 14.100 else: 14.101 opts.load_defconfig() 14.102 + if opts.vals.dryrun: 14.103 + opts.vals.vnc = 0 14.104 preprocess(opts, opts.vals) 14.105 if not opts.getopt('name') and opts.getopt('defconfig'): 14.106 opts.setopt('name', os.path.basename(opts.getopt('defconfig')))
15.1 --- a/xen/arch/x86/domain.c Wed Jun 29 21:53:07 2005 +0000 15.2 +++ b/xen/arch/x86/domain.c Thu Jun 30 08:07:29 2005 +0000 15.3 @@ -345,7 +345,7 @@ static int vmx_final_setup_guest( 15.4 v->arch.schedule_tail = arch_vmx_do_launch; 15.5 15.6 #if defined (__i386) 15.7 - v->arch.arch_vmx.vmx_platform.real_mode_data = 15.8 + v->domain->arch.vmx_platform.real_mode_data = 15.9 (unsigned long *) regs->esi; 15.10 #endif 15.11 15.12 @@ -356,7 +356,6 @@ static int vmx_final_setup_guest( 15.13 */ 15.14 memset(&v->domain->shared_info->evtchn_mask[0], 0xff, 15.15 sizeof(v->domain->shared_info->evtchn_mask)); 15.16 - clear_bit(IOPACKET_PORT, &v->domain->shared_info->evtchn_mask[0]); 15.17 15.18 /* Put the domain in shadow mode even though we're going to be using 15.19 * the shared 1:1 page table initially. It shouldn't hurt */ 15.20 @@ -906,7 +905,7 @@ static void vmx_relinquish_resources(str 15.21 v->arch.arch_vmx.vmcs = 0; 15.22 15.23 free_monitor_pagetable(v); 15.24 - rem_ac_timer(&v->arch.arch_vmx.vmx_platform.vmx_pit.pit_timer); 15.25 + rem_ac_timer(&v->domain->arch.vmx_platform.vmx_pit.pit_timer); 15.26 } 15.27 #else 15.28 #define vmx_relinquish_resources(_v) ((void)0)
16.1 --- a/xen/arch/x86/vmx.c Wed Jun 29 21:53:07 2005 +0000 16.2 +++ b/xen/arch/x86/vmx.c Thu Jun 30 08:07:29 2005 +0000 16.3 @@ -388,7 +388,7 @@ static void vmx_io_instruction(struct cp 16.4 return; 16.5 } 16.6 16.7 - vio = (vcpu_iodata_t *) d->arch.arch_vmx.vmx_platform.shared_page_va; 16.8 + vio = get_vio(d->domain, d->vcpu_id); 16.9 if (vio == 0) { 16.10 printk("bad shared page: %lx", (unsigned long) vio); 16.11 domain_crash_synchronous(); 16.12 @@ -458,7 +458,7 @@ static void vmx_io_instruction(struct cp 16.13 16.14 set_bit(ARCH_VMX_IO_WAIT, &d->arch.arch_vmx.flags); 16.15 p->state = STATE_IOREQ_READY; 16.16 - evtchn_send(IOPACKET_PORT); 16.17 + evtchn_send(iopacket_port(d->domain)); 16.18 vmx_wait_io(); 16.19 } 16.20 16.21 @@ -1260,7 +1260,7 @@ asmlinkage void vmx_vmexit_handler(struc 16.22 (unsigned long)regs.eax, (unsigned long)regs.ebx, 16.23 (unsigned long)regs.ecx, (unsigned long)regs.edx, 16.24 (unsigned long)regs.esi, (unsigned long)regs.edi); 16.25 - v->arch.arch_vmx.vmx_platform.mpci.inst_decoder_regs = ®s; 16.26 + v->domain->arch.vmx_platform.mpci.inst_decoder_regs = ®s; 16.27 16.28 if (!(error = vmx_do_page_fault(va, ®s))) { 16.29 /*
17.1 --- a/xen/arch/x86/vmx_intercept.c Wed Jun 29 21:53:07 2005 +0000 17.2 +++ b/xen/arch/x86/vmx_intercept.c Thu Jun 30 08:07:29 2005 +0000 17.3 @@ -35,7 +35,7 @@ 17.4 int vmx_io_intercept(ioreq_t *p) 17.5 { 17.6 struct vcpu *d = current; 17.7 - struct vmx_handler_t *handler = &(d->arch.arch_vmx.vmx_platform.vmx_handler); 17.8 + struct vmx_handler_t *handler = &(d->domain->arch.vmx_platform.vmx_handler); 17.9 int i; 17.10 unsigned long addr, offset; 17.11 for (i = 0; i < handler->num_slot; i++) { 17.12 @@ -51,7 +51,7 @@ int vmx_io_intercept(ioreq_t *p) 17.13 int register_io_handler(unsigned long addr, unsigned long offset, intercept_action_t action) 17.14 { 17.15 struct vcpu *d = current; 17.16 - struct vmx_handler_t *handler = &(d->arch.arch_vmx.vmx_platform.vmx_handler); 17.17 + struct vmx_handler_t *handler = &(d->domain->arch.vmx_platform.vmx_handler); 17.18 int num = handler->num_slot; 17.19 17.20 if (num >= MAX_IO_HANDLER) { 17.21 @@ -163,7 +163,7 @@ static void resume_pit_io(ioreq_t *p) 17.22 int intercept_pit_io(ioreq_t *p) 17.23 { 17.24 struct vcpu *d = current; 17.25 - struct vmx_virpit_t *vpit = &(d->arch.arch_vmx.vmx_platform.vmx_pit); 17.26 + struct vmx_virpit_t *vpit = &(d->domain->arch.vmx_platform.vmx_pit); 17.27 17.28 if (p->size != 1 || 17.29 p->pdata_valid || 17.30 @@ -206,10 +206,10 @@ static void pit_timer_fn(void *data) 17.31 */ 17.32 void vmx_hooks_assist(struct vcpu *d) 17.33 { 17.34 - vcpu_iodata_t *vio = (vcpu_iodata_t *) d->arch.arch_vmx.vmx_platform.shared_page_va; 17.35 + vcpu_iodata_t * vio = get_vio(d->domain, d->vcpu_id); 17.36 ioreq_t *p = &vio->vp_ioreq; 17.37 unsigned long *intr = &(vio->vp_intr[0]); 17.38 - struct vmx_virpit_t *vpit = &(d->arch.arch_vmx.vmx_platform.vmx_pit); 17.39 + struct vmx_virpit_t *vpit = &(d->domain->arch.vmx_platform.vmx_pit); 17.40 int rw_mode; 17.41 17.42 /* load init count*/
18.1 --- a/xen/arch/x86/vmx_io.c Wed Jun 29 21:53:07 2005 +0000 18.2 +++ b/xen/arch/x86/vmx_io.c Thu Jun 30 08:07:29 2005 +0000 18.3 @@ -317,10 +317,11 @@ void vmx_io_assist(struct vcpu *v) 18.4 struct mi_per_cpu_info *mpci_p; 18.5 struct cpu_user_regs *inst_decoder_regs; 18.6 18.7 - mpci_p = &v->arch.arch_vmx.vmx_platform.mpci; 18.8 + mpci_p = &v->domain->arch.vmx_platform.mpci; 18.9 inst_decoder_regs = mpci_p->inst_decoder_regs; 18.10 18.11 - vio = (vcpu_iodata_t *) v->arch.arch_vmx.vmx_platform.shared_page_va; 18.12 + vio = get_vio(v->domain, v->vcpu_id); 18.13 + 18.14 if (vio == 0) { 18.15 VMX_DBG_LOG(DBG_LEVEL_1, 18.16 "bad shared page: %lx", (unsigned long) vio); 18.17 @@ -356,10 +357,10 @@ void vmx_io_assist(struct vcpu *v) 18.18 } 18.19 int size = -1, index = -1; 18.20 18.21 - size = operand_size(v->arch.arch_vmx.vmx_platform.mpci.mmio_target); 18.22 - index = operand_index(v->arch.arch_vmx.vmx_platform.mpci.mmio_target); 18.23 + size = operand_size(v->domain->arch.vmx_platform.mpci.mmio_target); 18.24 + index = operand_index(v->domain->arch.vmx_platform.mpci.mmio_target); 18.25 18.26 - if (v->arch.arch_vmx.vmx_platform.mpci.mmio_target & WZEROEXTEND) { 18.27 + if (v->domain->arch.vmx_platform.mpci.mmio_target & WZEROEXTEND) { 18.28 p->u.data = p->u.data & 0xffff; 18.29 } 18.30 set_reg_value(size, index, 0, regs, p->u.data); 18.31 @@ -404,18 +405,18 @@ void vmx_io_assist(struct vcpu *v) 18.32 int vmx_clear_pending_io_event(struct vcpu *v) 18.33 { 18.34 struct domain *d = v->domain; 18.35 + int port = iopacket_port(d); 18.36 18.37 /* evtchn_pending is shared by other event channels in 0-31 range */ 18.38 - if (!d->shared_info->evtchn_pending[IOPACKET_PORT>>5]) 18.39 - clear_bit(IOPACKET_PORT>>5, &v->vcpu_info->evtchn_pending_sel); 18.40 + if (!d->shared_info->evtchn_pending[port>>5]) 18.41 + clear_bit(port>>5, &v->vcpu_info->evtchn_pending_sel); 18.42 18.43 /* Note: VMX domains may need upcalls as well */ 18.44 if (!v->vcpu_info->evtchn_pending_sel) 18.45 clear_bit(0, &v->vcpu_info->evtchn_upcall_pending); 18.46 18.47 - /* clear the pending bit for IOPACKET_PORT */ 18.48 - return test_and_clear_bit(IOPACKET_PORT, 18.49 - &d->shared_info->evtchn_pending[0]); 18.50 + /* clear the pending bit for port */ 18.51 + return test_and_clear_bit(port, &d->shared_info->evtchn_pending[0]); 18.52 } 18.53 18.54 /* Because we've cleared the pending events first, we need to guarantee that 18.55 @@ -437,17 +438,17 @@ void vmx_check_events(struct vcpu *d) 18.56 void vmx_wait_io() 18.57 { 18.58 extern void do_block(); 18.59 + int port = iopacket_port(current->domain); 18.60 18.61 do { 18.62 - if(!test_bit(IOPACKET_PORT, 18.63 - ¤t->domain->shared_info->evtchn_pending[0])) 18.64 + if(!test_bit(port, ¤t->domain->shared_info->evtchn_pending[0])) 18.65 do_block(); 18.66 vmx_check_events(current); 18.67 if (!test_bit(ARCH_VMX_IO_WAIT, ¤t->arch.arch_vmx.flags)) 18.68 break; 18.69 /* Events other than IOPACKET_PORT might have woken us up. In that 18.70 case, safely go back to sleep. */ 18.71 - clear_bit(IOPACKET_PORT>>5, ¤t->vcpu_info->evtchn_pending_sel); 18.72 + clear_bit(port>>5, ¤t->vcpu_info->evtchn_pending_sel); 18.73 clear_bit(0, ¤t->vcpu_info->evtchn_upcall_pending); 18.74 } while(1); 18.75 } 18.76 @@ -522,7 +523,8 @@ static inline int find_highest_pending_i 18.77 { 18.78 vcpu_iodata_t *vio; 18.79 18.80 - vio = (vcpu_iodata_t *) d->arch.arch_vmx.vmx_platform.shared_page_va; 18.81 + vio = get_vio(d->domain, d->vcpu_id); 18.82 + 18.83 if (vio == 0) { 18.84 VMX_DBG_LOG(DBG_LEVEL_1, 18.85 "bad shared page: %lx", (unsigned long) vio); 18.86 @@ -536,7 +538,8 @@ static inline void clear_highest_bit(str 18.87 { 18.88 vcpu_iodata_t *vio; 18.89 18.90 - vio = (vcpu_iodata_t *) d->arch.arch_vmx.vmx_platform.shared_page_va; 18.91 + vio = get_vio(d->domain, d->vcpu_id); 18.92 + 18.93 if (vio == 0) { 18.94 VMX_DBG_LOG(DBG_LEVEL_1, 18.95 "bad shared page: %lx", (unsigned long) vio); 18.96 @@ -555,7 +558,7 @@ void vmx_intr_assist(struct vcpu *d) 18.97 { 18.98 int highest_vector = find_highest_pending_irq(d); 18.99 unsigned long intr_fields, eflags; 18.100 - struct vmx_virpit_t *vpit = &(d->arch.arch_vmx.vmx_platform.vmx_pit); 18.101 + struct vmx_virpit_t *vpit = &(d->domain->arch.vmx_platform.vmx_pit); 18.102 18.103 if (highest_vector == -1) 18.104 return;
19.1 --- a/xen/arch/x86/vmx_platform.c Wed Jun 29 21:53:07 2005 +0000 19.2 +++ b/xen/arch/x86/vmx_platform.c Thu Jun 30 08:07:29 2005 +0000 19.3 @@ -565,10 +565,11 @@ static void send_mmio_req(unsigned long 19.4 struct cpu_user_regs *inst_decoder_regs; 19.5 extern long evtchn_send(int lport); 19.6 19.7 - mpci_p = ¤t->arch.arch_vmx.vmx_platform.mpci; 19.8 + mpci_p = ¤t->domain->arch.vmx_platform.mpci; 19.9 inst_decoder_regs = mpci_p->inst_decoder_regs; 19.10 19.11 - vio = (vcpu_iodata_t *) d->arch.arch_vmx.vmx_platform.shared_page_va; 19.12 + vio = get_vio(d->domain, d->vcpu_id); 19.13 + 19.14 if (vio == NULL) { 19.15 printk("bad shared page\n"); 19.16 domain_crash_synchronous(); 19.17 @@ -612,7 +613,7 @@ static void send_mmio_req(unsigned long 19.18 p->port_mm, p->size, p->addr, value, p->count); 19.19 #endif 19.20 19.21 - evtchn_send(IOPACKET_PORT); 19.22 + evtchn_send(iopacket_port(d->domain)); 19.23 vmx_wait_io(); 19.24 } 19.25 19.26 @@ -626,7 +627,7 @@ void handle_mmio(unsigned long va, unsig 19.27 unsigned char inst[MAX_INST_LEN]; 19.28 int vm86, ret; 19.29 19.30 - mpci_p = ¤t->arch.arch_vmx.vmx_platform.mpci; 19.31 + mpci_p = ¤t->domain->arch.vmx_platform.mpci; 19.32 inst_decoder_regs = mpci_p->inst_decoder_regs; 19.33 19.34 __vmread(GUEST_RIP, &eip);
20.1 --- a/xen/arch/x86/vmx_vmcs.c Wed Jun 29 21:53:07 2005 +0000 20.2 +++ b/xen/arch/x86/vmx_vmcs.c Thu Jun 30 08:07:29 2005 +0000 20.3 @@ -151,8 +151,10 @@ int vmx_setup_platform(struct vcpu *d, s 20.4 /* Initialise shared page */ 20.5 mpfn = phys_to_machine_mapping(gpfn); 20.6 p = map_domain_page(mpfn); 20.7 - memset(p, 0, PAGE_SIZE); 20.8 - d->arch.arch_vmx.vmx_platform.shared_page_va = (unsigned long)p; 20.9 + d->domain->arch.vmx_platform.shared_page_va = (unsigned long)p; 20.10 + 20.11 + clear_bit(iopacket_port(d->domain), 20.12 + &d->domain->shared_info->evtchn_mask[0]); 20.13 20.14 return 0; 20.15 }
21.1 --- a/xen/include/asm-x86/domain.h Wed Jun 29 21:53:07 2005 +0000 21.2 +++ b/xen/include/asm-x86/domain.h Thu Jun 30 08:07:29 2005 +0000 21.3 @@ -63,7 +63,7 @@ struct arch_domain 21.4 struct list_head free_shadow_frames; 21.5 21.6 pagetable_t phys_table; /* guest 1:1 pagetable */ 21.7 - 21.8 + struct virtual_platform_def vmx_platform; 21.9 } __cacheline_aligned; 21.10 21.11 struct arch_vcpu
22.1 --- a/xen/include/asm-x86/vmx.h Wed Jun 29 21:53:07 2005 +0000 22.2 +++ b/xen/include/asm-x86/vmx.h Thu Jun 30 08:07:29 2005 +0000 22.3 @@ -26,6 +26,8 @@ 22.4 #include <asm/vmx_vmcs.h> 22.5 #include <asm/i387.h> 22.6 22.7 +#include <public/io/ioreq.h> 22.8 + 22.9 extern void vmx_asm_vmexit_handler(struct cpu_user_regs); 22.10 extern void vmx_asm_do_resume(void); 22.11 extern void vmx_asm_do_launch(void); 22.12 @@ -337,4 +339,14 @@ static inline int vmx_paging_enabled(str 22.13 return (cr0 & X86_CR0_PE) && (cr0 & X86_CR0_PG); 22.14 } 22.15 22.16 +static inline vcpu_iodata_t *get_vio(struct domain *d, unsigned long cpu) 22.17 +{ 22.18 + return &((shared_iopage_t *) d->arch.vmx_platform.shared_page_va)->vcpu_iodata[cpu]; 22.19 +} 22.20 + 22.21 +static inline int iopacket_port(struct domain *d) 22.22 +{ 22.23 + return ((shared_iopage_t *) d->arch.vmx_platform.shared_page_va)->sp_global.eport; 22.24 +} 22.25 + 22.26 #endif /* __ASM_X86_VMX_H__ */
23.1 --- a/xen/include/asm-x86/vmx_intercept.h Wed Jun 29 21:53:07 2005 +0000 23.2 +++ b/xen/include/asm-x86/vmx_intercept.h Thu Jun 30 08:07:29 2005 +0000 23.3 @@ -9,7 +9,6 @@ 23.4 #include <xen/errno.h> 23.5 #include <public/io/ioreq.h> 23.6 23.7 - 23.8 #define MAX_IO_HANDLER 6 23.9 23.10 typedef int (*intercept_action_t)(ioreq_t*);
24.1 --- a/xen/include/asm-x86/vmx_platform.h Wed Jun 29 21:53:07 2005 +0000 24.2 +++ b/xen/include/asm-x86/vmx_platform.h Thu Jun 30 08:07:29 2005 +0000 24.3 @@ -77,7 +77,7 @@ struct mi_per_cpu_info 24.4 struct cpu_user_regs *inst_decoder_regs; 24.5 }; 24.6 24.7 -struct virutal_platform_def { 24.8 +struct virtual_platform_def { 24.9 unsigned long *real_mode_data; /* E820, etc. */ 24.10 unsigned long shared_page_va; 24.11 struct vmx_virpit_t vmx_pit;
25.1 --- a/xen/include/asm-x86/vmx_vmcs.h Wed Jun 29 21:53:07 2005 +0000 25.2 +++ b/xen/include/asm-x86/vmx_vmcs.h Thu Jun 30 08:07:29 2005 +0000 25.3 @@ -68,7 +68,6 @@ struct arch_vmx_struct { 25.4 unsigned long cpu_cr3; 25.5 unsigned long cpu_state; 25.6 struct msr_state msr_content; 25.7 - struct virutal_platform_def vmx_platform; 25.8 }; 25.9 25.10 #define vmx_schedule_tail(next) \
26.1 --- a/xen/include/public/io/ioreq.h Wed Jun 29 21:53:07 2005 +0000 26.2 +++ b/xen/include/public/io/ioreq.h Thu Jun 30 08:07:29 2005 +0000 26.3 @@ -29,8 +29,6 @@ 26.4 #define STATE_IORESP_READY 3 26.5 #define STATE_IORESP_HOOK 4 26.6 26.7 -#define IOPACKET_PORT 2 26.8 - 26.9 /* VMExit dispatcher should cooperate with instruction decoder to 26.10 prepare this structure and notify service OS and DM by sending 26.11 virq */ 26.12 @@ -53,9 +51,23 @@ typedef struct { 26.13 #define BITS_PER_BYTE 8 26.14 #define INTR_LEN (MAX_VECTOR/(BITS_PER_BYTE * sizeof(unsigned long))) 26.15 26.16 +/* We only track the master PIC state here */ 26.17 +typedef struct { 26.18 + uint16_t irr; /* interrupt request register */ 26.19 + uint16_t imr; /* interrupt mask register */ 26.20 + uint16_t isr; /* interrupt service register */ 26.21 + 26.22 + int eport; /* Event channel port */ 26.23 +} global_iodata_t; 26.24 + 26.25 typedef struct { 26.26 ioreq_t vp_ioreq; 26.27 unsigned long vp_intr[INTR_LEN]; 26.28 } vcpu_iodata_t; 26.29 26.30 +typedef struct { 26.31 + global_iodata_t sp_global; 26.32 + vcpu_iodata_t vcpu_iodata[1]; 26.33 +} shared_iopage_t; 26.34 + 26.35 #endif /* _IOREQ_H_ */