[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] xen/domctl: Add DOMINFO_hap to xen_domctl_getdomaininfo



commit 7179cd39efdb22ac847ae465d1aa11cd6263f19b
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Fri Jul 15 16:43:48 2016 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Wed Jul 27 15:34:31 2016 +0100

    xen/domctl: Add DOMINFO_hap to xen_domctl_getdomaininfo
    
    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@xxxxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Reviewed-by: Julien Grall <julien.grall@xxxxxxx>
    Reviewed-by: George Dunlap <george.dunlap@xxxxxxxxxx>
---
 tools/libxc/include/xenctrl.h | 2 +-
 tools/libxc/xc_domain.c       | 1 +
 xen/arch/arm/domctl.c         | 7 +++++++
 xen/arch/x86/domctl.c         | 7 +++++++
 xen/common/domctl.c           | 2 ++
 xen/include/public/domctl.h   | 3 +++
 xen/include/xen/domain.h      | 2 ++
 7 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index e904bd5..fdc148a 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -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;
diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
index 050216e..296b852 100644
--- a/tools/libxc/xc_domain.c
+++ b/tools/libxc/xc_domain.c
@@ -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) &
diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c
index f61f98a..09d9959 100644
--- a/xen/arch/arm/domctl.c
+++ b/xen/arch/arm/domctl.c
@@ -14,6 +14,13 @@
 #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)
 {
diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index aedf264..bed70aa 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -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(
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 87640b6..8f25131 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -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)
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index d6d2319..ddd3de4 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -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
diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h
index a1a6f25..bce0ea1 100644
--- a/xen/include/xen/domain.h
+++ b/xen/include/xen/domain.h
@@ -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.
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.