ia64/xen-unstable

changeset 1320:112eec3395e6

bitkeeper revision 1.879 (408e5c62UO4MIO4Nqnx5MucD8D5izg)

Merge labyrinth.cl.cam.ac.uk:/auto/groups/xeno/BK/xeno.bk
into labyrinth.cl.cam.ac.uk:/auto/groups/xeno/users/iap10/xeno-clone/xeno.bk
author iap10@labyrinth.cl.cam.ac.uk
date Tue Apr 27 13:13:06 2004 +0000 (2004-04-27)
parents 8c64f13373a3 fc75c553f56e
children d41f26deb150 8f158bd218a6
files tools/examples/xc_dom_create.py tools/xc/lib/xc.h tools/xc/lib/xc_domain.c tools/xc/lib/xc_linux_restore.c tools/xc/py/Xc.c xen/Makefile xen/common/dom0_ops.c xen/common/domain.c xen/include/hypervisor-ifs/dom0_ops.h
line diff
     1.1 --- a/tools/examples/xc_dom_create.py	Mon Apr 26 10:02:49 2004 +0000
     1.2 +++ b/tools/examples/xc_dom_create.py	Tue Apr 27 13:13:06 2004 +0000
     1.3 @@ -221,30 +221,32 @@ def make_domain():
     1.4          print "Ramdisk file '" + ramdisk + "' does not exist"
     1.5          sys.exit()
     1.6  
     1.7 +    id = xc.domain_create( mem_kb=mem_size*1024, name=domain_name )
     1.8 +    if id <= 0:
     1.9 +	print "Error creating domain"
    1.10 +	sys.exit()
    1.11 +
    1.12 +    cmsg = 'new_control_interface(dom='+str(id)+', console_port='+str(console_port)+')'
    1.13 +
    1.14 +    xend_response = xenctl.utils.xend_control_message(cmsg)
    1.15 +
    1.16 +    if not xend_response['success']:
    1.17 +	print "Error creating initial event channel"
    1.18 +	print "Error type: " + xend_response['error_type']
    1.19 +	if xend_response['error_type'] == 'exception':
    1.20 +	    print "Exception type: " + xend_response['exception_type']
    1.21 +	    print "Exception value: " + xend_response['exception_value']
    1.22 +	xc.domain_destroy ( dom=id )
    1.23 +	sys.exit()
    1.24 +
    1.25      if restore:
    1.26 -        ret = eval('xc.%s_restore ( state_file=state_file, progress=1 )' % builder_fn)
    1.27 +        ret = eval('xc.%s_restore ( dom=id, state_file=state_file, progress=1 )' % builder_fn)
    1.28          if ret < 0:
    1.29              print "Error restoring domain"
    1.30 -            sys.exit()
    1.31 -        else:
    1.32 -            id = ret
    1.33 -    else:
    1.34 -        id = xc.domain_create( mem_kb=mem_size*1024, name=domain_name )
    1.35 -        if id <= 0:
    1.36 -            print "Error creating domain"
    1.37 -            sys.exit()
    1.38 -            
    1.39 -        cmsg = 'new_control_interface(dom='+str(id)+', console_port='+str(console_port)+')'
    1.40 -
    1.41 -        xend_response = xenctl.utils.xend_control_message(cmsg)
    1.42 -        if not xend_response['success']:
    1.43 -            print "Error creating initial event channel"
    1.44 -            print "Error type: " + xend_response['error_type']
    1.45 -            if xend_response['error_type'] == 'exception':
    1.46 -                print "Exception type: " + xend_response['exception_type']
    1.47 -                print "Exception value: " + xend_response['exception_value']
    1.48 +            print "Return code = " + str(ret)
    1.49              xc.domain_destroy ( dom=id )
    1.50              sys.exit()
    1.51 +    else:
    1.52  
    1.53          ret = eval('xc.%s_build ( dom=id, image=image, ramdisk=ramdisk, cmdline=cmdline, control_evtchn=xend_response["remote_port"] )' % builder_fn)
    1.54          if ret < 0:
     2.1 --- a/tools/xc/lib/xc.h	Mon Apr 26 10:02:49 2004 +0000
     2.2 +++ b/tools/xc/lib/xc.h	Tue Apr 27 13:13:06 2004 +0000
     2.3 @@ -32,6 +32,7 @@ typedef struct {
     2.4      u64           cpu_time;
     2.5  #define XC_DOMINFO_MAXNAME 16
     2.6      char          name[XC_DOMINFO_MAXNAME];
     2.7 +    unsigned long max_memkb;
     2.8  } xc_dominfo_t;
     2.9  
    2.10  int xc_domain_create(int xc_handle, 
    2.11 @@ -61,10 +62,13 @@ int xc_linux_save(int xc_handle,
    2.12                    u64 domid, 
    2.13                    const char *state_file, 
    2.14                    int verbose);
    2.15 +
    2.16  int xc_linux_restore(int xc_handle,
    2.17 +		     u64 domid,
    2.18                       const char *state_file, 
    2.19                       int verbose,
    2.20                       u64 *pdomid);
    2.21 +
    2.22  int xc_linux_build(int xc_handle,
    2.23                     u64 domid,
    2.24                     const char *image_name,
    2.25 @@ -237,4 +241,22 @@ int xc_readconsolering(int xc_handle,
    2.26  int xc_physinfo(int xc_handle,
    2.27                  xc_physinfo_t *info);
    2.28  
    2.29 +
    2.30 +int xc_shadow_control(int xc_handle,
    2.31 +                      u64 domid, 
    2.32 +                      unsigned int sop);
    2.33 +
    2.34 +int xc_domain_setname(int xc_handle,
    2.35 +                      u64 domid, 
    2.36 +		      char *name);
    2.37 +
    2.38 +int xc_domain_setinitialmem(int xc_handle,
    2.39 +			    u64 domid, 
    2.40 +			    unsigned int initial_memkb);
    2.41 +
    2.42 +int xc_domain_setmaxmem(int xc_handle,
    2.43 +			    u64 domid, 
    2.44 +			    unsigned int max_memkb);
    2.45 +
    2.46 +
    2.47  #endif /* __XC_H__ */
     3.1 --- a/tools/xc/lib/xc_domain.c	Mon Apr 26 10:02:49 2004 +0000
     3.2 +++ b/tools/xc/lib/xc_domain.c	Tue Apr 27 13:13:06 2004 +0000
     3.3 @@ -91,6 +91,7 @@ int xc_domain_getinfo(int xc_handle,
     3.4          info->has_cpu = op.u.getdomaininfo.has_cpu;
     3.5          info->stopped = (op.u.getdomaininfo.state == DOMSTATE_STOPPED);
     3.6          info->nr_pages = op.u.getdomaininfo.tot_pages;
     3.7 +        info->max_memkb = op.u.getdomaininfo.max_pages<<(PAGE_SHIFT-10);
     3.8          info->shared_info_frame = op.u.getdomaininfo.shared_info_frame;
     3.9          info->cpu_time = op.u.getdomaininfo.cpu_time;
    3.10          strncpy(info->name, op.u.getdomaininfo.name, XC_DOMINFO_MAXNAME);
    3.11 @@ -113,3 +114,37 @@ int xc_shadow_control(int xc_handle,
    3.12      op.u.shadow_control.op     = sop;
    3.13      return do_dom0_op(xc_handle, &op);
    3.14  }
    3.15 +
    3.16 +int xc_domain_setname(int xc_handle,
    3.17 +                      u64 domid, 
    3.18 +		      char *name)
    3.19 +{
    3.20 +    dom0_op_t op;
    3.21 +    op.cmd = DOM0_SETDOMAINNAME;
    3.22 +    op.u.setdomainname.domain = (domid_t)domid;
    3.23 +    strncpy(op.u.setdomainname.name, name, MAX_DOMAIN_NAME);
    3.24 +    return do_dom0_op(xc_handle, &op);
    3.25 +}
    3.26 +
    3.27 +int xc_domain_setinitialmem(int xc_handle,
    3.28 +			    u64 domid, 
    3.29 +			    unsigned int initial_memkb)
    3.30 +{
    3.31 +    dom0_op_t op;
    3.32 +    op.cmd = DOM0_SETDOMAININITIALMEM;
    3.33 +    op.u.setdomaininitialmem.domain = (domid_t)domid;
    3.34 +    op.u.setdomaininitialmem.initial_memkb = initial_memkb;
    3.35 +    return do_dom0_op(xc_handle, &op);
    3.36 +}
    3.37 +
    3.38 +int xc_domain_setmaxmem(int xc_handle,
    3.39 +			    u64 domid, 
    3.40 +			    unsigned int max_memkb)
    3.41 +{
    3.42 +    dom0_op_t op;
    3.43 +    op.cmd = DOM0_SETDOMAINMAXMEM;
    3.44 +    op.u.setdomainmaxmem.domain = (domid_t)domid;
    3.45 +    op.u.setdomainmaxmem.max_memkb = max_memkb;
    3.46 +    return do_dom0_op(xc_handle, &op);
    3.47 +}
    3.48 +
     4.1 --- a/tools/xc/lib/xc_linux_restore.c	Mon Apr 26 10:02:49 2004 +0000
     4.2 +++ b/tools/xc/lib/xc_linux_restore.c	Tue Apr 27 13:13:06 2004 +0000
     4.3 @@ -52,6 +52,7 @@ static int checked_read(gzFile fd, void 
     4.4  }
     4.5  
     4.6  int xc_linux_restore(int xc_handle,
     4.7 +		     u64 dom,
     4.8                       const char *state_file,
     4.9                       int verbose,
    4.10                       u64 *pdomid)
    4.11 @@ -59,7 +60,6 @@ int xc_linux_restore(int xc_handle,
    4.12      dom0_op_t op;
    4.13      int rc = 1, i, j;
    4.14      unsigned long mfn, pfn;
    4.15 -    u64 dom = 0ULL;
    4.16      unsigned int prev_pc, this_pc;
    4.17      
    4.18      /* Number of page frames in use by this Linux session. */
    4.19 @@ -165,16 +165,21 @@ int xc_linux_restore(int xc_handle,
    4.20          goto out;
    4.21      }
    4.22  
    4.23 -    /* Create a new domain of the appropriate size, and find it's dom_id. */
    4.24 -    op.cmd = DOM0_CREATEDOMAIN;
    4.25 -    op.u.createdomain.memory_kb = nr_pfns * (PAGE_SIZE / 1024);
    4.26 -    memcpy(op.u.createdomain.name, name, MAX_DOMAIN_NAME);
    4.27 -    if ( do_dom0_op(xc_handle, &op) < 0 )
    4.28 +    /* Set the domain's name to that from the restore file */
    4.29 +    if ( xc_domain_setname( xc_handle, dom, name ) )
    4.30      {
    4.31 -        ERROR("Could not create new domain");
    4.32 +        ERROR("Could not set domain name");
    4.33          goto out;
    4.34      }
    4.35 -    dom = (u64)op.u.createdomain.domain;
    4.36 +
    4.37 +    /* Set the domain's initial memory allocation 
    4.38 +       to that from the restore file */
    4.39 +
    4.40 +    if ( xc_domain_setinitialmem( xc_handle, dom, nr_pfns * (PAGE_SIZE / 1024)) )
    4.41 +    {
    4.42 +        ERROR("Could not set domain initial memory");
    4.43 +        goto out;
    4.44 +    }
    4.45  
    4.46      /* Get the domain's shared-info frame. */
    4.47      op.cmd = DOM0_GETDOMAININFO;
     5.1 --- a/tools/xc/py/Xc.c	Mon Apr 26 10:02:49 2004 +0000
     5.2 +++ b/tools/xc/py/Xc.c	Tue Apr 27 13:13:06 2004 +0000
     5.3 @@ -29,7 +29,7 @@ static PyObject *pyxc_domain_create(PyOb
     5.4  {
     5.5      XcObject *xc = (XcObject *)self;
     5.6  
     5.7 -    unsigned int mem_kb = 65536;
     5.8 +    unsigned int mem_kb = 0;
     5.9      char        *name   = "(anon)";
    5.10      u64          dom;
    5.11      int          ret;
    5.12 @@ -157,14 +157,16 @@ static PyObject *pyxc_domain_getinfo(PyO
    5.13      {
    5.14          PyList_SetItem(
    5.15              list, i, 
    5.16 -            Py_BuildValue("{s:L,s:i,s:i,s:i,s:l,s:L,s:s}",
    5.17 +            Py_BuildValue("{s:L,s:i,s:i,s:i,s:l,s:L,s:s,s:l}",
    5.18                            "dom",      info[i].domid,
    5.19                            "cpu",      info[i].cpu,
    5.20                            "running",  info[i].has_cpu,
    5.21                            "stopped",  info[i].stopped,
    5.22                            "mem_kb",   info[i].nr_pages*4,
    5.23                            "cpu_time", info[i].cpu_time,
    5.24 -                          "name",     info[i].name));
    5.25 +                          "name",     info[i].name,
    5.26 +                          "maxmem_kb",info[i].max_memkb
    5.27 +		));
    5.28      }
    5.29  
    5.30      free(info);
    5.31 @@ -205,16 +207,17 @@ static PyObject *pyxc_linux_restore(PyOb
    5.32      int          progress = 1;
    5.33      u64          dom;
    5.34  
    5.35 -    static char *kwd_list[] = { "state_file", "progress", NULL };
    5.36 +    static char *kwd_list[] = { "dom", "state_file", "progress", NULL };
    5.37  
    5.38 -    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "s|i", kwd_list, 
    5.39 -                                      &state_file, &progress) )
    5.40 +    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Ls|i", kwd_list, 
    5.41 +                                      &dom, &state_file, &progress) )
    5.42          return NULL;
    5.43  
    5.44 -    if ( xc_linux_restore(xc->xc_handle, state_file, progress, &dom) != 0 )
    5.45 +    if ( xc_linux_restore(xc->xc_handle, dom, state_file, progress, &dom) != 0 )
    5.46          return PyErr_SetFromErrno(xc_error);
    5.47  
    5.48 -    return PyLong_FromUnsignedLongLong(dom);
    5.49 +    Py_INCREF(zero);
    5.50 +    return zero;
    5.51  }
    5.52  
    5.53  static PyObject *pyxc_linux_build(PyObject *self,
    5.54 @@ -1032,6 +1035,49 @@ static PyObject *pyxc_rrobin_global_get(
    5.55      return Py_BuildValue("{s:L}", "slice", slice);
    5.56  }
    5.57  
    5.58 +static PyObject *pyxc_domain_setname(PyObject *self,
    5.59 +                                     PyObject *args,
    5.60 +                                     PyObject *kwds)
    5.61 +{
    5.62 +    XcObject *xc = (XcObject *)self;
    5.63 +    u64 dom;
    5.64 +    char *name;
    5.65 +
    5.66 +    static char *kwd_list[] = { "dom", "name", NULL };
    5.67 +
    5.68 +    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Ls", kwd_list, 
    5.69 +                                      &dom, &name) )
    5.70 +        return NULL;
    5.71 +
    5.72 +    if ( xc_domain_setname(xc->xc_handle, dom, name) != 0 )
    5.73 +        return PyErr_SetFromErrno(xc_error);
    5.74 +    
    5.75 +    Py_INCREF(zero);
    5.76 +    return zero;
    5.77 +}
    5.78 +
    5.79 +static PyObject *pyxc_domain_setmaxmem(PyObject *self,
    5.80 +				       PyObject *args,
    5.81 +				       PyObject *kwds)
    5.82 +{
    5.83 +    XcObject *xc = (XcObject *)self;
    5.84 +
    5.85 +    u64 dom;
    5.86 +    unsigned long max_memkb;
    5.87 +
    5.88 +    static char *kwd_list[] = { "dom", "max_memkb", NULL };
    5.89 +
    5.90 +    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Li", kwd_list, 
    5.91 +                                      &dom, &max_memkb) )
    5.92 +        return NULL;
    5.93 +
    5.94 +    if ( xc_domain_setmaxmem(xc->xc_handle, dom, max_memkb) != 0 )
    5.95 +        return PyErr_SetFromErrno(xc_error);
    5.96 +    
    5.97 +    Py_INCREF(zero);
    5.98 +    return zero;
    5.99 +}
   5.100 +
   5.101  
   5.102  static PyMethodDef pyxc_methods[] = {
   5.103      { "domain_create", 
   5.104 @@ -1379,6 +1425,21 @@ static PyMethodDef pyxc_methods[] = {
   5.105        " op [int, 0]: operation\n\n"
   5.106        "Returns: [int] 0 on success; -1 on error.\n" },
   5.107  
   5.108 +    { "domain_setname", 
   5.109 +      (PyCFunction)pyxc_domain_setname, 
   5.110 +      METH_VARARGS | METH_KEYWORDS, "\n"
   5.111 +      "Set domain informative textual name\n"
   5.112 +      " dom [long]: Identifier of domain.\n"
   5.113 +      " name [str]: Text string.\n\n"
   5.114 +      "Returns: [int] 0 on success; -1 on error.\n" },
   5.115 +
   5.116 +    { "domain_setmaxmem", 
   5.117 +      (PyCFunction)pyxc_domain_setname, 
   5.118 +      METH_VARARGS | METH_KEYWORDS, "\n"
   5.119 +      "Set a domain's memory limit\n"
   5.120 +      " dom [long]: Identifier of domain.\n"
   5.121 +      " max_memkb [long]: .\n"
   5.122 +      "Returns: [int] 0 on success; -1 on error.\n" },
   5.123  
   5.124      { NULL, NULL, 0, NULL }
   5.125  };
     6.1 --- a/xen/Makefile	Mon Apr 26 10:02:49 2004 +0000
     6.2 +++ b/xen/Makefile	Tue Apr 27 13:13:06 2004 +0000
     6.3 @@ -15,7 +15,7 @@ default: $(TARGET)
     6.4  	gzip -f -9 < $(TARGET) > $(TARGET).gz
     6.5  
     6.6  debug:	
     6.7 -	objdump -D -S $(TARGET) > $(TARGET).s
     6.8 +	objdump -D -S $(TARGET).dbg > $(TARGET).s
     6.9  
    6.10  install: $(TARGET)
    6.11  	gzip -f -9 < $(TARGET) > $(TARGET).gz
     7.1 --- a/xen/common/dom0_ops.c	Mon Apr 26 10:02:49 2004 +0000
     7.2 +++ b/xen/common/dom0_ops.c	Tue Apr 27 13:13:06 2004 +0000
     7.3 @@ -117,7 +117,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
     7.4          static unsigned int pro = 0;
     7.5          domid_t dom;
     7.6          ret = -ENOMEM;
     7.7 -        
     7.8 +
     7.9          spin_lock_irq(&create_dom_lock);
    7.10          
    7.11          if ( (dom = get_domnr()) == 0 ) 
    7.12 @@ -287,6 +287,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
    7.13                  op->u.getdomaininfo.state = DOMSTATE_STOPPED;
    7.14              op->u.getdomaininfo.hyp_events  = p->hyp_events;
    7.15              op->u.getdomaininfo.tot_pages   = p->tot_pages;
    7.16 +            op->u.getdomaininfo.max_pages   = p->max_pages;
    7.17              op->u.getdomaininfo.cpu_time    = p->cpu_time;
    7.18              op->u.getdomaininfo.shared_info_frame = 
    7.19                  __pa(p->shared_info) >> PAGE_SHIFT;
    7.20 @@ -498,14 +499,15 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
    7.21  
    7.22      case DOM0_SHADOW_CONTROL:
    7.23      {
    7.24 -        struct task_struct *p; 
    7.25 -	
    7.26 +	struct task_struct *p; 
    7.27 +	ret = -ESRCH;
    7.28  	p = find_domain_by_id( op->u.shadow_control.domain );
    7.29  	if ( p )
    7.30  	{
    7.31              ret = shadow_mode_control(p, op->u.shadow_control.op );
    7.32  	    put_task_struct(p);
    7.33          }
    7.34 +	
    7.35      }
    7.36      break;
    7.37  
    7.38 @@ -516,7 +518,52 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
    7.39          copy_to_user(u_dom0_op, op, sizeof(*op));
    7.40          ret = 0;        
    7.41      }
    7.42 -     
    7.43 +    break;
    7.44 +
    7.45 +    case DOM0_SETDOMAINNAME:
    7.46 +    {
    7.47 +	struct task_struct *p; 
    7.48 +	p = find_domain_by_id( op->u.setdomainname.domain );
    7.49 +	if ( p )
    7.50 +	{
    7.51 +	    strncpy(p->name, op->u.setdomainname.name, MAX_DOMAIN_NAME);
    7.52 +	}
    7.53 +	else 
    7.54 +	    ret = -ESRCH;
    7.55 +    }
    7.56 +    break;
    7.57 +
    7.58 +    case DOM0_SETDOMAININITIALMEM:
    7.59 +    {
    7.60 +	struct task_struct *p; 
    7.61 +	ret = -ESRCH;
    7.62 +	p = find_domain_by_id( op->u.setdomaininitialmem.domain );
    7.63 +	if ( p )
    7.64 +	{	
    7.65 +	    /* should only be used *before* domain is built. */
    7.66 +            if ( ! test_bit(PF_CONSTRUCTED, &p->flags) )
    7.67 +		ret = alloc_new_dom_mem( 
    7.68 +		    p, op->u.setdomaininitialmem.initial_memkb );
    7.69 +	    else
    7.70 +		ret = -EINVAL;
    7.71 +	}
    7.72 +    }
    7.73 +    break;
    7.74 +
    7.75 +    case DOM0_SETDOMAINMAXMEM:
    7.76 +    {
    7.77 +	struct task_struct *p; 
    7.78 +	p = find_domain_by_id( op->u.setdomainmaxmem.domain );
    7.79 +	if ( p )
    7.80 +	{
    7.81 +	    p->max_pages = 
    7.82 +		(op->u.setdomainmaxmem.max_memkb+PAGE_SIZE-1)>> PAGE_SHIFT;
    7.83 +	}
    7.84 +	else 
    7.85 +	    ret = -ESRCH;
    7.86 +    }
    7.87 +    break;
    7.88 +
    7.89      default:
    7.90          ret = -ENOSYS;
    7.91  
     8.1 --- a/xen/common/domain.c	Mon Apr 26 10:02:49 2004 +0000
     8.2 +++ b/xen/common/domain.c	Tue Apr 27 13:13:06 2004 +0000
     8.3 @@ -483,12 +483,11 @@ unsigned int alloc_new_dom_mem(struct ta
     8.4  {
     8.5      unsigned int alloc_pfns, nr_pages;
     8.6  
     8.7 -    nr_pages = kbytes >> (PAGE_SHIFT - 10);
     8.8 +    nr_pages = (kbytes + ((PAGE_SIZE-1)>>10)) >> (PAGE_SHIFT - 10);
     8.9 +    p->max_pages = nr_pages; /* this can now be controlled independently */
    8.10  
    8.11 -    /* TEMPORARY: max_pages should be explicitly specified. */
    8.12 -    p->max_pages = nr_pages;
    8.13 -
    8.14 -    for ( alloc_pfns = 0; alloc_pfns < nr_pages; alloc_pfns++ )
    8.15 +    /* grow the allocation if necessary */
    8.16 +    for ( alloc_pfns = p->tot_pages; alloc_pfns < nr_pages; alloc_pfns++ )
    8.17      {
    8.18          if ( unlikely(alloc_domain_page(p) == NULL) ||
    8.19               unlikely(free_pfns < (SLACK_DOMAIN_MEM_KILOBYTES >> 
     9.1 --- a/xen/include/hypervisor-ifs/dom0_ops.h	Mon Apr 26 10:02:49 2004 +0000
     9.2 +++ b/xen/include/hypervisor-ifs/dom0_ops.h	Tue Apr 27 13:13:06 2004 +0000
     9.3 @@ -22,6 +22,27 @@
     9.4  
     9.5  #define MAX_DOMAIN_NAME    16
     9.6  
     9.7 +/************************************************************************/
     9.8 +
     9.9 +#define DOM0_GETMEMLIST        2
    9.10 +typedef struct dom0_getmemlist_st
    9.11 +{
    9.12 +    /* IN variables. */
    9.13 +    domid_t       domain;
    9.14 +    unsigned long max_pfns;
    9.15 +    void         *buffer;
    9.16 +    /* OUT variables. */
    9.17 +    unsigned long num_pfns;
    9.18 +} dom0_getmemlist_t;
    9.19 +
    9.20 +#define DOM0_SCHEDCTL          6
    9.21 + /* struct sched_ctl_cmd is from sched-ctl.h   */
    9.22 +typedef struct sched_ctl_cmd dom0_schedctl_t;
    9.23 +
    9.24 +#define DOM0_ADJUSTDOM         7
    9.25 +/* struct sched_adjdom_cmd is from sched-ctl.h */
    9.26 +typedef struct sched_adjdom_cmd dom0_adjustdom_t;
    9.27 +
    9.28  #define DOM0_CREATEDOMAIN      8
    9.29  typedef struct dom0_createdomain_st 
    9.30  {
    9.31 @@ -32,6 +53,14 @@ typedef struct dom0_createdomain_st
    9.32      domid_t      domain; 
    9.33  } dom0_createdomain_t;
    9.34  
    9.35 +#define DOM0_DESTROYDOMAIN     9
    9.36 +typedef struct dom0_destroydomain_st
    9.37 +{
    9.38 +    /* IN variables. */
    9.39 +    domid_t      domain;
    9.40 +    int          force;
    9.41 +} dom0_destroydomain_t;
    9.42 +
    9.43  #define DOM0_STARTDOMAIN      10
    9.44  typedef struct dom0_startdomain_st
    9.45  {
    9.46 @@ -46,42 +75,6 @@ typedef struct dom0_stopdomain_st
    9.47      domid_t domain;
    9.48  } dom0_stopdomain_t;
    9.49  
    9.50 -#define DOM0_DESTROYDOMAIN     9
    9.51 -typedef struct dom0_destroydomain_st
    9.52 -{
    9.53 -    /* IN variables. */
    9.54 -    domid_t      domain;
    9.55 -    int          force;
    9.56 -} dom0_destroydomain_t;
    9.57 -
    9.58 -#define DOM0_GETMEMLIST        2
    9.59 -typedef struct dom0_getmemlist_st
    9.60 -{
    9.61 -    /* IN variables. */
    9.62 -    domid_t       domain;
    9.63 -    unsigned long max_pfns;
    9.64 -    void         *buffer;
    9.65 -    /* OUT variables. */
    9.66 -    unsigned long num_pfns;
    9.67 -} dom0_getmemlist_t;
    9.68 -
    9.69 -#define DOM0_BUILDDOMAIN      13
    9.70 -typedef struct dom0_builddomain_st
    9.71 -{
    9.72 -    /* IN variables. */
    9.73 -    domid_t                  domain;
    9.74 -    unsigned int             num_vifs;
    9.75 -    full_execution_context_t ctxt;
    9.76 -} dom0_builddomain_t;
    9.77 -
    9.78 -#define DOM0_SCHEDCTL            6
    9.79 - /* struct sched_ctl_cmd is from sched-ctl.h   */
    9.80 -typedef struct sched_ctl_cmd dom0_schedctl_t;
    9.81 -
    9.82 -#define DOM0_ADJUSTDOM         7
    9.83 -/* struct sched_adjdom_cmd is from sched-ctl.h */
    9.84 -typedef struct sched_adjdom_cmd dom0_adjustdom_t;
    9.85 -
    9.86  #define DOM0_GETDOMAININFO    12
    9.87  typedef struct dom0_getdomaininfo_st
    9.88  {
    9.89 @@ -95,22 +88,20 @@ typedef struct dom0_getdomaininfo_st
    9.90  #define DOMSTATE_STOPPED             1
    9.91      int state;
    9.92      int hyp_events;
    9.93 -    unsigned int tot_pages;
    9.94 +    unsigned int tot_pages, max_pages;
    9.95      long long cpu_time;
    9.96      unsigned long shared_info_frame;  /* MFN of shared_info struct */
    9.97      full_execution_context_t ctxt;
    9.98  } dom0_getdomaininfo_t;
    9.99  
   9.100 -#define DOM0_GETPAGEFRAMEINFO 18
   9.101 -typedef struct dom0_getpageframeinfo_st
   9.102 +#define DOM0_BUILDDOMAIN      13
   9.103 +typedef struct dom0_builddomain_st
   9.104  {
   9.105      /* IN variables. */
   9.106 -    unsigned long pfn;     /* Machine page frame number to query.       */
   9.107 -    domid_t domain;        /* To which domain does the frame belong?    */
   9.108 -    /* OUT variables. */
   9.109 -    /* Is the page PINNED to a type? */
   9.110 -    enum { NONE, L1TAB, L2TAB, L3TAB, L4TAB } type;
   9.111 -} dom0_getpageframeinfo_t;
   9.112 +    domid_t                  domain;
   9.113 +    unsigned int             num_vifs;
   9.114 +    full_execution_context_t ctxt;
   9.115 +} dom0_builddomain_t;
   9.116  
   9.117  #define DOM0_IOPL             14
   9.118  typedef struct dom0_iopl_st
   9.119 @@ -153,6 +144,18 @@ typedef struct dom0_settime_st
   9.120      u64 system_time;
   9.121  } dom0_settime_t;
   9.122  
   9.123 +#define DOM0_GETPAGEFRAMEINFO 18
   9.124 +typedef struct dom0_getpageframeinfo_st
   9.125 +{
   9.126 +    /* IN variables. */
   9.127 +    unsigned long pfn;     /* Machine page frame number to query.       */
   9.128 +    domid_t domain;        /* To which domain does the frame belong?    */
   9.129 +    /* OUT variables. */
   9.130 +    /* Is the page PINNED to a type? */
   9.131 +    enum { NONE, L1TAB, L2TAB, L3TAB, L4TAB } type;
   9.132 +} dom0_getpageframeinfo_t;
   9.133 +
   9.134 +
   9.135  /*
   9.136   * Read console content from Xen buffer ring.
   9.137   */
   9.138 @@ -225,7 +228,7 @@ typedef struct dom0_sched_id_st
   9.139  /* 
   9.140   * Control shadow pagetables operation
   9.141   */
   9.142 -#define DOM0_SHADOW_CONTROL   25
   9.143 +#define DOM0_SHADOW_CONTROL  25
   9.144  
   9.145  #define DOM0_SHADOW_CONTROL_OP_OFF         0
   9.146  #define DOM0_SHADOW_CONTROL_OP_ENABLE_TEST 1
   9.147 @@ -239,6 +242,30 @@ typedef struct dom0_shadow_control_st
   9.148      int          op;
   9.149  } dom0_shadow_control_t;
   9.150  
   9.151 +#define DOM0_SETDOMAINNAME     26
   9.152 +typedef struct dom0_setdomainname_st
   9.153 +{
   9.154 +    /* IN variables. */
   9.155 +    domid_t      domain;
   9.156 +    char         name[MAX_DOMAIN_NAME];    
   9.157 +} dom0_setdomainname_t;
   9.158 +
   9.159 +#define DOM0_SETDOMAININITIALMEM   27
   9.160 +typedef struct dom0_setdomaininitialmem_st
   9.161 +{
   9.162 +    /* IN variables. */
   9.163 +    domid_t      domain;
   9.164 +    unsigned int initial_memkb;  /* use before domain is built */
   9.165 +} dom0_setdomaininitialmem_t;
   9.166 +
   9.167 +#define DOM0_SETDOMAINMAXMEM   28
   9.168 +typedef struct dom0_setdomainmaxmem_st
   9.169 +{
   9.170 +    /* IN variables. */
   9.171 +    domid_t      domain;
   9.172 +    unsigned int max_memkb;
   9.173 +} dom0_setdomainmaxmem_t;
   9.174 +
   9.175  
   9.176  typedef struct dom0_op_st
   9.177  {
   9.178 @@ -267,6 +294,9 @@ typedef struct dom0_op_st
   9.179          dom0_pcidev_access_t    pcidev_access;
   9.180          dom0_sched_id_t         sched_id;
   9.181  	dom0_shadow_control_t   shadow_control;
   9.182 +	dom0_setdomainname_t    setdomainname;
   9.183 +	dom0_setdomaininitialmem_t setdomaininitialmem;
   9.184 +	dom0_setdomainmaxmem_t  setdomainmaxmem;
   9.185      } u;
   9.186  } dom0_op_t;
   9.187