]> xenbits.xensource.com Git - xen.git/commitdiff
xen/domctl: Add DOMINFO_hap to xen_domctl_getdomaininfo
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 15 Jul 2016 15:43:48 +0000 (16:43 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 27 Jul 2016 14:34:31 +0000 (15:34 +0100)
This allows a toolstack to identify whether a running domain is using hardware
assisted paging or not.

The appropriate tests differ by architecture, so introduce
arch_get_domain_info().  ARM unconditionally sets the new flag, while x86
checks with the paging subsystem first.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
tools/libxc/include/xenctrl.h
tools/libxc/xc_domain.c
xen/arch/arm/domctl.c
xen/arch/x86/domctl.c
xen/common/domctl.c
xen/include/public/domctl.h
xen/include/xen/domain.h

index e904bd591113bd72cfc2a83ae483144845e9fba1..fdc148ac2d956f62aef998bcc9d5f57ce5cf21e2 100644 (file)
@@ -442,7 +442,7 @@ typedef struct xc_dominfo {
     uint32_t      ssidref;
     unsigned int  dying:1, crashed:1, shutdown:1,
                   paused:1, blocked:1, running:1,
-                  hvm:1, debugged:1, pvh:1, xenstore:1;
+                  hvm:1, debugged:1, pvh:1, xenstore:1, hap:1;
     unsigned int  shutdown_reason; /* only meaningful if shutdown==1 */
     unsigned long nr_pages; /* current number, not maximum */
     unsigned long nr_outstanding_pages;
index 050216e028a233ecd148665f24826794a4026e23..296b8523b5454fb68b15431e1ec7333ac45ac830 100644 (file)
@@ -372,6 +372,7 @@ int xc_domain_getinfo(xc_interface *xch,
         info->debugged = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_debugged);
         info->pvh      = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_pvh_guest);
         info->xenstore = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_xs_domain);
+        info->hap      = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_hap);
 
         info->shutdown_reason =
             (domctl.u.getdomaininfo.flags>>XEN_DOMINF_shutdownshift) &
index f61f98aac799b295611a27a512b49620cdf96ccd..09d9959ed78897cfe8eac79579fa755392c191ee 100644 (file)
 #include <xsm/xsm.h>
 #include <public/domctl.h>
 
+void arch_get_domain_info(const struct domain *d,
+                          struct xen_domctl_getdomaininfo *info)
+{
+    /* All ARM domains use hardware assisted paging. */
+    info->flags |= XEN_DOMINF_hap;
+}
+
 long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
                     XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
 {
index aedf26494beb9a582c0b835cafc8b9fb7ce84f90..bed70aad66fbe3dc420fd0e9295bb4cac2165a3f 100644 (file)
@@ -229,6 +229,13 @@ static void update_domain_cpuid_info(struct domain *d,
     }
 }
 
+void arch_get_domain_info(const struct domain *d,
+                          struct xen_domctl_getdomaininfo *info)
+{
+    if ( paging_mode_hap(d) )
+        info->flags |= XEN_DOMINF_hap;
+}
+
 #define MAX_IOPORTS 0x10000
 
 long arch_do_domctl(
index 87640b63be592829037e0975c87a08183e7039a4..8f25131b1bcc98477b382db1ed3d1d5c2a8851a3 100644 (file)
@@ -215,6 +215,8 @@ void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info)
     info->cpupool = d->cpupool ? d->cpupool->cpupool_id : CPUPOOLID_NONE;
 
     memcpy(info->handle, d->handle, sizeof(xen_domain_handle_t));
+
+    arch_get_domain_info(d, info);
 }
 
 bool_t domctl_lock_acquire(void)
index d6d231950139a7ee8c023f7052caa2f87a5cc1d4..ddd3de44bee364378a8491729aeb0d134264bb4e 100644 (file)
@@ -103,6 +103,9 @@ struct xen_domctl_getdomaininfo {
 /* domain is a xenstore domain */
 #define _XEN_DOMINF_xs_domain 8
 #define XEN_DOMINF_xs_domain  (1U<<_XEN_DOMINF_xs_domain)
+/* domain has hardware assisted paging */
+#define _XEN_DOMINF_hap       9
+#define XEN_DOMINF_hap        (1U<<_XEN_DOMINF_hap)
  /* XEN_DOMINF_shutdown guest-supplied code.  */
 #define XEN_DOMINF_shutdownmask 255
 #define XEN_DOMINF_shutdownshift 16
index a1a6f2528a61a4cb721e9650ee32c8bda673009a..bce0ea1ea9fbf8a4c22f6c8786bb2a3a38a0da6c 100644 (file)
@@ -18,6 +18,8 @@ int vcpu_reset(struct vcpu *);
 
 struct xen_domctl_getdomaininfo;
 void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info);
+void arch_get_domain_info(const struct domain *d,
+                          struct xen_domctl_getdomaininfo *info);
 
 /*
  * Arch-specifics.