xen: decouple HVM and IOMMU capabilities

HVM and IOMMU are two distinct hardware features, yet they were
bundled together in sysctl and xl's output.

Decouple them on sysctl level. On toolstack level we still need to
maintain a sensible semantics for `xl info`. Massage the information
according to the following table:

pv      hvm     iommu           flags in xl info
0       0       0               n/a
0       0       1               n/a
0       1       0               hvm
0       1       1               hvm hvm_directio
1       0       0               NIL
1       0       1               directio
1       1       0               hvm
1       1       1               hvm hvm_directio directio

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
This commit is contained in:
Wei Liu committed 2018-09-13 17:03:32 +01:00
1 parent efaf9122b8
commit 0e2c886efa
6 files changed
+18 -9

No files matched your search

+3 -2
View File
@@ -396,8 +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_hvm_directio =
!!(xcphysinfo.capabilities & XEN_SYSCTL_PHYSCAP_hvm_directio);
physinfo->cap_directio =
!!(xcphysinfo.capabilities & XEN_SYSCTL_PHYSCAP_directio);
physinfo->cap_hvm_directio = physinfo->cap_hvm && physinfo->cap_directio;
GC_FREE;
return 0;
+6
View File
@@ -67,6 +67,12 @@
* the same $(XEN_VERSION) (e.g. throughout a major release).
*/
/* LIBXL_HAVE_PHYSINFO_CAP_DIRECTIO
*
* If this is defined, libxl_physinfo has a "cap_directio" field.
*/
#define LIBXL_HAVE_PHYSINFO_CAP_DIRECTIO 1
/* LIBXL_HAVE_CONSOLE_NOTIFY_FD
*
* If this is defined, libxl_console_exec and
+1
View File
@@ -1014,6 +1014,7 @@ libxl_physinfo = Struct("physinfo", [
("cap_hvm", bool),
("cap_hvm_directio", bool),
("cap_directio", bool),
], dir=DIR_OUT)
libxl_connectorinfo = Struct("connectorinfo", [
+3 -2
View File
@@ -210,9 +210,10 @@ 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\n",
maybe_printf("virt_caps :%s%s%s\n",
info.cap_hvm ? " hvm" : "",
info.cap_hvm_directio ? " hvm_directio" : ""
info.cap_hvm_directio ? " hvm_directio" : "",
info.cap_directio ? " directio" : ""
);
vinfo = libxl_get_version_info(ctx);
+1 -1
View File
@@ -93,7 +93,7 @@ void arch_do_physinfo(struct xen_sysctl_physinfo *pi)
if ( hvm_enabled )
pi->capabilities |= XEN_SYSCTL_PHYSCAP_hvm;
if ( iommu_enabled )
pi->capabilities |= XEN_SYSCTL_PHYSCAP_hvm_directio;
pi->capabilities |= XEN_SYSCTL_PHYSCAP_directio;
}
long arch_do_sysctl(
+4 -4
View File
@@ -36,7 +36,7 @@
#include "physdev.h"
#include "tmem.h"
#define XEN_SYSCTL_INTERFACE_VERSION 0x00000011
#define XEN_SYSCTL_INTERFACE_VERSION 0x00000012
/*
* Read console content from Xen buffer ring.
@@ -85,9 +85,9 @@ 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 HVM-guest direct access to I/O devices. */
#define _XEN_SYSCTL_PHYSCAP_hvm_directio 1
#define XEN_SYSCTL_PHYSCAP_hvm_directio (1u<<_XEN_SYSCTL_PHYSCAP_hvm_directio)
/* (x86) The platform supports direct access to I/O devices with IOMMU. */
#define _XEN_SYSCTL_PHYSCAP_directio 1
#define XEN_SYSCTL_PHYSCAP_directio (1u<<_XEN_SYSCTL_PHYSCAP_directio)
struct xen_sysctl_physinfo {
uint32_t threads_per_core;
uint32_t cores_per_socket;
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.