direct-io.hg

changeset 888:4b4252761715

bitkeeper revision 1.559 (3fa8d58fJMWFHK02Nc3nDhxvCmwvXA)

Many files:
Cleanups -- Xen now doesn't need to know about the start_info structure for anything except DOM0 boot.
author kaf24@scramble.cl.cam.ac.uk
date Wed Nov 05 10:48:47 2003 +0000 (2003-11-05)
parents 77eeb794412d
children 45635770bd4c 10d149839712
files extras/mini-os/h/hypervisor.h extras/mini-os/head.S extras/mini-os/kernel.c tools/internal/xi_build.c xen/common/dom0_ops.c xen/common/domain.c xen/drivers/block/xen_block.c xen/include/asm-i386/processor.h xen/include/hypervisor-ifs/dom0_ops.h xen/include/hypervisor-ifs/hypervisor-if.h xen/include/hypervisor-ifs/network.h xen/include/hypervisor-ifs/vbd.h xen/net/dev.c xenolinux-2.4.22-sparse/arch/xeno/drivers/block/xl_block.c xenolinux-2.4.22-sparse/arch/xeno/drivers/network/network.c xenolinux-2.4.22-sparse/arch/xeno/kernel/head.S xenolinux-2.4.22-sparse/include/asm-xeno/hypervisor.h
line diff
     1.1 --- a/extras/mini-os/h/hypervisor.h	Wed Nov 05 09:07:50 2003 +0000
     1.2 +++ b/extras/mini-os/h/hypervisor.h	Wed Nov 05 10:48:47 2003 +0000
     1.3 @@ -103,13 +103,13 @@ static inline int HYPERVISOR_set_callbac
     1.4      return ret;
     1.5  }
     1.6  
     1.7 -static inline int HYPERVISOR_net_io_op(unsigned int op, unsigned int idx)
     1.8 +static inline int HYPERVISOR_net_io_op(netop_t *op)
     1.9  {
    1.10      int ret;
    1.11      __asm__ __volatile__ (
    1.12          TRAP_INSTR
    1.13          : "=a" (ret) : "0" (__HYPERVISOR_net_io_op),
    1.14 -        "b" (op), "c" (idx) );
    1.15 +        "b" (op) );
    1.16  
    1.17      return ret;
    1.18  }
     2.1 --- a/extras/mini-os/head.S	Wed Nov 05 09:07:50 2003 +0000
     2.2 +++ b/extras/mini-os/head.S	Wed Nov 05 10:48:47 2003 +0000
     2.3 @@ -1,8 +1,8 @@
     2.4  #include <os.h>
     2.5  
     2.6  /* Offsets in start_info structure */
     2.7 -#define MOD_START    4
     2.8 -#define MOD_LEN      8
     2.9 +#define MOD_START 20
    2.10 +#define MOD_LEN   24
    2.11  
    2.12  .globl _start, shared_info
    2.13                          
     3.1 --- a/extras/mini-os/kernel.c	Wed Nov 05 09:07:50 2003 +0000
     3.2 +++ b/extras/mini-os/kernel.c	Wed Nov 05 10:48:47 2003 +0000
     3.3 @@ -79,8 +79,6 @@ static shared_info_t *map_shared_info(un
     3.4   */
     3.5  void start_kernel(start_info_t *si)
     3.6  {
     3.7 -    int i;
     3.8 -
     3.9      /* Copy the start_info struct to a globally-accessible area. */
    3.10      memcpy(&start_info, si, sizeof(*si));
    3.11  
    3.12 @@ -105,11 +103,13 @@ void start_kernel(start_info_t *si)
    3.13      printk("  pt_base:    %p",    (void *)si->pt_base); 
    3.14      printk("  mod_start:  0x%lx\n", si->mod_start);
    3.15      printk("  mod_len:    %lu\n", si->mod_len); 
    3.16 +#if 0 /* XXX Change to use NETOP_GET_VIF_INFO and BLOCK_IO_OP_RING_ADDRESS */
    3.17      printk("  net_rings: ");
    3.18      for (i = 0; i < MAX_DOMAIN_VIFS; i++) {
    3.19          printk(" %lx", si->net_rings[i]);
    3.20      }; printk("\n");
    3.21      printk("  blk_ring:   0x%lx\n", si->blk_ring);
    3.22 +#endif
    3.23      printk("  dom_id:     %d\n",  si->dom_id);
    3.24      printk("  flags:      0x%lx\n", si->flags);
    3.25      printk("  cmd_line:   %s\n",  si->cmd_line ? (const char *)si->cmd_line : "NULL");
     4.1 --- a/tools/internal/xi_build.c	Wed Nov 05 09:07:50 2003 +0000
     4.2 +++ b/tools/internal/xi_build.c	Wed Nov 05 10:48:47 2003 +0000
     4.3 @@ -10,7 +10,6 @@
     4.4  #define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
     4.5  
     4.6  static unsigned long virt_startinfo_addr;
     4.7 -static unsigned long startinfo_frame;
     4.8  
     4.9  static char *argv0 = "internal_domain_build";
    4.10  
    4.11 @@ -318,9 +317,8 @@ static int setup_guestos(
    4.12  
    4.13      virt_startinfo_addr =
    4.14          virt_load_addr + ((alloc_index-1) << PAGE_SHIFT);
    4.15 -    startinfo_frame = page_array[alloc_index-1];
    4.16  
    4.17 -    start_info = map_pfn(startinfo_frame);
    4.18 +    start_info = map_pfn(page_array[alloc_index-1]);
    4.19      memset(start_info, 0, sizeof(*start_info));
    4.20      start_info->pt_base     = virt_load_addr + ((tot_pages-1) << PAGE_SHIFT);
    4.21      start_info->mod_start   = initrd_addr;
    4.22 @@ -511,8 +509,6 @@ int main(int argc, char **argv)
    4.23      ctxt->failsafe_callback_cs  = FLAT_RING1_CS;
    4.24      ctxt->failsafe_callback_eip = 0;
    4.25  
    4.26 -    ctxt->start_info_frame = startinfo_frame;
    4.27 -
    4.28      launch_op.u.builddomain.domain   = domain_id;
    4.29      launch_op.u.builddomain.num_vifs = atoi(argv[3]);
    4.30  
     5.1 --- a/xen/common/dom0_ops.c	Wed Nov 05 09:07:50 2003 +0000
     5.2 +++ b/xen/common/dom0_ops.c	Wed Nov 05 10:48:47 2003 +0000
     5.3 @@ -321,8 +321,6 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
     5.4                      p->failsafe_selector;
     5.5                  op.u.getdomaininfo.ctxt.failsafe_callback_eip = 
     5.6                      p->failsafe_address;
     5.7 -                op.u.getdomaininfo.ctxt.start_info_frame = 
     5.8 -                    p->thread.start_info_frame;
     5.9              }
    5.10          }
    5.11          read_unlock_irqrestore(&tasklist_lock, flags);
     6.1 --- a/xen/common/domain.c	Wed Nov 05 09:07:50 2003 +0000
     6.2 +++ b/xen/common/domain.c	Wed Nov 05 10:48:47 2003 +0000
     6.3 @@ -325,11 +325,7 @@ void release_task(struct task_struct *p)
     6.4   */
     6.5  int final_setup_guestos(struct task_struct *p, dom0_builddomain_t *builddomain)
     6.6  {
     6.7 -    start_info_t *startinfo;
     6.8      unsigned long phys_l2tab;
     6.9 -    net_ring_t *shared_rings;
    6.10 -    net_vif_t *net_vif;
    6.11 -    int i;
    6.12  
    6.13      if ( (p->flags & PF_CONSTRUCTED) )
    6.14          return -EINVAL;
    6.15 @@ -365,7 +361,6 @@ int final_setup_guestos(struct task_stru
    6.16      p->event_address     = builddomain->ctxt.event_callback_eip;
    6.17      p->failsafe_selector = builddomain->ctxt.failsafe_callback_cs;
    6.18      p->failsafe_address  = builddomain->ctxt.failsafe_callback_eip;
    6.19 -    p->thread.start_info_frame = builddomain->ctxt.start_info_frame;
    6.20      
    6.21      /* NB. Page base must already be pinned! */
    6.22      phys_l2tab = builddomain->ctxt.pt_base;
    6.23 @@ -376,30 +371,9 @@ int final_setup_guestos(struct task_stru
    6.24      /* Set up the shared info structure. */
    6.25      update_dom_time(p->shared_info);
    6.26  
    6.27 -    startinfo = (start_info_t *)
    6.28 -        map_domain_mem(p->thread.start_info_frame << PAGE_SHIFT);
    6.29 -
    6.30      /* Add virtual network interfaces and point to them in startinfo. */
    6.31      while ( builddomain->num_vifs-- > 0 )
    6.32 -    {
    6.33 -        net_vif = create_net_vif(p->domain);
    6.34 -        shared_rings = net_vif->shared_rings;
    6.35 -        if (!shared_rings) panic("no network ring!\n");
    6.36 -    }
    6.37 -
    6.38 -    for ( i = 0; i < MAX_DOMAIN_VIFS; i++ )
    6.39 -    {
    6.40 -        if ( p->net_vif_list[i] == NULL ) continue;
    6.41 -        startinfo->net_rings[i] = 
    6.42 -            virt_to_phys(p->net_vif_list[i]->shared_rings);
    6.43 -        memcpy(startinfo->net_vmac[i],
    6.44 -               p->net_vif_list[i]->vmac, ETH_ALEN);
    6.45 -    }
    6.46 -
    6.47 -    /* Add block io interface */
    6.48 -    startinfo->blk_ring = virt_to_phys(p->blk_ring_base);
    6.49 -
    6.50 -    unmap_domain_mem(startinfo);
    6.51 +        (void)create_net_vif(p->domain);
    6.52  
    6.53      p->flags |= PF_CONSTRUCTED;
    6.54      
    6.55 @@ -438,8 +412,6 @@ int setup_guestos(struct task_struct *p,
    6.56      l2_pgentry_t *l2tab, *l2start;
    6.57      l1_pgentry_t *l1tab = NULL, *l1start = NULL;
    6.58      struct pfn_info *page = NULL;
    6.59 -    net_ring_t *shared_rings;
    6.60 -    net_vif_t *net_vif;
    6.61  
    6.62      /* Sanity! */
    6.63      if ( p->domain != 0 ) BUG();
    6.64 @@ -581,9 +553,6 @@ int setup_guestos(struct task_struct *p,
    6.65      update_dom_time(p->shared_info);
    6.66      p->shared_info->domain_time = 0;
    6.67  
    6.68 -    /* DOM0 can't be stopped/started, so no need for an ongoing s.i. frame. */
    6.69 -    p->thread.start_info_frame = 0;
    6.70 -
    6.71      virt_startinfo_address = (start_info_t *)
    6.72          (virt_load_address + ((alloc_index - 1) << PAGE_SHIFT));
    6.73      virt_stack_address  = (unsigned long)virt_startinfo_address;
    6.74 @@ -636,23 +605,8 @@ int setup_guestos(struct task_struct *p,
    6.75      }
    6.76  
    6.77      /* Add virtual network interfaces and point to them in startinfo. */
    6.78 -    while (num_vifs-- > 0) {
    6.79 -        net_vif = create_net_vif(dom);
    6.80 -        shared_rings = net_vif->shared_rings;
    6.81 -        if (!shared_rings) panic("no network ring!\n");
    6.82 -    }
    6.83 -
    6.84 -    for ( i = 0; i < MAX_DOMAIN_VIFS; i++ )
    6.85 -    {
    6.86 -        if ( p->net_vif_list[i] == NULL ) continue;
    6.87 -        virt_startinfo_address->net_rings[i] = 
    6.88 -            virt_to_phys(p->net_vif_list[i]->shared_rings);
    6.89 -        memcpy(virt_startinfo_address->net_vmac[i],
    6.90 -               p->net_vif_list[i]->vmac, ETH_ALEN);
    6.91 -    }
    6.92 -
    6.93 -    /* Add block io interface */
    6.94 -    virt_startinfo_address->blk_ring = virt_to_phys(p->blk_ring_base); 
    6.95 +    while ( num_vifs-- > 0 )
    6.96 +        (void)create_net_vif(dom);
    6.97  
    6.98      dst = virt_startinfo_address->cmd_line;
    6.99      if ( cmdline != NULL )
     7.1 --- a/xen/drivers/block/xen_block.c	Wed Nov 05 09:07:50 2003 +0000
     7.2 +++ b/xen/drivers/block/xen_block.c	Wed Nov 05 10:48:47 2003 +0000
     7.3 @@ -281,6 +281,11 @@ long do_block_io_op(block_io_op_t *u_blo
     7.4          }
     7.5          break;
     7.6  
     7.7 +    case BLOCK_IO_OP_RING_ADDRESS:
     7.8 +        op.u.ring_mfn = virt_to_phys(p->blk_ring_base) >> PAGE_SHIFT;
     7.9 +        ret = copy_to_user(u_block_io_op, &op, sizeof(op)) ? -EFAULT : 0;
    7.10 +        break;
    7.11 +
    7.12      default: 
    7.13  	ret = -ENOSYS; 
    7.14      } 
     8.1 --- a/xen/include/asm-i386/processor.h	Wed Nov 05 09:07:50 2003 +0000
     8.2 +++ b/xen/include/asm-i386/processor.h	Wed Nov 05 10:48:47 2003 +0000
     8.3 @@ -354,7 +354,6 @@ struct tss_struct {
     8.4  };
     8.5  
     8.6  struct thread_struct {
     8.7 -    unsigned long start_info_frame; /* Filled in on DOM0_START */
     8.8      unsigned long esp1, ss1;
     8.9  /* Hardware debugging registers */
    8.10      unsigned long	debugreg[8];  /* %%db0-7 debug registers */
    8.11 @@ -386,7 +385,7 @@ extern struct desc_struct *idt_tables[];
    8.12  long set_fast_trap(struct task_struct *p, int idx);
    8.13  
    8.14  #define INIT_THREAD  {						\
    8.15 -	0, 0, 0,		      		       		\
    8.16 +	0, 0,		      		       			\
    8.17  	{ [0 ... 7] = 0 },	/* debugging registers */	\
    8.18  	{ { 0, }, },		/* 387 state */			\
    8.19  	0x20, { 0, 0 },		/* DEFAULT_FAST_TRAP */		\
     9.1 --- a/xen/include/hypervisor-ifs/dom0_ops.h	Wed Nov 05 09:07:50 2003 +0000
     9.2 +++ b/xen/include/hypervisor-ifs/dom0_ops.h	Wed Nov 05 10:48:47 2003 +0000
     9.3 @@ -41,7 +41,6 @@ typedef struct full_execution_context_st
     9.4      unsigned long event_callback_eip;
     9.5      unsigned long failsafe_callback_cs;     /* CS:EIP of failsafe callback  */
     9.6      unsigned long failsafe_callback_eip;
     9.7 -    unsigned long start_info_frame;         /* Page frame containing s.i.   */
     9.8  } full_execution_context_t;
     9.9  
    9.10  #define MAX_CMD_LEN       256
    10.1 --- a/xen/include/hypervisor-ifs/hypervisor-if.h	Wed Nov 05 09:07:50 2003 +0000
    10.2 +++ b/xen/include/hypervisor-ifs/hypervisor-if.h	Wed Nov 05 10:48:47 2003 +0000
    10.3 @@ -286,18 +286,15 @@ typedef struct shared_info_st {
    10.4   * NB. We expect that this struct is smaller than a page.
    10.5   */
    10.6  typedef struct start_info_st {
    10.7 +    /* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME.     */
    10.8 +    unsigned long nr_pages;	  /* total pages allocated to this domain. */
    10.9 +    unsigned long shared_info;	  /* MACHINE address of shared info struct.*/
   10.10 +    unsigned long dom_id;         /* Domain identifier.                    */
   10.11 +    unsigned long flags;          /* SIF_xxx flags.                        */
   10.12      /* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME).      */
   10.13      unsigned long pt_base;	  /* VIRTUAL address of page directory.    */
   10.14      unsigned long mod_start;	  /* VIRTUAL address of pre-loaded module. */
   10.15      unsigned long mod_len;	  /* Size (bytes) of pre-loaded module.    */
   10.16 -    /* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME.     */
   10.17 -    unsigned long nr_pages;	  /* total pages allocated to this domain. */
   10.18 -    unsigned long shared_info;	  /* MACHINE address of shared info struct.*/
   10.19 -    unsigned int  dom_id;         /* Domain identifier.                    */
   10.20 -    unsigned long flags;          /* SIF_xxx flags.                        */
   10.21 -    unsigned long net_rings[MAX_DOMAIN_VIFS];   /* MACHINE address of ring.*/
   10.22 -    unsigned char net_vmac[MAX_DOMAIN_VIFS][6]; /* MAC address of VIF.     */
   10.23 -    unsigned long blk_ring;       /* MACHINE address of blkdev ring.       */
   10.24      unsigned char cmd_line[1];	  /* Variable-length options.              */
   10.25  } start_info_t;
   10.26  
    11.1 --- a/xen/include/hypervisor-ifs/network.h	Wed Nov 05 09:07:50 2003 +0000
    11.2 +++ b/xen/include/hypervisor-ifs/network.h	Wed Nov 05 10:48:47 2003 +0000
    11.3 @@ -19,6 +19,18 @@
    11.4  #define NETOP_PUSH_BUFFERS    0  /* Notify Xen of new buffers on the rings. */
    11.5  #define NETOP_FLUSH_BUFFERS   1  /* Flush all pending request buffers.      */
    11.6  #define NETOP_RESET_RINGS     2  /* Reset ring indexes on a quiescent vif.  */
    11.7 +#define NETOP_GET_VIF_INFO    3  /* Query information for this vif.         */
    11.8 +typedef struct netop_st {
    11.9 +    unsigned int cmd; /* NETOP_xxx */
   11.10 +    unsigned int vif; /* VIF index */
   11.11 +    union {
   11.12 +        struct {
   11.13 +            unsigned long ring_mfn; /* Page frame containing net_ring_t. */
   11.14 +            unsigned char vmac[6];  /* Virtual Ethernet MAC address.     */
   11.15 +        } get_vif_info;
   11.16 +    } u;
   11.17 +} netop_t;
   11.18 +
   11.19  
   11.20  typedef struct tx_req_entry_st
   11.21  {
    12.1 --- a/xen/include/hypervisor-ifs/vbd.h	Wed Nov 05 09:07:50 2003 +0000
    12.2 +++ b/xen/include/hypervisor-ifs/vbd.h	Wed Nov 05 10:48:47 2003 +0000
    12.3 @@ -78,9 +78,10 @@ typedef struct xen_vbd_info
    12.4  /* Block I/O trap operations and associated structures.
    12.5   */
    12.6  
    12.7 -#define BLOCK_IO_OP_SIGNAL      0    /* let xen know we have work to do */ 
    12.8 -#define BLOCK_IO_OP_ATTACH_VBD  1    /* attach a VBD to a given domain */
    12.9 -#define BLOCK_IO_OP_RESET       2    /* reset ring indexes on quiescent i/f */
   12.10 +#define BLOCK_IO_OP_SIGNAL       0 /* let xen know we have work to do     */ 
   12.11 +#define BLOCK_IO_OP_ATTACH_VBD   1 /* attach a VBD to a given domain      */
   12.12 +#define BLOCK_IO_OP_RESET        2 /* reset ring indexes on quiescent i/f */
   12.13 +#define BLOCK_IO_OP_RING_ADDRESS 3 /* returns machine address of I/O ring */
   12.14  
   12.15  typedef struct _extent { 
   12.16      u16       raw_device; 
   12.17 @@ -103,9 +104,10 @@ typedef struct block_io_op_st
   12.18      unsigned long cmd;
   12.19      union
   12.20      {
   12.21 -        /* no entry for BLOCK_IO_OP_SIGNAL */
   12.22 +        /* no entry for BLOCK_IO_OP_SIGNAL       */
   12.23  	vbd_attach_t attach_info; 
   12.24 -        /* no entry for BLOCK_IO_OP_RESET  */
   12.25 +        /* no entry for BLOCK_IO_OP_RESET        */
   12.26 +        unsigned long ring_mfn;
   12.27      }
   12.28      u;
   12.29  } block_io_op_t;
    13.1 --- a/xen/net/dev.c	Wed Nov 05 09:07:50 2003 +0000
    13.2 +++ b/xen/net/dev.c	Wed Nov 05 10:48:47 2003 +0000
    13.3 @@ -27,11 +27,10 @@
    13.4  #include <linux/brlock.h>
    13.5  #include <linux/init.h>
    13.6  #include <linux/module.h>
    13.7 -
    13.8  #include <linux/event.h>
    13.9  #include <asm/domain_page.h>
   13.10  #include <asm/pgalloc.h>
   13.11 -
   13.12 +#include <asm/io.h>
   13.13  #include <xeno/perfc.h>
   13.14  
   13.15  #define BUG_TRAP ASSERT
   13.16 @@ -2209,17 +2208,22 @@ long flush_bufs_for_vif(net_vif_t *vif)
   13.17   * Called from guest OS to notify updates to its transmit and/or receive
   13.18   * descriptor rings.
   13.19   */
   13.20 -long do_net_io_op(unsigned int op, unsigned int idx)
   13.21 +long do_net_io_op(netop_t *uop)
   13.22  {
   13.23 +    netop_t op;
   13.24      net_vif_t *vif;
   13.25      long ret;
   13.26  
   13.27      perfc_incr(net_hypercalls);
   13.28  
   13.29 -    if ( (vif = current->net_vif_list[idx]) == NULL )
   13.30 +    if ( copy_from_user(&op, uop, sizeof(op)) )
   13.31 +        return -EFAULT;
   13.32 +
   13.33 +    if ( (op.vif >= MAX_DOMAIN_VIFS) || 
   13.34 +         ((vif = current->net_vif_list[op.vif]) == NULL) )
   13.35          return -EINVAL;
   13.36  
   13.37 -    switch ( op )
   13.38 +    switch ( op.cmd )
   13.39      {
   13.40      case NETOP_PUSH_BUFFERS:
   13.41          ret = get_bufs_from_vif(vif);
   13.42 @@ -2247,6 +2251,13 @@ long do_net_io_op(unsigned int op, unsig
   13.43          spin_unlock_irq(&vif->tx_lock);
   13.44          break;
   13.45  
   13.46 +    case NETOP_GET_VIF_INFO:
   13.47 +        op.u.get_vif_info.ring_mfn = 
   13.48 +            virt_to_phys(vif->shared_rings) >> PAGE_SHIFT;
   13.49 +        memcpy(op.u.get_vif_info.vmac, vif->vmac, ETH_ALEN);
   13.50 +        ret = copy_to_user(uop, &op, sizeof(op)) ? -EFAULT: 0;
   13.51 +        break;
   13.52 +
   13.53      default:
   13.54          ret = -EINVAL;
   13.55          break;
    14.1 --- a/xenolinux-2.4.22-sparse/arch/xeno/drivers/block/xl_block.c	Wed Nov 05 09:07:50 2003 +0000
    14.2 +++ b/xenolinux-2.4.22-sparse/arch/xeno/drivers/block/xl_block.c	Wed Nov 05 10:48:47 2003 +0000
    14.3 @@ -599,7 +599,10 @@ static void reset_xlblk_interface(void)
    14.4      if ( HYPERVISOR_block_io_op(&op) != 0 )
    14.5          printk(KERN_ALERT "Possible blkdev trouble: couldn't reset ring\n");
    14.6  
    14.7 -    set_fixmap(FIX_BLKRING_BASE, start_info.blk_ring);
    14.8 +    op.cmd = BLOCK_IO_OP_RING_ADDRESS;
    14.9 +    (void)HYPERVISOR_block_io_op(&op);
   14.10 +
   14.11 +    set_fixmap(FIX_BLKRING_BASE, op.u.ring_mfn << PAGE_SHIFT);
   14.12      blk_ring = (blk_ring_t *)fix_to_virt(FIX_BLKRING_BASE);
   14.13      blk_ring->req_prod = blk_ring->resp_prod = resp_cons = req_prod = 0;
   14.14  
    15.1 --- a/xenolinux-2.4.22-sparse/arch/xeno/drivers/network/network.c	Wed Nov 05 09:07:50 2003 +0000
    15.2 +++ b/xenolinux-2.4.22-sparse/arch/xeno/drivers/network/network.c	Wed Nov 05 10:48:47 2003 +0000
    15.3 @@ -118,13 +118,29 @@ static void dbg_network_int(int irq, voi
    15.4  static int network_open(struct net_device *dev)
    15.5  {
    15.6      struct net_private *np = dev->priv;
    15.7 -    int i;
    15.8 +    netop_t netop;
    15.9 +    int i, ret;
   15.10  
   15.11 -    if ( HYPERVISOR_net_io_op(NETOP_RESET_RINGS, np->idx) != 0 )
   15.12 +    netop.cmd = NETOP_RESET_RINGS;
   15.13 +    netop.vif = np->idx;
   15.14 +    if ( (ret = HYPERVISOR_net_io_op(&netop)) != 0 )
   15.15 +    {
   15.16          printk(KERN_ALERT "Possible net trouble: couldn't reset ring idxs\n");
   15.17 +        return ret;
   15.18 +    }
   15.19 +
   15.20 +    netop.cmd = NETOP_GET_VIF_INFO;
   15.21 +    netop.vif = np->idx;
   15.22 +    if ( (ret = HYPERVISOR_net_io_op(&netop)) != 0 )
   15.23 +    {
   15.24 +        printk(KERN_ALERT "Couldn't get info for vif %d\n", np->idx);
   15.25 +        return ret;
   15.26 +    }
   15.27 +
   15.28 +    memcpy(dev->dev_addr, netop.u.get_vif_info.vmac, ETH_ALEN);
   15.29  
   15.30      set_fixmap(FIX_NETRING0_BASE + np->net_ring_fixmap_idx, 
   15.31 -               start_info.net_rings[np->idx]);
   15.32 +               netop.u.get_vif_info.ring_mfn << PAGE_SHIFT);
   15.33      np->net_ring = (net_ring_t *)fix_to_virt(
   15.34          FIX_NETRING0_BASE + np->net_ring_fixmap_idx);
   15.35      np->net_idx  = &HYPERVISOR_shared_info->net_idx[np->idx];
   15.36 @@ -209,6 +225,7 @@ static void network_alloc_rx_buffers(str
   15.37      struct net_private *np = dev->priv;
   15.38      struct sk_buff *skb;
   15.39      unsigned int end = RX_RING_ADD(np->rx_resp_cons, RX_MAX_ENTRIES);    
   15.40 +    netop_t netop;
   15.41  
   15.42      if ( ((i = np->net_idx->rx_req_prod) == end) ||
   15.43           (np->state != STATE_ACTIVE) )
   15.44 @@ -245,7 +262,9 @@ static void network_alloc_rx_buffers(str
   15.45      /* Batch Xen notifications. */
   15.46      if ( np->rx_bufs_to_notify > (RX_MAX_ENTRIES/4) )
   15.47      {
   15.48 -        HYPERVISOR_net_io_op(NETOP_PUSH_BUFFERS, np->idx);
   15.49 +        netop.cmd = NETOP_PUSH_BUFFERS;
   15.50 +        netop.vif = np->idx;
   15.51 +        (void)HYPERVISOR_net_io_op(&netop);
   15.52          np->rx_bufs_to_notify = 0;
   15.53      }
   15.54  }
   15.55 @@ -255,6 +274,7 @@ static int network_start_xmit(struct sk_
   15.56  {
   15.57      unsigned int i, id;
   15.58      struct net_private *np = (struct net_private *)dev->priv;
   15.59 +    netop_t netop;
   15.60  
   15.61      if ( np->tx_full )
   15.62      {
   15.63 @@ -303,7 +323,11 @@ static int network_start_xmit(struct sk_
   15.64      /* Only notify Xen if there are no outstanding responses. */
   15.65      mb();
   15.66      if ( np->net_idx->tx_resp_prod == i )
   15.67 -        HYPERVISOR_net_io_op(NETOP_PUSH_BUFFERS, np->idx);
   15.68 +    {
   15.69 +        netop.cmd = NETOP_PUSH_BUFFERS;
   15.70 +        netop.vif = np->idx;
   15.71 +        (void)HYPERVISOR_net_io_op(&netop);
   15.72 +    }
   15.73  
   15.74      return 0;
   15.75  }
   15.76 @@ -391,13 +415,16 @@ static void network_interrupt(int irq, v
   15.77  int network_close(struct net_device *dev)
   15.78  {
   15.79      struct net_private *np = dev->priv;
   15.80 +    netop_t netop;
   15.81  
   15.82      np->state = STATE_SUSPENDED;
   15.83      wmb();
   15.84  
   15.85      netif_stop_queue(np->dev);
   15.86  
   15.87 -    HYPERVISOR_net_io_op(NETOP_FLUSH_BUFFERS, np->idx);
   15.88 +    netop.cmd = NETOP_FLUSH_BUFFERS;
   15.89 +    netop.vif = np->idx;
   15.90 +    (void)HYPERVISOR_net_io_op(&netop);
   15.91  
   15.92      while ( (np->rx_resp_cons != np->net_idx->rx_req_prod) ||
   15.93              (np->tx_resp_cons != np->net_idx->tx_req_prod) )
   15.94 @@ -498,6 +525,7 @@ int __init init_module(void)
   15.95      int i, fixmap_idx=-1, err;
   15.96      struct net_device *dev;
   15.97      struct net_private *np;
   15.98 +    netop_t netop;
   15.99  
  15.100      INIT_LIST_HEAD(&dev_list);
  15.101  
  15.102 @@ -523,7 +551,10 @@ int __init init_module(void)
  15.103  
  15.104      for ( i = 0; i < MAX_DOMAIN_VIFS; i++ )
  15.105      {
  15.106 -        if ( start_info.net_rings[i] == 0 )
  15.107 +        /* If the VIF is invalid then the query hypercall will fail. */
  15.108 +        netop.cmd = NETOP_GET_VIF_INFO;
  15.109 +        netop.vif = i;
  15.110 +        if ( HYPERVISOR_net_io_op(&netop) != 0 )
  15.111              continue;
  15.112  
  15.113          /* We actually only support up to 4 vifs right now. */
  15.114 @@ -548,7 +579,7 @@ int __init init_module(void)
  15.115          dev->stop            = network_close;
  15.116          dev->get_stats       = network_get_stats;
  15.117  
  15.118 -        memcpy(dev->dev_addr, start_info.net_vmac[i], ETH_ALEN);
  15.119 +        memcpy(dev->dev_addr, netop.u.get_vif_info.vmac, ETH_ALEN);
  15.120  
  15.121          if ( (err = register_netdev(dev)) != 0 )
  15.122          {
    16.1 --- a/xenolinux-2.4.22-sparse/arch/xeno/kernel/head.S	Wed Nov 05 09:07:50 2003 +0000
    16.2 +++ b/xenolinux-2.4.22-sparse/arch/xeno/kernel/head.S	Wed Nov 05 10:48:47 2003 +0000
    16.3 @@ -9,8 +9,8 @@
    16.4  #include <asm/desc.h>
    16.5  
    16.6  /* Offsets in start_info structure */
    16.7 -#define MOD_START   4
    16.8 -#define MOD_LEN     8
    16.9 +#define MOD_START 20
   16.10 +#define MOD_LEN   24
   16.11                  
   16.12  startup_32:
   16.13          cld
    17.1 --- a/xenolinux-2.4.22-sparse/include/asm-xeno/hypervisor.h	Wed Nov 05 09:07:50 2003 +0000
    17.2 +++ b/xenolinux-2.4.22-sparse/include/asm-xeno/hypervisor.h	Wed Nov 05 10:48:47 2003 +0000
    17.3 @@ -220,13 +220,13 @@ static inline int HYPERVISOR_set_callbac
    17.4      return ret;
    17.5  }
    17.6  
    17.7 -static inline int HYPERVISOR_net_io_op(unsigned int op, unsigned int idx)
    17.8 +static inline int HYPERVISOR_net_io_op(netop_t *op)
    17.9  {
   17.10      int ret;
   17.11      __asm__ __volatile__ (
   17.12          TRAP_INSTR
   17.13          : "=a" (ret) : "0" (__HYPERVISOR_net_io_op),
   17.14 -        "b" (op), "c" (idx) );
   17.15 +        "b" (op) );
   17.16  
   17.17      return ret;
   17.18  }