direct-io.hg

changeset 1422:44389f729723

bitkeeper revision 1.926 (40bd9cabtHdCYn95rortVN7FyCSxgg)

Clean up dom_mem_op hypercall.
author kaf24@scramble.cl.cam.ac.uk
date Wed Jun 02 09:23:55 2004 +0000 (2004-06-02)
parents abde9435cdb4
children 7e6b26d1ec0a
files .rootkeys xen/common/dom_mem_ops.c xen/include/hypervisor-ifs/arch-i386/hypervisor-if.h xen/include/hypervisor-ifs/arch-x86_64/hypervisor-if.h xen/include/hypervisor-ifs/dom_mem_ops.h xen/include/hypervisor-ifs/hypervisor-if.h xenolinux-2.4.26-sparse/arch/xen/drivers/balloon/balloon.c xenolinux-2.4.26-sparse/arch/xen/drivers/netif/backend/main.c xenolinux-2.4.26-sparse/arch/xen/drivers/netif/frontend/main.c xenolinux-2.4.26-sparse/arch/xen/mm/hypervisor.c xenolinux-2.4.26-sparse/include/asm-xen/hypervisor.h
line diff
     1.1 --- a/.rootkeys	Tue Jun 01 16:47:17 2004 +0000
     1.2 +++ b/.rootkeys	Wed Jun 02 09:23:55 2004 +0000
     1.3 @@ -543,7 +543,6 @@ 404f1bc68SXxmv0zQpXBWGrCzSyp8w xen/inclu
     1.4  404f1bc7IwU-qnH8mJeVu0YsNGMrcw xen/include/hypervisor-ifs/arch-x86_64/hypervisor-if.h
     1.5  3ddb79c2YTaZwOqWin9-QNgHge5RVw xen/include/hypervisor-ifs/block.h
     1.6  3ddb79c2PMeWTK86y4C3F4MzHw4A1g xen/include/hypervisor-ifs/dom0_ops.h
     1.7 -3e6377eaioRoNm0m_HSDEAd4Vqrq_w xen/include/hypervisor-ifs/dom_mem_ops.h
     1.8  403cd194j2pyLqXD8FJ-ukvZzkPenw xen/include/hypervisor-ifs/event_channel.h
     1.9  3ddb79c25UE59iu4JJcbRalx95mvcg xen/include/hypervisor-ifs/hypervisor-if.h
    1.10  3ead095dE_VF-QA88rl_5cWYRWtRVQ xen/include/hypervisor-ifs/kbd.h
     2.1 --- a/xen/common/dom_mem_ops.c	Tue Jun 01 16:47:17 2004 +0000
     2.2 +++ b/xen/common/dom_mem_ops.c	Wed Jun 02 09:23:55 2004 +0000
     2.3 @@ -10,20 +10,21 @@
     2.4  #include <xen/types.h>
     2.5  #include <xen/lib.h>
     2.6  #include <xen/mm.h>
     2.7 -#include <hypervisor-ifs/dom_mem_ops.h>
     2.8  #include <xen/perfc.h>
     2.9  #include <xen/sched.h>
    2.10  #include <xen/event.h>
    2.11  #include <asm/domain_page.h>
    2.12  
    2.13 -static long alloc_dom_mem(struct task_struct *p, reservation_increase_t op)
    2.14 +static long alloc_dom_mem(struct task_struct *p, 
    2.15 +                          unsigned long      *pages, 
    2.16 +                          unsigned long       nr_pages)
    2.17  {
    2.18      struct pfn_info *page;
    2.19      unsigned long    i;
    2.20  
    2.21      /* Leave some slack pages; e.g., for the network. */
    2.22 -    if ( unlikely(free_pfns < (op.size + (SLACK_DOMAIN_MEM_KILOBYTES >> 
    2.23 -                                          (PAGE_SHIFT-10)))) )
    2.24 +    if ( unlikely(free_pfns < (nr_pages + (SLACK_DOMAIN_MEM_KILOBYTES >> 
    2.25 +                                           (PAGE_SHIFT-10)))) )
    2.26      {
    2.27          DPRINTK("Not enough slack: %u %u\n",
    2.28                  free_pfns,
    2.29 @@ -31,7 +32,7 @@ static long alloc_dom_mem(struct task_st
    2.30          return 0;
    2.31      }
    2.32  
    2.33 -    for ( i = 0; i < op.size; i++ )
    2.34 +    for ( i = 0; i < nr_pages; i++ )
    2.35      {
    2.36          /* NB. 'alloc_domain_page' does limit-checking on pages per domain. */
    2.37          if ( unlikely((page = alloc_domain_page(p)) == NULL) )
    2.38 @@ -41,22 +42,24 @@ static long alloc_dom_mem(struct task_st
    2.39          }
    2.40  
    2.41          /* Inform the domain of the new page's machine address. */ 
    2.42 -        if ( unlikely(put_user(page_to_pfn(page), &op.pages[i]) != 0) )
    2.43 +        if ( unlikely(put_user(page_to_pfn(page), &pages[i]) != 0) )
    2.44              break;
    2.45      }
    2.46  
    2.47      return i;
    2.48  }
    2.49      
    2.50 -static long free_dom_mem(struct task_struct *p, reservation_decrease_t op)
    2.51 +static long free_dom_mem(struct task_struct *p, 
    2.52 +                         unsigned long      *pages, 
    2.53 +                         unsigned long       nr_pages)
    2.54  {
    2.55      struct pfn_info *page;
    2.56      unsigned long    i, mpfn;
    2.57      long             rc = 0;
    2.58  
    2.59 -    for ( i = 0; i < op.size; i++ )
    2.60 +    for ( i = 0; i < nr_pages; i++ )
    2.61      {
    2.62 -        if ( unlikely(get_user(mpfn, &op.pages[i]) != 0) )
    2.63 +        if ( unlikely(get_user(mpfn, &pages[i]) != 0) )
    2.64              break;
    2.65  
    2.66          if ( unlikely(mpfn >= max_page) )
    2.67 @@ -84,31 +87,16 @@ static long free_dom_mem(struct task_str
    2.68          put_page(page);
    2.69      }
    2.70  
    2.71 -    return rc ? rc : op.size;
    2.72 +    return rc ? rc : nr_pages;
    2.73  }
    2.74      
    2.75 -long do_dom_mem_op(dom_mem_op_t *mem_op)
    2.76 +long do_dom_mem_op(unsigned int op, void *pages, unsigned long nr_pages)
    2.77  {
    2.78 -    dom_mem_op_t dmop;
    2.79 -    unsigned long ret;
    2.80 -
    2.81 -    if ( copy_from_user(&dmop, mem_op, sizeof(dom_mem_op_t)) )
    2.82 -        return -EFAULT;
    2.83 +    if ( op == MEMOP_increase_reservation )
    2.84 +        return alloc_dom_mem(current, pages, nr_pages);
    2.85  
    2.86 -    switch ( dmop.op )
    2.87 -    {
    2.88 -    case MEMOP_RESERVATION_INCREASE:
    2.89 -        ret = alloc_dom_mem(current, dmop.u.increase);
    2.90 -        break;
    2.91 +    if ( op == MEMOP_decrease_reservation )
    2.92 +        return free_dom_mem(current, pages, nr_pages);
    2.93  
    2.94 -    case MEMOP_RESERVATION_DECREASE:
    2.95 -        ret = free_dom_mem(current, dmop.u.decrease);
    2.96 -        break;
    2.97 -
    2.98 -    default:
    2.99 -        ret = -ENOSYS;
   2.100 -        break;
   2.101 -    }
   2.102 -
   2.103 -    return ret;    
   2.104 +    return -ENOSYS;
   2.105  }
     3.1 --- a/xen/include/hypervisor-ifs/arch-i386/hypervisor-if.h	Tue Jun 01 16:47:17 2004 +0000
     3.2 +++ b/xen/include/hypervisor-ifs/arch-i386/hypervisor-if.h	Wed Jun 02 09:23:55 2004 +0000
     3.3 @@ -66,7 +66,7 @@ typedef struct trap_info_st
     3.4  {
     3.5      unsigned char  vector;  /* exception vector                              */
     3.6      unsigned char  flags;   /* 0-3: privilege level; 4: clear event enable?  */
     3.7 -    unsigned short cs;	    /* code selector                                 */
     3.8 +    unsigned short cs;      /* code selector                                 */
     3.9      unsigned long  address; /* code address                                  */
    3.10  } trap_info_t;
    3.11  
     4.1 --- a/xen/include/hypervisor-ifs/arch-x86_64/hypervisor-if.h	Tue Jun 01 16:47:17 2004 +0000
     4.2 +++ b/xen/include/hypervisor-ifs/arch-x86_64/hypervisor-if.h	Wed Jun 02 09:23:55 2004 +0000
     4.3 @@ -31,9 +31,9 @@
     4.4   * installing their own GDT.
     4.5   */
     4.6  
     4.7 -#define FLAT_RING3_CS32 0x0823	/* GDT index 260 */
     4.8 -#define FLAT_RING3_CS64 0x082b	/* GDT index 261 */
     4.9 -#define FLAT_RING3_DS 0x0833	/* GDT index 262 */
    4.10 +#define FLAT_RING3_CS32 0x0823  /* GDT index 260 */
    4.11 +#define FLAT_RING3_CS64 0x082b  /* GDT index 261 */
    4.12 +#define FLAT_RING3_DS   0x0833  /* GDT index 262 */
    4.13  
    4.14  #define FLAT_GUESTOS_DS   FLAT_RING3_DS
    4.15  #define FLAT_GUESTOS_CS   FLAT_RING3_CS64
    4.16 @@ -46,7 +46,7 @@
    4.17  /* And the trap vector is... */
    4.18  #define TRAP_INSTR "syscall"
    4.19  
    4.20 -
    4.21 +/* The machine->physical mapping table starts at this address, read-only. */
    4.22  #ifndef machine_to_phys_mapping
    4.23  #define machine_to_phys_mapping ((unsigned long *)0xffff810000000000ULL)
    4.24  #endif
    4.25 @@ -64,7 +64,7 @@ typedef struct trap_info_st
    4.26  {
    4.27      unsigned char  vector;  /* exception vector                              */
    4.28      unsigned char  flags;   /* 0-3: privilege level; 4: clear event enable?  */
    4.29 -    unsigned short cs;	    /* code selector                                 */
    4.30 +    unsigned short cs;      /* code selector                                 */
    4.31      unsigned long  address; /* code address                                  */
    4.32  } trap_info_t;
    4.33  
     5.1 --- a/xen/include/hypervisor-ifs/dom_mem_ops.h	Tue Jun 01 16:47:17 2004 +0000
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,30 +0,0 @@
     5.4 -/******************************************************************************
     5.5 - * dom_mem_ops.h
     5.6 - *
     5.7 - * Guest OS operations dealing with physical memory reservations.
     5.8 - *
     5.9 - * Copyright (c) 2003, B Dragovic & K A Fraser.
    5.10 - */
    5.11 -
    5.12 -#define MEMOP_RESERVATION_INCREASE 0
    5.13 -#define MEMOP_RESERVATION_DECREASE 1
    5.14 -
    5.15 -typedef struct reservation_increase {
    5.16 -    unsigned long   size;
    5.17 -    unsigned long   * pages;
    5.18 -} reservation_increase_t;
    5.19 -
    5.20 -typedef struct reservation_decrease {
    5.21 -    unsigned long   size;
    5.22 -    unsigned long   * pages;
    5.23 -} reservation_decrease_t;
    5.24 -
    5.25 -typedef struct dom_mem_op
    5.26 -{
    5.27 -    unsigned int op;
    5.28 -    union
    5.29 -    {
    5.30 -        reservation_increase_t increase;
    5.31 -        reservation_decrease_t decrease;
    5.32 -    } u;
    5.33 -} dom_mem_op_t;
     6.1 --- a/xen/include/hypervisor-ifs/hypervisor-if.h	Tue Jun 01 16:47:17 2004 +0000
     6.2 +++ b/xen/include/hypervisor-ifs/hypervisor-if.h	Wed Jun 02 09:23:55 2004 +0000
     6.3 @@ -56,7 +56,6 @@
     6.4   * 
     6.5   * Virtual interrupts that a guest OS may receive from the hypervisor.
     6.6   */
     6.7 -
     6.8  #define VIRQ_BLKDEV     0  /* A block device response has been queued. */
     6.9  #define VIRQ_TIMER      1  /* A timeout has been updated. */
    6.10  #define VIRQ_DIE        2  /* OS is about to be killed. Clean up please! */
    6.11 @@ -169,7 +168,7 @@
    6.12  
    6.13  
    6.14  /*
    6.15 - * SCHEDOP_* - Scheduler hypercall operations.
    6.16 + * Commands to HYPERVISOR_sched_op().
    6.17   */
    6.18  #define SCHEDOP_yield           0   /* Give up the CPU voluntarily.      */
    6.19  #define SCHEDOP_block           1   /* Block until an event is received. */
    6.20 @@ -182,6 +181,12 @@
    6.21  #define CONSOLEIO_write         0
    6.22  #define CONSOLEIO_read          1
    6.23  
    6.24 +/*
    6.25 + * Commands to HYPERVISOR_dom_mem_op().
    6.26 + */
    6.27 +#define MEMOP_increase_reservation 0
    6.28 +#define MEMOP_decrease_reservation 1
    6.29 +
    6.30  #ifndef __ASSEMBLY__
    6.31  
    6.32  typedef u64 domid_t;
     7.1 --- a/xenolinux-2.4.26-sparse/arch/xen/drivers/balloon/balloon.c	Tue Jun 01 16:47:17 2004 +0000
     7.2 +++ b/xenolinux-2.4.26-sparse/arch/xen/drivers/balloon/balloon.c	Wed Jun 02 09:23:55 2004 +0000
     7.3 @@ -24,8 +24,6 @@
     7.4  #include <asm/uaccess.h>
     7.5  #include <asm/tlb.h>
     7.6  
     7.7 -#include <asm/hypervisor-ifs/dom_mem_ops.h>
     7.8 -
     7.9  /* USER DEFINES -- THESE SHOULD BE COPIED TO USER-SPACE TOOLS */
    7.10  #define USER_INFLATE_BALLOON  1   /* return mem to hypervisor */
    7.11  #define USER_DEFLATE_BALLOON  2   /* claim mem from hypervisor */
    7.12 @@ -59,7 +57,6 @@ static inline pte_t *get_ptep(unsigned l
    7.13  /* main function for relinquishing bit of memory */
    7.14  static unsigned long inflate_balloon(unsigned long num_pages)
    7.15  {
    7.16 -    dom_mem_op_t dom_mem_op;
    7.17      unsigned long *parray;
    7.18      unsigned long *currp;
    7.19      unsigned long curraddr;
    7.20 @@ -67,19 +64,18 @@ static unsigned long inflate_balloon(uns
    7.21      unsigned long vaddr;
    7.22      unsigned long i, j;
    7.23  
    7.24 -    parray = (unsigned long *)kmalloc(num_pages *
    7.25 -                                      sizeof(unsigned long), GFP_KERNEL);
    7.26 +    parray = (unsigned long *)kmalloc(num_pages * sizeof(unsigned long),
    7.27 +                                      GFP_KERNEL);
    7.28      currp = parray;
    7.29  
    7.30      for ( i = 0; i < num_pages; i++ )
    7.31      {
    7.32 -        /* try to obtain a free page, has to be done with GFP_ATOMIC
    7.33 -         * as we do not want to sleep indefinately.
    7.34 -         */
    7.35 +        /* Try to obtain a free page (has to be done with GFP_ATOMIC). */
    7.36          vaddr = __get_free_page(GFP_ATOMIC);
    7.37  
    7.38 -        /* if allocation fails, free all reserved pages */
    7.39 -        if(!vaddr){
    7.40 +        /* If allocation fails then free all reserved pages. */
    7.41 +        if ( vaddr == 0 )
    7.42 +        {
    7.43              printk("Unable to inflate balloon by %ld, only %ld pages free.",
    7.44                     num_pages, i);
    7.45              currp = parray;
    7.46 @@ -105,10 +101,9 @@ static unsigned long inflate_balloon(uns
    7.47  
    7.48      XEN_flush_page_update_queue();
    7.49  
    7.50 -    dom_mem_op.op = MEMOP_RESERVATION_DECREASE;
    7.51 -    dom_mem_op.u.decrease.size  = num_pages;
    7.52 -    dom_mem_op.u.decrease.pages = parray;
    7.53 -    if ( (ret = HYPERVISOR_dom_mem_op(&dom_mem_op)) != num_pages )
    7.54 +    ret = HYPERVISOR_dom_mem_op(MEMOP_decrease_reservation, 
    7.55 +                                parray, num_pages);
    7.56 +    if ( unlikely(ret != num_pages) )
    7.57      {
    7.58          printk("Unable to inflate balloon, error %lx\n", ret);
    7.59          goto cleanup;
    7.60 @@ -177,12 +172,9 @@ static unsigned long process_new_pages(u
    7.61  
    7.62  unsigned long deflate_balloon(unsigned long num_pages)
    7.63  {
    7.64 -    dom_mem_op_t dom_mem_op;
    7.65      unsigned long ret;
    7.66      unsigned long * parray;
    7.67  
    7.68 -    printk(KERN_ALERT "bd240 debug: deflate balloon called for %lx pages\n", num_pages);
    7.69 -
    7.70      if ( num_pages > credit )
    7.71      {
    7.72          printk("Can not allocate more pages than previously released.\n");
    7.73 @@ -192,15 +184,16 @@ unsigned long deflate_balloon(unsigned l
    7.74      parray = (unsigned long *)kmalloc(num_pages * sizeof(unsigned long), 
    7.75                                        GFP_KERNEL);
    7.76  
    7.77 -    dom_mem_op.op = MEMOP_RESERVATION_INCREASE;
    7.78 -    dom_mem_op.u.increase.size = num_pages;
    7.79 -    dom_mem_op.u.increase.pages = parray;
    7.80 -    if((ret = HYPERVISOR_dom_mem_op(&dom_mem_op)) != num_pages){
    7.81 +    ret = HYPERVISOR_dom_mem_op(MEMOP_increase_reservation, 
    7.82 +                                parray, num_pages);
    7.83 +    if ( unlikely(ret != num_pages) )
    7.84 +    {
    7.85          printk("Unable to deflate balloon, error %lx\n", ret);
    7.86          goto cleanup;
    7.87      }
    7.88  
    7.89 -    if((ret = process_new_pages(parray, num_pages)) < num_pages){
    7.90 +    if ( (ret = process_new_pages(parray, num_pages)) < num_pages )
    7.91 +    {
    7.92          printk("Unable to deflate balloon by specified %lx pages, only %lx.\n",
    7.93                 num_pages, ret);
    7.94          goto cleanup;
    7.95 @@ -255,8 +248,7 @@ static int __init init_module(void)
    7.96  
    7.97      credit = 0;
    7.98  
    7.99 -    balloon_pde = create_xen_proc_entry("balloon", 0600);
   7.100 -    if ( balloon_pde == NULL )
   7.101 +    if ( (balloon_pde = create_xen_proc_entry("balloon", 0600)) == NULL )
   7.102      {
   7.103          printk(KERN_ALERT "Unable to create balloon driver proc entry!");
   7.104          return -1;
     8.1 --- a/xenolinux-2.4.26-sparse/arch/xen/drivers/netif/backend/main.c	Tue Jun 01 16:47:17 2004 +0000
     8.2 +++ b/xenolinux-2.4.26-sparse/arch/xen/drivers/netif/backend/main.c	Wed Jun 02 09:23:55 2004 +0000
     8.3 @@ -11,7 +11,6 @@
     8.4   */
     8.5  
     8.6  #include "common.h"
     8.7 -#include <asm/hypervisor-ifs/dom_mem_ops.h>
     8.8  
     8.9  static void netif_page_release(struct page *page);
    8.10  static void make_tx_response(netif_t *netif, 
    8.11 @@ -80,12 +79,9 @@ static spinlock_t mfn_lock = SPIN_LOCK_U
    8.12  
    8.13  static void __refresh_mfn_list(void)
    8.14  {
    8.15 -    int ret;
    8.16 -    dom_mem_op_t op;
    8.17 -    op.op = MEMOP_RESERVATION_INCREASE;
    8.18 -    op.u.increase.size  = MAX_MFN_ALLOC;
    8.19 -    op.u.increase.pages = mfn_list;
    8.20 -    if ( (ret = HYPERVISOR_dom_mem_op(&op)) != MAX_MFN_ALLOC )
    8.21 +    int ret = HYPERVISOR_dom_mem_op(MEMOP_increase_reservation,
    8.22 +                                    mfn_list, MAX_MFN_ALLOC);
    8.23 +    if ( unlikely(ret != MAX_MFN_ALLOC) )
    8.24      {
    8.25          printk(KERN_ALERT "Unable to increase memory reservation (%d)\n", ret);
    8.26          BUG();
    8.27 @@ -107,21 +103,11 @@ static unsigned long get_new_mfn(void)
    8.28  static void dealloc_mfn(unsigned long mfn)
    8.29  {
    8.30      unsigned long flags;
    8.31 -    dom_mem_op_t  op;
    8.32 -
    8.33      spin_lock_irqsave(&mfn_lock, flags);
    8.34      if ( alloc_index != MAX_MFN_ALLOC )
    8.35 -    {
    8.36 -        /* Usually we can put the MFN back on the quicklist. */
    8.37          mfn_list[alloc_index++] = mfn;
    8.38 -    }
    8.39      else
    8.40 -    {
    8.41 -        op.op = MEMOP_RESERVATION_INCREASE;
    8.42 -        op.u.decrease.size  = 1;
    8.43 -        op.u.decrease.pages = &mfn;
    8.44 -        (void)HYPERVISOR_dom_mem_op(&op);
    8.45 -    }
    8.46 +        (void)HYPERVISOR_dom_mem_op(MEMOP_decrease_reservation, &mfn, 1);
    8.47      spin_unlock_irqrestore(&mfn_lock, flags);
    8.48  }
    8.49  
     9.1 --- a/xenolinux-2.4.26-sparse/arch/xen/drivers/netif/frontend/main.c	Tue Jun 01 16:47:17 2004 +0000
     9.2 +++ b/xenolinux-2.4.26-sparse/arch/xen/drivers/netif/frontend/main.c	Wed Jun 02 09:23:55 2004 +0000
     9.3 @@ -27,7 +27,6 @@
     9.4  
     9.5  #include <asm/evtchn.h>
     9.6  #include <asm/ctrl_if.h>
     9.7 -#include <asm/hypervisor-ifs/dom_mem_ops.h>
     9.8  
     9.9  #include "../netif.h"
    9.10  
    9.11 @@ -181,7 +180,6 @@ static void network_alloc_rx_buffers(str
    9.12      struct net_private *np = dev->priv;
    9.13      struct sk_buff *skb;
    9.14      NETIF_RING_IDX i = np->rx->req_prod;
    9.15 -    dom_mem_op_t op;
    9.16      int nr_pfns = 0;
    9.17  
    9.18      /* Make sure the batch is large enough to be worthwhile (1/2 ring). */
    9.19 @@ -225,11 +223,10 @@ static void network_alloc_rx_buffers(str
    9.20      rx_mcl[nr_pfns-1].args[2] = UVMF_FLUSH_TLB;
    9.21  
    9.22      /* Give away a batch of pages. */
    9.23 -    op.op = MEMOP_RESERVATION_DECREASE;
    9.24 -    op.u.decrease.size  = nr_pfns;
    9.25 -    op.u.decrease.pages = rx_pfn_array;
    9.26      rx_mcl[nr_pfns].op = __HYPERVISOR_dom_mem_op;
    9.27 -    rx_mcl[nr_pfns].args[0] = (unsigned long)&op;
    9.28 +    rx_mcl[nr_pfns].args[0] = MEMOP_decrease_reservation;
    9.29 +    rx_mcl[nr_pfns].args[1] = (unsigned long)rx_pfn_array;
    9.30 +    rx_mcl[nr_pfns].args[2] = (unsigned long)nr_pfns;
    9.31  
    9.32      /* Zap PTEs and give away pages in one big multicall. */
    9.33      (void)HYPERVISOR_multicall(rx_mcl, nr_pfns+1);
    10.1 --- a/xenolinux-2.4.26-sparse/arch/xen/mm/hypervisor.c	Tue Jun 01 16:47:17 2004 +0000
    10.2 +++ b/xenolinux-2.4.26-sparse/arch/xen/mm/hypervisor.c	Wed Jun 02 09:23:55 2004 +0000
    10.3 @@ -11,7 +11,6 @@
    10.4  #include <linux/mm.h>
    10.5  #include <linux/vmalloc.h>
    10.6  #include <asm/hypervisor.h>
    10.7 -#include <asm/hypervisor-ifs/dom_mem_ops.h>
    10.8  #include <asm/page.h>
    10.9  #include <asm/pgtable.h>
   10.10  #include <asm/multicall.h>
   10.11 @@ -269,7 +268,6 @@ unsigned long allocate_empty_lowmem_regi
   10.12      unsigned long  i;
   10.13      int            ret;
   10.14      unsigned int   order = get_order(pages*PAGE_SIZE);
   10.15 -    dom_mem_op_t   dom_mem_op;
   10.16  
   10.17      vstart = __get_free_pages(GFP_KERNEL, order);
   10.18      if ( vstart == 0 )
   10.19 @@ -291,10 +289,9 @@ unsigned long allocate_empty_lowmem_regi
   10.20  
   10.21      flush_page_update_queue();
   10.22  
   10.23 -    dom_mem_op.op = MEMOP_RESERVATION_DECREASE;
   10.24 -    dom_mem_op.u.decrease.size  = 1<<order;
   10.25 -    dom_mem_op.u.decrease.pages = pfn_array;
   10.26 -    if ( (ret = HYPERVISOR_dom_mem_op(&dom_mem_op)) != (1<<order) )
   10.27 +    ret = HYPERVISOR_dom_mem_op(MEMOP_decrease_reservation, 
   10.28 +                                pfn_array, 1<<order);
   10.29 +    if ( unlikely(ret != (1<<order)) )
   10.30      {
   10.31          printk(KERN_WARNING "Unable to reduce memory reservation (%d)\n", ret);
   10.32          BUG();
   10.33 @@ -314,16 +311,14 @@ void deallocate_lowmem_region(unsigned l
   10.34      unsigned long  i;
   10.35      int            ret;
   10.36      unsigned int   order = get_order(pages*PAGE_SIZE);
   10.37 -    dom_mem_op_t   dom_mem_op;
   10.38  
   10.39      pfn_array = vmalloc((1<<order) * sizeof(*pfn_array));
   10.40      if ( pfn_array == NULL )
   10.41          BUG();
   10.42  
   10.43 -    dom_mem_op.op = MEMOP_RESERVATION_INCREASE;
   10.44 -    dom_mem_op.u.increase.size  = 1<<order;
   10.45 -    dom_mem_op.u.increase.pages = pfn_array;
   10.46 -    if ( (ret = HYPERVISOR_dom_mem_op(&dom_mem_op)) != (1<<order) )
   10.47 +    ret = HYPERVISOR_dom_mem_op(MEMOP_increase_reservation,
   10.48 +                                pfn_array, 1<<order);
   10.49 +    if ( unlikely(ret != (1<<order)) )
   10.50      {
   10.51          printk(KERN_WARNING "Unable to increase memory reservation (%d)\n",
   10.52                 ret);
    11.1 --- a/xenolinux-2.4.26-sparse/include/asm-xen/hypervisor.h	Tue Jun 01 16:47:17 2004 +0000
    11.2 +++ b/xenolinux-2.4.26-sparse/include/asm-xen/hypervisor.h	Wed Jun 02 09:23:55 2004 +0000
    11.3 @@ -368,13 +368,15 @@ static inline int HYPERVISOR_set_fast_tr
    11.4      return ret;
    11.5  }
    11.6  
    11.7 -static inline int HYPERVISOR_dom_mem_op(void *dom_mem_op)
    11.8 +static inline int HYPERVISOR_dom_mem_op(unsigned int   op,
    11.9 +                                        unsigned long *pages,
   11.10 +                                        unsigned long  nr_pages)
   11.11  {
   11.12      int ret;
   11.13      __asm__ __volatile__ (
   11.14          TRAP_INSTR
   11.15          : "=a" (ret) : "0" (__HYPERVISOR_dom_mem_op),
   11.16 -        "b" (dom_mem_op) : "memory" );
   11.17 +        "b" (op), "c" (pages), "d" (nr_pages) : "memory" );
   11.18  
   11.19      return ret;
   11.20  }