ia64/xen-unstable

changeset 8154:6bc8ceab6dff

Merged.
author emellor@leeni.uk.xensource.com
date Thu Dec 01 03:07:24 2005 +0000 (2005-12-01)
parents bd250c4a86cb 06c3b8e194d7
children 9ff0a75fc3f7 572752a4ed8b
files
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/fixup.c	Wed Nov 30 11:44:19 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/fixup.c	Thu Dec 01 03:07:24 2005 +0000
     1.3 @@ -56,9 +56,11 @@ fastcall void do_fixup_4gb_segment(struc
     1.4  	DP("***************************************************************");
     1.5  	DP("***************************************************************");
     1.6  	DP("** WARNING: Currently emulating unsupported memory accesses  **");
     1.7 -	DP("**          in /lib/tls libraries. The emulation is very     **");
     1.8 +	DP("**          in /lib/tls glibc libraries. The emulation is    **");
     1.9  	DP("**          slow. To ensure full performance you should      **");
    1.10 -	DP("**          execute the following as root:                   **");
    1.11 +	DP("**          install a 'xen-friendly' (nosegneg) version of   **");
    1.12 +	DP("**          the library, or disable tls support by executing **");
    1.13 +	DP("**          the following as root:                           **");
    1.14  	DP("**          mv /lib/tls /lib/tls.disabled                    **");
    1.15  	DP("** Offending process: %-38.38s **", info);
    1.16  	DP("***************************************************************");
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Wed Nov 30 11:44:19 2005 +0000
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Thu Dec 01 03:07:24 2005 +0000
     2.3 @@ -88,10 +88,10 @@ static inline void flush_plugged_queue(v
     2.4   * handle returned must be used to unmap the frame. This is needed to
     2.5   * drop the ref count on the frame.
     2.6   */
     2.7 -static u16 pending_grant_handles[MMAP_PAGES];
     2.8 +static grant_handle_t pending_grant_handles[MMAP_PAGES];
     2.9  #define pending_handle(_idx, _i) \
    2.10      (pending_grant_handles[((_idx) * BLKIF_MAX_SEGMENTS_PER_REQUEST) + (_i)])
    2.11 -#define BLKBACK_INVALID_HANDLE (0xFFFF)
    2.12 +#define BLKBACK_INVALID_HANDLE (~0)
    2.13  
    2.14  #ifdef CONFIG_XEN_BLKDEV_TAP_BE
    2.15  /*
    2.16 @@ -114,7 +114,7 @@ static void fast_flush_area(int idx, int
    2.17  {
    2.18  	struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST];
    2.19  	unsigned int i, invcount = 0;
    2.20 -	u16 handle;
    2.21 +	grant_handle_t handle;
    2.22  	int ret;
    2.23  
    2.24  	for (i = 0; i < nr_pages; i++) {
    2.25 @@ -335,7 +335,6 @@ static void dispatch_rw_block_io(blkif_t
    2.26  {
    2.27  	extern void ll_rw_block(int rw, int nr, struct buffer_head * bhs[]); 
    2.28  	int operation = (req->operation == BLKIF_OP_WRITE) ? WRITE : READ;
    2.29 -	unsigned long fas = 0;
    2.30  	int i, pending_idx = pending_ring[MASK_PEND_IDX(pending_cons)];
    2.31  	pending_req_t *pending_req;
    2.32  	struct gnttab_map_grant_ref map[BLKIF_MAX_SEGMENTS_PER_REQUEST];
    2.33 @@ -362,16 +361,17 @@ static void dispatch_rw_block_io(blkif_t
    2.34  	preq.nr_sects      = 0;
    2.35  
    2.36  	for (i = 0; i < nseg; i++) {
    2.37 -		fas         = req->frame_and_sects[i];
    2.38 -		seg[i].nsec = blkif_last_sect(fas) - blkif_first_sect(fas) + 1;
    2.39 +		seg[i].nsec = req->seg[i].last_sect -
    2.40 +			req->seg[i].first_sect + 1;
    2.41  
    2.42 -		if (seg[i].nsec <= 0)
    2.43 +		if ((req->seg[i].last_sect >= (PAGE_SIZE >> 9)) ||
    2.44 +		    (seg[i].nsec <= 0))
    2.45  			goto bad_descriptor;
    2.46  		preq.nr_sects += seg[i].nsec;
    2.47  
    2.48  		map[i].host_addr = MMAP_VADDR(pending_idx, i);
    2.49  		map[i].dom = blkif->domid;
    2.50 -		map[i].ref = blkif_gref_from_fas(fas);
    2.51 +		map[i].ref = req->seg[i].gref;
    2.52  		map[i].flags = GNTMAP_host_map;
    2.53  		if ( operation == WRITE )
    2.54  			map[i].flags |= GNTMAP_readonly;
    2.55 @@ -381,7 +381,7 @@ static void dispatch_rw_block_io(blkif_t
    2.56  	BUG_ON(ret);
    2.57  
    2.58  	for (i = 0; i < nseg; i++) {
    2.59 -		if (likely(map[i].handle >= 0)) {
    2.60 +		if (likely(map[i].status == 0)) {
    2.61  			pending_handle(pending_idx, i) = map[i].handle;
    2.62  #ifdef __ia64__
    2.63  			MMAP_VADDR(pending_idx,i) = gnttab_map_vaddr(map[i]);
    2.64 @@ -390,9 +390,8 @@ static void dispatch_rw_block_io(blkif_t
    2.65  				pending_idx, i)) >> PAGE_SHIFT,
    2.66  				FOREIGN_FRAME(map[i].dev_bus_addr>>PAGE_SHIFT));
    2.67  #endif
    2.68 -			fas        = req->frame_and_sects[i];
    2.69 -			seg[i].buf = map[i].dev_bus_addr | 
    2.70 -				(blkif_first_sect(fas) << 9);
    2.71 +			seg[i].buf = map[i].dev_bus_addr |
    2.72 +				(req->seg[i].first_sect << 9);
    2.73  		} else {
    2.74  			errors++;
    2.75  		}
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/common.h	Wed Nov 30 11:44:19 2005 +0000
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/common.h	Thu Dec 01 03:07:24 2005 +0000
     3.3 @@ -66,8 +66,8 @@ typedef struct blkif_st {
     3.4  
     3.5  	struct work_struct free_work;
     3.6  
     3.7 -	u16         shmem_handle;
     3.8 -	grant_ref_t shmem_ref;
     3.9 +	grant_handle_t shmem_handle;
    3.10 +	grant_ref_t    shmem_ref;
    3.11  } blkif_t;
    3.12  
    3.13  blkif_t *alloc_blkif(domid_t domid);
     4.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c	Wed Nov 30 11:44:19 2005 +0000
     4.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c	Thu Dec 01 03:07:24 2005 +0000
     4.3 @@ -43,9 +43,9 @@ static int map_frontend_page(blkif_t *bl
     4.4  	unlock_vm_area(blkif->blk_ring_area);
     4.5  	BUG_ON(ret);
     4.6  
     4.7 -	if (op.handle < 0) {
     4.8 +	if (op.status) {
     4.9  		DPRINTK(" Grant table operation failure !\n");
    4.10 -		return op.handle;
    4.11 +		return op.status;
    4.12  	}
    4.13  
    4.14  	blkif->shmem_ref = shared_page;
     5.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Wed Nov 30 11:44:19 2005 +0000
     5.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Thu Dec 01 03:07:24 2005 +0000
     5.3 @@ -32,7 +32,6 @@
     5.4   * IN THE SOFTWARE.
     5.5   */
     5.6  
     5.7 -
     5.8  #if 1
     5.9  #define ASSERT(p)							   \
    5.10  	if (!(p)) { printk("Assertion '%s' failed, line %d, file %s", #p , \
    5.11 @@ -41,7 +40,6 @@
    5.12  #define ASSERT(_p)
    5.13  #endif
    5.14  
    5.15 -
    5.16  #include <linux/version.h>
    5.17  #include "block.h"
    5.18  #include <linux/cdrom.h>
    5.19 @@ -54,16 +52,14 @@
    5.20  #include <asm-xen/gnttab.h>
    5.21  #include <asm/hypervisor.h>
    5.22  
    5.23 -
    5.24  #define BLKIF_STATE_DISCONNECTED 0
    5.25  #define BLKIF_STATE_CONNECTED    1
    5.26  #define BLKIF_STATE_SUSPENDED    2
    5.27  
    5.28  #define MAXIMUM_OUTSTANDING_BLOCK_REQS \
    5.29 -    (BLKIF_MAX_SEGMENTS_PER_REQUEST * BLKIF_RING_SIZE)
    5.30 +    (BLKIF_MAX_SEGMENTS_PER_REQUEST * BLK_RING_SIZE)
    5.31  #define GRANT_INVALID_REF	0
    5.32  
    5.33 -
    5.34  static void connect(struct blkfront_info *);
    5.35  static void blkfront_closing(struct xenbus_device *);
    5.36  static int blkfront_remove(struct xenbus_device *);
    5.37 @@ -551,8 +547,11 @@ static int blkif_queue_request(struct re
    5.38  			info->shadow[id].frame[ring_req->nr_segments] =
    5.39  				mfn_to_pfn(buffer_mfn);
    5.40  
    5.41 -			ring_req->frame_and_sects[ring_req->nr_segments] =
    5.42 -				blkif_fas_from_gref(ref, fsect, lsect);
    5.43 +			ring_req->seg[ring_req->nr_segments] =
    5.44 +				(struct blkif_request_segment) {
    5.45 +					.gref       = ref,
    5.46 +					.first_sect = fsect, 
    5.47 +					.last_sect  = lsect };
    5.48  
    5.49  			ring_req->nr_segments++;
    5.50  		}
    5.51 @@ -699,8 +698,7 @@ static void blkif_completion(struct blk_
    5.52  {
    5.53  	int i;
    5.54  	for (i = 0; i < s->req.nr_segments; i++)
    5.55 -		gnttab_end_foreign_access(
    5.56 -			blkif_gref_from_fas(s->req.frame_and_sects[i]), 0, 0UL);
    5.57 +		gnttab_end_foreign_access(s->req.seg[i].gref, 0, 0UL);
    5.58  }
    5.59  
    5.60  static void blkif_recover(struct blkfront_info *info)
    5.61 @@ -740,7 +738,7 @@ static void blkif_recover(struct blkfron
    5.62  		/* Rewrite any grant references invalidated by susp/resume. */
    5.63  		for (j = 0; j < req->nr_segments; j++)
    5.64  			gnttab_grant_foreign_access_ref(
    5.65 -				blkif_gref_from_fas(req->frame_and_sects[j]),
    5.66 +				req->seg[j].gref,
    5.67  				info->xbdev->otherend_id,
    5.68  				pfn_to_mfn(info->shadow[req->id].frame[j]),
    5.69  				rq_data_dir(
     6.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c	Wed Nov 30 11:44:19 2005 +0000
     6.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c	Thu Dec 01 03:07:24 2005 +0000
     6.3 @@ -33,6 +33,9 @@
     6.4  #include <linux/blkdev.h>
     6.5  #include <linux/list.h>
     6.6  
     6.7 +#define BLKIF_MAJOR(dev) ((dev)>>8)
     6.8 +#define BLKIF_MINOR(dev) ((dev) & 0xff)
     6.9 +
    6.10  /*
    6.11   * For convenience we distinguish between ide, scsi and 'other' (i.e.,
    6.12   * potentially combinations of the two) in the naming scheme and in a few other
     7.1 --- a/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c	Wed Nov 30 11:44:19 2005 +0000
     7.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c	Thu Dec 01 03:07:24 2005 +0000
     7.3 @@ -177,8 +177,8 @@ extern inline domid_t ID_TO_DOM(unsigned
     7.4   */
     7.5  struct grant_handle_pair
     7.6  {
     7.7 -	u16  kernel;
     7.8 -	u16  user;
     7.9 +	grant_handle_t kernel;
    7.10 +	grant_handle_t user;
    7.11  };
    7.12  static struct grant_handle_pair pending_grant_handles[MMAP_PAGES];
    7.13  #define pending_handle(_idx, _i) \
    7.14 @@ -713,7 +713,7 @@ static void dispatch_rw_block_io(blkif_t
    7.15  		/* Map the remote page to kernel. */
    7.16  		map[op].host_addr = kvaddr;
    7.17  		map[op].dom   = blkif->domid;
    7.18 -		map[op].ref   = blkif_gref_from_fas(req->frame_and_sects[i]);
    7.19 +		map[op].ref   = req->seg[i].gref;
    7.20  		map[op].flags = GNTMAP_host_map;
    7.21  		/* This needs a bit more thought in terms of interposition: 
    7.22  		 * If we want to be able to modify pages during write using 
    7.23 @@ -733,7 +733,7 @@ static void dispatch_rw_block_io(blkif_t
    7.24  
    7.25  		map[op].host_addr = ptep;
    7.26  		map[op].dom       = blkif->domid;
    7.27 -		map[op].ref       = blkif_gref_from_fas(req->frame_and_sects[i]);
    7.28 +		map[op].ref       = req->seg[i].gref;
    7.29  		map[op].flags     = GNTMAP_host_map | GNTMAP_application_map
    7.30  			| GNTMAP_contains_pte;
    7.31  		/* Above interposition comment applies here as well. */
    7.32 @@ -755,17 +755,17 @@ static void dispatch_rw_block_io(blkif_t
    7.33  		uvaddr = MMAP_VADDR(user_vstart, pending_idx, i/2);
    7.34  		kvaddr = MMAP_VADDR(mmap_vstart, pending_idx, i/2);
    7.35  
    7.36 -		if (unlikely(map[i].handle < 0)) {
    7.37 +		if (unlikely(map[i].status)) {
    7.38  			DPRINTK("Error on kernel grant mapping (%d)\n",
    7.39 -				map[i].handle);
    7.40 -			ret = map[i].handle;
    7.41 +				map[i].status);
    7.42 +			ret = map[i].status;
    7.43  			cancel = 1;
    7.44  		}
    7.45  
    7.46 -		if (unlikely(map[i+1].handle < 0)) {
    7.47 +		if (unlikely(map[i+1].status)) {
    7.48  			DPRINTK("Error on user grant mapping (%d)\n",
    7.49 -				map[i+1].handle);
    7.50 -			ret = map[i+1].handle;
    7.51 +				map[i+1].status);
    7.52 +			ret = map[i+1].status;
    7.53  			cancel = 1;
    7.54  		}
    7.55  
     8.1 --- a/linux-2.6-xen-sparse/drivers/xen/blktap/common.h	Wed Nov 30 11:44:19 2005 +0000
     8.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/common.h	Thu Dec 01 03:07:24 2005 +0000
     8.3 @@ -64,7 +64,7 @@ typedef struct blkif_st {
     8.4  
     8.5  	struct work_struct free_work;
     8.6  
     8.7 -	u16              shmem_handle;
     8.8 +	grant_handle_t   shmem_handle;
     8.9  	grant_ref_t      shmem_ref;
    8.10  } blkif_t;
    8.11  
     9.1 --- a/linux-2.6-xen-sparse/drivers/xen/blktap/interface.c	Wed Nov 30 11:44:19 2005 +0000
     9.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/interface.c	Thu Dec 01 03:07:24 2005 +0000
     9.3 @@ -43,9 +43,9 @@ static int map_frontend_page(blkif_t *bl
     9.4  	unlock_vm_area(blkif->blk_ring_area);
     9.5  	BUG_ON(ret);
     9.6  
     9.7 -	if (op.handle < 0) {
     9.8 +	if (op.status) {
     9.9  		DPRINTK(" Grant table operation failure !\n");
    9.10 -		return op.handle;
    9.11 +		return op.status;
    9.12  	}
    9.13  
    9.14  	blkif->shmem_ref    = shared_page;
    10.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/common.h	Wed Nov 30 11:44:19 2005 +0000
    10.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/common.h	Thu Dec 01 03:07:24 2005 +0000
    10.3 @@ -45,9 +45,9 @@ typedef struct netif_st {
    10.4  	u8               fe_dev_addr[6];
    10.5  
    10.6  	/* Physical parameters of the comms window. */
    10.7 -	u16              tx_shmem_handle;
    10.8 +	grant_handle_t   tx_shmem_handle;
    10.9  	grant_ref_t      tx_shmem_ref; 
   10.10 -	u16              rx_shmem_handle;
   10.11 +	grant_handle_t   rx_shmem_handle;
   10.12  	grant_ref_t      rx_shmem_ref; 
   10.13  	unsigned int     evtchn;
   10.14  	unsigned int     irq;
    11.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c	Wed Nov 30 11:44:19 2005 +0000
    11.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c	Thu Dec 01 03:07:24 2005 +0000
    11.3 @@ -127,9 +127,9 @@ static int map_frontend_pages(
    11.4  	unlock_vm_area(netif->comms_area);
    11.5  	BUG_ON(ret);
    11.6  
    11.7 -	if (op.handle < 0) { 
    11.8 +	if (op.status) { 
    11.9  		DPRINTK(" Gnttab failure mapping tx_ring_ref!\n");
   11.10 -		return op.handle;
   11.11 +		return op.status;
   11.12  	}
   11.13  
   11.14  	netif->tx_shmem_ref    = tx_ring_ref;
   11.15 @@ -145,9 +145,9 @@ static int map_frontend_pages(
   11.16  	unlock_vm_area(netif->comms_area);
   11.17  	BUG_ON(ret);
   11.18  
   11.19 -	if (op.handle < 0) { 
   11.20 +	if (op.status) {
   11.21  		DPRINTK(" Gnttab failure mapping rx_ring_ref!\n");
   11.22 -		return op.handle;
   11.23 +		return op.status;
   11.24  	}
   11.25  
   11.26  	netif->rx_shmem_ref    = rx_ring_ref;
    12.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Wed Nov 30 11:44:19 2005 +0000
    12.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Thu Dec 01 03:07:24 2005 +0000
    12.3 @@ -68,7 +68,7 @@ static PEND_RING_IDX dealloc_prod, deall
    12.4  
    12.5  static struct sk_buff_head tx_queue;
    12.6  
    12.7 -static u16 grant_tx_ref[MAX_PENDING_REQS];
    12.8 +static grant_handle_t grant_tx_handle[MAX_PENDING_REQS];
    12.9  static gnttab_unmap_grant_ref_t tx_unmap_ops[MAX_PENDING_REQS];
   12.10  static gnttab_map_grant_ref_t tx_map_ops[MAX_PENDING_REQS];
   12.11  
   12.12 @@ -412,7 +412,7 @@ inline static void net_tx_action_dealloc
   12.13  		pending_idx = dealloc_ring[MASK_PEND_IDX(dc++)];
   12.14  		gop->host_addr    = MMAP_VADDR(pending_idx);
   12.15  		gop->dev_bus_addr = 0;
   12.16 -		gop->handle       = grant_tx_ref[pending_idx];
   12.17 +		gop->handle       = grant_tx_handle[pending_idx];
   12.18  		gop++;
   12.19  	}
   12.20  	ret = HYPERVISOR_grant_table_op(
   12.21 @@ -592,7 +592,7 @@ static void net_tx_action(unsigned long 
   12.22  		       sizeof(txreq));
   12.23  
   12.24  		/* Check the remap error code. */
   12.25 -		if (unlikely(mop->handle < 0)) {
   12.26 +		if (unlikely(mop->status)) {
   12.27  			printk(KERN_ALERT "#### netback grant fails\n");
   12.28  			make_tx_response(netif, txreq.id, NETIF_RSP_ERROR);
   12.29  			netif_put(netif);
   12.30 @@ -605,7 +605,7 @@ static void net_tx_action(unsigned long 
   12.31  		set_phys_to_machine(
   12.32  			__pa(MMAP_VADDR(pending_idx)) >> PAGE_SHIFT,
   12.33  			FOREIGN_FRAME(mop->dev_bus_addr >> PAGE_SHIFT));
   12.34 -		grant_tx_ref[pending_idx] = mop->handle;
   12.35 +		grant_tx_handle[pending_idx] = mop->handle;
   12.36  
   12.37  		data_len = (txreq.size > PKT_PROT_LEN) ?
   12.38  			PKT_PROT_LEN : txreq.size;
    13.1 --- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Wed Nov 30 11:44:19 2005 +0000
    13.2 +++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Thu Dec 01 03:07:24 2005 +0000
    13.3 @@ -33,6 +33,7 @@
    13.4  #include <asm-xen/xen_proc.h>
    13.5  
    13.6  static struct proc_dir_entry *privcmd_intf;
    13.7 +static struct proc_dir_entry *capabilities_intf;
    13.8  
    13.9  static int privcmd_ioctl(struct inode *inode, struct file *file,
   13.10                           unsigned int cmd, unsigned long data)
   13.11 @@ -234,6 +235,18 @@ static struct file_operations privcmd_fi
   13.12  	.mmap  = privcmd_mmap,
   13.13  };
   13.14  
   13.15 +static int capabilities_read(char *page, char **start, off_t off,
   13.16 +                        int count, int *eof, void *data)
   13.17 +{
   13.18 +	int len = 0;
   13.19 +	*page = 0;
   13.20 +
   13.21 +	if (xen_start_info->flags & SIF_INITDOMAIN)
   13.22 +		len = sprintf( page, "control_d\n" );
   13.23 +
   13.24 +	*eof = 1;
   13.25 +	return len;
   13.26 +}
   13.27  
   13.28  static int __init privcmd_init(void)
   13.29  {
   13.30 @@ -241,6 +254,10 @@ static int __init privcmd_init(void)
   13.31  	if (privcmd_intf != NULL)
   13.32  		privcmd_intf->proc_fops = &privcmd_file_ops;
   13.33  
   13.34 +	capabilities_intf = create_xen_proc_entry("capabilities", 0400 );
   13.35 +	if (capabilities_intf != NULL)
   13.36 +		capabilities_intf->read_proc = capabilities_read;
   13.37 +
   13.38  	return 0;
   13.39  }
   13.40  
    14.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/common.h	Wed Nov 30 11:44:19 2005 +0000
    14.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/common.h	Thu Dec 01 03:07:24 2005 +0000
    14.3 @@ -54,7 +54,7 @@ typedef struct tpmif_st {
    14.4  
    14.5  	struct work_struct work;
    14.6  
    14.7 -	u16 shmem_handle;
    14.8 +	grant_handle_t shmem_handle;
    14.9  	grant_ref_t shmem_ref;
   14.10  } tpmif_t;
   14.11  
    15.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c	Wed Nov 30 11:44:19 2005 +0000
    15.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c	Thu Dec 01 03:07:24 2005 +0000
    15.3 @@ -91,9 +91,9 @@ map_frontend_page(tpmif_t *tpmif, unsign
    15.4  	unlock_vm_area(tpmif->tx_area);
    15.5  	BUG_ON(ret);
    15.6  
    15.7 -	if (op.handle < 0) {
    15.8 +	if (op.status) {
    15.9  		DPRINTK(" Grant table operation failure !\n");
   15.10 -		return op.handle;
   15.11 +		return op.status;
   15.12  	}
   15.13  
   15.14  	tpmif->shmem_ref = shared_page;
    16.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c	Wed Nov 30 11:44:19 2005 +0000
    16.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c	Thu Dec 01 03:07:24 2005 +0000
    16.3 @@ -249,7 +249,7 @@ static int
    16.4  	 * and send it to the front end.
    16.5  	 */
    16.6  	tpmif_t *tpmif = pak->tpmif;
    16.7 -	u16 handle;
    16.8 +	grant_handle_t handle;
    16.9  	int rc = 0;
   16.10  	unsigned int i = 0;
   16.11  	unsigned int offset = 0;
   16.12 @@ -290,7 +290,7 @@ static int
   16.13  
   16.14  		handle = map_op.handle;
   16.15  
   16.16 -		if (map_op.handle < 0) {
   16.17 +		if (map_op.status) {
   16.18  			DPRINTK(" Grant table operation failure !\n");
   16.19  			return 0;
   16.20  		}
   16.21 @@ -427,7 +427,7 @@ packet_read_shmem(struct packet *pak,
   16.22  	u32 i = (last_read / PAGE_SIZE);
   16.23  	u32 pg_offset = last_read & (PAGE_SIZE - 1);
   16.24  	u32 to_copy;
   16.25 -	u16 handle;
   16.26 +	grant_handle_t handle;
   16.27  
   16.28  	tpmif_tx_request_t *tx;
   16.29  	tx = &tpmif->tx->ring[0].req;
   16.30 @@ -455,7 +455,7 @@ packet_read_shmem(struct packet *pak,
   16.31  			BUG();
   16.32  		}
   16.33  
   16.34 -		if (map_op.handle < 0) {
   16.35 +		if (map_op.status) {
   16.36  			DPRINTK(" Grant table operation failure !\n");
   16.37  			return -EFAULT;
   16.38  		}
    17.1 --- a/tools/blktap/blkdump.c	Wed Nov 30 11:44:19 2005 +0000
    17.2 +++ b/tools/blktap/blkdump.c	Thu Dec 01 03:07:24 2005 +0000
    17.3 @@ -11,7 +11,6 @@
    17.4  int request_print(blkif_request_t *req)
    17.5  {
    17.6      int i;
    17.7 -    unsigned long fas;
    17.8      
    17.9      if ( (req->operation == BLKIF_OP_READ) ||
   17.10           (req->operation == BLKIF_OP_WRITE) )
   17.11 @@ -24,12 +23,10 @@ int request_print(blkif_request_t *req)
   17.12          
   17.13          
   17.14          for (i=0; i < req->nr_segments; i++) {
   17.15 -            fas = req->frame_and_sects[i];
   17.16 -            printf("              (pf: 0x%8lx start: %lu stop: %lu)\n",
   17.17 -                    (fas & PAGE_MASK),
   17.18 -                    blkif_first_sect(fas),
   17.19 -                    blkif_last_sect(fas)
   17.20 -                    );
   17.21 +            printf("              (gref: 0x%8x start: %u stop: %u)\n",
   17.22 +                   req->seg[i].gref,
   17.23 +                   req->seg[i].first_sect,
   17.24 +                   req->seg[i].last_sect);
   17.25          }
   17.26              
   17.27      } else {
    18.1 --- a/tools/blktap/blktaplib.c	Wed Nov 30 11:44:19 2005 +0000
    18.2 +++ b/tools/blktap/blktaplib.c	Thu Dec 01 03:07:24 2005 +0000
    18.3 @@ -244,8 +244,8 @@ int blktap_listen(void)
    18.4      RING_IDX          rp, i, pfd_count; 
    18.5      
    18.6      /* pending rings */
    18.7 -    blkif_request_t req_pending[BLKIF_RING_SIZE];
    18.8 -    /* blkif_response_t rsp_pending[BLKIF_RING_SIZE] */;
    18.9 +    blkif_request_t req_pending[BLK_RING_SIZE];
   18.10 +    /* blkif_response_t rsp_pending[BLK_RING_SIZE] */;
   18.11      
   18.12      /* handler hooks: */
   18.13      request_hook_t   *req_hook;
    19.1 --- a/tools/blktap/blktaplib.h	Wed Nov 30 11:44:19 2005 +0000
    19.2 +++ b/tools/blktap/blktaplib.h	Thu Dec 01 03:07:24 2005 +0000
    19.3 @@ -18,11 +18,13 @@
    19.4  #include <xen/io/domain_controller.h>
    19.5  #include <xs.h>
    19.6  
    19.7 +#define BLK_RING_SIZE __RING_SIZE((blkif_sring_t *)0, PAGE_SIZE)
    19.8 +
    19.9  /* /dev/xen/blktap resides at device number major=10, minor=202        */ 
   19.10  #define BLKTAP_MINOR 202
   19.11  
   19.12  /* size of the extra VMA area to map in attached pages. */
   19.13 -#define BLKTAP_VMA_PAGES BLKIF_RING_SIZE
   19.14 +#define BLKTAP_VMA_PAGES BLK_RING_SIZE
   19.15  
   19.16  /* blktap IOCTLs:                                                      */
   19.17  #define BLKTAP_IOCTL_KICK_FE         1
    20.1 --- a/tools/blktap/parallax/parallax.c	Wed Nov 30 11:44:19 2005 +0000
    20.2 +++ b/tools/blktap/parallax/parallax.c	Thu Dec 01 03:07:24 2005 +0000
    20.3 @@ -280,8 +280,7 @@ int parallax_probe(blkif_request_t *req,
    20.4        goto err;
    20.5  
    20.6      /* Make sure the buffer is page-sized. */
    20.7 -    if ( (blkif_first_sect(req->frame_and_sects[0]) != 0) ||
    20.8 -       (blkif_last_sect (req->frame_and_sects[0]) != 7) )
    20.9 +    if ( (req->seg[0].first_sect != 0) || (req->seg[0].last_sect != 7) )
   20.10        goto err;
   20.11  
   20.12      /* fill the list of devices */
   20.13 @@ -350,17 +349,16 @@ static void read_cb(struct io_ret r, voi
   20.14      /* Calculate read size and offset within the read block. */
   20.15  
   20.16      offset = (param->sector << SECTOR_SHIFT) % BLOCK_SIZE;
   20.17 -    size = ( blkif_last_sect (req->frame_and_sects[segment]) -
   20.18 -             blkif_first_sect(req->frame_and_sects[segment]) + 1
   20.19 -        ) << SECTOR_SHIFT;
   20.20 -    start = blkif_first_sect(req->frame_and_sects[segment]) 
   20.21 -        << SECTOR_SHIFT;
   20.22 +    size = (req->seg[segment].last_sect - req->seg[segment].first_sect + 1) <<
   20.23 +        SECTOR_SHIFT;
   20.24 +    start = req->seg[segment].first_sect << SECTOR_SHIFT;
   20.25  
   20.26      DPRINTF("ParallaxRead: sect: %lld (%ld,%ld),  "
   20.27              "vblock %llx, "
   20.28              "size %lx\n", 
   20.29 -            param->sector, blkif_first_sect(p->req->frame_and_sects[segment]),
   20.30 -            blkif_last_sect (p->req->frame_and_sects[segment]),
   20.31 +            param->sector,
   20.32 +            p->req->seg[segment].first_sect,
   20.33 +            p->req->seg[segment].last_sect,
   20.34              param->vblock, size); 
   20.35  
   20.36      memcpy(dpage + start, spage + offset, size);
   20.37 @@ -506,16 +504,15 @@ int parallax_write(blkif_request_t *req,
   20.38          /* Calculate read size and offset within the read block. */
   20.39          
   20.40          offset = (sector << SECTOR_SHIFT) % BLOCK_SIZE;
   20.41 -        size = ( blkif_last_sect (req->frame_and_sects[i]) -
   20.42 -                 blkif_first_sect(req->frame_and_sects[i]) + 1
   20.43 -            ) << SECTOR_SHIFT;
   20.44 -        start = blkif_first_sect(req->frame_and_sects[i]) << SECTOR_SHIFT;
   20.45 +        size = (req->seg[i].last_sect - req->seg[i].first_sect + 1) <<
   20.46 +            SECTOR_SHIFT;
   20.47 +        start = req->seg[i].first_sect << SECTOR_SHIFT;
   20.48  
   20.49          DPRINTF("ParallaxWrite: sect: %lld (%ld,%ld),  "
   20.50                  "vblock %llx, gblock %llx, "
   20.51                  "size %lx\n", 
   20.52 -                sector, blkif_first_sect(req->frame_and_sects[i]),
   20.53 -                blkif_last_sect (req->frame_and_sects[i]),
   20.54 +                sector, 
   20.55 +                req->seg[i].first_sect, req->seg[i].last_sect,
   20.56                  vblock, gblock, size); 
   20.57        
   20.58          /* XXX: For now we just freak out if they try to write a   */
    21.1 --- a/tools/blktap/ublkback/ublkbacklib.c	Wed Nov 30 11:44:19 2005 +0000
    21.2 +++ b/tools/blktap/ublkback/ublkbacklib.c	Thu Dec 01 03:07:24 2005 +0000
    21.3 @@ -233,8 +233,7 @@ int ublkback_request(blkif_t *blkif, blk
    21.4      case BLKIF_OP_WRITE:
    21.5      {
    21.6          unsigned long size;
    21.7 -        
    21.8 -        
    21.9 +
   21.10          batch_count++;
   21.11  
   21.12          idx = ID_TO_IDX(req->id);
   21.13 @@ -247,18 +246,17 @@ int ublkback_request(blkif_t *blkif, blk
   21.14              
   21.15              sector = req->sector_number + (8*i);
   21.16              
   21.17 -            size = blkif_last_sect (req->frame_and_sects[i]) -
   21.18 -                   blkif_first_sect(req->frame_and_sects[i]) + 1;
   21.19 +            size = req->seg[i].last_sect - req->seg[i].first_sect + 1;
   21.20              
   21.21 -            if (blkif_first_sect(req->frame_and_sects[i]) != 0)
   21.22 -            DPRINTF("iWR: sec_nr: %10llu sec: %10llu (%1lu,%1lu) pos: %15lu\n",
   21.23 -                    req->sector_number, sector, 
   21.24 -                    blkif_first_sect(req->frame_and_sects[i]),
   21.25 -                    blkif_last_sect (req->frame_and_sects[i]),
   21.26 -                    (long)(sector << SECTOR_SHIFT));
   21.27 +            if (req->seg[i].first_sect != 0)
   21.28 +                DPRINTF("iWR: sec_nr: %10llu sec: %10llu (%1lu,%1lu) "
   21.29 +                        "pos: %15lu\n",
   21.30 +                        req->sector_number, sector, 
   21.31 +                        req->seg[i].first_sect, req->seg[i].last_sect,
   21.32 +                        (long)(sector << SECTOR_SHIFT));
   21.33                          
   21.34              spage  = (char *)MMAP_VADDR(ID_TO_IDX(req->id), i);
   21.35 -            spage += blkif_first_sect(req->frame_and_sects[i]) << SECTOR_SHIFT;
   21.36 +            spage += req->seg[i].first_sect << SECTOR_SHIFT;
   21.37              
   21.38              /*convert size and sector to byte offsets */
   21.39              size   <<= SECTOR_SHIFT;
   21.40 @@ -297,19 +295,17 @@ int ublkback_request(blkif_t *blkif, blk
   21.41              
   21.42              sector  = req->sector_number + (8*i);
   21.43              
   21.44 -            size = blkif_last_sect (req->frame_and_sects[i]) -
   21.45 -                   blkif_first_sect(req->frame_and_sects[i]) + 1;
   21.46 -            
   21.47 +            size = req->seg[i].last_sect - req->seg[i].first_sect + 1;
   21.48 +
   21.49              dpage  = (char *)MMAP_VADDR(ID_TO_IDX(req->id), i);
   21.50 -            dpage += blkif_first_sect(req->frame_and_sects[i]) << SECTOR_SHIFT;
   21.51 +            dpage += req->seg[i].first_sect << SECTOR_SHIFT;
   21.52              
   21.53 -            if (blkif_first_sect(req->frame_and_sects[i]) != 0)
   21.54 -            DPRINTF("iRD : sec_nr: %10llu sec: %10llu (%1lu,%1lu) "
   21.55 -                    "pos: %15lu dpage: %p\n", 
   21.56 -                    req->sector_number, sector, 
   21.57 -                    blkif_first_sect(req->frame_and_sects[i]),
   21.58 -                    blkif_last_sect (req->frame_and_sects[i]),
   21.59 -                    (long)(sector << SECTOR_SHIFT), dpage);
   21.60 +            if (req->seg[i].first_sect != 0)
   21.61 +                DPRINTF("iRD : sec_nr: %10llu sec: %10llu (%1lu,%1lu) "
   21.62 +                        "pos: %15lu dpage: %p\n", 
   21.63 +                        req->sector_number, sector, 
   21.64 +                        req->seg[i].first_sect, req->seg[i].last_sect,
   21.65 +                        (long)(sector << SECTOR_SHIFT), dpage);
   21.66              
   21.67              /*convert size and sector to byte offsets */
   21.68              size   <<= SECTOR_SHIFT;
    22.1 --- a/tools/console/daemon/io.c	Wed Nov 30 11:44:19 2005 +0000
    22.2 +++ b/tools/console/daemon/io.c	Thu Dec 01 03:07:24 2005 +0000
    22.3 @@ -376,9 +376,6 @@ static void remove_domain(struct domain 
    22.4  
    22.5  static void cleanup_domain(struct domain *d)
    22.6  {
    22.7 -	if (!buffer_empty(&d->buffer))
    22.8 -		return;
    22.9 -
   22.10  	if (d->tty_fd != -1) {
   22.11  		close(d->tty_fd);
   22.12  		d->tty_fd = -1;
    23.1 --- a/tools/libxc/xc_domain.c	Wed Nov 30 11:44:19 2005 +0000
    23.2 +++ b/tools/libxc/xc_domain.c	Thu Dec 01 03:07:24 2005 +0000
    23.3 @@ -365,9 +365,9 @@ int xc_domain_get_vcpu_info(int xc_handl
    23.4  
    23.5  int xc_domain_ioport_permission(int xc_handle,
    23.6                                  uint32_t domid,
    23.7 -                                uint16_t first_port,
    23.8 -                                uint16_t nr_ports,
    23.9 -                                uint16_t allow_access)
   23.10 +                                uint32_t first_port,
   23.11 +                                uint32_t nr_ports,
   23.12 +                                uint32_t allow_access)
   23.13  {
   23.14      DECLARE_DOM0_OP;
   23.15  
    24.1 --- a/tools/libxc/xc_gnttab.c	Wed Nov 30 11:44:19 2005 +0000
    24.2 +++ b/tools/libxc/xc_gnttab.c	Thu Dec 01 03:07:24 2005 +0000
    24.3 @@ -42,9 +42,10 @@ do_gnttab_op(int xc_handle,
    24.4  int xc_gnttab_map_grant_ref(int         xc_handle,
    24.5                              uint64_t    host_virt_addr,
    24.6                              uint32_t    dom,
    24.7 -                            uint16_t    ref,
    24.8 +                            grant_ref_t ref,
    24.9                              uint16_t    flags,
   24.10 -                            int16_t    *handle,
   24.11 +                            int16_t    *status,
   24.12 +                            grant_handle_t *handle,
   24.13                              uint64_t   *dev_bus_addr)
   24.14  {
   24.15      struct gnttab_map_grant_ref op;
   24.16 @@ -58,6 +59,7 @@ int xc_gnttab_map_grant_ref(int         
   24.17      if ( (rc = do_gnttab_op(xc_handle, GNTTABOP_map_grant_ref,
   24.18                              &op, 1)) == 0 )
   24.19      {
   24.20 +        *status         = op.status;
   24.21          *handle         = op.handle;
   24.22          *dev_bus_addr   = op.dev_bus_addr;
   24.23      }
   24.24 @@ -69,7 +71,7 @@ int xc_gnttab_map_grant_ref(int         
   24.25  int xc_gnttab_unmap_grant_ref(int       xc_handle,
   24.26                                uint64_t  host_virt_addr,
   24.27                                uint64_t  dev_bus_addr,
   24.28 -                              uint16_t  handle,
   24.29 +                              grant_handle_t handle,
   24.30                                int16_t  *status)
   24.31  {
   24.32      struct gnttab_unmap_grant_ref op;
    25.1 --- a/tools/libxc/xc_linux_restore.c	Wed Nov 30 11:44:19 2005 +0000
    25.2 +++ b/tools/libxc/xc_linux_restore.c	Thu Dec 01 03:07:24 2005 +0000
    25.3 @@ -221,7 +221,7 @@ int xc_linux_restore(int xc_handle, int 
    25.4      
    25.5      if(xc_domain_memory_increase_reservation(
    25.6             xc_handle, dom, max_pfn, 0, 0, NULL) != 0) { 
    25.7 -        ERR("Failed to increase reservation by %lx KB\n", PFN_TO_KB(max_pfn));
    25.8 +        ERR("Failed to increase reservation by %lx KB", PFN_TO_KB(max_pfn));
    25.9          errno = ENOMEM;
   25.10          goto out;
   25.11      }
   25.12 @@ -487,7 +487,7 @@ int xc_linux_restore(int xc_handle, int 
   25.13                  for(k = 0; k < j; k++) {
   25.14                      if(!uncanonicalize_pagetable(L1TAB, 
   25.15                                                   region_base + k*PAGE_SIZE)) {
   25.16 -                        ERR("failed uncanonicalize pt!\n"); 
   25.17 +                        ERR("failed uncanonicalize pt!"); 
   25.18                          goto out; 
   25.19                      } 
   25.20                  }
    26.1 --- a/tools/libxc/xc_linux_save.c	Wed Nov 30 11:44:19 2005 +0000
    26.2 +++ b/tools/libxc/xc_linux_save.c	Thu Dec 01 03:07:24 2005 +0000
    26.3 @@ -523,13 +523,13 @@ static unsigned long *xc_map_m2p(int xc_
    26.4  
    26.5      xmml.max_extents = m2p_chunks;
    26.6      if (!(xmml.extent_start = malloc(m2p_chunks * sizeof(unsigned long)))) { 
    26.7 -        ERR("failed to allocate space for m2p mfns!\n"); 
    26.8 +        ERR("failed to allocate space for m2p mfns"); 
    26.9          return NULL; 
   26.10      } 
   26.11  
   26.12      if (xc_memory_op(xc_handle, XENMEM_machphys_mfn_list, &xmml) ||
   26.13          (xmml.nr_extents != m2p_chunks)) {
   26.14 -        ERR("xc_get_m2p_mfns:"); 
   26.15 +        ERR("xc_get_m2p_mfns"); 
   26.16          return NULL;
   26.17      }
   26.18  
   26.19 @@ -540,7 +540,7 @@ static unsigned long *xc_map_m2p(int xc_
   26.20      } 
   26.21  
   26.22      if (!(entries = malloc(m2p_chunks * sizeof(privcmd_mmap_entry_t)))) { 
   26.23 -        ERR("failed to allocate space for mmap entries!\n"); 
   26.24 +        ERR("failed to allocate space for mmap entries"); 
   26.25          return NULL; 
   26.26      } 
   26.27  
   26.28 @@ -794,7 +794,7 @@ int xc_linux_save(int xc_handle, int io_
   26.29      pfn_batch = calloc(MAX_BATCH_SIZE, sizeof(unsigned long));
   26.30  
   26.31      if ((pfn_type == NULL) || (pfn_batch == NULL)) {
   26.32 -        ERR("failed to alloc memory for pfn_type and/or pfn_batch arays."); 
   26.33 +        ERR("failed to alloc memory for pfn_type and/or pfn_batch arrays"); 
   26.34          errno = ENOMEM;
   26.35          goto out;
   26.36      }
    27.1 --- a/tools/libxc/xenctrl.h	Wed Nov 30 11:44:19 2005 +0000
    27.2 +++ b/tools/libxc/xenctrl.h	Thu Dec 01 03:07:24 2005 +0000
    27.3 @@ -13,6 +13,7 @@
    27.4  #include <sys/ptrace.h>
    27.5  #include <xen/xen.h>
    27.6  #include <xen/dom0_ops.h>
    27.7 +#include <xen/grant_table.h>
    27.8  #include <xen/version.h>
    27.9  #include <xen/event_channel.h>
   27.10  #include <xen/sched.h>
   27.11 @@ -374,9 +375,9 @@ int xc_domain_memory_decrease_reservatio
   27.12  
   27.13  int xc_domain_ioport_permission(int xc_handle,
   27.14                                  uint32_t domid,
   27.15 -                                uint16_t first_port,
   27.16 -                                uint16_t nr_ports,
   27.17 -                                uint16_t allow_access);
   27.18 +                                uint32_t first_port,
   27.19 +                                uint32_t nr_ports,
   27.20 +                                uint32_t allow_access);
   27.21  
   27.22  unsigned long xc_make_page_below_4G(int xc_handle, uint32_t domid, 
   27.23  				    unsigned long mfn);
   27.24 @@ -475,15 +476,16 @@ int xc_grant_interface_close(int xc_hand
   27.25  int xc_gnttab_map_grant_ref(int      xc_handle,
   27.26                              uint64_t host_virt_addr,
   27.27                              uint32_t dom,
   27.28 -                            uint16_t ref,
   27.29 +                            grant_ref_t ref,
   27.30                              uint16_t flags,
   27.31 -                            int16_t *handle,
   27.32 +                            int16_t *status,
   27.33 +                            grant_handle_t *handle,
   27.34                              uint64_t *dev_bus_addr);
   27.35  
   27.36  int xc_gnttab_unmap_grant_ref(int  xc_handle,
   27.37                                uint64_t  host_virt_addr,
   27.38                                uint64_t  dev_bus_addr,
   27.39 -                              uint16_t  handle,
   27.40 +                              grant_handle_t handle,
   27.41                                int16_t *status);
   27.42  
   27.43  int xc_gnttab_setup_table(int        xc_handle,
    28.1 --- a/tools/libxc/xg_save_restore.h	Wed Nov 30 11:44:19 2005 +0000
    28.2 +++ b/tools/libxc/xg_save_restore.h	Thu Dec 01 03:07:24 2005 +0000
    28.3 @@ -10,7 +10,7 @@
    28.4  #define PROGRESS 0
    28.5  
    28.6  #define ERR(_f, _a...) do {                     \
    28.7 -    fprintf(stderr, _f "\n" , ## _a);           \
    28.8 +    fprintf(stderr, _f ": %d\n" , ## _a, errno);\
    28.9      fflush(stderr); }                           \
   28.10  while (0)
   28.11  
    29.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Wed Nov 30 11:44:19 2005 +0000
    29.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Thu Dec 01 03:07:24 2005 +0000
    29.3 @@ -575,6 +575,13 @@ static PyObject *pyxc_readconsolering(Xc
    29.4      return PyString_FromStringAndSize(str, count);
    29.5  }
    29.6  
    29.7 +
    29.8 +static unsigned long pages_to_mb(unsigned long pages)
    29.9 +{
   29.10 +    return (pages * (XC_PAGE_SIZE / 1024) + 1023) / 1024;
   29.11 +}
   29.12 +
   29.13 +
   29.14  static PyObject *pyxc_physinfo(XcObject *self)
   29.15  {
   29.16      xc_physinfo_t info;
   29.17 @@ -599,8 +606,8 @@ static PyObject *pyxc_physinfo(XcObject 
   29.18                           "cores_per_socket", info.cores_per_socket,
   29.19                           "sockets_per_node", info.sockets_per_node,
   29.20                           "nr_nodes",         info.nr_nodes,
   29.21 -                         "total_pages",      info.total_pages,
   29.22 -                         "free_pages",       info.free_pages,
   29.23 +                         "total_memory",     pages_to_mb(info.total_pages),
   29.24 +                         "free_memory",      pages_to_mb(info.free_pages),
   29.25                           "cpu_khz",          info.cpu_khz,
   29.26                           "hw_caps",          cpu_cap);
   29.27  }
    30.1 --- a/tools/python/xen/xend/XendCheckpoint.py	Wed Nov 30 11:44:19 2005 +0000
    30.2 +++ b/tools/python/xen/xend/XendCheckpoint.py	Thu Dec 01 03:07:24 2005 +0000
    30.3 @@ -18,8 +18,6 @@ import xen.util.auxbin
    30.4  
    30.5  import xen.lowlevel.xc
    30.6  
    30.7 -from xen.xend.xenstore.xsutil import IntroduceDomain
    30.8 -
    30.9  from XendError import XendError
   30.10  from XendLogging import log
   30.11  
    31.1 --- a/tools/python/xen/xend/XendClient.py	Wed Nov 30 11:44:19 2005 +0000
    31.2 +++ b/tools/python/xen/xend/XendClient.py	Thu Dec 01 03:07:24 2005 +0000
    31.3 @@ -232,6 +232,11 @@ class Xend:
    31.4          return self.xendPost(self.domainurl(id),
    31.5                               {'op'      : 'pause' })
    31.6  
    31.7 +    def xend_domain_rename(self, id, name):
    31.8 +        return self.xendPost(self.domainurl(id),
    31.9 +                             {'op'      : 'rename',
   31.10 +                              'name'    : name})
   31.11 +
   31.12      def xend_domain_shutdown(self, id, reason):
   31.13          return self.xendPost(self.domainurl(id),
   31.14                               {'op'      : 'shutdown',
    32.1 --- a/tools/python/xen/xend/XendDomain.py	Wed Nov 30 11:44:19 2005 +0000
    32.2 +++ b/tools/python/xen/xend/XendDomain.py	Thu Dec 01 03:07:24 2005 +0000
    32.3 @@ -24,6 +24,7 @@
    32.4  
    32.5  import logging
    32.6  import os
    32.7 +import socket
    32.8  import sys
    32.9  import threading
   32.10  
   32.11 @@ -35,7 +36,6 @@ from xen.xend import XendRoot
   32.12  from xen.xend import XendCheckpoint
   32.13  from xen.xend.XendError import XendError
   32.14  from xen.xend.XendLogging import log
   32.15 -from xen.xend.server import relocate
   32.16  from xen.xend.xenstore.xswatch import xswatch
   32.17  
   32.18  
   32.19 @@ -54,15 +54,16 @@ class XendDomain:
   32.20      ## public:
   32.21      
   32.22      def __init__(self):
   32.23 -        # Hack alert. Python does not support mutual imports, but XendDomainInfo
   32.24 -        # needs access to the XendDomain instance to look up domains. Attempting
   32.25 -        # to import XendDomain from XendDomainInfo causes unbounded recursion.
   32.26 -        # So we stuff the XendDomain instance (self) into xroot's components.
   32.27 -        xroot.add_component("xen.xend.XendDomain", self)
   32.28 -
   32.29          self.domains = {}
   32.30          self.domains_lock = threading.RLock()
   32.31  
   32.32 +
   32.33 +    # This must be called only the once, by instance() below.  It is separate
   32.34 +    # from the constructor because XendDomainInfo calls back into this class
   32.35 +    # in order to check the uniqueness of domain names.  This means that
   32.36 +    # instance() must be able to return a valid instance of this class even
   32.37 +    # during this initialisation.
   32.38 +    def init(self):
   32.39          self.domains_lock.acquire()
   32.40          try:
   32.41              self._add_domain(
   32.42 @@ -389,10 +390,15 @@ class XendDomain:
   32.43          dominfo = self.domain_lookup(domid)
   32.44  
   32.45          port = xroot.get_xend_relocation_port()
   32.46 -        sock = relocate.setupRelocation(dst, port)
   32.47 +        try:
   32.48 +            sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
   32.49 +            sock.connect((dst, port))
   32.50 +        except socket.error, err:
   32.51 +            raise XendError("can't connect: %s" % err[1])
   32.52  
   32.53 +        sock.send("receive\n")
   32.54          XendCheckpoint.save(sock.fileno(), dominfo, live)
   32.55 -        
   32.56 +
   32.57  
   32.58      def domain_save(self, domid, dst):
   32.59          """Start saving a domain to file.
   32.60 @@ -527,4 +533,5 @@ def instance():
   32.61          inst
   32.62      except:
   32.63          inst = XendDomain()
   32.64 +        inst.init()
   32.65      return inst
    33.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Wed Nov 30 11:44:19 2005 +0000
    33.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Thu Dec 01 03:07:24 2005 +0000
    33.3 @@ -33,14 +33,14 @@ import xen.lowlevel.xc
    33.4  from xen.util import asserts
    33.5  from xen.util.blkif import blkdev_uname_to_file
    33.6  
    33.7 -from xen.xend import image
    33.8 -from xen.xend import sxp
    33.9 -from xen.xend import XendRoot
   33.10 +import image
   33.11 +import sxp
   33.12 +import uuid
   33.13 +import XendDomain
   33.14 +import XendRoot
   33.15 +
   33.16  from xen.xend.XendBootloader import bootloader
   33.17  from xen.xend.XendError import XendError, VmError
   33.18 -from xen.xend.XendRoot import get_component
   33.19 -
   33.20 -import uuid
   33.21  
   33.22  from xen.xend.xenstore.xstransact import xstransact
   33.23  from xen.xend.xenstore.xsutil import GetDomainPath, IntroduceDomain
   33.24 @@ -338,9 +338,8 @@ def parseConfig(config):
   33.25  
   33.26  
   33.27  def domain_by_name(name):
   33.28 -    # See comment in XendDomain constructor.
   33.29 -    xd = get_component('xen.xend.XendDomain')
   33.30 -    return xd.domain_lookup_by_name_nr(name)
   33.31 +    return XendDomain.instance().domain_lookup_by_name_nr(name)
   33.32 +
   33.33  
   33.34  def shutdown_reason(code):
   33.35      """Get a shutdown reason from a code.
   33.36 @@ -1343,8 +1342,7 @@ class XendDomainInfo:
   33.37  
   33.38              new_dom = None
   33.39              try:
   33.40 -                xd = get_component('xen.xend.XendDomain')
   33.41 -                new_dom = xd.domain_create(config)
   33.42 +                new_dom = XendDomain.instance().domain_create(config)
   33.43                  new_dom.unpause()
   33.44                  new_dom.removeVm(RESTART_IN_PROGRESS)
   33.45              except:
    34.1 --- a/tools/python/xen/xend/XendNode.py	Wed Nov 30 11:44:19 2005 +0000
    34.2 +++ b/tools/python/xen/xend/XendNode.py	Thu Dec 01 03:07:24 2005 +0000
    34.3 @@ -57,30 +57,45 @@ class XendNode:
    34.4                  ['machine', mch]]
    34.5  
    34.6      def physinfo(self):
    34.7 -        pinfo = self.xc.physinfo()
    34.8 -        info = [['nr_cpus',          pinfo['nr_nodes']*pinfo['sockets_per_node']*pinfo['cores_per_socket']*pinfo['threads_per_core']],
    34.9 -                ['nr_nodes',         pinfo['nr_nodes']],
   34.10 -                ['sockets_per_node', pinfo['sockets_per_node']],
   34.11 -                ['cores_per_socket', pinfo['cores_per_socket']],
   34.12 -                ['threads_per_core', pinfo['threads_per_core']],
   34.13 -                ['cpu_mhz',          pinfo['cpu_khz']/1000],
   34.14 -                ['hw_caps',          pinfo['hw_caps']],
   34.15 -                ['memory',           pinfo['total_pages']/256],
   34.16 -                ['free_memory',      pinfo['free_pages']/256]]
   34.17 -        return info
   34.18 -        
   34.19 +        info = self.xc.physinfo()
   34.20 +
   34.21 +        info['nr_cpus'] = (info['nr_nodes'] *
   34.22 +                           info['sockets_per_node'] *
   34.23 +                           info['cores_per_socket'] *
   34.24 +                           info['threads_per_core'])
   34.25 +        info['cpu_mhz'] = info['cpu_khz'] / 1000
   34.26 +
   34.27 +        ITEM_ORDER = ['nr_cpus',
   34.28 +                      'nr_nodes',
   34.29 +                      'sockets_per_node',
   34.30 +                      'cores_per_socket',
   34.31 +                      'threads_per_core',
   34.32 +                      'cpu_mhz',
   34.33 +                      'hw_caps',
   34.34 +                      'total_memory',
   34.35 +                      'free_memory',
   34.36 +                      ]
   34.37 +
   34.38 +        return [[k, info[k]] for k in ITEM_ORDER]
   34.39 +
   34.40 +
   34.41      def xeninfo(self):
   34.42 -        xinfo = self.xc.xeninfo()
   34.43 -        return [['xen_major', xinfo['xen_major']],
   34.44 -                ['xen_minor', xinfo['xen_minor']],
   34.45 -                ['xen_extra', xinfo['xen_extra']],
   34.46 -                ['xen_caps',  xinfo['xen_caps']],
   34.47 -                ['platform_params',xinfo['platform_params']],
   34.48 -                ['xen_changeset', xinfo['xen_changeset']],
   34.49 -                ['cc_compiler', xinfo['cc_compiler']],
   34.50 -                ['cc_compile_by', xinfo['cc_compile_by']],
   34.51 -                ['cc_compile_domain', xinfo['cc_compile_domain']],
   34.52 -                ['cc_compile_date', xinfo['cc_compile_date']]]
   34.53 +        info = self.xc.xeninfo()
   34.54 +
   34.55 +        ITEM_ORDER = ['xen_major',
   34.56 +                      'xen_minor',
   34.57 +                      'xen_extra',
   34.58 +                      'xen_caps',
   34.59 +                      'platform_params',
   34.60 +                      'xen_changeset',
   34.61 +                      'cc_compiler',
   34.62 +                      'cc_compile_by',
   34.63 +                      'cc_compile_domain',
   34.64 +                      'cc_compile_date',
   34.65 +                      ]
   34.66 +
   34.67 +        return [[k, info[k]] for k in ITEM_ORDER]
   34.68 +
   34.69  
   34.70  def instance():
   34.71      global inst
    35.1 --- a/tools/python/xen/xend/XendProtocol.py	Wed Nov 30 11:44:19 2005 +0000
    35.2 +++ b/tools/python/xen/xend/XendProtocol.py	Thu Dec 01 03:07:24 2005 +0000
    35.3 @@ -100,7 +100,7 @@ class XendClientProtocol:
    35.4          """
    35.5          return self.xendRequest(url, "POST", args)
    35.6  
    35.7 -    def handleStatus(self, version, status, message):
    35.8 +    def handleStatus(self, _, status, message):
    35.9          """Handle the status returned from the request.
   35.10          """
   35.11          status = int(status)
   35.12 @@ -114,8 +114,8 @@ class XendClientProtocol:
   35.13          """Handle the data returned in response to the request.
   35.14          """
   35.15          if data is None: return None
   35.16 -        type = self.getHeader('Content-Type')
   35.17 -        if type != sxp.mime_type:
   35.18 +        typ = self.getHeader('Content-Type')
   35.19 +        if typ != sxp.mime_type:
   35.20              return data
   35.21          try:
   35.22              pin = sxp.Parser()
   35.23 @@ -205,5 +205,5 @@ class UnixXendClientProtocol(HttpXendCli
   35.24              path = xroot.get_xend_unix_path()
   35.25          self.path = path
   35.26  
   35.27 -    def makeConnection(self, url):
   35.28 +    def makeConnection(self, _):
   35.29          return UnixConnection(self.path)
    36.1 --- a/tools/python/xen/xend/XendRoot.py	Wed Nov 30 11:44:19 2005 +0000
    36.2 +++ b/tools/python/xen/xend/XendRoot.py	Thu Dec 01 03:07:24 2005 +0000
    36.3 @@ -93,24 +93,6 @@ class XendRoot:
    36.4          self.configure()
    36.5  
    36.6  
    36.7 -    def add_component(self, name, val):
    36.8 -        """Add a xend component.
    36.9 -
   36.10 -        @param name: component name
   36.11 -        @param val:  component object
   36.12 -        """
   36.13 -        self.components[name] = val
   36.14 -
   36.15 -    def get_component(self, name):
   36.16 -        """Get a xend component from its name.
   36.17 -        This is used as a work-round for problems caused by mutually
   36.18 -        recursive imports.
   36.19 -
   36.20 -        @param name: component name
   36.21 -        @return: component object (or None)
   36.22 -        """
   36.23 -        return self.components.get(name)
   36.24 -
   36.25      def _logError(self, fmt, *args):
   36.26          """Logging function to log to stderr. We use this for XendRoot log
   36.27          messages because they may be logged before the logger has been
   36.28 @@ -189,7 +171,7 @@ class XendRoot:
   36.29          v = self.get_config_value(name, val)
   36.30          try:
   36.31              return int(v)
   36.32 -        except Exception, ex:
   36.33 +        except Exception:
   36.34              raise XendError("invalid xend config %s: expected int: %s" % (name, v))
   36.35  
   36.36      def get_xend_http_server(self):
   36.37 @@ -277,21 +259,3 @@ def instance():
   36.38      except:
   36.39          inst = XendRoot()
   36.40      return inst
   36.41 -
   36.42 -def add_component(name, val):
   36.43 -    """Register a component with XendRoot.
   36.44 -    This is used to work-round import cycles.
   36.45 -
   36.46 -    @param name: component name
   36.47 -    @param val:  component value (often a module)
   36.48 -    """
   36.49 -    return instance().add_component(name, val)
   36.50 -
   36.51 -def get_component(name):
   36.52 -    """Get a component.
   36.53 -    This is used to work-round import cycles.
   36.54 -
   36.55 -    @param name: component name
   36.56 -    @return component or None
   36.57 -    """
   36.58 -    return instance().get_component(name)
    37.1 --- a/tools/python/xen/xend/server/SrvDomain.py	Wed Nov 30 11:44:19 2005 +0000
    37.2 +++ b/tools/python/xen/xend/server/SrvDomain.py	Thu Dec 01 03:07:24 2005 +0000
    37.3 @@ -55,6 +55,10 @@ class SrvDomain(SrvDir):
    37.4          req.setResponseCode(http.ACCEPTED)
    37.5          req.setHeader("Location", "%s/.." % req.prePathURL())
    37.6  
    37.7 +    def op_rename(self, _, req):
    37.8 +        self.acceptCommand(req)
    37.9 +        return self.dom.setName(req.args['name'][0])
   37.10 +
   37.11      def op_shutdown(self, _, req):
   37.12          self.acceptCommand(req)
   37.13          return self.dom.shutdown(req.args['reason'][0])
    38.1 --- a/tools/python/xen/xend/server/netif.py	Wed Nov 30 11:44:19 2005 +0000
    38.2 +++ b/tools/python/xen/xend/server/netif.py	Thu Dec 01 03:07:24 2005 +0000
    38.3 @@ -71,8 +71,8 @@ class NetifController(DevController):
    38.4          script = os.path.join(xroot.network_script_dir,
    38.5                                sxp.child_value(config, 'script',
    38.6                                                xroot.get_vif_script()))
    38.7 -        type = sxp.child_value(config, 'type')
    38.8 -        if type == 'ioemu':
    38.9 +        typ = sxp.child_value(config, 'type')
   38.10 +        if typ == 'ioemu':
   38.11              return (None,{},{})
   38.12          bridge = sxp.child_value(config, 'bridge')
   38.13          mac    = sxp.child_value(config, 'mac')
    39.1 --- a/tools/python/xen/xend/server/relocate.py	Wed Nov 30 11:44:19 2005 +0000
    39.2 +++ b/tools/python/xen/xend/server/relocate.py	Thu Dec 01 03:07:24 2005 +0000
    39.3 @@ -16,23 +16,18 @@
    39.4  # Copyright (C) 2005 XenSource Ltd
    39.5  #============================================================================
    39.6  
    39.7 -import socket
    39.8  import sys
    39.9  import StringIO
   39.10  
   39.11  from xen.web import protocol, tcp, unix
   39.12  
   39.13  from xen.xend import sxp
   39.14 +from xen.xend import XendDomain
   39.15 +from xen.xend import XendRoot
   39.16  from xen.xend.XendError import XendError
   39.17 -from xen.xend import XendRoot
   39.18  from xen.xend.XendLogging import log
   39.19  
   39.20  
   39.21 -xroot = XendRoot.instance()
   39.22 -
   39.23 -
   39.24 -DEBUG = 0
   39.25 -
   39.26  class RelocationProtocol(protocol.Protocol):
   39.27      """Asynchronous handler for a connected relocation socket.
   39.28      """
   39.29 @@ -111,8 +106,8 @@ class RelocationProtocol(protocol.Protoc
   39.30          if self.transport:
   39.31              self.send_reply(["ready", name])
   39.32              self.transport.sock.setblocking(1)
   39.33 -            xd = xroot.get_component("xen.xend.XendDomain")
   39.34 -            xd.domain_restore_fd(self.transport.sock.fileno())
   39.35 +            XendDomain.instance().domain_restore_fd(
   39.36 +                self.transport.sock.fileno())
   39.37              self.transport.sock.setblocking(0)
   39.38          else:
   39.39              log.error(name + ": no transport")
   39.40 @@ -120,6 +115,7 @@ class RelocationProtocol(protocol.Protoc
   39.41  
   39.42  
   39.43  def listenRelocation():
   39.44 +    xroot = XendRoot.instance()
   39.45      if xroot.get_xend_unix_server():
   39.46          path = '/var/lib/xend/relocation-socket'
   39.47          unix.listenUNIX(path, RelocationProtocol)
   39.48 @@ -128,15 +124,3 @@ def listenRelocation():
   39.49          interface = xroot.get_xend_relocation_address()
   39.50          l = tcp.listenTCP(port, RelocationProtocol, interface=interface)
   39.51          l.setCloExec()
   39.52 -
   39.53 -def setupRelocation(dst, port):
   39.54 -    try:
   39.55 -        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
   39.56 -        sock.connect((dst, port))
   39.57 -    except socket.error, err:
   39.58 -        raise XendError("can't connect: %s" % err[1])
   39.59 -
   39.60 -    sock.send("receive\n")
   39.61 -    print sock.recv(80)
   39.62 -
   39.63 -    return sock
    40.1 --- a/tools/python/xen/xend/tests/test_sxp.py	Wed Nov 30 11:44:19 2005 +0000
    40.2 +++ b/tools/python/xen/xend/tests/test_sxp.py	Thu Dec 01 03:07:24 2005 +0000
    40.3 @@ -6,8 +6,8 @@ import xen.xend.sxp
    40.4  class test_sxp(unittest.TestCase):
    40.5  
    40.6      def testAllFromString(self):
    40.7 -        def t(input, expected):
    40.8 -            self.assertEqual(xen.xend.sxp.all_from_string(input), expected)
    40.9 +        def t(inp, expected):
   40.10 +            self.assertEqual(xen.xend.sxp.all_from_string(inp), expected)
   40.11  
   40.12          t('String',           ['String'])
   40.13          t('(String Thing)',   [['String', 'Thing']])
    41.1 --- a/tools/python/xen/xend/tests/test_uuid.py	Wed Nov 30 11:44:19 2005 +0000
    41.2 +++ b/tools/python/xen/xend/tests/test_uuid.py	Thu Dec 01 03:07:24 2005 +0000
    41.3 @@ -21,9 +21,9 @@ class test_uuid(unittest.TestCase):
    41.4              self.assertEqual(uuid.toString(inp), expected)
    41.5              self.assertEqual(uuid.fromString(expected), inp)
    41.6  
    41.7 -        t([0 for i in range(0, 16)], "00000000-0000-0000-0000-000000000000")
    41.8 +        t([0 for _ in range(0, 16)], "00000000-00000000-00000000-00000000")
    41.9          t([185, 158, 125, 206, 250, 178, 125, 57, 2, 6, 162, 74, 178, 236,
   41.10 -           196, 5], "b99e7dce-fab2-7d39-0206-a24ab2ecc405")
   41.11 +           196, 5], "b99e7dce-fab27d39-0206a24a-b2ecc405")
   41.12  
   41.13  
   41.14  def test_suite():
    42.1 --- a/tools/python/xen/xend/uuid.py	Wed Nov 30 11:44:19 2005 +0000
    42.2 +++ b/tools/python/xen/xend/uuid.py	Thu Dec 01 03:07:24 2005 +0000
    42.3 @@ -25,14 +25,14 @@ import commands
    42.4  import random
    42.5  
    42.6  
    42.7 -def getUuidUuidgen(random = True):
    42.8 +def getUuidUuidgen(randomly = True):
    42.9      """Generate a UUID using the command uuidgen.
   42.10  
   42.11 -    If random is true (default) generates a random uuid.
   42.12 -    If random is false generates a time-based uuid.
   42.13 +    If randomly is true (default) generates a random uuid.
   42.14 +    If randomly is false generates a time-based uuid.
   42.15      """
   42.16      cmd = "uuidgen"
   42.17 -    if random:
   42.18 +    if randomly:
   42.19          cmd += " -r"
   42.20      else:
   42.21          cmd += " -t"
   42.22 @@ -42,7 +42,7 @@ def getUuidUuidgen(random = True):
   42.23  def getUuidRandom():
   42.24      """Generate a random UUID."""
   42.25      
   42.26 -    return [ random.randint(0, 255) for i in range(0, 16) ]
   42.27 +    return [ random.randint(0, 255) for _ in range(0, 16) ]
   42.28  
   42.29  
   42.30  #uuidFactory = getUuidUuidgen
    43.1 --- a/tools/python/xen/xend/xenstore/xstransact.py	Wed Nov 30 11:44:19 2005 +0000
    43.2 +++ b/tools/python/xen/xend/xenstore/xstransact.py	Thu Dec 01 03:07:24 2005 +0000
    43.3 @@ -198,9 +198,10 @@ class xstransact:
    43.4              if len(tup) == 2:
    43.5                  (key, val) = tup
    43.6                  try:
    43.7 -                    fmt = { str : "%s",
    43.8 -                            int : "%i",
    43.9 -                            float : "%f",
   43.10 +                    fmt = { str        : "%s",
   43.11 +                            int        : "%i",
   43.12 +                            float      : "%f",
   43.13 +                            long       : "%li",
   43.14                              type(None) : None }[type(val)]
   43.15                  except KeyError:
   43.16                      raise TypeError
    44.1 --- a/tools/python/xen/xm/main.py	Wed Nov 30 11:44:19 2005 +0000
    44.2 +++ b/tools/python/xen/xm/main.py	Thu Dec 01 03:07:24 2005 +0000
    44.3 @@ -70,6 +70,7 @@ vcpu_list_help = "vcpu-list <DomId>     
    44.4  vcpu_pin_help = "vcpu-pin <DomId> <VCPU> <CPUs>   Set which cpus a VCPU can use" 
    44.5  dmesg_help =   "dmesg [--clear]                  Read or clear Xen's message buffer"
    44.6  info_help =    "info                             Get information about the xen host"
    44.7 +rename_help =  "rename <DomId> <New Name>        Rename a domain"
    44.8  log_help =     "log                              Print the xend log"
    44.9  sched_bvt_help = """sched-bvt <Parameters>           Set Borrowed Virtual Time scheduler
   44.10                                      parameters"""
   44.11 @@ -125,6 +126,7 @@ domain_commands = [
   44.12      "migrate",
   44.13      "pause",
   44.14      "reboot",
   44.15 +    "rename",
   44.16      "restore",
   44.17      "save",
   44.18      "shutdown",
   44.19 @@ -226,10 +228,20 @@ for command in all_commands:
   44.20  #
   44.21  ####################################################################
   44.22  
   44.23 -def arg_check(args,num,name):
   44.24 -    if len(args) < num:
   44.25 -        err("'xm %s' requires %s argument(s)!\n" % (name, num))
   44.26 -        usage(name)
   44.27 +def arg_check(args, name, lo, hi = -1):
   44.28 +    n = len(args)
   44.29 +    
   44.30 +    if hi == -1:
   44.31 +        if n != lo:
   44.32 +            err("'xm %s' requires %d argument%s.\n" % (name, lo,
   44.33 +                                                       lo > 1 and 's' or ''))
   44.34 +            usage(name)
   44.35 +    else:
   44.36 +        if n < lo or n > hi:
   44.37 +            err("'xm %s' requires between %d and %d arguments.\n" %
   44.38 +                (name, lo, hi))
   44.39 +            usage(name)
   44.40 +
   44.41  
   44.42  def unit(c):
   44.43      if not c.isalpha():
   44.44 @@ -259,14 +271,17 @@ def int_unit(str, dest):
   44.45  def err(msg):
   44.46      print >>sys.stderr, "Error:", msg
   44.47  
   44.48 -def handle_xend_error(cmd, dom, ex):
   44.49 +def handle_xend_error(cmd, args, ex):
   44.50 +    non_option = filter(lambda x: x[0] != '-', args)
   44.51 +    dom = len(non_option) > 0 and non_option[0] or None
   44.52 +
   44.53      error = str(ex)
   44.54      if error == "Not found" and dom != None:
   44.55          err("Domain '%s' not found when running 'xm %s'" % (dom, cmd))
   44.56 -        sys.exit(1)
   44.57      else:
   44.58          err(error)
   44.59 -        sys.exit(1)
   44.60 +
   44.61 +    sys.exit(1)
   44.62      
   44.63  
   44.64  #########################################################################
   44.65 @@ -276,7 +291,7 @@ def handle_xend_error(cmd, dom, ex):
   44.66  #########################################################################
   44.67  
   44.68  def xm_save(args):
   44.69 -    arg_check(args,2,"save")
   44.70 +    arg_check(args, "save", 2)
   44.71  
   44.72      dom = args[0] # TODO: should check if this exists
   44.73      savefile = os.path.abspath(args[1])
   44.74 @@ -289,7 +304,7 @@ def xm_save(args):
   44.75      server.xend_domain_save(dom, savefile)
   44.76      
   44.77  def xm_restore(args):
   44.78 -    arg_check(args,1,"restore")
   44.79 +    arg_check(args, "restore", 1)
   44.80  
   44.81      savefile = os.path.abspath(args[0])
   44.82  
   44.83 @@ -479,24 +494,30 @@ def xm_vcpu_list(args):
   44.84  
   44.85  
   44.86  def xm_reboot(args):
   44.87 -    arg_check(args,1,"reboot")
   44.88 +    arg_check(args, "reboot", 1, 4)
   44.89      from xen.xm import shutdown
   44.90      shutdown.main(["shutdown", "-R"] + args)
   44.91  
   44.92  def xm_pause(args):
   44.93 -    arg_check(args, 1, "pause")
   44.94 +    arg_check(args, "pause", 1)
   44.95      dom = args[0]
   44.96  
   44.97      from xen.xend.XendClient import server
   44.98      server.xend_domain_pause(dom)
   44.99  
  44.100  def xm_unpause(args):
  44.101 -    arg_check(args, 1, "unpause")
  44.102 +    arg_check(args, "unpause", 1)
  44.103      dom = args[0]
  44.104  
  44.105      from xen.xend.XendClient import server
  44.106      server.xend_domain_unpause(dom)
  44.107  
  44.108 +def xm_rename(args):
  44.109 +    arg_check(args, "rename", 2)
  44.110 +
  44.111 +    from xen.xend.XendClient import server
  44.112 +    server.xend_domain_rename(args[0], args[1])
  44.113 +
  44.114  def xm_subcommand(command, args):
  44.115      cmd = __import__(command, globals(), locals(), 'xen.xm')
  44.116      cmd.main([command] + args)
  44.117 @@ -517,7 +538,7 @@ def cpu_make_map(cpulist):
  44.118      return cpus
  44.119  
  44.120  def xm_vcpu_pin(args):
  44.121 -    arg_check(args, 3, "vcpu-pin")
  44.122 +    arg_check(args, "vcpu-pin", 3)
  44.123  
  44.124      dom  = args[0]
  44.125      vcpu = int(args[1])
  44.126 @@ -527,7 +548,7 @@ def xm_vcpu_pin(args):
  44.127      server.xend_domain_pincpu(dom, vcpu, cpumap)
  44.128  
  44.129  def xm_mem_max(args):
  44.130 -    arg_check(args, 2, "mem-max")
  44.131 +    arg_check(args, "mem-max", 2)
  44.132  
  44.133      dom = args[0]
  44.134      mem = int_unit(args[1], 'm')
  44.135 @@ -536,7 +557,7 @@ def xm_mem_max(args):
  44.136      server.xend_domain_maxmem_set(dom, mem)
  44.137      
  44.138  def xm_mem_set(args):
  44.139 -    arg_check(args, 2, "mem-set")
  44.140 +    arg_check(args, "mem-set", 2)
  44.141  
  44.142      dom = args[0]
  44.143      mem_target = int_unit(args[1], 'm')
  44.144 @@ -545,13 +566,13 @@ def xm_mem_set(args):
  44.145      server.xend_domain_mem_target_set(dom, mem_target)
  44.146      
  44.147  def xm_set_vcpus(args):
  44.148 -    arg_check(args, 2, "set-vcpus")
  44.149 +    arg_check(args, "set-vcpus", 2)
  44.150      
  44.151      from xen.xend.XendClient import server
  44.152      server.xend_domain_set_vcpus(args[0], int(args[1]))
  44.153  
  44.154  def xm_domid(args):
  44.155 -    arg_check(args, 1, "domid")
  44.156 +    arg_check(args, "domid", 1)
  44.157  
  44.158      name = args[0]
  44.159  
  44.160 @@ -560,7 +581,7 @@ def xm_domid(args):
  44.161      print sxp.child_value(dom, 'domid')
  44.162      
  44.163  def xm_domname(args):
  44.164 -    arg_check(args, 1, "domname")
  44.165 +    arg_check(args, "domname", 1)
  44.166  
  44.167      name = args[0]
  44.168  
  44.169 @@ -569,21 +590,21 @@ def xm_domname(args):
  44.170      print sxp.child_value(dom, 'name')
  44.171  
  44.172  def xm_sched_bvt(args):
  44.173 -    arg_check(args, 6, "sched-bvt")
  44.174 +    arg_check(args, "sched-bvt", 6)
  44.175      dom = args[0]
  44.176      v = map(long, args[1:6])
  44.177      from xen.xend.XendClient import server
  44.178      server.xend_domain_cpu_bvt_set(dom, *v)
  44.179  
  44.180  def xm_sched_bvt_ctxallow(args):
  44.181 -    arg_check(args, 1, "sched-bvt-ctxallow")
  44.182 +    arg_check(args, "sched-bvt-ctxallow", 1)
  44.183  
  44.184      slice = int(args[0])
  44.185      from xen.xend.XendClient import server
  44.186      server.xend_node_cpu_bvt_slice_set(slice)
  44.187  
  44.188  def xm_sched_sedf(args):
  44.189 -    arg_check(args, 6, "sched-sedf")
  44.190 +    arg_check(args, "sched-sedf", 6)
  44.191      
  44.192      dom = args[0]
  44.193      v = map(int, args[1:6])
  44.194 @@ -600,9 +621,8 @@ def xm_info(args):
  44.195          else: 
  44.196              print "%-23s:" % x[0], x[1]
  44.197  
  44.198 -# TODO: remove as soon as console server shows up
  44.199  def xm_console(args):
  44.200 -    arg_check(args,1,"console")
  44.201 +    arg_check(args, "console", 1)
  44.202  
  44.203      dom = args[0]
  44.204      from xen.xend.XendClient import server
  44.205 @@ -639,11 +659,13 @@ its contents if the [-c|--clear] flag is
  44.206          server.xend_node_clear_dmesg()
  44.207  
  44.208  def xm_log(args):
  44.209 +    arg_check(args, 'xm-log', 0)
  44.210 +    
  44.211      from xen.xend.XendClient import server
  44.212      print server.xend_node_log()
  44.213  
  44.214  def xm_network_list(args):
  44.215 -    arg_check(args,1,"network-list")
  44.216 +    arg_check(args, "network-list", 1)
  44.217      dom = args[0]
  44.218      from xen.xend.XendClient import server
  44.219      for x in server.xend_domain_devices(dom, 'vif'):
  44.220 @@ -651,7 +673,7 @@ def xm_network_list(args):
  44.221          print
  44.222  
  44.223  def xm_block_list(args):
  44.224 -    arg_check(args,1,"block-list")
  44.225 +    arg_check(args, "block-list", 1)
  44.226      dom = args[0]
  44.227      from xen.xend.XendClient import server
  44.228      for x in server.xend_domain_devices(dom, 'vbd'):
  44.229 @@ -659,20 +681,14 @@ def xm_block_list(args):
  44.230          print
  44.231  
  44.232  def xm_block_attach(args):
  44.233 -    n = len(args)
  44.234 -    if n == 0:
  44.235 -        usage("block-attach")
  44.236 -        
  44.237 -    if n < 4 or n > 5:
  44.238 -        err("%s: Invalid argument(s)" % args[0])
  44.239 -        usage("block-attach")
  44.240 +    arg_check(args, 'block-attach', 4, 5)
  44.241  
  44.242      dom = args[0]
  44.243      vbd = ['vbd',
  44.244             ['uname', args[1]],
  44.245             ['dev',   args[2]],
  44.246             ['mode',  args[3]]]
  44.247 -    if n == 5:
  44.248 +    if len(args) == 5:
  44.249          vbd.append(['backend', args[4]])
  44.250  
  44.251      from xen.xend.XendClient import server
  44.252 @@ -680,10 +696,8 @@ def xm_block_attach(args):
  44.253  
  44.254  
  44.255  def xm_network_attach(args):
  44.256 -    n = len(args)
  44.257 -    if n == 0:
  44.258 -        usage("network-attach")
  44.259 -        
  44.260 +    arg_check(args, 'network-attach', 1, 10000)
  44.261 +
  44.262      dom = args[0]
  44.263      vif = ['vif']
  44.264  
  44.265 @@ -695,7 +709,7 @@ def xm_network_attach(args):
  44.266  
  44.267  
  44.268  def detach(args, command, deviceClass):
  44.269 -    arg_check(args, 2, command)
  44.270 +    arg_check(args, command, 2)
  44.271  
  44.272      dom = args[0]
  44.273      dev = args[1]
  44.274 @@ -742,7 +756,7 @@ def xm_vnet_list(args):
  44.275              print vnet, ex
  44.276  
  44.277  def xm_vnet_create(args):
  44.278 -    arg_check(args, 1, "vnet-create")
  44.279 +    arg_check(args, "vnet-create", 1)
  44.280      conf = args[0]
  44.281      if not os.access(conf, os.R_OK):
  44.282          print "File not found: %s" % conf
  44.283 @@ -752,7 +766,7 @@ def xm_vnet_create(args):
  44.284      server.xend_vnet_create(conf)
  44.285  
  44.286  def xm_vnet_delete(args):
  44.287 -    arg_check(args, 1, "vnet-delete")
  44.288 +    arg_check(args, "vnet-delete", 1)
  44.289      vnet = args[0]
  44.290      from xen.xend.XendClient import server
  44.291      server.xend_vnet_delete(vnet)
  44.292 @@ -765,6 +779,7 @@ commands = {
  44.293      # domain commands
  44.294      "domid": xm_domid,
  44.295      "domname": xm_domname,
  44.296 +    "rename": xm_rename,
  44.297      "restore": xm_restore,
  44.298      "save": xm_save,
  44.299      "reboot": xm_reboot,
  44.300 @@ -888,7 +903,7 @@ def main(argv=sys.argv):
  44.301              sys.exit(1)
  44.302          except xen.xend.XendError.XendError, ex:
  44.303              if len(args) > 0:
  44.304 -                handle_xend_error(argv[1], args[0], ex)
  44.305 +                handle_xend_error(argv[1], args, ex)
  44.306              else:
  44.307                  print "Unexpected error:", sys.exc_info()[0]
  44.308                  print
  44.309 @@ -896,7 +911,7 @@ def main(argv=sys.argv):
  44.310                  raise
  44.311          except xen.xend.XendProtocol.XendError, ex:
  44.312              if len(args) > 0:
  44.313 -                handle_xend_error(argv[1], args[0], ex)
  44.314 +                handle_xend_error(argv[1], args, ex)
  44.315              else:
  44.316                  print "Unexpected error:", sys.exc_info()[0]
  44.317                  print
    45.1 --- a/tools/xm-test/lib/XmTestReport/OSReport.py	Wed Nov 30 11:44:19 2005 +0000
    45.2 +++ b/tools/xm-test/lib/XmTestReport/OSReport.py	Thu Dec 01 03:07:24 2005 +0000
    45.3 @@ -97,7 +97,7 @@ class Machine:
    45.4                       "cores_per_socket" : "Unknown",
    45.5                       "threads_per_core" : "Unknown",
    45.6                       "cpu_mhz"          : "Unknown",
    45.7 -                     "memory"           : "Unknown"}
    45.8 +                     "total_memory"     : "Unknown"}
    45.9  
   45.10          xen = self.__getXenInfo(xenValues)
   45.11          cpu = self.__getCpuInfo(cpuValues)
    46.1 --- a/tools/xm-test/tests/create/06_create_mem_neg.py	Wed Nov 30 11:44:19 2005 +0000
    46.2 +++ b/tools/xm-test/tests/create/06_create_mem_neg.py	Thu Dec 01 03:07:24 2005 +0000
    46.3 @@ -31,6 +31,7 @@ domain1=XenDomain(opts1)
    46.4  
    46.5  try:
    46.6      domain1.start()
    46.7 +    eyecatcher1 = "Created"
    46.8  except DomainError, e:
    46.9      eyecatcher1 = "Fail"
   46.10  
   46.11 @@ -41,7 +42,7 @@ if eyecatcher1 != "Fail":
   46.12  
   46.13  # Test 2: create a domain with mem>sys_mem
   46.14  
   46.15 -mem = int(getInfo("free_memory"))
   46.16 +mem = int(getInfo("total_memory"))
   46.17  extreme_mem = str(mem + 100)
   46.18  
   46.19  opts2=  {
   46.20 @@ -56,6 +57,7 @@ domain2=XenDomain(opts2)
   46.21  
   46.22  try:
   46.23      domain2.start()
   46.24 +    eyecatcher2 = "Created"
   46.25  except DomainError, e:
   46.26      eyecatcher2 = "Fail"
   46.27  
    47.1 --- a/tools/xm-test/tests/info/02_info_compiledata_pos.py	Wed Nov 30 11:44:19 2005 +0000
    47.2 +++ b/tools/xm-test/tests/info/02_info_compiledata_pos.py	Thu Dec 01 03:07:24 2005 +0000
    47.3 @@ -24,7 +24,7 @@ for line in lines:
    47.4          map[pieces[0]] = pieces[1]
    47.5  
    47.6  for field in ["cores_per_socket", "threads_per_core", "cpu_mhz",
    47.7 -              "memory", "free_memory", "xen_major", "xen_minor"]:
    47.8 +              "total_memory", "free_memory", "xen_major", "xen_minor"]:
    47.9      val = map[field]
   47.10      if not val.isdigit():
   47.11          FAIL("Numeric field %s not all-numbers: %s" % (field, val))
    48.1 --- a/xen/arch/x86/dm/i8259.c	Wed Nov 30 11:44:19 2005 +0000
    48.2 +++ b/xen/arch/x86/dm/i8259.c	Thu Dec 01 03:07:24 2005 +0000
    48.3 @@ -31,7 +31,7 @@
    48.4  #include <xen/sched.h>
    48.5  #include <public/io/ioreq.h>
    48.6  #include <asm/vmx.h>
    48.7 -#include <public/io/vmx_vpic.h>
    48.8 +#include <asm/vmx_vpic.h>
    48.9  #include <asm/current.h>
   48.10  #include <asm/vmx_vioapic.h>
   48.11  #include <asm/vmx_vlapic.h>
    49.1 --- a/xen/arch/x86/dm/vmx_vioapic.c	Wed Nov 30 11:44:19 2005 +0000
    49.2 +++ b/xen/arch/x86/dm/vmx_vioapic.c	Thu Dec 01 03:07:24 2005 +0000
    49.3 @@ -39,7 +39,7 @@
    49.4  #include <xen/sched.h>
    49.5  #include <public/io/ioreq.h>
    49.6  #include <asm/vmx.h>
    49.7 -#include <public/io/vmx_vpic.h>
    49.8 +#include <asm/vmx_vpic.h>
    49.9  #include <asm/current.h>
   49.10  
   49.11  static void ioapic_enable(vmx_vioapic_t *s, uint8_t enable)
    50.1 --- a/xen/arch/x86/dom0_ops.c	Wed Nov 30 11:44:19 2005 +0000
    50.2 +++ b/xen/arch/x86/dom0_ops.c	Thu Dec 01 03:07:24 2005 +0000
    50.3 @@ -144,7 +144,7 @@ long arch_do_dom0_op(dom0_op_t *op, dom0
    50.4          unsigned int p;
    50.5  
    50.6          ret = -EINVAL;
    50.7 -        if ( (fp + np) >= 65536 )
    50.8 +        if ( (fp + np) > 65536 )
    50.9              break;
   50.10  
   50.11          ret = -ESRCH;
    51.1 --- a/xen/arch/x86/vmx.c	Wed Nov 30 11:44:19 2005 +0000
    51.2 +++ b/xen/arch/x86/vmx.c	Thu Dec 01 03:07:24 2005 +0000
    51.3 @@ -43,8 +43,8 @@
    51.4  #endif
    51.5  #include <public/sched.h>
    51.6  #include <public/io/ioreq.h>
    51.7 -#include <public/io/vmx_vpic.h>
    51.8 -#include <public/io/vmx_vlapic.h>
    51.9 +#include <asm/vmx_vpic.h>
   51.10 +#include <asm/vmx_vlapic.h>
   51.11  
   51.12  int hvm_enabled;
   51.13  
    52.1 --- a/xen/arch/x86/vmx_intercept.c	Wed Nov 30 11:44:19 2005 +0000
    52.2 +++ b/xen/arch/x86/vmx_intercept.c	Thu Dec 01 03:07:24 2005 +0000
    52.3 @@ -21,7 +21,7 @@
    52.4  #include <xen/types.h>
    52.5  #include <asm/vmx.h>
    52.6  #include <asm/vmx_platform.h>
    52.7 -#include <asm/vmx_virpit.h>
    52.8 +#include <asm/vmx_vpit.h>
    52.9  #include <asm/vmx_intercept.h>
   52.10  #include <asm/vmx_vlapic.h>
   52.11  #include <public/io/ioreq.h>
    53.1 --- a/xen/arch/x86/vmx_io.c	Wed Nov 30 11:44:19 2005 +0000
    53.2 +++ b/xen/arch/x86/vmx_io.c	Thu Dec 01 03:07:24 2005 +0000
    53.3 @@ -32,13 +32,12 @@
    53.4  #include <asm/vmx.h>
    53.5  #include <asm/vmx_vmcs.h>
    53.6  #include <asm/vmx_platform.h>
    53.7 -#include <asm/vmx_virpit.h>
    53.8 +#include <asm/vmx_vpit.h>
    53.9  #include <asm/apic.h>
   53.10  #include <asm/shadow.h>
   53.11 -
   53.12 +#include <asm/vmx_vpic.h>
   53.13  #include <asm/vmx_vlapic.h>
   53.14  #include <public/io/ioreq.h>
   53.15 -#include <public/io/vmx_vpic.h>
   53.16  
   53.17  #ifdef CONFIG_VMX
   53.18  #if defined (__i386__)
    54.1 --- a/xen/common/grant_table.c	Wed Nov 30 11:44:19 2005 +0000
    54.2 +++ b/xen/common/grant_table.c	Thu Dec 01 03:07:24 2005 +0000
    54.3 @@ -114,13 +114,13 @@ static int
    54.4                     (GNTMAP_device_map|GNTMAP_host_map)) == 0) )
    54.5      {
    54.6          DPRINTK("Bad ref (%d) or flags (%x).\n", ref, dev_hst_ro_flags);
    54.7 -        (void)__put_user(GNTST_bad_gntref, &uop->handle);
    54.8 +        (void)__put_user(GNTST_bad_gntref, &uop->status);
    54.9          return GNTST_bad_gntref;
   54.10      }
   54.11  
   54.12      if ( acm_pre_grant_map_ref(dom) )
   54.13      {
   54.14 -        (void)__put_user(GNTST_permission_denied, &uop->handle);
   54.15 +        (void)__put_user(GNTST_permission_denied, &uop->status);
   54.16          return GNTST_permission_denied;
   54.17      }
   54.18  
   54.19 @@ -130,7 +130,7 @@ static int
   54.20          if ( rd != NULL )
   54.21              put_domain(rd);
   54.22          DPRINTK("Could not find domain %d\n", dom);
   54.23 -        (void)__put_user(GNTST_bad_domain, &uop->handle);
   54.24 +        (void)__put_user(GNTST_bad_domain, &uop->status);
   54.25          return GNTST_bad_domain;
   54.26      }
   54.27  
   54.28 @@ -145,7 +145,7 @@ static int
   54.29          {
   54.30              put_domain(rd);
   54.31              DPRINTK("Maptrack table is at maximum size.\n");
   54.32 -            (void)__put_user(GNTST_no_device_space, &uop->handle);
   54.33 +            (void)__put_user(GNTST_no_device_space, &uop->status);
   54.34              return GNTST_no_device_space;
   54.35          }
   54.36  
   54.37 @@ -155,7 +155,7 @@ static int
   54.38          {
   54.39              put_domain(rd);
   54.40              DPRINTK("No more map handles available.\n");
   54.41 -            (void)__put_user(GNTST_no_device_space, &uop->handle);
   54.42 +            (void)__put_user(GNTST_no_device_space, &uop->status);
   54.43              return GNTST_no_device_space;
   54.44          }
   54.45  
   54.46 @@ -370,6 +370,7 @@ static int
   54.47  
   54.48      (void)__put_user((u64)frame << PAGE_SHIFT, &uop->dev_bus_addr);
   54.49      (void)__put_user(handle, &uop->handle);
   54.50 +    (void)__put_user(GNTST_okay, &uop->status);
   54.51  
   54.52      put_domain(rd);
   54.53      return rc;
   54.54 @@ -377,7 +378,7 @@ static int
   54.55  
   54.56   unlock_out:
   54.57      spin_unlock(&rd->grant_table->lock);
   54.58 -    (void)__put_user(rc, &uop->handle);
   54.59 +    (void)__put_user(rc, &uop->status);
   54.60      put_maptrack_handle(ld->grant_table, handle);
   54.61      return rc;
   54.62  }
   54.63 @@ -400,7 +401,7 @@ static int
   54.64  {
   54.65      domid_t          dom;
   54.66      grant_ref_t      ref;
   54.67 -    u16              handle;
   54.68 +    grant_handle_t   handle;
   54.69      struct domain   *ld, *rd;
   54.70      active_grant_entry_t *act;
   54.71      grant_entry_t   *sha;
   54.72 @@ -957,7 +958,7 @@ gnttab_release_mappings(
   54.73      grant_table_t        *gt = d->grant_table;
   54.74      grant_mapping_t      *map;
   54.75      grant_ref_t           ref;
   54.76 -    u16                   handle;
   54.77 +    grant_handle_t        handle;
   54.78      struct domain        *rd;
   54.79      active_grant_entry_t *act;
   54.80      grant_entry_t        *sha;
    55.1 --- a/xen/include/asm-x86/vmx_platform.h	Wed Nov 30 11:44:19 2005 +0000
    55.2 +++ b/xen/include/asm-x86/vmx_platform.h	Thu Dec 01 03:07:24 2005 +0000
    55.3 @@ -22,10 +22,10 @@
    55.4  
    55.5  #include <public/xen.h>
    55.6  #include <asm/e820.h>
    55.7 -#include <asm/vmx_virpit.h>
    55.8 +#include <asm/vmx_vpit.h>
    55.9  #include <asm/vmx_intercept.h>
   55.10  #include <asm/vmx_vioapic.h>
   55.11 -#include <public/io/vmx_vpic.h>
   55.12 +#include <asm/vmx_vpic.h>
   55.13  
   55.14  #define MAX_OPERAND_NUM 2
   55.15  
    56.1 --- a/xen/include/asm-x86/vmx_virpit.h	Wed Nov 30 11:44:19 2005 +0000
    56.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.3 @@ -1,55 +0,0 @@
    56.4 -#ifndef _VMX_VIRPIT_H
    56.5 -#define _VMX_VIRPIT_H
    56.6 -
    56.7 -#include <xen/config.h>
    56.8 -#include <xen/init.h>
    56.9 -#include <xen/lib.h>
   56.10 -#include <xen/time.h>
   56.11 -#include <xen/errno.h>
   56.12 -#include <xen/ac_timer.h>
   56.13 -#include <asm/vmx_vmcs.h>
   56.14 -#include <public/io/vmx_vpic.h>
   56.15 -
   56.16 -#define PIT_FREQ 1193181
   56.17 -
   56.18 -#define LSByte 0
   56.19 -#define MSByte 1
   56.20 -#define LSByte_multiple 2
   56.21 -#define MSByte_multiple 3
   56.22 -
   56.23 -struct vmx_virpit {
   56.24 -    /* for simulation of counter 0 in mode 2*/
   56.25 -    u64 period_cycles;	                /* pit frequency in cpu cycles */
   56.26 -    u64 inject_point; /* the time inject virt intr */
   56.27 -    s_time_t scheduled;                 /* scheduled timer interrupt */
   56.28 -    struct ac_timer pit_timer;  /* periodic timer for mode 2*/
   56.29 -    unsigned int channel;  /* the pit channel, counter 0~2 */
   56.30 -    unsigned int pending_intr_nr; /* the couner for pending timer interrupts */
   56.31 -    u32 period;		/* pit frequency in ns */
   56.32 -    int first_injected;                 /* flag to prevent shadow window */
   56.33 -    int ticking;    /* indicating it is ticking */
   56.34 -
   56.35 -    /* virtual PIT state for handle related I/O */
   56.36 -    int read_state;
   56.37 -    int count_LSB_latched;
   56.38 -    int count_MSB_latched;
   56.39 -
   56.40 -    unsigned int count;  /* the 16 bit channel count */
   56.41 -    unsigned int init_val; /* the init value for the counter */
   56.42 -};
   56.43 -
   56.44 -/* to hook the ioreq packet to get the PIT initializaiton info */
   56.45 -extern void vmx_hooks_assist(struct vcpu *v);
   56.46 -
   56.47 -static __inline__ s_time_t get_pit_scheduled(
   56.48 -    struct vcpu *v, 
   56.49 -    struct vmx_virpit *vpit)
   56.50 -{
   56.51 -    if ( is_irq_enabled(v, 0) ) {
   56.52 -        return vpit->scheduled;
   56.53 -    }
   56.54 -    else
   56.55 -        return -1;
   56.56 -}
   56.57 -
   56.58 -#endif /* _VMX_VIRPIT_H_ */
    57.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.2 +++ b/xen/include/asm-x86/vmx_vpic.h	Thu Dec 01 03:07:24 2005 +0000
    57.3 @@ -0,0 +1,85 @@
    57.4 +/*
    57.5 + * QEMU System Emulator header
    57.6 + * 
    57.7 + * Copyright (c) 2003 Fabrice Bellard
    57.8 + * Copyright (c) 2005 Intel Corp
    57.9 + * 
   57.10 + * Permission is hereby granted, free of charge, to any person obtaining a copy
   57.11 + * of this software and associated documentation files (the "Software"), to deal
   57.12 + * in the Software without restriction, including without limitation the rights
   57.13 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   57.14 + * copies of the Software, and to permit persons to whom the Software is
   57.15 + * furnished to do so, subject to the following conditions:
   57.16 + *
   57.17 + * The above copyright notice and this permission notice shall be included in
   57.18 + * all copies or substantial portions of the Software.
   57.19 + *
   57.20 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   57.21 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   57.22 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
   57.23 + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   57.24 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   57.25 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
   57.26 + * THE SOFTWARE.
   57.27 + */
   57.28 +
   57.29 +#ifndef _VMX_VPIC_H
   57.30 +#define _VMX_VPIC_H
   57.31 +
   57.32 +#define hw_error(x)  do {} while (0);
   57.33 +
   57.34 +
   57.35 +/* i8259.c */
   57.36 +typedef struct IOAPICState IOAPICState;
   57.37 +typedef struct PicState {
   57.38 +    uint8_t last_irr; /* edge detection */
   57.39 +    uint8_t irr; /* interrupt request register */
   57.40 +    uint8_t imr; /* interrupt mask register */
   57.41 +    uint8_t isr; /* interrupt service register */
   57.42 +    uint8_t priority_add; /* highest irq priority */
   57.43 +    uint8_t irq_base;
   57.44 +    uint8_t read_reg_select;
   57.45 +    uint8_t poll;
   57.46 +    uint8_t special_mask;
   57.47 +    uint8_t init_state;
   57.48 +    uint8_t auto_eoi;
   57.49 +    uint8_t rotate_on_auto_eoi;
   57.50 +    uint8_t special_fully_nested_mode;
   57.51 +    uint8_t init4; /* true if 4 byte init */
   57.52 +    uint8_t elcr; /* PIIX edge/trigger selection*/
   57.53 +    uint8_t elcr_mask;
   57.54 +    struct vmx_virpic *pics_state;
   57.55 +} PicState;
   57.56 +
   57.57 +struct vmx_virpic {
   57.58 +    /* 0 is master pic, 1 is slave pic */
   57.59 +    /* XXX: better separation between the two pics */
   57.60 +    PicState pics[2];
   57.61 +    void (*irq_request)(int *opaque, int level);
   57.62 +    void *irq_request_opaque;
   57.63 +    /* IOAPIC callback support */
   57.64 +    void (*alt_irq_func)(void *opaque, int irq_num, int level);
   57.65 +    void *alt_irq_opaque;
   57.66 +};
   57.67 +
   57.68 +
   57.69 +void pic_set_irq(struct vmx_virpic *s, int irq, int level);
   57.70 +void pic_set_irq_new(void *opaque, int irq, int level);
   57.71 +void pic_init(struct vmx_virpic *s, 
   57.72 +              void (*irq_request)(),
   57.73 +              void *irq_request_opaque);
   57.74 +void pic_set_alt_irq_func(struct vmx_virpic *s, 
   57.75 +                          void(*alt_irq_func)(),
   57.76 +                          void *alt_irq_opaque);
   57.77 +int pic_read_irq(struct vmx_virpic *s);
   57.78 +void pic_update_irq(struct vmx_virpic *s);
   57.79 +uint32_t pic_intack_read(struct vmx_virpic *s);
   57.80 +void register_pic_io_hook (void);
   57.81 +int cpu_get_pic_interrupt(struct vcpu *v, int *type);
   57.82 +int is_pit_irq(struct vcpu *v, int irq, int type);
   57.83 +int is_irq_enabled(struct vcpu *v, int irq);
   57.84 +void do_pic_irqs (struct vmx_virpic *s, uint16_t irqs);
   57.85 +void do_pic_irqs_clear (struct vmx_virpic *s, uint16_t irqs);
   57.86 +
   57.87 +/* APIC */
   57.88 +#endif  /* _VMX_VPIC_H */  
    58.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.2 +++ b/xen/include/asm-x86/vmx_vpit.h	Thu Dec 01 03:07:24 2005 +0000
    58.3 @@ -0,0 +1,55 @@
    58.4 +#ifndef _VMX_VIRPIT_H
    58.5 +#define _VMX_VIRPIT_H
    58.6 +
    58.7 +#include <xen/config.h>
    58.8 +#include <xen/init.h>
    58.9 +#include <xen/lib.h>
   58.10 +#include <xen/time.h>
   58.11 +#include <xen/errno.h>
   58.12 +#include <xen/ac_timer.h>
   58.13 +#include <asm/vmx_vmcs.h>
   58.14 +#include <asm/vmx_vpic.h>
   58.15 +
   58.16 +#define PIT_FREQ 1193181
   58.17 +
   58.18 +#define LSByte 0
   58.19 +#define MSByte 1
   58.20 +#define LSByte_multiple 2
   58.21 +#define MSByte_multiple 3
   58.22 +
   58.23 +struct vmx_virpit {
   58.24 +    /* for simulation of counter 0 in mode 2*/
   58.25 +    u64 period_cycles;	                /* pit frequency in cpu cycles */
   58.26 +    u64 inject_point; /* the time inject virt intr */
   58.27 +    s_time_t scheduled;                 /* scheduled timer interrupt */
   58.28 +    struct ac_timer pit_timer;  /* periodic timer for mode 2*/
   58.29 +    unsigned int channel;  /* the pit channel, counter 0~2 */
   58.30 +    unsigned int pending_intr_nr; /* the couner for pending timer interrupts */
   58.31 +    u32 period;		/* pit frequency in ns */
   58.32 +    int first_injected;                 /* flag to prevent shadow window */
   58.33 +    int ticking;    /* indicating it is ticking */
   58.34 +
   58.35 +    /* virtual PIT state for handle related I/O */
   58.36 +    int read_state;
   58.37 +    int count_LSB_latched;
   58.38 +    int count_MSB_latched;
   58.39 +
   58.40 +    unsigned int count;  /* the 16 bit channel count */
   58.41 +    unsigned int init_val; /* the init value for the counter */
   58.42 +};
   58.43 +
   58.44 +/* to hook the ioreq packet to get the PIT initializaiton info */
   58.45 +extern void vmx_hooks_assist(struct vcpu *v);
   58.46 +
   58.47 +static __inline__ s_time_t get_pit_scheduled(
   58.48 +    struct vcpu *v, 
   58.49 +    struct vmx_virpit *vpit)
   58.50 +{
   58.51 +    if ( is_irq_enabled(v, 0) ) {
   58.52 +        return vpit->scheduled;
   58.53 +    }
   58.54 +    else
   58.55 +        return -1;
   58.56 +}
   58.57 +
   58.58 +#endif /* _VMX_VIRPIT_H_ */
    59.1 --- a/xen/include/public/acm_ops.h	Wed Nov 30 11:44:19 2005 +0000
    59.2 +++ b/xen/include/public/acm_ops.h	Thu Dec 01 03:07:24 2005 +0000
    59.3 @@ -63,7 +63,7 @@ struct acm_getssid {
    59.4          ssidref_t    ssidref;
    59.5      } id;
    59.6      void *ssidbuf;
    59.7 -    uint16_t ssidbuf_size;
    59.8 +    uint32_t ssidbuf_size;
    59.9  };
   59.10  
   59.11  #define ACM_GETDECISION        8
    60.1 --- a/xen/include/public/dom0_ops.h	Wed Nov 30 11:44:19 2005 +0000
    60.2 +++ b/xen/include/public/dom0_ops.h	Thu Dec 01 03:07:24 2005 +0000
    60.3 @@ -19,7 +19,7 @@
    60.4   * This makes sure that old versions of dom0 tools will stop working in a
    60.5   * well-defined way (rather than crashing the machine, for instance).
    60.6   */
    60.7 -#define DOM0_INTERFACE_VERSION   0xAAAA1012
    60.8 +#define DOM0_INTERFACE_VERSION   0xAAAA1014
    60.9  
   60.10  /************************************************************************/
   60.11  
   60.12 @@ -98,7 +98,7 @@ typedef struct {
   60.13  typedef struct {
   60.14      /* IN variables. */
   60.15      domid_t               domain;
   60.16 -    uint16_t              vcpu;
   60.17 +    uint32_t              vcpu;
   60.18      /* IN/OUT parameters */
   60.19      vcpu_guest_context_t *ctxt;
   60.20  } dom0_setdomaininfo_t;
   60.21 @@ -107,7 +107,7 @@ typedef struct {
   60.22  typedef struct {
   60.23      /* IN variables. */
   60.24      uint32_t write;
   60.25 -    uint32_t cpu_mask;
   60.26 +    cpumap_t cpu_mask;
   60.27      uint32_t msr;
   60.28      uint32_t in1;
   60.29      uint32_t in2;
   60.30 @@ -116,21 +116,6 @@ typedef struct {
   60.31      uint32_t out2;
   60.32  } dom0_msr_t;
   60.33  
   60.34 -#define DOM0_DEBUG            16
   60.35 -typedef struct {
   60.36 -    /* IN variables. */
   60.37 -    domid_t  domain;
   60.38 -    uint8_t  opcode;
   60.39 -    uint32_t in1;
   60.40 -    uint32_t in2;
   60.41 -    uint32_t in3;
   60.42 -    uint32_t in4;
   60.43 -    /* OUT variables. */
   60.44 -    uint32_t status;
   60.45 -    uint32_t out1;
   60.46 -    uint32_t out2;
   60.47 -} dom0_debug_t;
   60.48 -
   60.49  /*
   60.50   * Set clock such that it would read <secs,nsecs> after 00:00:00 UTC,
   60.51   * 1 January, 1970 if the current system time was <system_time>.
   60.52 @@ -182,8 +167,8 @@ typedef struct {
   60.53  typedef struct {
   60.54      /* IN variables. */
   60.55      domid_t   domain;
   60.56 -    uint16_t  vcpu;
   60.57 -    cpumap_t cpumap;
   60.58 +    uint32_t  vcpu;
   60.59 +    cpumap_t  cpumap;
   60.60  } dom0_pincpudomain_t;
   60.61  
   60.62  /* Get trace buffers machine base address */
   60.63 @@ -196,9 +181,9 @@ typedef struct {
   60.64  #define DOM0_TBUF_SET_SIZE     3
   60.65  #define DOM0_TBUF_ENABLE       4
   60.66  #define DOM0_TBUF_DISABLE      5
   60.67 -    uint8_t op;
   60.68 +    uint32_t      op;
   60.69      /* IN/OUT variables */
   60.70 -    unsigned long cpu_mask;
   60.71 +    cpumap_t      cpu_mask;
   60.72      uint32_t      evt_mask;
   60.73      /* OUT variables */
   60.74      unsigned long buffer_mfn;
   60.75 @@ -327,7 +312,7 @@ typedef struct {
   60.76  #define DOM0_PERFCCONTROL_OP_RESET 1   /* Reset all counters to zero. */
   60.77  #define DOM0_PERFCCONTROL_OP_QUERY 2   /* Get perfctr information. */
   60.78  typedef struct {
   60.79 -    uint8_t      name[80];             /*  name of perf counter */
   60.80 +    uint8_t      name[80];             /* name of perf counter */
   60.81      uint32_t     nr_vals;              /* number of values for this counter */
   60.82      uint32_t     vals[64];             /* array of values */
   60.83  } dom0_perfc_desc_t;
   60.84 @@ -349,16 +334,16 @@ typedef struct {
   60.85  #define DOM0_IOPORT_PERMISSION   36
   60.86  typedef struct {
   60.87      domid_t  domain;                  /* domain to be affected */
   60.88 -    uint16_t first_port;              /* first port int range */
   60.89 -    uint16_t nr_ports;                /* size of port range */
   60.90 -    uint16_t allow_access;            /* allow or deny access to range? */
   60.91 +    uint32_t first_port;              /* first port int range */
   60.92 +    uint32_t nr_ports;                /* size of port range */
   60.93 +    uint8_t  allow_access;            /* allow or deny access to range? */
   60.94  } dom0_ioport_permission_t;
   60.95  
   60.96  #define DOM0_GETVCPUCONTEXT      37
   60.97  typedef struct {
   60.98      /* IN variables. */
   60.99      domid_t  domain;                  /* domain to be affected */
  60.100 -    uint16_t vcpu;                    /* vcpu # */
  60.101 +    uint32_t vcpu;                    /* vcpu # */
  60.102      /* OUT variables. */
  60.103      vcpu_guest_context_t *ctxt;
  60.104  } dom0_getvcpucontext_t;
  60.105 @@ -367,7 +352,7 @@ typedef struct {
  60.106  typedef struct {
  60.107      /* IN variables. */
  60.108      domid_t  domain;                  /* domain to be affected */
  60.109 -    uint16_t vcpu;                    /* vcpu # */
  60.110 +    uint32_t vcpu;                    /* vcpu # */
  60.111      /* OUT variables. */
  60.112      uint8_t  online;                  /* currently online (not hotplugged)? */
  60.113      uint8_t  blocked;                 /* blocked waiting for an event? */
  60.114 @@ -381,35 +366,36 @@ typedef struct {
  60.115  typedef struct {
  60.116      /* IN variables. */
  60.117      domid_t               first_domain;
  60.118 -    unsigned int          max_domains;
  60.119 +    uint32_t              max_domains;
  60.120      dom0_getdomaininfo_t *buffer;
  60.121      /* OUT variables. */
  60.122 -    unsigned int          num_domains;
  60.123 +    uint32_t              num_domains;
  60.124  } dom0_getdomaininfolist_t;
  60.125  
  60.126  #define DOM0_PLATFORM_QUIRK      39  
  60.127  #define QUIRK_NOIRQBALANCING  1
  60.128  typedef struct {
  60.129      /* IN variables. */
  60.130 -    int quirk_id;
  60.131 +    uint32_t quirk_id;
  60.132  } dom0_platform_quirk_t;
  60.133  
  60.134  #define DOM0_PHYSICAL_MEMORY_MAP 40
  60.135  typedef struct {
  60.136      /* IN variables. */
  60.137 -    int max_map_entries;
  60.138 +    uint32_t max_map_entries;
  60.139      /* OUT variables. */
  60.140 -    int nr_map_entries;
  60.141 +    uint32_t nr_map_entries;
  60.142      struct dom0_memory_map_entry {
  60.143          uint64_t start, end;
  60.144 -        int is_ram;
  60.145 +        uint32_t flags; /* reserved */
  60.146 +        uint8_t  is_ram;
  60.147      } *memory_map;
  60.148  } dom0_physical_memory_map_t;
  60.149  
  60.150  #define DOM0_MAX_VCPUS 41
  60.151  typedef struct {
  60.152 -    domid_t domain;             /* domain to be affected */
  60.153 -    unsigned int max;           /* maximum number of vcpus */
  60.154 +    domid_t  domain;        /* domain to be affected */
  60.155 +    uint32_t max;           /* maximum number of vcpus */
  60.156  } dom0_max_vcpus_t;
  60.157  
  60.158  #define DOM0_SETDOMAINHANDLE 44
  60.159 @@ -433,7 +419,6 @@ typedef struct {
  60.160          dom0_getdomaininfo_t     getdomaininfo;
  60.161          dom0_getpageframeinfo_t  getpageframeinfo;
  60.162          dom0_msr_t               msr;
  60.163 -        dom0_debug_t             debug;
  60.164          dom0_settime_t           settime;
  60.165          dom0_readconsole_t       readconsole;
  60.166          dom0_pincpudomain_t      pincpudomain;
    61.1 --- a/xen/include/public/grant_table.h	Wed Nov 30 11:44:19 2005 +0000
    61.2 +++ b/xen/include/public/grant_table.h	Thu Dec 01 03:07:24 2005 +0000
    61.3 @@ -73,14 +73,14 @@
    61.4   */
    61.5  typedef struct grant_entry {
    61.6      /* GTF_xxx: various type and flag information.  [XEN,GST] */
    61.7 -    uint16_t     flags;
    61.8 +    uint16_t flags;
    61.9      /* The domain being granted foreign privileges. [GST] */
   61.10 -    domid_t domid;
   61.11 +    domid_t  domid;
   61.12      /*
   61.13       * GTF_permit_access: Frame that @domid is allowed to map and access. [GST]
   61.14       * GTF_accept_transfer: Frame whose ownership transferred by @domid. [XEN]
   61.15       */
   61.16 -    uint32_t     frame;
   61.17 +    uint32_t frame;
   61.18  } grant_entry_t;
   61.19  
   61.20  /*
   61.21 @@ -131,7 +131,12 @@ typedef struct grant_entry {
   61.22  /*
   61.23   * Reference to a grant entry in a specified domain's grant table.
   61.24   */
   61.25 -typedef uint16_t grant_ref_t;
   61.26 +typedef uint32_t grant_ref_t;
   61.27 +
   61.28 +/*
   61.29 + * Handle to track a mapping created via a grant reference.
   61.30 + */
   61.31 +typedef uint32_t grant_handle_t;
   61.32  
   61.33  /*
   61.34   * GNTTABOP_map_grant_ref: Map the grant entry (<dom>,<ref>) for access
   61.35 @@ -154,11 +159,12 @@ typedef uint16_t grant_ref_t;
   61.36  typedef struct gnttab_map_grant_ref {
   61.37      /* IN parameters. */
   61.38      uint64_t host_addr;
   61.39 -    domid_t  dom;
   61.40 +    uint32_t flags;               /* GNTMAP_* */
   61.41      grant_ref_t ref;
   61.42 -    uint16_t flags;               /* GNTMAP_* */
   61.43 +    domid_t  dom;
   61.44      /* OUT parameters. */
   61.45 -    int16_t  handle;              /* +ve: handle; -ve: GNTST_* */
   61.46 +    int16_t  status;              /* GNTST_* */
   61.47 +    grant_handle_t handle;
   61.48      uint64_t dev_bus_addr;
   61.49  } gnttab_map_grant_ref_t;
   61.50  
   61.51 @@ -178,7 +184,7 @@ typedef struct gnttab_unmap_grant_ref {
   61.52      /* IN parameters. */
   61.53      uint64_t host_addr;
   61.54      uint64_t dev_bus_addr;
   61.55 -    uint16_t handle;
   61.56 +    grant_handle_t handle;
   61.57      /* OUT parameters. */
   61.58      int16_t  status;              /* GNTST_* */
   61.59  } gnttab_unmap_grant_ref_t;
   61.60 @@ -196,7 +202,7 @@ typedef struct gnttab_unmap_grant_ref {
   61.61  typedef struct gnttab_setup_table {
   61.62      /* IN parameters. */
   61.63      domid_t  dom;
   61.64 -    uint16_t nr_frames;
   61.65 +    uint32_t nr_frames;
   61.66      /* OUT parameters. */
   61.67      int16_t  status;              /* GNTST_* */
   61.68      unsigned long *frame_list;
   61.69 @@ -283,7 +289,8 @@ typedef struct {
   61.70      "invalid virtual address",                  \
   61.71      "invalid device address",                   \
   61.72      "no spare translation slot in the I/O MMU", \
   61.73 -    "permission denied"                         \
   61.74 +    "permission denied",                        \
   61.75 +    "bad page"                                  \
   61.76  }
   61.77  
   61.78  #endif /* __XEN_PUBLIC_GRANT_TABLE_H__ */
    62.1 --- a/xen/include/public/io/blkif.h	Wed Nov 30 11:44:19 2005 +0000
    62.2 +++ b/xen/include/public/io/blkif.h	Thu Dec 01 03:07:24 2005 +0000
    62.3 @@ -19,9 +19,6 @@
    62.4  #define BLKIF_OP_READ      0
    62.5  #define BLKIF_OP_WRITE     1
    62.6  
    62.7 -/* NB. Ring size must be small enough for sizeof(blkif_ring_t) <= PAGE_SIZE. */
    62.8 -#define BLKIF_RING_SIZE        64
    62.9 -
   62.10  /*
   62.11   * Maximum scatter/gather segments per request.
   62.12   * This is carefully chosen so that sizeof(blkif_ring_t) <= PAGE_SIZE.
   62.13 @@ -33,24 +30,18 @@ typedef struct blkif_request {
   62.14      uint8_t        operation;    /* BLKIF_OP_???                         */
   62.15      uint8_t        nr_segments;  /* number of segments                   */
   62.16      blkif_vdev_t   handle;       /* only for read/write requests         */
   62.17 -    unsigned long  id;           /* private guest value, echoed in resp  */
   62.18 +    uint64_t       id;           /* private guest value, echoed in resp  */
   62.19      blkif_sector_t sector_number;/* start sector idx on disk (r/w only)  */
   62.20 -    /* @f_a_s[4:0]=last_sect ; @f_a_s[9:5]=first_sect                        */
   62.21 -    /* @f_a_s[:16]= grant reference (16 bits)                                */
   62.22 -    /* @first_sect: first sector in frame to transfer (inclusive).           */
   62.23 -    /* @last_sect: last sector in frame to transfer (inclusive).             */
   62.24 -    unsigned long  frame_and_sects[BLKIF_MAX_SEGMENTS_PER_REQUEST];
   62.25 +    struct blkif_request_segment {
   62.26 +        grant_ref_t gref;        /* reference to I/O buffer frame        */
   62.27 +        /* @first_sect: first sector in frame to transfer (inclusive).   */
   62.28 +        /* @last_sect: last sector in frame to transfer (inclusive).     */
   62.29 +        uint8_t     first_sect, last_sect;
   62.30 +    } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
   62.31  } blkif_request_t;
   62.32  
   62.33 -#define blkif_fas(_addr, _fs, _ls) ((_addr)|((_fs)<<5)|(_ls))
   62.34 -#define blkif_first_sect(_fas) (((_fas)>>5)&31)
   62.35 -#define blkif_last_sect(_fas)  ((_fas)&31)
   62.36 -
   62.37 -#define blkif_fas_from_gref(_gref, _fs, _ls) (((_gref)<<16)|((_fs)<<5)|(_ls))
   62.38 -#define blkif_gref_from_fas(_fas) ((_fas)>>16)
   62.39 -
   62.40  typedef struct blkif_response {
   62.41 -    unsigned long   id;              /* copied from request */
   62.42 +    uint64_t        id;              /* copied from request */
   62.43      uint8_t         operation;       /* copied from request */
   62.44      int16_t         status;          /* BLKIF_RSP_???       */
   62.45  } blkif_response_t;
   62.46 @@ -58,9 +49,6 @@ typedef struct blkif_response {
   62.47  #define BLKIF_RSP_ERROR  -1 /* non-specific 'error' */
   62.48  #define BLKIF_RSP_OKAY    0 /* non-specific 'okay'  */
   62.49  
   62.50 -#define BLKIF_MAJOR(dev) ((dev)>>8)
   62.51 -#define BLKIF_MINOR(dev) ((dev) & 0xff)
   62.52 -
   62.53  /*
   62.54   * Generate blkif ring structures and types.
   62.55   */
    63.1 --- a/xen/include/public/io/tpmif.h	Wed Nov 30 11:44:19 2005 +0000
    63.2 +++ b/xen/include/public/io/tpmif.h	Thu Dec 01 03:07:24 2005 +0000
    63.3 @@ -18,7 +18,7 @@
    63.4  
    63.5  typedef struct {
    63.6      unsigned long addr;   /* Machine address of packet.   */
    63.7 -    int      ref;         /* grant table access reference */
    63.8 +    grant_ref_t ref;      /* grant table access reference */
    63.9      uint16_t id;          /* Echoed in response message.  */
   63.10      uint16_t size;        /* Packet size in bytes.        */
   63.11  } tpmif_tx_request_t;
    64.1 --- a/xen/include/public/io/vmx_vlapic.h	Wed Nov 30 11:44:19 2005 +0000
    64.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.3 @@ -1,58 +0,0 @@
    64.4 -#ifndef _VMX_VLAPIC_H
    64.5 -#define _VMX_VLAPIC_H
    64.6 -
    64.7 -/*
    64.8 -   We extended one bit for PIC type
    64.9 - */
   64.10 -#define VLAPIC_DELIV_MODE_FIXED          0x0
   64.11 -#define VLAPIC_DELIV_MODE_LPRI           0x1
   64.12 -#define VLAPIC_DELIV_MODE_SMI            0x2
   64.13 -#define VLAPIC_DELIV_MODE_NMI            0x4
   64.14 -#define VLAPIC_DELIV_MODE_INIT           0x5
   64.15 -#define VLAPIC_DELIV_MODE_STARTUP        0x6
   64.16 -#define VLAPIC_DELIV_MODE_EXT            0x7
   64.17 -#define VLAPIC_DELIV_MODE_MASK            0x8
   64.18 -
   64.19 -#define VLAPIC_MSG_LEVEL                4
   64.20 -
   64.21 -#define INTR_EXT   0
   64.22 -#define INTR_APIC   1
   64.23 -#define INTR_LAPIC  2
   64.24 -
   64.25 -#define VL_STATE_EOI    1
   64.26 -#define VL_STATE_EXT_LOCK   2
   64.27 -#define VL_STATE_MSG_LOCK   3
   64.28 -#define VL_STATE_EOI_LOCK   3
   64.29 -
   64.30 -#define VLOCAL_APIC_MAX_INTS             256
   64.31 -#define VLAPIC_INT_COUNT                (VLOCAL_APIC_MAX_INTS/(BITS_PER_BYTE * sizeof(uint64_t)))
   64.32 -#define VLAPIC_INT_COUNT_32             (VLOCAL_APIC_MAX_INTS/(BITS_PER_BYTE * sizeof(uint32_t)))
   64.33 -
   64.34 -typedef struct {
   64.35 -    /* interrupt for PIC and ext type IOAPIC interrupt */
   64.36 -    uint64_t   vl_ext_intr[VLAPIC_INT_COUNT];
   64.37 -    uint64_t   vl_ext_intr_mask[VLAPIC_INT_COUNT];
   64.38 -    uint64_t   vl_apic_intr[VLAPIC_INT_COUNT];
   64.39 -    uint64_t   vl_apic_tmr[VLAPIC_INT_COUNT];
   64.40 -    uint64_t   vl_eoi[VLAPIC_INT_COUNT];
   64.41 -    uint32_t   vl_lapic_id;
   64.42 -    uint32_t   direct_intr;
   64.43 -    uint32_t   vl_apr;
   64.44 -    uint32_t   vl_logical_dest;
   64.45 -    uint32_t   vl_dest_format;
   64.46 -    uint32_t   vl_arb_id;
   64.47 -    uint32_t   vl_state;
   64.48 -    uint32_t   apic_msg_count;
   64.49 -} vlapic_info;
   64.50 -
   64.51 -#endif /* _VMX_VLAPIC_H_ */
   64.52 -
   64.53 -/*
   64.54 - * Local variables:
   64.55 - * mode: C
   64.56 - * c-set-style: "BSD"
   64.57 - * c-basic-offset: 4
   64.58 - * tab-width: 4
   64.59 - * indent-tabs-mode: nil
   64.60 - * End:
   64.61 - */
    65.1 --- a/xen/include/public/io/vmx_vpic.h	Wed Nov 30 11:44:19 2005 +0000
    65.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.3 @@ -1,85 +0,0 @@
    65.4 -/*
    65.5 - * QEMU System Emulator header
    65.6 - * 
    65.7 - * Copyright (c) 2003 Fabrice Bellard
    65.8 - * Copyright (c) 2005 Intel Corp
    65.9 - * 
   65.10 - * Permission is hereby granted, free of charge, to any person obtaining a copy
   65.11 - * of this software and associated documentation files (the "Software"), to deal
   65.12 - * in the Software without restriction, including without limitation the rights
   65.13 - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   65.14 - * copies of the Software, and to permit persons to whom the Software is
   65.15 - * furnished to do so, subject to the following conditions:
   65.16 - *
   65.17 - * The above copyright notice and this permission notice shall be included in
   65.18 - * all copies or substantial portions of the Software.
   65.19 - *
   65.20 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   65.21 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   65.22 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
   65.23 - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   65.24 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   65.25 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
   65.26 - * THE SOFTWARE.
   65.27 - */
   65.28 -
   65.29 -#ifndef _VMX_VPIC_H
   65.30 -#define _VMX_VPIC_H
   65.31 -
   65.32 -#define hw_error(x)  do {} while (0);
   65.33 -
   65.34 -
   65.35 -/* i8259.c */
   65.36 -typedef struct IOAPICState IOAPICState;
   65.37 -typedef struct PicState {
   65.38 -    uint8_t last_irr; /* edge detection */
   65.39 -    uint8_t irr; /* interrupt request register */
   65.40 -    uint8_t imr; /* interrupt mask register */
   65.41 -    uint8_t isr; /* interrupt service register */
   65.42 -    uint8_t priority_add; /* highest irq priority */
   65.43 -    uint8_t irq_base;
   65.44 -    uint8_t read_reg_select;
   65.45 -    uint8_t poll;
   65.46 -    uint8_t special_mask;
   65.47 -    uint8_t init_state;
   65.48 -    uint8_t auto_eoi;
   65.49 -    uint8_t rotate_on_auto_eoi;
   65.50 -    uint8_t special_fully_nested_mode;
   65.51 -    uint8_t init4; /* true if 4 byte init */
   65.52 -    uint8_t elcr; /* PIIX edge/trigger selection*/
   65.53 -    uint8_t elcr_mask;
   65.54 -    struct vmx_virpic *pics_state;
   65.55 -} PicState;
   65.56 -
   65.57 -struct vmx_virpic {
   65.58 -    /* 0 is master pic, 1 is slave pic */
   65.59 -    /* XXX: better separation between the two pics */
   65.60 -    PicState pics[2];
   65.61 -    void (*irq_request)(int *opaque, int level);
   65.62 -    void *irq_request_opaque;
   65.63 -    /* IOAPIC callback support */
   65.64 -    void (*alt_irq_func)(void *opaque, int irq_num, int level);
   65.65 -    void *alt_irq_opaque;
   65.66 -};
   65.67 -
   65.68 -
   65.69 -void pic_set_irq(struct vmx_virpic *s, int irq, int level);
   65.70 -void pic_set_irq_new(void *opaque, int irq, int level);
   65.71 -void pic_init(struct vmx_virpic *s, 
   65.72 -              void (*irq_request)(),
   65.73 -              void *irq_request_opaque);
   65.74 -void pic_set_alt_irq_func(struct vmx_virpic *s, 
   65.75 -                          void(*alt_irq_func)(),
   65.76 -                          void *alt_irq_opaque);
   65.77 -int pic_read_irq(struct vmx_virpic *s);
   65.78 -void pic_update_irq(struct vmx_virpic *s);
   65.79 -uint32_t pic_intack_read(struct vmx_virpic *s);
   65.80 -void register_pic_io_hook (void);
   65.81 -int cpu_get_pic_interrupt(struct vcpu *v, int *type);
   65.82 -int is_pit_irq(struct vcpu *v, int irq, int type);
   65.83 -int is_irq_enabled(struct vcpu *v, int irq);
   65.84 -void do_pic_irqs (struct vmx_virpic *s, uint16_t irqs);
   65.85 -void do_pic_irqs_clear (struct vmx_virpic *s, uint16_t irqs);
   65.86 -
   65.87 -/* APIC */
   65.88 -#endif  /* _VMX_VPIC_H */  
    66.1 --- a/xen/include/public/sched_ctl.h	Wed Nov 30 11:44:19 2005 +0000
    66.2 +++ b/xen/include/public/sched_ctl.h	Thu Dec 01 03:07:24 2005 +0000
    66.3 @@ -48,8 +48,8 @@ struct sched_adjdom_cmd {
    66.4              uint64_t period;
    66.5              uint64_t slice;
    66.6              uint64_t latency;
    66.7 -            uint16_t extratime;
    66.8 -            uint16_t weight;
    66.9 +            uint32_t extratime;
   66.10 +            uint32_t weight;
   66.11          } sedf;
   66.12  
   66.13      } u;
    67.1 --- a/xen/include/public/xen.h	Wed Nov 30 11:44:19 2005 +0000
    67.2 +++ b/xen/include/public/xen.h	Thu Dec 01 03:07:24 2005 +0000
    67.3 @@ -410,9 +410,9 @@ typedef struct start_info {
    67.4      unsigned long shared_info;  /* MACHINE address of shared info struct. */
    67.5      uint32_t flags;             /* SIF_xxx flags.                         */
    67.6      unsigned long store_mfn;    /* MACHINE page number of shared page.    */
    67.7 -    uint16_t store_evtchn;      /* Event channel for store communication. */
    67.8 +    uint32_t store_evtchn;      /* Event channel for store communication. */
    67.9      unsigned long console_mfn;  /* MACHINE address of console page.       */
   67.10 -    uint16_t console_evtchn;    /* Event channel for console messages.    */
   67.11 +    uint32_t console_evtchn;    /* Event channel for console messages.    */
   67.12      /* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME).     */
   67.13      unsigned long pt_base;      /* VIRTUAL address of page directory.     */
   67.14      unsigned long nr_pt_frames; /* Number of bootstrap p.t. frames.       */