xen: report PV capability in sysctl and use it in toolstack

0e2c886ef ("xen: decouple HVM and IOMMU capabilities") provided a
truth table for what `xl info` would report. In order to make the
table work xen will need to report its PV capability.

Replace cap_directio with cap_pv in libxl IDL. It is safe to do so
because cap_directio has never been released. Revert to use
cap_hvm_directio to mark the availability of IOMMU, to save us from
providing a compatibility layer.

Don't bump sysctl version number because we've already done so.

Also provide a new virt_caps "pv", change "directio" to "pv_directio".
The truth table is now:

    pv      hvm     iommu           flags in xl info
    0       0       x               n/a
    0       1       0               hvm
    0       1       1               hvm hvm_directio
    1       0       0               pv
    1       0       1               pv pv_directio
    1       1       0               pv hvm
    1       1       1               pv hvm hvm_directio pv_directio

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
This commit is contained in:
Wei Liu committed 2018-11-15 15:16:49 +00:00
1 parent 2262e808f4
commit f089fddd94
6 files changed
+17 -11

No files matched your search

+2 -2
View File
@@ -396,9 +396,9 @@ int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo)
memcpy(physinfo->hw_cap,xcphysinfo.hw_cap, sizeof(physinfo->hw_cap));
physinfo->cap_hvm = !!(xcphysinfo.capabilities & XEN_SYSCTL_PHYSCAP_hvm);
physinfo->cap_directio =
physinfo->cap_pv = !!(xcphysinfo.capabilities & XEN_SYSCTL_PHYSCAP_pv);
physinfo->cap_hvm_directio =
!!(xcphysinfo.capabilities & XEN_SYSCTL_PHYSCAP_directio);
physinfo->cap_hvm_directio = physinfo->cap_hvm && physinfo->cap_directio;
GC_FREE;
return 0;
+3 -3
View File
@@ -67,11 +67,11 @@
* the same $(XEN_VERSION) (e.g. throughout a major release).
*/
/* LIBXL_HAVE_PHYSINFO_CAP_DIRECTIO
/* LIBXL_HAVE_PHYSINFO_CAP_PV
*
* If this is defined, libxl_physinfo has a "cap_directio" field.
* If this is defined, libxl_physinfo has a "cap_pv" field.
*/
#define LIBXL_HAVE_PHYSINFO_CAP_DIRECTIO 1
#define LIBXL_HAVE_PHYSINFO_CAP_PV 1
/* LIBXL_HAVE_CONSOLE_NOTIFY_FD
*
+2 -2
View File
@@ -1013,8 +1013,8 @@ libxl_physinfo = Struct("physinfo", [
("hw_cap", libxl_hwcap),
("cap_hvm", bool),
("cap_hvm_directio", bool),
("cap_directio", bool),
("cap_pv", bool),
("cap_hvm_directio", bool), # No longer HVM specific
], dir=DIR_OUT)
libxl_connectorinfo = Struct("connectorinfo", [
+4 -3
View File
@@ -210,10 +210,11 @@ 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\n",
maybe_printf("virt_caps :%s%s%s%s\n",
info.cap_pv ? " pv" : "",
info.cap_hvm ? " hvm" : "",
info.cap_hvm_directio ? " hvm_directio" : "",
info.cap_directio ? " directio" : ""
info.cap_hvm && info.cap_hvm_directio ? " hvm_directio" : "",
info.cap_pv && info.cap_hvm_directio ? " pv_directio" : ""
);
vinfo = libxl_get_version_info(ctx);
+2
View File
@@ -120,6 +120,8 @@ void arch_do_physinfo(struct xen_sysctl_physinfo *pi)
min(sizeof(pi->hw_cap), sizeof(boot_cpu_data.x86_capability)));
if ( hvm_enabled )
pi->capabilities |= XEN_SYSCTL_PHYSCAP_hvm;
if ( IS_ENABLED(CONFIG_PV) )
pi->capabilities |= XEN_SYSCTL_PHYSCAP_pv;
if ( iommu_enabled )
pi->capabilities |= XEN_SYSCTL_PHYSCAP_directio;
}
+4 -1
View File
@@ -85,8 +85,11 @@ struct xen_sysctl_tbuf_op {
/* (x86) The platform supports HVM guests. */
#define _XEN_SYSCTL_PHYSCAP_hvm 0
#define XEN_SYSCTL_PHYSCAP_hvm (1u<<_XEN_SYSCTL_PHYSCAP_hvm)
/* (x86) The platform supports PV guests. */
#define _XEN_SYSCTL_PHYSCAP_pv 1
#define XEN_SYSCTL_PHYSCAP_pv (1u<<_XEN_SYSCTL_PHYSCAP_pv)
/* (x86) The platform supports direct access to I/O devices with IOMMU. */
#define _XEN_SYSCTL_PHYSCAP_directio 1
#define _XEN_SYSCTL_PHYSCAP_directio 2
#define XEN_SYSCTL_PHYSCAP_directio (1u<<_XEN_SYSCTL_PHYSCAP_directio)
struct xen_sysctl_physinfo {
uint32_t threads_per_core;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.