[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] xen: Report grant table v1/v2 capabilities to the toolstack
commit b36c23eada769f647e5352d5691f793be06afd62 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Fri Oct 29 18:38:13 2021 +0100 Commit: Ian Jackson <iwj@xxxxxxxxxxxxxx> CommitDate: Mon Nov 8 15:09:16 2021 +0000 xen: Report grant table v1/v2 capabilities to the toolstack In order to let the toolstack be able to set the gnttab version on a per-domain basis, it needs to know which ABIs Xen supports. Introduce XEN_SYSCTL_PHYSCAP_gnttab_v{1,2} for the purpose, and plumb in down into userspace. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Acked-by: Christian Lindig <christian.lindig@xxxxxxxxxx> Reviewed-by: Ian Jackson <iwj@xxxxxxxxxxxxxx> Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> Releae-Acked-by: Ian Jackson <iwj@xxxxxxxxxxxxxx> --- tools/golang/xenlight/helpers.gen.go | 4 ++++ tools/golang/xenlight/types.gen.go | 2 ++ tools/include/libxl.h | 6 ++++++ tools/libs/light/libxl.c | 4 ++++ tools/libs/light/libxl_types.idl | 2 ++ tools/ocaml/libs/xc/xenctrl.ml | 2 ++ tools/ocaml/libs/xc/xenctrl.mli | 2 ++ tools/xl/xl_info.c | 6 ++++-- xen/common/grant_table.c | 2 +- xen/common/sysctl.c | 6 ++++++ xen/include/public/sysctl.h | 6 +++++- xen/include/xen/grant_table.h | 2 ++ 12 files changed, 40 insertions(+), 4 deletions(-) diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/helpers.gen.go index 2449580bad..6e1b054310 100644 --- a/tools/golang/xenlight/helpers.gen.go +++ b/tools/golang/xenlight/helpers.gen.go @@ -3367,6 +3367,8 @@ x.CapShadow = bool(xc.cap_shadow) x.CapIommuHapPtShare = bool(xc.cap_iommu_hap_pt_share) x.CapVmtrace = bool(xc.cap_vmtrace) x.CapVpmu = bool(xc.cap_vpmu) +x.CapGnttabV1 = bool(xc.cap_gnttab_v1) +x.CapGnttabV2 = bool(xc.cap_gnttab_v2) return nil} @@ -3399,6 +3401,8 @@ xc.cap_shadow = C.bool(x.CapShadow) xc.cap_iommu_hap_pt_share = C.bool(x.CapIommuHapPtShare) xc.cap_vmtrace = C.bool(x.CapVmtrace) xc.cap_vpmu = C.bool(x.CapVpmu) +xc.cap_gnttab_v1 = C.bool(x.CapGnttabV1) +xc.cap_gnttab_v2 = C.bool(x.CapGnttabV2) return nil } diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/types.gen.go index b2e8bd1a85..a0acfaacc3 100644 --- a/tools/golang/xenlight/types.gen.go +++ b/tools/golang/xenlight/types.gen.go @@ -1010,6 +1010,8 @@ CapShadow bool CapIommuHapPtShare bool CapVmtrace bool CapVpmu bool +CapGnttabV1 bool +CapGnttabV2 bool } type Connectorinfo struct { diff --git a/tools/include/libxl.h b/tools/include/libxl.h index 2e8679dbcb..54c10f6efe 100644 --- a/tools/include/libxl.h +++ b/tools/include/libxl.h @@ -514,6 +514,12 @@ */ #define LIBXL_HAVE_VPMU 1 +/* + * LIBXL_HAVE_PHYSINFO_CAP_GNTTAB indicates that libxl_physinfo has a + * cap_gnttab_v1/2 fields, which indicates the available grant table ABIs. + */ +#define LIBXL_HAVE_PHYSINFO_CAP_GNTTAB 1 + /* * libxl ABI compatibility * diff --git a/tools/libs/light/libxl.c b/tools/libs/light/libxl.c index a032723fde..a77aa856fd 100644 --- a/tools/libs/light/libxl.c +++ b/tools/libs/light/libxl.c @@ -405,6 +405,10 @@ int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo) physinfo->cap_vmtrace = !!(xcphysinfo.capabilities & XEN_SYSCTL_PHYSCAP_vmtrace); physinfo->cap_vpmu = !!(xcphysinfo.capabilities & XEN_SYSCTL_PHYSCAP_vpmu); + physinfo->cap_gnttab_v1 = + !!(xcphysinfo.capabilities & XEN_SYSCTL_PHYSCAP_gnttab_v1); + physinfo->cap_gnttab_v2 = + !!(xcphysinfo.capabilities & XEN_SYSCTL_PHYSCAP_gnttab_v2); GC_FREE; return 0; diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl index 608d55a456..573bba68ee 100644 --- a/tools/libs/light/libxl_types.idl +++ b/tools/libs/light/libxl_types.idl @@ -1065,6 +1065,8 @@ libxl_physinfo = Struct("physinfo", [ ("cap_iommu_hap_pt_share", bool), ("cap_vmtrace", bool), ("cap_vpmu", bool), + ("cap_gnttab_v1", bool), + ("cap_gnttab_v2", bool), ], dir=DIR_OUT) libxl_connectorinfo = Struct("connectorinfo", [ diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml index addcf4cc59..ed2924a2b3 100644 --- a/tools/ocaml/libs/xc/xenctrl.ml +++ b/tools/ocaml/libs/xc/xenctrl.ml @@ -123,6 +123,8 @@ type physinfo_cap_flag = | CAP_IOMMU_HAP_PT_SHARE | CAP_Vmtrace | CAP_Vpmu + | CAP_Gnttab_v1 + | CAP_Gnttab_v2 type physinfo = { diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.mli index 0a5ce529e9..d20dc0108d 100644 --- a/tools/ocaml/libs/xc/xenctrl.mli +++ b/tools/ocaml/libs/xc/xenctrl.mli @@ -108,6 +108,8 @@ type physinfo_cap_flag = | CAP_IOMMU_HAP_PT_SHARE | CAP_Vmtrace | CAP_Vpmu + | CAP_Gnttab_v1 + | CAP_Gnttab_v2 type physinfo = { threads_per_core : int; diff --git a/tools/xl/xl_info.c b/tools/xl/xl_info.c index 2c86b317b7..712b7638b0 100644 --- a/tools/xl/xl_info.c +++ b/tools/xl/xl_info.c @@ -210,7 +210,7 @@ static void output_physinfo(void) info.hw_cap[4], info.hw_cap[5], info.hw_cap[6], info.hw_cap[7] ); - maybe_printf("virt_caps :%s%s%s%s%s%s%s%s%s\n", + maybe_printf("virt_caps :%s%s%s%s%s%s%s%s%s%s%s\n", info.cap_pv ? " pv" : "", info.cap_hvm ? " hvm" : "", info.cap_hvm && info.cap_hvm_directio ? " hvm_directio" : "", @@ -219,7 +219,9 @@ static void output_physinfo(void) info.cap_shadow ? " shadow" : "", info.cap_iommu_hap_pt_share ? " iommu_hap_pt_share" : "", info.cap_vmtrace ? " vmtrace" : "", - info.cap_vpmu ? " vpmu" : "" + info.cap_vpmu ? " vpmu" : "", + info.cap_gnttab_v1 ? " gnttab-v1" : "", + info.cap_gnttab_v2 ? " gnttab-v2" : "" ); vinfo = libxl_get_version_info(ctx); diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index e510395d08..a20319b22a 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -178,7 +178,7 @@ static int parse_gnttab_max_maptrack_frames(const char *arg) #define GNTTAB_MAX_VERSION 2 #endif -static unsigned int __read_mostly opt_gnttab_max_version = GNTTAB_MAX_VERSION; +unsigned int __read_mostly opt_gnttab_max_version = GNTTAB_MAX_VERSION; static bool __read_mostly opt_transitive_grants = true; static int __init parse_gnttab(const char *s) diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c index f2dab722b6..1ad3c29351 100644 --- a/xen/common/sysctl.c +++ b/xen/common/sysctl.c @@ -12,6 +12,7 @@ #include <xen/sched.h> #include <xen/domain.h> #include <xen/event.h> +#include <xen/grant_table.h> #include <xen/domain_page.h> #include <xen/trace.h> #include <xen/console.h> @@ -283,6 +284,11 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl) if ( vpmu_is_available ) pi->capabilities |= XEN_SYSCTL_PHYSCAP_vpmu; + if ( opt_gnttab_max_version >= 1 ) + pi->capabilities |= XEN_SYSCTL_PHYSCAP_gnttab_v1; + if ( opt_gnttab_max_version >= 2 ) + pi->capabilities |= XEN_SYSCTL_PHYSCAP_gnttab_v2; + if ( copy_to_guest(u_sysctl, op, 1) ) ret = -EFAULT; } diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h index 3e53681b43..55252e97f2 100644 --- a/xen/include/public/sysctl.h +++ b/xen/include/public/sysctl.h @@ -104,8 +104,12 @@ struct xen_sysctl_tbuf_op { /* The platform supports vPMU. */ #define XEN_SYSCTL_PHYSCAP_vpmu (1u << 7) +/* Xen supports the Grant v1 and/or v2 ABIs. */ +#define XEN_SYSCTL_PHYSCAP_gnttab_v1 (1u << 8) +#define XEN_SYSCTL_PHYSCAP_gnttab_v2 (1u << 9) + /* Max XEN_SYSCTL_PHYSCAP_* constant. Used for ABI checking. */ -#define XEN_SYSCTL_PHYSCAP_MAX XEN_SYSCTL_PHYSCAP_vpmu +#define XEN_SYSCTL_PHYSCAP_MAX XEN_SYSCTL_PHYSCAP_gnttab_v2 struct xen_sysctl_physinfo { uint32_t threads_per_core; diff --git a/xen/include/xen/grant_table.h b/xen/include/xen/grant_table.h index 41713e2726..9ee830cfd0 100644 --- a/xen/include/xen/grant_table.h +++ b/xen/include/xen/grant_table.h @@ -32,6 +32,7 @@ struct grant_table; #ifdef CONFIG_GRANT_TABLE +extern unsigned int opt_gnttab_max_version; extern unsigned int opt_max_grant_frames; /* Create/destroy per-domain grant table context. */ @@ -63,6 +64,7 @@ int gnttab_acquire_resource( #else +#define opt_gnttab_max_version 0 #define opt_max_grant_frames 0 static inline int grant_table_init(struct domain *d, -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |