direct-io.hg
changeset 238:de6e697bb960
bitkeeper revision 1.96 (3e5a5cd7-6YCRyx9vceH0j_ljuOe-Q)
hypervisor-ifs:
new file
Many files:
Allow forced killing of domains with 'kill_domain -f'. task_structs now reference counted.
.del-network.h~823d28e86ebe9d9b:
Delete: xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs/network.h
.del-hypervisor-if.h~d1f6a7dd4307ddfe:
Delete: xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs/hypervisor-if.h
.del-block.h~81aa08f4e2012da6:
Delete: xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs/block.h
hypervisor-ifs:
new file
Many files:
Allow forced killing of domains with 'kill_domain -f'. task_structs now reference counted.
.del-network.h~823d28e86ebe9d9b:
Delete: xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs/network.h
.del-hypervisor-if.h~d1f6a7dd4307ddfe:
Delete: xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs/hypervisor-if.h
.del-block.h~81aa08f4e2012da6:
Delete: xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs/block.h
author | kaf24@labyrinth.cl.cam.ac.uk |
---|---|
date | Mon Feb 24 17:56:39 2003 +0000 (2003-02-24) |
parents | 22ebe9dcd444 |
children | 6e72ef415573 |
files | .bk-to-hg .hg-to-bk .rootkeys tools/domain_builder/dom0_ops.h tools/domain_builder/dom_kill.c xen/common/dom0_ops.c xen/common/domain.c xen/common/network.c xen/include/asm-i386/processor.h xen/include/xeno/dom0_ops.h xen/include/xeno/sched.h xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/dom0_ops.h xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs/block.h xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs/hypervisor-if.h xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs/network.h |
line diff
1.1 --- a/.bk-to-hg Mon Feb 24 17:05:41 2003 +0000 1.2 +++ b/.bk-to-hg Mon Feb 24 17:56:39 2003 +0000 1.3 @@ -2,5 +2,7 @@ 1.4 set -e 1.5 test -L old/xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor-ifs 1.6 rm old/xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor-ifs 1.7 +test -L xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs 1.8 +rm xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs 1.9 (find -depth -type d -print | xargs -r rmdir 2>/dev/null) || true 1.10 exit 0
2.1 --- a/.hg-to-bk Mon Feb 24 17:05:41 2003 +0000 2.2 +++ b/.hg-to-bk Mon Feb 24 17:56:39 2003 +0000 2.3 @@ -5,5 +5,9 @@ mkdir -p old/xenolinux-2.4.16-sparse 2.4 mkdir -p old/xenolinux-2.4.16-sparse/include 2.5 mkdir -p old/xenolinux-2.4.16-sparse/include/asm-xeno 2.6 ln -s ../../../xen-2.4.16/include/hypervisor-ifs old/xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor-ifs 2.7 +mkdir -p xenolinux-2.4.21-pre4-sparse 2.8 +mkdir -p xenolinux-2.4.21-pre4-sparse/include 2.9 +mkdir -p xenolinux-2.4.21-pre4-sparse/include/asm-xeno 2.10 +ln -s ../../../xen/include/hypervisor-ifs/ xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs 2.11 (find -depth -type d -print | xargs -r rmdir 2>/dev/null) || true 2.12 exit 0
3.1 --- a/.rootkeys Mon Feb 24 17:05:41 2003 +0000 3.2 +++ b/.rootkeys Mon Feb 24 17:56:39 2003 +0000 3.3 @@ -544,9 +544,7 @@ 3e5a4e67uPmwPbjvF7YGsG2hX-3oBQ xenolinux 3.4 3e5a4e67P_6RRoCzUiQt_gyx6lmyWw xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hdreg.h 3.5 3e5a4e67w_DWgjIJ17Tlossu1LGujQ xenolinux-2.4.21-pre4-sparse/include/asm-xeno/highmem.h 3.6 3e5a4e67YtcyDLQsShhCfQwPSELfvA xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hw_irq.h 3.7 -3e5a4e67ASLV411RBbSd1tsCc1Dobg xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs/block.h 3.8 -3e5a4e675NGZazUEJ9DDEbTzK3PuDQ xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs/hypervisor-if.h 3.9 -3e5a4e67poqyxiAz_921VNzba90kmw xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs/network.h 3.10 +3e5a5ccawqXeyC62v0oeh-KcabObgA xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs 3.11 3e5a4e677VBavzM1UZIEcH1B-RlXMA xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor.h 3.12 3e5a4e679TYbXAUiURvTeX4cFb1RlQ xenolinux-2.4.21-pre4-sparse/include/asm-xeno/i387.h 3.13 3e5a4e672eNAzAKUZsefsPdmsH19hA xenolinux-2.4.21-pre4-sparse/include/asm-xeno/ide.h
4.1 --- a/tools/domain_builder/dom0_ops.h Mon Feb 24 17:05:41 2003 +0000 4.2 +++ b/tools/domain_builder/dom0_ops.h Mon Feb 24 17:56:39 2003 +0000 4.3 @@ -27,6 +27,7 @@ typedef struct dom0_newdomain_st 4.4 typedef struct dom0_killdomain_st 4.5 { 4.6 unsigned int domain; 4.7 + int force; 4.8 } dom0_killdomain_t; 4.9 4.10 typedef struct dom0_getmemlist_st
5.1 --- a/tools/domain_builder/dom_kill.c Mon Feb 24 17:05:41 2003 +0000 5.2 +++ b/tools/domain_builder/dom_kill.c Mon Feb 24 17:56:39 2003 +0000 5.3 @@ -15,7 +15,7 @@ 5.4 5.5 #define PERR_STRING "Xen Domain Killer" 5.6 5.7 -static int do_kill_domain(int dom_id) 5.8 +static int do_kill_domain(int dom_id, int force) 5.9 { 5.10 char cmd_path[MAX_PATH]; 5.11 dom0_op_t dop; 5.12 @@ -23,6 +23,7 @@ static int do_kill_domain(int dom_id) 5.13 5.14 dop.cmd = DOM0_KILLDOMAIN; 5.15 dop.u.killdomain.domain = dom_id; 5.16 + dop.u.killdomain.force = force; 5.17 5.18 /* open the /proc command interface */ 5.19 sprintf(cmd_path, "%s%s%s%s", "/proc/", PROC_XENO_ROOT, "/", PROC_CMD); 5.20 @@ -42,13 +43,18 @@ int main(int argc, char **argv) 5.21 { 5.22 int ret; 5.23 5.24 - if(argc < 2){ 5.25 - printf("Usage: kill_domain <domain_id>\n"); 5.26 + if ( (argc < 2) || (argc > 3) ) 5.27 + { 5.28 + usage: 5.29 + printf("Usage: kill_domain [-f] <domain_id>\n"); 5.30 + printf(" -f: Forces immediate destruction of specified domain\n"); 5.31 ret = -1; 5.32 goto out; 5.33 } 5.34 5.35 - ret = do_kill_domain(atoi(argv[1])); 5.36 + if ( (argc == 3) && strcmp("-f", argv[1]) ) goto usage; 5.37 + 5.38 + ret = do_kill_domain(atoi(argv[argc-1]), argc == 3); 5.39 5.40 out: 5.41 return ret;
6.1 --- a/xen/common/dom0_ops.c Mon Feb 24 17:05:41 2003 +0000 6.2 +++ b/xen/common/dom0_ops.c Mon Feb 24 17:56:39 2003 +0000 6.3 @@ -81,6 +81,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op) 6.4 wake_up(p); 6.5 reschedule(p); 6.6 ret = p->domain; 6.7 + free_task_struct(p); 6.8 } 6.9 break; 6.10 6.11 @@ -113,13 +114,14 @@ long do_dom0_op(dom0_op_t *u_dom0_op) 6.12 case DOM0_KILLDOMAIN: 6.13 { 6.14 unsigned int dom = op.u.killdomain.domain; 6.15 + int force = op.u.killdomain.force; 6.16 if ( dom == IDLE_DOMAIN_ID ) 6.17 { 6.18 ret = -EPERM; 6.19 } 6.20 else 6.21 { 6.22 - ret = kill_other_domain(dom); 6.23 + ret = kill_other_domain(dom, force); 6.24 } 6.25 } 6.26 break;
7.1 --- a/xen/common/domain.c Mon Feb 24 17:05:41 2003 +0000 7.2 +++ b/xen/common/domain.c Mon Feb 24 17:56:39 2003 +0000 7.3 @@ -40,6 +40,8 @@ struct task_struct *do_newdomain(unsigne 7.4 if (!p) goto newdomain_out; 7.5 memset(p, 0, sizeof(*p)); 7.6 7.7 + atomic_set(&p->refcnt, 1); 7.8 + 7.9 p->domain = dom_id; 7.10 p->processor = cpu; 7.11 7.12 @@ -82,6 +84,7 @@ struct task_struct *find_domain_by_id(un 7.13 read_lock_irq(&tasklist_lock); 7.14 do { 7.15 if ( (p->domain == dom) ) { 7.16 + get_task_struct(p); /* increment the refcnt for caller */ 7.17 read_unlock_irq(&tasklist_lock); 7.18 return (p); 7.19 } 7.20 @@ -117,27 +120,27 @@ void kill_domain(void) 7.21 } 7.22 7.23 7.24 -long kill_other_domain(unsigned int dom) 7.25 +long kill_other_domain(unsigned int dom, int force) 7.26 { 7.27 - struct task_struct *p = &idle0_task; 7.28 + struct task_struct *p; 7.29 unsigned long cpu_mask = 0; 7.30 - long ret = -ESRCH; 7.31 + 7.32 + p = find_domain_by_id(dom); 7.33 + if ( p == NULL ) return -ESRCH; 7.34 7.35 - read_lock_irq(&tasklist_lock); 7.36 - do { 7.37 - if ( p->domain == dom ) 7.38 - { 7.39 - cpu_mask = mark_guest_event(p, _EVENT_DIE); 7.40 - ret = 0; 7.41 - break; 7.42 - } 7.43 + if ( force ) 7.44 + { 7.45 + cpu_mask = mark_hyp_event(p, _HYP_EVENT_DIE); 7.46 + hyp_event_notify(cpu_mask); 7.47 } 7.48 - while ( (p = p->next_task) != &idle0_task ); 7.49 - read_unlock_irq(&tasklist_lock); 7.50 + else 7.51 + { 7.52 + cpu_mask = mark_guest_event(p, _EVENT_DIE); 7.53 + guest_event_notify(cpu_mask); 7.54 + } 7.55 7.56 - hyp_event_notify(cpu_mask); 7.57 - 7.58 - return ret; 7.59 + free_task_struct(p); 7.60 + return 0; 7.61 } 7.62 7.63
8.1 --- a/xen/common/network.c Mon Feb 24 17:05:41 2003 +0000 8.2 +++ b/xen/common/network.c Mon Feb 24 17:56:39 2003 +0000 8.3 @@ -81,7 +81,7 @@ net_vif_t *create_net_vif(int domain) 8.4 new_vif->net_ring = new_ring; 8.5 new_vif->shadow_ring = shadow_ring; 8.6 8.7 - new_vif->domain = find_domain_by_id(domain); 8.8 + new_vif->domain = dom_task; 8.9 8.10 new_vif->list.next = NULL; 8.11 8.12 @@ -93,6 +93,7 @@ net_vif_t *create_net_vif(int domain) 8.13 dom_task->net_vif_list[dom_task->num_net_vifs] = new_vif; 8.14 dom_task->num_net_vifs++; 8.15 8.16 + free_task_struct(dom_task); 8.17 return new_vif; 8.18 8.19 fail: 8.20 @@ -103,6 +104,8 @@ fail: 8.21 if ( shadow_ring->tx_ring ) kfree(shadow_ring->tx_ring); 8.22 kfree(shadow_ring); 8.23 } 8.24 + 8.25 + free_task_struct(dom_task); 8.26 return NULL; 8.27 } 8.28 8.29 @@ -149,6 +152,7 @@ void vif_query(vif_query_t *vq) 8.30 8.31 copy_to_user(vq->buf, buf, strlen(buf) + 1); 8.32 8.33 + free_task_struct(dom_task); 8.34 } 8.35 8.36
9.1 --- a/xen/include/asm-i386/processor.h Mon Feb 24 17:05:41 2003 +0000 9.2 +++ b/xen/include/asm-i386/processor.h Mon Feb 24 17:56:39 2003 +0000 9.3 @@ -440,9 +440,12 @@ unsigned long get_wchan(struct task_stru 9.4 #define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1022]) 9.5 9.6 #define THREAD_SIZE (2*PAGE_SIZE) 9.7 -#define alloc_task_struct() ((struct task_struct *) __get_free_pages(GFP_KERNEL,1)) 9.8 -#define free_task_struct(p) free_pages((unsigned long) (p), 1) 9.9 -#define get_task_struct(tsk) atomic_inc(&virt_to_page(tsk)->count) 9.10 +#define alloc_task_struct() \ 9.11 + ((struct task_struct *) __get_free_pages(GFP_KERNEL,1)) 9.12 +#define free_task_struct(_p) \ 9.13 + if ( atomic_dec_and_test(&(_p)->refcnt) ) free_pages((unsigned long)(_p), 1) 9.14 +#define get_task_struct(_p) \ 9.15 + atomic_inc(&(_p)->refcnt) 9.16 9.17 #define idle0_task (idle0_task_union.task) 9.18 #define idle0_stack (idle0_task_union.stack)
10.1 --- a/xen/include/xeno/dom0_ops.h Mon Feb 24 17:05:41 2003 +0000 10.2 +++ b/xen/include/xeno/dom0_ops.h Mon Feb 24 17:56:39 2003 +0000 10.3 @@ -27,6 +27,7 @@ typedef struct dom0_newdomain_st 10.4 typedef struct dom0_killdomain_st 10.5 { 10.6 unsigned int domain; 10.7 + int force; 10.8 } dom0_killdomain_t; 10.9 10.10 typedef struct dom0_getmemlist_st
11.1 --- a/xen/include/xeno/sched.h Mon Feb 24 17:05:41 2003 +0000 11.2 +++ b/xen/include/xeno/sched.h Mon Feb 24 17:56:39 2003 +0000 11.3 @@ -60,7 +60,7 @@ struct task_struct { 11.4 11.5 int processor; 11.6 int state; 11.7 - int hyp_events; 11.8 + int hyp_events; 11.9 unsigned int domain; 11.10 11.11 /* An unsafe pointer into a shared data area. */ 11.12 @@ -101,6 +101,8 @@ struct task_struct { 11.13 struct task_struct *prev_task, *next_task; 11.14 11.15 unsigned long flags; 11.16 + 11.17 + atomic_t refcnt; 11.18 }; 11.19 11.20 /* 11.21 @@ -163,7 +165,7 @@ struct task_struct *find_domain_by_id(un 11.22 extern void release_task(struct task_struct *); 11.23 extern void kill_domain(void); 11.24 extern void kill_domain_with_errmsg(const char *err); 11.25 -extern long kill_other_domain(unsigned int dom); 11.26 +extern long kill_other_domain(unsigned int dom, int force); 11.27 11.28 /* arch/process.c */ 11.29 void new_thread(struct task_struct *p,
12.1 --- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/dom0_ops.h Mon Feb 24 17:05:41 2003 +0000 12.2 +++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/dom0_ops.h Mon Feb 24 17:56:39 2003 +0000 12.3 @@ -27,6 +27,7 @@ typedef struct dom0_newdomain_st 12.4 typedef struct dom0_killdomain_st 12.5 { 12.6 unsigned int domain; 12.7 + int force; 12.8 } dom0_killdomain_t; 12.9 12.10 typedef struct dom0_getmemlist_st
13.1 --- a/xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs/block.h Mon Feb 24 17:05:41 2003 +0000 13.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 13.3 @@ -1,78 +0,0 @@ 13.4 -/****************************************************************************** 13.5 - * block.h 13.6 - * 13.7 - * Block IO communication rings. 13.8 - * 13.9 - * These are the ring data structures for buffering messages between 13.10 - * the hypervisor and guestos's. 13.11 - * 13.12 - */ 13.13 - 13.14 -#ifndef __BLOCK_H__ 13.15 -#define __BLOCK_H__ 13.16 - 13.17 -#include <linux/kdev_t.h> 13.18 - 13.19 -/* the first four definitions match fs.h */ 13.20 -#define XEN_BLOCK_READ 0 13.21 -#define XEN_BLOCK_WRITE 1 13.22 -#define XEN_BLOCK_READA 2 /* currently unused */ 13.23 -#define XEN_BLOCK_SPECIAL 4 /* currently unused */ 13.24 -#define XEN_BLOCK_PROBE 8 /* determine io configuration from hypervisor */ 13.25 -#define XEN_BLOCK_DEBUG 16 /* debug */ 13.26 - 13.27 -#define BLK_RING_SIZE 128 13.28 -#define BLK_RING_MAX_ENTRIES (BLK_RING_SIZE - 2) 13.29 -#define BLK_RING_INC(_i) (((_i)+1) & (BLK_RING_SIZE-1)) 13.30 -#define BLK_RING_ADD(_i,_j) (((_i)+(_j)) & (BLK_RING_SIZE-1)) 13.31 - 13.32 -typedef struct blk_ring_req_entry 13.33 -{ 13.34 - void * id; /* for guest os use */ 13.35 - int operation; /* XEN_BLOCK_READ or XEN_BLOCK_WRITE */ 13.36 - char * buffer; 13.37 - unsigned long block_number; /* block number */ 13.38 - unsigned short block_size; /* block size */ 13.39 - kdev_t device; 13.40 - unsigned long sector_number; /* real buffer location on disk */ 13.41 -} blk_ring_req_entry_t; 13.42 - 13.43 -typedef struct blk_ring_resp_entry 13.44 -{ 13.45 - void *id; 13.46 - unsigned long status; 13.47 -} blk_ring_resp_entry_t; 13.48 - 13.49 -typedef struct blk_ring_st 13.50 -{ 13.51 - unsigned int req_prod; /* Request producer. Updated by guest OS. */ 13.52 - unsigned int resp_prod; /* Response producer. Updated by Xen. */ 13.53 - union { 13.54 - blk_ring_req_entry_t req; 13.55 - blk_ring_resp_entry_t resp; 13.56 - } ring[BLK_RING_SIZE]; 13.57 -} blk_ring_t; 13.58 - 13.59 -#define MAX_XEN_DISK_COUNT 100 13.60 - 13.61 -#define XEN_DISK_IDE 1 13.62 -#define XEN_DISK_SCSI 2 13.63 - 13.64 -typedef struct xen_disk /* physical disk */ 13.65 -{ 13.66 - int type; /* disk type */ 13.67 - unsigned long capacity; 13.68 - unsigned char heads; /* hdreg.h::hd_geometry */ 13.69 - unsigned char sectors; /* hdreg.h::hd_geometry */ 13.70 - unsigned int cylinders; /* hdreg.h::hd_big_geometry */ 13.71 - unsigned long start; /* hdreg.h::hd_geometry */ 13.72 - void * gendisk; /* struct gendisk ptr */ 13.73 -} xen_disk_t; 13.74 - 13.75 -typedef struct xen_disk_info 13.76 -{ 13.77 - int count; /* number of subsequent xen_disk_t structures to follow */ 13.78 - xen_disk_t disks[100]; 13.79 -} xen_disk_info_t; 13.80 - 13.81 -#endif
14.1 --- a/xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs/hypervisor-if.h Mon Feb 24 17:05:41 2003 +0000 14.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 14.3 @@ -1,209 +0,0 @@ 14.4 -/****************************************************************************** 14.5 - * hypervisor-if.h 14.6 - * 14.7 - * Interface to Xeno hypervisor. 14.8 - */ 14.9 - 14.10 -#include "network.h" 14.11 -#include "block.h" 14.12 - 14.13 -#ifndef __HYPERVISOR_IF_H__ 14.14 -#define __HYPERVISOR_IF_H__ 14.15 - 14.16 -/* 14.17 - * Virtual addresses beyond this are not modifiable by guest OSes. 14.18 - * The machine->physical mapping table starts at this address, read-only 14.19 - * to all domains except DOM0. 14.20 - */ 14.21 -#define HYPERVISOR_VIRT_START (0xFC000000UL) 14.22 -#ifndef machine_to_phys_mapping 14.23 -#define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START) 14.24 -#endif 14.25 - 14.26 -typedef struct trap_info_st 14.27 -{ 14.28 - unsigned char vector; /* exception/interrupt vector */ 14.29 - unsigned char dpl; /* privilege level */ 14.30 - unsigned short cs; /* code selector */ 14.31 - unsigned long address; /* code address */ 14.32 -} trap_info_t; 14.33 - 14.34 - 14.35 -typedef struct 14.36 -{ 14.37 -/* 14.38 - * PGREQ_XXX: specified in least-significant bits of 'ptr' field. 14.39 - * All requests specify relevent PTE or PT address in 'ptr'. 14.40 - * Normal requests specify update value in 'value'. 14.41 - * Extended requests specify command in least 8 bits of 'value'. 14.42 - */ 14.43 -/* A normal page-table update request. */ 14.44 -#define PGREQ_NORMAL 0 14.45 -/* Update an entry in the machine->physical mapping table. */ 14.46 -#define PGREQ_MPT_UPDATE 1 14.47 -/* An extended command. */ 14.48 -#define PGREQ_EXTENDED_COMMAND 2 14.49 -/* DOM0 can make entirely unchecked updates which do not affect refcnts. */ 14.50 -#define PGREQ_UNCHECKED_UPDATE 3 14.51 - unsigned long ptr, val; /* *ptr = val */ 14.52 -/* Announce a new top-level page table. */ 14.53 -#define PGEXT_PIN_L1_TABLE 0 14.54 -#define PGEXT_PIN_L2_TABLE 1 14.55 -#define PGEXT_PIN_L3_TABLE 2 14.56 -#define PGEXT_PIN_L4_TABLE 3 14.57 -#define PGEXT_UNPIN_TABLE 4 14.58 -#define PGEXT_NEW_BASEPTR 5 14.59 -#define PGEXT_TLB_FLUSH 6 14.60 -#define PGEXT_INVLPG 7 14.61 -#define PGEXT_CMD_MASK 255 14.62 -#define PGEXT_CMD_SHIFT 8 14.63 -} page_update_request_t; 14.64 - 14.65 - 14.66 -/* 14.67 - * Segment descriptor tables. 14.68 - */ 14.69 -/* 8 entries, plus a TSS entry for each CPU (up to 32 CPUs). */ 14.70 -#define FIRST_DOMAIN_GDT_ENTRY 40 14.71 -/* These are flat segments for domain bootstrap and fallback. */ 14.72 -#define FLAT_RING1_CS 0x11 14.73 -#define FLAT_RING1_DS 0x19 14.74 -#define FLAT_RING3_CS 0x23 14.75 -#define FLAT_RING3_DS 0x2b 14.76 - 14.77 - 14.78 -/* EAX = vector; EBX, ECX, EDX, ESI, EDI = args 1, 2, 3, 4, 5. */ 14.79 - 14.80 -#define __HYPERVISOR_set_trap_table 0 14.81 -#define __HYPERVISOR_pt_update 1 14.82 -#define __HYPERVISOR_console_write 2 14.83 -#define __HYPERVISOR_set_gdt 3 14.84 -#define __HYPERVISOR_stack_and_ldt_switch 4 14.85 -#define __HYPERVISOR_net_update 5 14.86 -#define __HYPERVISOR_fpu_taskswitch 6 14.87 -#define __HYPERVISOR_sched_op 7 14.88 -#define __HYPERVISOR_exit 8 14.89 -#define __HYPERVISOR_dom0_op 9 14.90 -#define __HYPERVISOR_network_op 10 14.91 -#define __HYPERVISOR_block_io_op 11 14.92 -#define __HYPERVISOR_set_debugreg 12 14.93 -#define __HYPERVISOR_get_debugreg 13 14.94 -#define __HYPERVISOR_update_descriptor 14 14.95 -#define __HYPERVISOR_set_fast_trap 15 14.96 - 14.97 -#define TRAP_INSTR "int $0x82" 14.98 - 14.99 - 14.100 -/* Event message note: 14.101 - * 14.102 - * Here, as in the interrupts to the guestos, additional network interfaces 14.103 - * are defined. These definitions server as placeholders for the event bits, 14.104 - * however, in the code these events will allways be referred to as shifted 14.105 - * offsets from the base NET events. 14.106 - */ 14.107 - 14.108 -/* Events that a guest OS may receive from the hypervisor. */ 14.109 -#define EVENT_BLK_RESP 0x01 /* A block device response has been queued. */ 14.110 -#define EVENT_TIMER 0x02 /* A timeout has been updated. */ 14.111 -#define EVENT_DIE 0x04 /* OS is about to be killed. Clean up please! */ 14.112 -#define EVENT_DEBUG 0x08 /* Request guest to dump debug info (gross!) */ 14.113 -#define EVENT_NET_TX 0x10 /* There are packets for transmission. */ 14.114 -#define EVENT_NET_RX 0x20 /* There are empty buffers for receive. */ 14.115 - 14.116 -/* Bit offsets, as opposed to the above masks. */ 14.117 -#define _EVENT_BLK_RESP 0 14.118 -#define _EVENT_TIMER 1 14.119 -#define _EVENT_DIE 2 14.120 -#define _EVENT_NET_TX 3 14.121 -#define _EVENT_NET_RX 4 14.122 -#define _EVENT_DEBUG 5 14.123 - 14.124 - 14.125 -/* 14.126 - * NB. We expect that this struct is smaller than a page. 14.127 - */ 14.128 -typedef struct shared_info_st { 14.129 - 14.130 - /* Bitmask of outstanding event notifications hypervisor -> guest OS. */ 14.131 - unsigned long events; 14.132 - /* 14.133 - * Hypervisor will only signal event delivery via the "callback 14.134 - * exception" when this value is non-zero. Hypervisor clears this when 14.135 - * notiying the guest OS -- this prevents unbounded reentrancy and 14.136 - * stack overflow (in this way, acts as an interrupt-enable flag). 14.137 - */ 14.138 - unsigned long events_enable; 14.139 - 14.140 - /* 14.141 - * Address for callbacks hypervisor -> guest OS. 14.142 - * Stack frame looks like that of an interrupt. 14.143 - * Code segment is the default flat selector. 14.144 - * This handler will only be called when events_enable is non-zero. 14.145 - */ 14.146 - unsigned long event_address; 14.147 - 14.148 - /* 14.149 - * Hypervisor uses this callback when it takes a fault on behalf of 14.150 - * an application. This can happen when returning from interrupts for 14.151 - * example: various faults can occur when reloading the segment 14.152 - * registers, and executing 'iret'. 14.153 - * This callback is provided with an extended stack frame, augmented 14.154 - * with saved values for segment registers %ds and %es: 14.155 - * %ds, %es, %eip, %cs, %eflags [, %oldesp, %oldss] 14.156 - * Code segment is the default flat selector. 14.157 - * FAULTS WHEN CALLING THIS HANDLER WILL TERMINATE THE DOMAIN!!! 14.158 - */ 14.159 - unsigned long failsafe_address; 14.160 - 14.161 - /* 14.162 - * Time: 14.163 - * The following abstractions are exposed: System Time, Wall Clock 14.164 - * Time, Domain Virtual Time. Domains can access Cycle counter time 14.165 - * directly. 14.166 - * XXX RN: Need something to pass NTP scaling to GuestOS. 14.167 - */ 14.168 - 14.169 - u64 cpu_freq; /* to calculate ticks -> real time */ 14.170 - 14.171 - /* System Time */ 14.172 - long long system_time; /* in ns */ 14.173 - unsigned long st_timestamp; /* cyclecounter at last update */ 14.174 - 14.175 - /* Wall Clock Time */ 14.176 - u32 wc_version; /* a version number for info below */ 14.177 - long tv_sec; /* essentially a struct timeval */ 14.178 - long tv_usec; 14.179 - long long wc_timestamp; /* system time at last update */ 14.180 - 14.181 - /* Domain Virtual Time */ 14.182 - unsigned long long domain_time; 14.183 - 14.184 - /* 14.185 - * Timeout values: 14.186 - * Allow a domain to specify a timeout value in system time and 14.187 - * domain virtual time. 14.188 - */ 14.189 - unsigned long long wall_timeout; 14.190 - unsigned long long domain_timeout; 14.191 - 14.192 -} shared_info_t; 14.193 - 14.194 -/* 14.195 - * NB. We expect that this struct is smaller than a page. 14.196 - */ 14.197 -typedef struct start_info_st { 14.198 - unsigned long nr_pages; /* total pages allocated to this domain */ 14.199 - shared_info_t *shared_info; /* VIRTUAL address of shared info struct */ 14.200 - unsigned long pt_base; /* VIRTUAL address of page directory */ 14.201 - unsigned long mod_start; /* VIRTUAL address of pre-loaded module */ 14.202 - unsigned long mod_len; /* size (bytes) of pre-loaded module */ 14.203 - net_ring_t *net_rings; /* network rings (VIRTUAL ADDRESS) */ 14.204 - int num_net_rings; 14.205 - unsigned long blk_ring; /* block io ring (MACHINE ADDRESS) */ 14.206 - unsigned char cmd_line[1]; /* variable-length */ 14.207 -} start_info_t; 14.208 - 14.209 -/* For use in guest OSes. */ 14.210 -extern shared_info_t *HYPERVISOR_shared_info; 14.211 - 14.212 -#endif /* __HYPERVISOR_IF_H__ */
15.1 --- a/xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs/network.h Mon Feb 24 17:05:41 2003 +0000 15.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 15.3 @@ -1,131 +0,0 @@ 15.4 -/****************************************************************************** 15.5 - * network.h 15.6 - * 15.7 - * ring data structures for buffering messages between hypervisor and 15.8 - * guestos's. As it stands this is only used for network buffer exchange. 15.9 - * 15.10 - * This file also contains structures and interfaces for the per-domain 15.11 - * routing/filtering tables in the hypervisor. 15.12 - * 15.13 - */ 15.14 - 15.15 -#ifndef __RING_H__ 15.16 -#define __RING_H__ 15.17 - 15.18 -#include <linux/types.h> 15.19 - 15.20 -typedef struct tx_entry_st { 15.21 - unsigned long addr; /* virtual address */ 15.22 - unsigned long size; /* in bytes */ 15.23 - int status; /* per descriptor status. */ 15.24 -} tx_entry_t; 15.25 - 15.26 -typedef struct rx_entry_st { 15.27 - unsigned long addr; /* virtual address */ 15.28 - unsigned long size; /* in bytes */ 15.29 - int status; /* per descriptor status. */ 15.30 -} rx_entry_t; 15.31 - 15.32 -#define TX_RING_SIZE 256 15.33 -#define RX_RING_SIZE 256 15.34 -typedef struct net_ring_st { 15.35 - /* 15.36 - * Guest OS places packets into ring at tx_prod. 15.37 - * Hypervisor removes at tx_cons. 15.38 - * Ring is empty when tx_prod == tx_cons. 15.39 - * Guest OS receives a DOMAIN_EVENT_NET_TX when tx_cons passes tx_event. 15.40 - * Hypervisor may be prodded whenever tx_prod is updated, but this is 15.41 - * only necessary when tx_cons == old_tx_prod (ie. transmitter stalled). 15.42 - */ 15.43 - tx_entry_t *tx_ring; 15.44 - unsigned int tx_prod, tx_cons, tx_event; 15.45 - 15.46 - /* 15.47 - * Guest OS places empty buffers into ring at rx_prod. 15.48 - * Hypervisor fills buffers as rx_cons. 15.49 - * Ring is empty when rx_prod == rx_cons. 15.50 - * Guest OS receives a DOMAIN_EVENT_NET_RX when rx_cons passes rx_event. 15.51 - * Hypervisor may be prodded whenever rx_prod is updated, but this is 15.52 - * only necessary when rx_cons == old_rx_prod (ie. receiver stalled). 15.53 - */ 15.54 - rx_entry_t *rx_ring; 15.55 - unsigned int rx_prod, rx_cons, rx_event; 15.56 -} net_ring_t; 15.57 - 15.58 -/* Specify base of per-domain array. Get returned free slot in the array. */ 15.59 -/*net_ring_t *create_net_vif(int domain);*/ 15.60 - 15.61 -/* Packet routing/filtering code follows: 15.62 - */ 15.63 - 15.64 -#define NETWORK_ACTION_ACCEPT 0 15.65 -#define NETWORK_ACTION_COUNT 1 15.66 - 15.67 -#define NETWORK_PROTO_ANY 0 15.68 -#define NETWORK_PROTO_IP 1 15.69 -#define NETWORK_PROTO_TCP 2 15.70 -#define NETWORK_PROTO_UDP 3 15.71 -#define NETWORK_PROTO_ARP 4 15.72 - 15.73 -typedef struct net_rule_st 15.74 -{ 15.75 - u32 src_addr; 15.76 - u32 dst_addr; 15.77 - u16 src_port; 15.78 - u16 dst_port; 15.79 - u32 src_addr_mask; 15.80 - u32 dst_addr_mask; 15.81 - u16 src_port_mask; 15.82 - u16 dst_port_mask; 15.83 - u16 proto; 15.84 - 15.85 - int src_interface; 15.86 - int dst_interface; 15.87 - u16 action; 15.88 -} net_rule_t; 15.89 - 15.90 -typedef struct vif_query_st 15.91 -{ 15.92 - unsigned int domain; 15.93 - char *buf; // where to put the reply -- guest virtual address 15.94 -} vif_query_t; 15.95 - 15.96 -/* Network trap operations and associated structure. 15.97 - * This presently just handles rule insertion and deletion, but will 15.98 - * evenually have code to add and remove interfaces. 15.99 - */ 15.100 - 15.101 -#define NETWORK_OP_ADDRULE 0 15.102 -#define NETWORK_OP_DELETERULE 1 15.103 -#define NETWORK_OP_GETRULELIST 2 15.104 -#define NETWORK_OP_VIFQUERY 3 15.105 - 15.106 -typedef struct network_op_st 15.107 -{ 15.108 - unsigned long cmd; 15.109 - union 15.110 - { 15.111 - net_rule_t net_rule; 15.112 - vif_query_t vif_query; 15.113 - } 15.114 - u; 15.115 -} network_op_t; 15.116 - 15.117 -typedef struct net_rule_ent_st 15.118 -{ 15.119 - net_rule_t r; 15.120 - struct net_rule_ent_st *next; 15.121 -} net_rule_ent_t; 15.122 - 15.123 -/* Drop a new rule down to the network tables. */ 15.124 -int add_net_rule(net_rule_t *rule); 15.125 - 15.126 - 15.127 -/* Descriptor status values: 15.128 - */ 15.129 - 15.130 -#define RING_STATUS_OK 0 // Everything is gravy. 15.131 -#define RING_STATUS_ERR_CFU -1 // Copy from user problems. 15.132 -#define RING_STATUS_BAD_PAGE -2 // What they gave us was pure evil. 15.133 - 15.134 -#endif