[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] 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> --- CC: Jan Beulich <JBeulich@xxxxxxxx> CC: Stefano Stabellini <sstabellini@xxxxxxxxxx> CC: Julien Grall <julien.grall@xxxxxxx> CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> CC: Wei Liu <wei.liu2@xxxxxxxxxx> --- tools/libxc/include/xenctrl.h | 2 +- tools/libxc/xc_domain.c | 1 + xen/arch/arm/domctl.c | 6 ++++++ 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, 22 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..afa16d8 100644 --- a/xen/arch/arm/domctl.c +++ b/xen/arch/arm/domctl.c @@ -14,6 +14,12 @@ #include <xsm/xsm.h> #include <public/domctl.h> +void arch_get_domain_info(const struct domain *d, + struct xen_domctl_getdomaininfo *info) +{ + 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..08f0031 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_enabled(d) && 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 b784e6c..c827963 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); } static unsigned int default_vcpu0_location(cpumask_t *online) 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. -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |