xen/domctl: Add DOMINFO_hap to xen_domctl_getdomaininfo
PATCH 1/1 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.
---
CC: Jan Beulich <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
--- 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(-)
tools/libxc/include/xenctrl.h +1 -1
@@ -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;
tools/libxc/xc_domain.c +1 -0
@@ -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) &
xen/arch/arm/domctl.c +6 -0
@@ -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) {
xen/arch/x86/domctl.c +7 -0
@@ -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(
xen/common/domctl.c +2 -0
@@ -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)
xen/include/public/domctl.h +3 -0
@@ -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
xen/include/xen/domain.h +2 -0
@@ -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.
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 14 lines · Andrew Cooper
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 <[email protected]>---
CC: Jan Beulich <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
Quoted 3 lines
--- tools/libxc/include/xenctrl.h | 2 +- tools/libxc/xc_domain.c | 1 +
Subject to acks from x86 and ARM maintainers:
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Hi Andrew,
Quoted 5 lines · Andrew Cooper
xen/arch/arm/domctl.c +0
-0
xen/arch/arm/domctl.c line 22
Quoted 9 lines
xen/arch/arm/domctl.c +6
-0@@ -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; +} +
The ARM change looks good to me. I have just one request, would be it possible to add a comment in the code explaining why hap is unconditionally set? (I.e domains are always using hap on ARM).
With that:
xen/arch/arm/domctl.c line 25
Quoted 3 lines
xen/arch/arm/domctl.c +0
-0long arch_do_domctl (struct xen_domctl *domctl,struct domain *d,XEN_GUEST_HANDLE_PARAM (xen_domctl_t) u_domctl) {
Regards,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 8 lines · Andrew Cooper
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 <[email protected]>
For THE REST:
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel