direct-io.hg

changeset 12224:cfb1136ee8f7

[XEN] Remove VGCF_hvm_guest, replace with XEN_DOMINF_hvm_guest.
Rename DOMFLAGS_* to XEN_DOMINF_*.
Clean up tools to deal with flags changes.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Fri Nov 03 10:52:29 2006 +0000 (2006-11-03)
parents 4ff83eddd1f6
children fac36a01c06e
files tools/libxc/xc_core.c tools/libxc/xc_domain.c tools/libxc/xc_hvm_build.c tools/libxc/xc_private.h tools/libxc/xc_ptrace.c tools/libxc/xc_ptrace_core.c tools/libxc/xenctrl.h tools/python/xen/lowlevel/xc/xc.c tools/xenstat/libxenstat/src/xenstat.c xen/arch/x86/domain.c xen/arch/x86/domctl.c xen/common/domctl.c xen/include/asm-x86/hvm/support.h xen/include/public/arch-x86_32.h xen/include/public/arch-x86_64.h xen/include/public/domctl.h xen/include/xen/sched.h
line diff
     1.1 --- a/tools/libxc/xc_core.c	Fri Nov 03 10:41:20 2006 +0000
     1.2 +++ b/tools/libxc/xc_core.c	Fri Nov 03 10:52:29 2006 +0000
     1.3 @@ -62,7 +62,7 @@ xc_domain_dumpcore_via_callback(int xc_h
     1.4  
     1.5      nr_pages = info.nr_pages;
     1.6  
     1.7 -    header.xch_magic = XC_CORE_MAGIC;
     1.8 +    header.xch_magic = info.hvm ? XC_CORE_MAGIC_HVM : XC_CORE_MAGIC;
     1.9      header.xch_nr_vcpus = nr_vcpus;
    1.10      header.xch_nr_pages = nr_pages;
    1.11      header.xch_ctxt_offset = sizeof(struct xc_core_header);
     2.1 --- a/tools/libxc/xc_domain.c	Fri Nov 03 10:41:20 2006 +0000
     2.2 +++ b/tools/libxc/xc_domain.c	Fri Nov 03 10:52:29 2006 +0000
     2.3 @@ -171,15 +171,16 @@ int xc_domain_getinfo(int xc_handle,
     2.4              break;
     2.5          info->domid      = (uint16_t)domctl.domain;
     2.6  
     2.7 -        info->dying    = !!(domctl.u.getdomaininfo.flags & DOMFLAGS_DYING);
     2.8 -        info->shutdown = !!(domctl.u.getdomaininfo.flags & DOMFLAGS_SHUTDOWN);
     2.9 -        info->paused   = !!(domctl.u.getdomaininfo.flags & DOMFLAGS_PAUSED);
    2.10 -        info->blocked  = !!(domctl.u.getdomaininfo.flags & DOMFLAGS_BLOCKED);
    2.11 -        info->running  = !!(domctl.u.getdomaininfo.flags & DOMFLAGS_RUNNING);
    2.12 +        info->dying    = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_dying);
    2.13 +        info->shutdown = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_shutdown);
    2.14 +        info->paused   = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_paused);
    2.15 +        info->blocked  = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_blocked);
    2.16 +        info->running  = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_running);
    2.17 +        info->hvm      = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_hvm_guest);
    2.18  
    2.19          info->shutdown_reason =
    2.20 -            (domctl.u.getdomaininfo.flags>>DOMFLAGS_SHUTDOWNSHIFT) &
    2.21 -            DOMFLAGS_SHUTDOWNMASK;
    2.22 +            (domctl.u.getdomaininfo.flags>>XEN_DOMINF_shutdownshift) &
    2.23 +            XEN_DOMINF_shutdownmask;
    2.24  
    2.25          if ( info->shutdown && (info->shutdown_reason == SHUTDOWN_crash) )
    2.26          {
    2.27 @@ -202,7 +203,8 @@ int xc_domain_getinfo(int xc_handle,
    2.28          info++;
    2.29      }
    2.30  
    2.31 -    if( !nr_doms ) return rc;
    2.32 +    if ( nr_doms == 0 )
    2.33 +        return rc;
    2.34  
    2.35      return nr_doms;
    2.36  }
     3.1 --- a/tools/libxc/xc_hvm_build.c	Fri Nov 03 10:41:20 2006 +0000
     3.2 +++ b/tools/libxc/xc_hvm_build.c	Fri Nov 03 10:52:29 2006 +0000
     3.3 @@ -337,7 +337,6 @@ static int xc_hvm_build_internal(int xc_
     3.4      }
     3.5  
     3.6      memset(ctxt, 0, sizeof(*ctxt));
     3.7 -    ctxt->flags = VGCF_HVM_GUEST;
     3.8  
     3.9      if ( setup_guest(xc_handle, domid, memsize, image, image_size,
    3.10                       ctxt, domctl.u.getdomaininfo.shared_info_frame,
     4.1 --- a/tools/libxc/xc_private.h	Fri Nov 03 10:41:20 2006 +0000
     4.2 +++ b/tools/libxc/xc_private.h	Fri Nov 03 10:52:29 2006 +0000
     4.3 @@ -158,4 +158,9 @@ static inline int do_sysctl(int xc_handl
     4.4  int xc_map_foreign_ranges(int xc_handle, uint32_t dom,
     4.5                            privcmd_mmap_entry_t *entries, int nr);
     4.6  
     4.7 +void *map_domain_va_core(unsigned long domfd, int cpu, void *guest_va,
     4.8 +                         vcpu_guest_context_t *ctxt);
     4.9 +int xc_waitdomain_core(int xc_handle, int domain, int *status,
    4.10 +    int options, vcpu_guest_context_t *ctxt);
    4.11 +
    4.12  #endif /* __XC_PRIVATE_H__ */
     5.1 --- a/tools/libxc/xc_ptrace.c	Fri Nov 03 10:41:20 2006 +0000
     5.2 +++ b/tools/libxc/xc_ptrace.c	Fri Nov 03 10:52:29 2006 +0000
     5.3 @@ -36,8 +36,9 @@ static char *ptrace_names[] = {
     5.4  };
     5.5  #endif
     5.6  
     5.7 -static int                      current_domid = -1;
     5.8 -static int                      current_isfile;
     5.9 +static int current_domid = -1;
    5.10 +static int current_isfile;
    5.11 +static int current_is_hvm;
    5.12  
    5.13  static uint64_t                 online_cpumap;
    5.14  static uint64_t                 regs_valid;
    5.15 @@ -46,7 +47,6 @@ static vcpu_guest_context_t     ctxt[MAX
    5.16  extern int ffsll(long long int);
    5.17  #define FOREACH_CPU(cpumap, i)  for ( cpumap = online_cpumap; (i = ffsll(cpumap)); cpumap &= ~(1 << (index - 1)) )
    5.18  
    5.19 -
    5.20  static int
    5.21  fetch_regs(int xc_handle, int cpu, int *online)
    5.22  {
    5.23 @@ -172,7 +172,7 @@ to_ma(int cpu,
    5.24  {
    5.25      unsigned long maddr = in_addr;
    5.26  
    5.27 -    if ( (ctxt[cpu].flags & VGCF_HVM_GUEST) && paging_enabled(&ctxt[cpu]) )
    5.28 +    if ( current_is_hvm && paging_enabled(&ctxt[cpu]) )
    5.29          maddr = page_array[maddr >> PAGE_SHIFT] << PAGE_SHIFT;
    5.30      return maddr;
    5.31  }
    5.32 @@ -443,7 +443,7 @@ static int
    5.33          goto done;
    5.34      }
    5.35  
    5.36 -    if ( !(domctl.u.getdomaininfo.flags & DOMFLAGS_PAUSED) )
    5.37 +    if ( !(domctl.u.getdomaininfo.flags & XEN_DOMINF_paused) )
    5.38      {
    5.39          nanosleep(&ts,NULL);
    5.40          goto retry;
    5.41 @@ -482,11 +482,11 @@ xc_ptrace(
    5.42      case PTRACE_PEEKTEXT:
    5.43      case PTRACE_PEEKDATA:
    5.44          if (current_isfile)
    5.45 -            guest_va = (unsigned long *)map_domain_va_core(current_domid,
    5.46 -                                cpu, addr, ctxt);
    5.47 +            guest_va = (unsigned long *)map_domain_va_core(
    5.48 +                current_domid, cpu, addr, ctxt);
    5.49          else
    5.50 -            guest_va = (unsigned long *)map_domain_va(xc_handle,
    5.51 -                                cpu, addr, PROT_READ);
    5.52 +            guest_va = (unsigned long *)map_domain_va(
    5.53 +                xc_handle, cpu, addr, PROT_READ);
    5.54          if ( guest_va == NULL )
    5.55              goto out_error;
    5.56          retval = *guest_va;
    5.57 @@ -496,11 +496,11 @@ xc_ptrace(
    5.58      case PTRACE_POKEDATA:
    5.59          /* XXX assume that all CPUs have the same address space */
    5.60          if (current_isfile)
    5.61 -            guest_va = (unsigned long *)map_domain_va_core(current_domid,
    5.62 -                                cpu, addr, ctxt);
    5.63 +            guest_va = (unsigned long *)map_domain_va_core(
    5.64 +                current_domid, cpu, addr, ctxt);
    5.65          else
    5.66 -            guest_va = (unsigned long *)map_domain_va(xc_handle,
    5.67 -                                cpu, addr, PROT_READ|PROT_WRITE);
    5.68 +            guest_va = (unsigned long *)map_domain_va(
    5.69 +                xc_handle, cpu, addr, PROT_READ|PROT_WRITE);
    5.70          if ( guest_va == NULL )
    5.71              goto out_error;
    5.72          *guest_va = (unsigned long)data;
    5.73 @@ -590,10 +590,11 @@ xc_ptrace(
    5.74          retval = do_domctl(xc_handle, &domctl);
    5.75          if ( retval || (domctl.domain != current_domid) )
    5.76              goto out_error_domctl;
    5.77 -        if ( domctl.u.getdomaininfo.flags & DOMFLAGS_PAUSED )
    5.78 +        if ( domctl.u.getdomaininfo.flags & XEN_DOMINF_paused )
    5.79              IPRINTF("domain currently paused\n");
    5.80          else if ((retval = xc_domain_pause(xc_handle, current_domid)))
    5.81              goto out_error_domctl;
    5.82 +        current_is_hvm = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_hvm_guest);
    5.83          domctl.cmd = XEN_DOMCTL_setdebugging;
    5.84          domctl.domain = current_domid;
    5.85          domctl.u.setdebugging.enable = 1;
     6.1 --- a/tools/libxc/xc_ptrace_core.c	Fri Nov 03 10:41:20 2006 +0000
     6.2 +++ b/tools/libxc/xc_ptrace_core.c	Fri Nov 03 10:52:29 2006 +0000
     6.3 @@ -7,6 +7,7 @@
     6.4  
     6.5  /* XXX application state */
     6.6  
     6.7 +static int    current_is_hvm = 0;
     6.8  static long   nr_pages = 0;
     6.9  static unsigned long  *p2m_array = NULL;
    6.10  static unsigned long  *m2p_array = NULL;
    6.11 @@ -24,8 +25,8 @@ map_mtop_offset(unsigned long ma)
    6.12  
    6.13  
    6.14  void *
    6.15 -map_domain_va_core(unsigned long domfd, int cpu, void * guest_va,
    6.16 -                        vcpu_guest_context_t *ctxt)
    6.17 +map_domain_va_core(unsigned long domfd, int cpu, void *guest_va,
    6.18 +                   vcpu_guest_context_t *ctxt)
    6.19  {
    6.20      unsigned long pde, page;
    6.21      unsigned long va = (unsigned long)guest_va;
    6.22 @@ -55,7 +56,7 @@ map_domain_va_core(unsigned long domfd, 
    6.23      }
    6.24      if ((pde = cr3_virt[cpu][l2_table_offset_i386(va)]) == 0) /* logical address */
    6.25          return NULL;
    6.26 -    if (ctxt[cpu].flags & VGCF_HVM_GUEST)
    6.27 +    if (current_is_hvm)
    6.28          pde = p2m_array[pde >> PAGE_SHIFT] << PAGE_SHIFT;
    6.29      if (pde != pde_phys[cpu])
    6.30      {
    6.31 @@ -71,7 +72,7 @@ map_domain_va_core(unsigned long domfd, 
    6.32      }
    6.33      if ((page = pde_virt[cpu][l1_table_offset_i386(va)]) == 0) /* logical address */
    6.34          return NULL;
    6.35 -    if (ctxt[cpu].flags & VGCF_HVM_GUEST)
    6.36 +    if (current_is_hvm)
    6.37          page = p2m_array[page >> PAGE_SHIFT] << PAGE_SHIFT;
    6.38      if (page != page_phys[cpu])
    6.39      {
    6.40 @@ -104,17 +105,18 @@ xc_waitdomain_core(
    6.41      int i;
    6.42      xc_core_header_t header;
    6.43  
    6.44 -    if (nr_pages == 0)
    6.45 +    if ( nr_pages == 0 )
    6.46      {
    6.47 -
    6.48          if (read(domfd, &header, sizeof(header)) != sizeof(header))
    6.49              return -1;
    6.50  
    6.51 -        if (header.xch_magic != XC_CORE_MAGIC) {
    6.52 -                IPRINTF("Magic number missmatch: 0x%08x (file) != "
    6.53 -                                        " 0x%08x (code)\n", header.xch_magic,
    6.54 -                                        XC_CORE_MAGIC);
    6.55 -                return -1;
    6.56 +        current_is_hvm = (header.xch_magic == XC_CORE_MAGIC_HVM);
    6.57 +        if ( !current_is_hvm && (header.xch_magic != XC_CORE_MAGIC) )
    6.58 +        {
    6.59 +            IPRINTF("Magic number missmatch: 0x%08x (file) != "
    6.60 +                    " 0x%08x (code)\n", header.xch_magic,
    6.61 +                    XC_CORE_MAGIC);
    6.62 +            return -1;
    6.63          }
    6.64  
    6.65          nr_pages = header.xch_nr_pages;
     7.1 --- a/tools/libxc/xenctrl.h	Fri Nov 03 10:41:20 2006 +0000
     7.2 +++ b/tools/libxc/xenctrl.h	Fri Nov 03 10:52:29 2006 +0000
     7.3 @@ -113,26 +113,14 @@ typedef struct xc_core_header {
     7.4      unsigned int xch_pages_offset;
     7.5  } xc_core_header_t;
     7.6  
     7.7 -#define XC_CORE_MAGIC 0xF00FEBED
     7.8 +#define XC_CORE_MAGIC     0xF00FEBED
     7.9 +#define XC_CORE_MAGIC_HVM 0xF00FEBEE
    7.10  
    7.11  #ifdef __linux__
    7.12  
    7.13  #include <sys/ptrace.h>
    7.14  #include <thread_db.h>
    7.15  
    7.16 -void * map_domain_va_core(
    7.17 -    unsigned long domfd,
    7.18 -    int cpu,
    7.19 -    void *guest_va,
    7.20 -    vcpu_guest_context_t *ctxt);
    7.21 -
    7.22 -int xc_waitdomain_core(
    7.23 -    int xc_handle,
    7.24 -    int domain,
    7.25 -    int *status,
    7.26 -    int options,
    7.27 -    vcpu_guest_context_t *ctxt);
    7.28 -
    7.29  typedef void (*thr_ev_handler_t)(long);
    7.30  
    7.31  void xc_register_event_handler(
    7.32 @@ -158,11 +146,12 @@ int xc_waitdomain(
    7.33   * DOMAIN MANAGEMENT FUNCTIONS
    7.34   */
    7.35  
    7.36 -typedef struct {
    7.37 +typedef struct xc_dominfo {
    7.38      uint32_t      domid;
    7.39      uint32_t      ssidref;
    7.40      unsigned int  dying:1, crashed:1, shutdown:1,
    7.41 -                  paused:1, blocked:1, running:1;
    7.42 +                  paused:1, blocked:1, running:1,
    7.43 +                  hvm:1;
    7.44      unsigned int  shutdown_reason; /* only meaningful if shutdown==1 */
    7.45      unsigned long nr_pages;
    7.46      unsigned long shared_info_frame;
     8.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Fri Nov 03 10:41:20 2006 +0000
     8.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Fri Nov 03 10:52:29 2006 +0000
     8.3 @@ -257,11 +257,12 @@ static PyObject *pyxc_domain_getinfo(XcO
     8.4          PyObject *pyhandle = PyList_New(sizeof(xen_domain_handle_t));
     8.5          for ( j = 0; j < sizeof(xen_domain_handle_t); j++ )
     8.6              PyList_SetItem(pyhandle, j, PyInt_FromLong(info[i].handle[j]));
     8.7 -        info_dict = Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i"
     8.8 +        info_dict = Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i"
     8.9                                    ",s:l,s:L,s:l,s:i,s:i}",
    8.10                                    "domid",       info[i].domid,
    8.11                                    "online_vcpus", info[i].nr_online_vcpus,
    8.12                                    "max_vcpu_id", info[i].max_vcpu_id,
    8.13 +                                  "hvm",       info[i].hvm,
    8.14                                    "dying",     info[i].dying,
    8.15                                    "crashed",   info[i].crashed,
    8.16                                    "shutdown",  info[i].shutdown,
     9.1 --- a/tools/xenstat/libxenstat/src/xenstat.c	Fri Nov 03 10:41:20 2006 +0000
     9.2 +++ b/tools/xenstat/libxenstat/src/xenstat.c	Fri Nov 03 10:52:29 2006 +0000
     9.3 @@ -449,36 +449,36 @@ unsigned int xenstat_domain_ssid(xenstat
     9.4  /* Get domain states */
     9.5  unsigned int xenstat_domain_dying(xenstat_domain * domain)
     9.6  {
     9.7 -	return (domain->state & DOMFLAGS_DYING) == DOMFLAGS_DYING;
     9.8 +	return (domain->state & XEN_DOMINF_dying) == XEN_DOMINF_dying;
     9.9  }
    9.10  
    9.11  unsigned int xenstat_domain_crashed(xenstat_domain * domain)
    9.12  {
    9.13 -	return ((domain->state & DOMFLAGS_SHUTDOWN) == DOMFLAGS_SHUTDOWN)
    9.14 -	    && (((domain->state >> DOMFLAGS_SHUTDOWNSHIFT)
    9.15 -		 & DOMFLAGS_SHUTDOWNMASK) == SHUTDOWN_crash);
    9.16 +	return ((domain->state & XEN_DOMINF_shutdown) == XEN_DOMINF_shutdown)
    9.17 +	    && (((domain->state >> XEN_DOMINF_shutdownshift)
    9.18 +		 & XEN_DOMINF_shutdownmask) == SHUTDOWN_crash);
    9.19  }
    9.20  
    9.21  unsigned int xenstat_domain_shutdown(xenstat_domain * domain)
    9.22  {
    9.23 -	return ((domain->state & DOMFLAGS_SHUTDOWN) == DOMFLAGS_SHUTDOWN)
    9.24 -	    && (((domain->state >> DOMFLAGS_SHUTDOWNSHIFT)
    9.25 -		 & DOMFLAGS_SHUTDOWNMASK) != SHUTDOWN_crash);
    9.26 +	return ((domain->state & XEN_DOMINF_shutdown) == XEN_DOMINF_shutdown)
    9.27 +	    && (((domain->state >> XEN_DOMINF_shutdownshift)
    9.28 +		 & XEN_DOMINF_shutdownmask) != SHUTDOWN_crash);
    9.29  }
    9.30  
    9.31  unsigned int xenstat_domain_paused(xenstat_domain * domain)
    9.32  {
    9.33 -	return (domain->state & DOMFLAGS_PAUSED) == DOMFLAGS_PAUSED;
    9.34 +	return (domain->state & XEN_DOMINF_paused) == XEN_DOMINF_paused;
    9.35  }
    9.36  
    9.37  unsigned int xenstat_domain_blocked(xenstat_domain * domain)
    9.38  {
    9.39 -	return (domain->state & DOMFLAGS_BLOCKED) == DOMFLAGS_BLOCKED;
    9.40 +	return (domain->state & XEN_DOMINF_blocked) == XEN_DOMINF_blocked;
    9.41  }
    9.42  
    9.43  unsigned int xenstat_domain_running(xenstat_domain * domain)
    9.44  {
    9.45 -	return (domain->state & DOMFLAGS_RUNNING) == DOMFLAGS_RUNNING;
    9.46 +	return (domain->state & XEN_DOMINF_running) == XEN_DOMINF_running;
    9.47  }
    9.48  
    9.49  /* Get the number of networks for a given domain */
    10.1 --- a/xen/arch/x86/domain.c	Fri Nov 03 10:41:20 2006 +0000
    10.2 +++ b/xen/arch/x86/domain.c	Fri Nov 03 10:52:29 2006 +0000
    10.3 @@ -286,10 +286,6 @@ int arch_set_info_guest(
    10.4      unsigned long cr3_pfn = INVALID_MFN;
    10.5      int i, rc;
    10.6  
    10.7 -    if ( !!(c->flags & VGCF_hvm_guest) != is_hvm_vcpu(v) )
    10.8 -        return -EINVAL;
    10.9 -    c->flags &= ~VGCF_hvm_guest;
   10.10 -
   10.11      if ( !is_hvm_vcpu(v) )
   10.12      {
   10.13          fixup_guest_stack_selector(c->user_regs.ss);
    11.1 --- a/xen/arch/x86/domctl.c	Fri Nov 03 10:41:20 2006 +0000
    11.2 +++ b/xen/arch/x86/domctl.c	Fri Nov 03 10:52:29 2006 +0000
    11.3 @@ -310,8 +310,6 @@ void arch_getdomaininfo_ctxt(
    11.4          c->flags |= VGCF_i387_valid;
    11.5      if ( guest_kernel_mode(v, &v->arch.guest_context.user_regs) )
    11.6          c->flags |= VGCF_in_kernel;
    11.7 -    if ( is_hvm_vcpu(v) )
    11.8 -        c->flags |= VGCF_hvm_guest;
    11.9  
   11.10      c->ctrlreg[3] = xen_pfn_to_cr3(pagetable_get_pfn(v->arch.guest_table));
   11.11  
    12.1 --- a/xen/common/domctl.c	Fri Nov 03 10:41:20 2006 +0000
    12.2 +++ b/xen/common/domctl.c	Fri Nov 03 10:52:29 2006 +0000
    12.3 @@ -83,7 +83,7 @@ void getdomaininfo(struct domain *d, str
    12.4  {
    12.5      struct vcpu   *v;
    12.6      u64 cpu_time = 0;
    12.7 -    int flags = DOMFLAGS_BLOCKED;
    12.8 +    int flags = XEN_DOMINF_blocked;
    12.9      struct vcpu_runstate_info runstate;
   12.10      
   12.11      info->domain = d->domain_id;
   12.12 @@ -93,16 +93,17 @@ void getdomaininfo(struct domain *d, str
   12.13       * - domain is marked as blocked only if all its vcpus are blocked
   12.14       * - domain is marked as running if any of its vcpus is running
   12.15       */
   12.16 -    for_each_vcpu ( d, v ) {
   12.17 +    for_each_vcpu ( d, v )
   12.18 +    {
   12.19          vcpu_runstate_get(v, &runstate);
   12.20          cpu_time += runstate.time[RUNSTATE_running];
   12.21          info->max_vcpu_id = v->vcpu_id;
   12.22          if ( !test_bit(_VCPUF_down, &v->vcpu_flags) )
   12.23          {
   12.24              if ( !(v->vcpu_flags & VCPUF_blocked) )
   12.25 -                flags &= ~DOMFLAGS_BLOCKED;
   12.26 +                flags &= ~XEN_DOMINF_blocked;
   12.27              if ( v->vcpu_flags & VCPUF_running )
   12.28 -                flags |= DOMFLAGS_RUNNING;
   12.29 +                flags |= XEN_DOMINF_running;
   12.30              info->nr_online_vcpus++;
   12.31          }
   12.32      }
   12.33 @@ -110,12 +111,15 @@ void getdomaininfo(struct domain *d, str
   12.34      info->cpu_time = cpu_time;
   12.35      
   12.36      info->flags = flags |
   12.37 -        ((d->domain_flags & DOMF_dying)      ? DOMFLAGS_DYING    : 0) |
   12.38 -        ((d->domain_flags & DOMF_shutdown)   ? DOMFLAGS_SHUTDOWN : 0) |
   12.39 -        ((d->domain_flags & DOMF_ctrl_pause) ? DOMFLAGS_PAUSED   : 0) |
   12.40 -        d->shutdown_code << DOMFLAGS_SHUTDOWNSHIFT;
   12.41 +        ((d->domain_flags & DOMF_dying)      ? XEN_DOMINF_dying    : 0) |
   12.42 +        ((d->domain_flags & DOMF_shutdown)   ? XEN_DOMINF_shutdown : 0) |
   12.43 +        ((d->domain_flags & DOMF_ctrl_pause) ? XEN_DOMINF_paused   : 0) |
   12.44 +        d->shutdown_code << XEN_DOMINF_shutdownshift;
   12.45  
   12.46 -    if (d->ssid != NULL)
   12.47 +    if ( is_hvm_domain(d) )
   12.48 +        info->flags |= XEN_DOMINF_hvm_guest;
   12.49 +
   12.50 +    if ( d->ssid != NULL )
   12.51          info->ssidref = ((struct acm_ssid_domain *)d->ssid)->ssidref;
   12.52      else    
   12.53          info->ssidref = ACM_DEFAULT_SSID;
    13.1 --- a/xen/include/asm-x86/hvm/support.h	Fri Nov 03 10:41:20 2006 +0000
    13.2 +++ b/xen/include/asm-x86/hvm/support.h	Fri Nov 03 10:52:29 2006 +0000
    13.3 @@ -32,9 +32,6 @@
    13.4  #define HVM_DEBUG 1
    13.5  #endif
    13.6  
    13.7 -#define is_hvm_domain(d) ((d)->is_hvm)
    13.8 -#define is_hvm_vcpu(v)   (is_hvm_domain(v->domain))
    13.9 -
   13.10  static inline shared_iopage_t *get_sp(struct domain *d)
   13.11  {
   13.12      return (shared_iopage_t *) d->arch.hvm_domain.shared_page_va;
    14.1 --- a/xen/include/public/arch-x86_32.h	Fri Nov 03 10:41:20 2006 +0000
    14.2 +++ b/xen/include/public/arch-x86_32.h	Fri Nov 03 10:52:29 2006 +0000
    14.3 @@ -172,12 +172,9 @@ struct vcpu_guest_context {
    14.4      /* FPU registers come first so they can be aligned for FXSAVE/FXRSTOR. */
    14.5      struct { char x[512]; } fpu_ctxt;       /* User-level FPU registers     */
    14.6  #define VGCF_I387_VALID                (1<<0)
    14.7 -#define VGCF_HVM_GUEST                 (1<<1)
    14.8  #define VGCF_IN_KERNEL                 (1<<2)
    14.9  #define _VGCF_i387_valid               0
   14.10  #define VGCF_i387_valid                (1<<_VGCF_i387_valid)
   14.11 -#define _VGCF_hvm_guest                1
   14.12 -#define VGCF_hvm_guest                 (1<<_VGCF_hvm_guest)
   14.13  #define _VGCF_in_kernel                2
   14.14  #define VGCF_in_kernel                 (1<<_VGCF_in_kernel)
   14.15  #define _VGCF_failsafe_disables_events 3
    15.1 --- a/xen/include/public/arch-x86_64.h	Fri Nov 03 10:41:20 2006 +0000
    15.2 +++ b/xen/include/public/arch-x86_64.h	Fri Nov 03 10:52:29 2006 +0000
    15.3 @@ -245,12 +245,9 @@ struct vcpu_guest_context {
    15.4      /* FPU registers come first so they can be aligned for FXSAVE/FXRSTOR. */
    15.5      struct { char x[512]; } fpu_ctxt;       /* User-level FPU registers     */
    15.6  #define VGCF_I387_VALID                (1<<0)
    15.7 -#define VGCF_HVM_GUEST                 (1<<1)
    15.8  #define VGCF_IN_KERNEL                 (1<<2)
    15.9  #define _VGCF_i387_valid               0
   15.10  #define VGCF_i387_valid                (1<<_VGCF_i387_valid)
   15.11 -#define _VGCF_hvm_guest                1
   15.12 -#define VGCF_hvm_guest                 (1<<_VGCF_hvm_guest)
   15.13  #define _VGCF_in_kernel                2
   15.14  #define VGCF_in_kernel                 (1<<_VGCF_in_kernel)
   15.15  #define _VGCF_failsafe_disables_events 3
    16.1 --- a/xen/include/public/domctl.h	Fri Nov 03 10:41:20 2006 +0000
    16.2 +++ b/xen/include/public/domctl.h	Fri Nov 03 10:52:29 2006 +0000
    16.3 @@ -32,6 +32,7 @@ struct xen_domctl_createdomain {
    16.4      /* IN parameters */
    16.5      uint32_t ssidref;
    16.6      xen_domain_handle_t handle;
    16.7 + /* Is this an HVM guest (as opposed to a PV guest)? */
    16.8  #define _XEN_DOMCTL_CDF_hvm_guest 0
    16.9  #define XEN_DOMCTL_CDF_hvm_guest  (1U<<_XEN_DOMCTL_CDF_hvm_guest)
   16.10      uint32_t flags;
   16.11 @@ -47,22 +48,37 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_creat
   16.12  struct xen_domctl_getdomaininfo {
   16.13      /* OUT variables. */
   16.14      domid_t  domain;              /* Also echoed in domctl.domain */
   16.15 -#define DOMFLAGS_DYING     (1<<0) /* Domain is scheduled to die.             */
   16.16 -#define DOMFLAGS_SHUTDOWN  (1<<2) /* The guest OS has shut down.             */
   16.17 -#define DOMFLAGS_PAUSED    (1<<3) /* Currently paused by control software.   */
   16.18 -#define DOMFLAGS_BLOCKED   (1<<4) /* Currently blocked pending an event.     */
   16.19 -#define DOMFLAGS_RUNNING   (1<<5) /* Domain is currently running.            */
   16.20 -#define DOMFLAGS_CPUMASK      255 /* CPU to which this domain is bound.      */
   16.21 -#define DOMFLAGS_CPUSHIFT       8
   16.22 -#define DOMFLAGS_SHUTDOWNMASK 255 /* DOMFLAGS_SHUTDOWN guest-supplied code.  */
   16.23 -#define DOMFLAGS_SHUTDOWNSHIFT 16
   16.24 -    uint32_t flags;
   16.25 + /* Domain is scheduled to die. */
   16.26 +#define _XEN_DOMINF_dying     0
   16.27 +#define XEN_DOMINF_dying      (1U<<_XEN_DOMINF_dying)
   16.28 + /* Domain is an HVM guest (as opposed to a PV guest). */
   16.29 +#define _XEN_DOMINF_hvm_guest 1
   16.30 +#define XEN_DOMINF_hvm_guest  (1U<<_XEN_DOMINF_hvm_guest)
   16.31 + /* The guest OS has shut down. */
   16.32 +#define _XEN_DOMINF_shutdown  2
   16.33 +#define XEN_DOMINF_shutdown   (1U<<_XEN_DOMINF_shutdown)
   16.34 + /* Currently paused by control software. */
   16.35 +#define _XEN_DOMINF_paused    3
   16.36 +#define XEN_DOMINF_paused     (1U<<_XEN_DOMINF_paused)
   16.37 + /* Currently blocked pending an event.     */
   16.38 +#define _XEN_DOMINF_blocked   4
   16.39 +#define XEN_DOMINF_blocked    (1U<<_XEN_DOMINF_blocked)
   16.40 + /* Domain is currently running.            */
   16.41 +#define _XEN_DOMINF_running   5
   16.42 +#define XEN_DOMINF_running    (1U<<_XEN_DOMINF_running)
   16.43 + /* CPU to which this domain is bound.      */
   16.44 +#define XEN_DOMINF_cpumask      255
   16.45 +#define XEN_DOMINF_cpushift       8
   16.46 + /* XEN_DOMINF_shutdown guest-supplied code.  */
   16.47 +#define XEN_DOMINF_shutdownmask 255
   16.48 +#define XEN_DOMINF_shutdownshift 16
   16.49 +    uint32_t flags;              /* XEN_DOMINF_* */
   16.50      uint64_t tot_pages;
   16.51      uint64_t max_pages;
   16.52      uint64_t shared_info_frame;  /* MFN of shared_info struct */
   16.53      uint64_t cpu_time;
   16.54 -    uint32_t nr_online_vcpus;     /* Number of VCPUs currently online. */
   16.55 -    uint32_t max_vcpu_id;         /* Maximum VCPUID in use by this domain. */
   16.56 +    uint32_t nr_online_vcpus;    /* Number of VCPUs currently online. */
   16.57 +    uint32_t max_vcpu_id;        /* Maximum VCPUID in use by this domain. */
   16.58      uint32_t ssidref;
   16.59      xen_domain_handle_t handle;
   16.60  };
    17.1 --- a/xen/include/xen/sched.h	Fri Nov 03 10:41:20 2006 +0000
    17.2 +++ b/xen/include/xen/sched.h	Fri Nov 03 10:52:29 2006 +0000
    17.3 @@ -461,6 +461,9 @@ static inline void vcpu_unblock(struct v
    17.4  
    17.5  #define VM_ASSIST(_d,_t) (test_bit((_t), &(_d)->vm_assist))
    17.6  
    17.7 +#define is_hvm_domain(d) ((d)->is_hvm)
    17.8 +#define is_hvm_vcpu(v)   (is_hvm_domain(v->domain))
    17.9 +
   17.10  #endif /* __SCHED_H__ */
   17.11  
   17.12  /*