Signed-off-by: Filip Alac <filipalac@xxxxxxxxx> --- docs/schemas/capability.rng | 13 +++++++++++++ src/conf/capabilities.c | 9 +++++++++ src/conf/capabilities.h | 3 +++ src/libvirt_private.syms | 1 + src/qemu/qemu_capabilities.c | 3 +++ src/test/test_driver.c | 2 ++ tests/qemucaps2xmldata/all_1.6.0-1.xml | 1 + tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.xml | 1 + tests/vircaps2xmldata/vircaps-aarch64-basic.xml | 1 + tests/vircaps2xmldata/vircaps-x86_64-basic.xml | 1 + tests/vircaps2xmldata/vircaps-x86_64-caches.xml | 1 + .../vircaps2xmldata/vircaps-x86_64-resctrl-cdp.xml | 1 + .../vircaps-x86_64-resctrl-skx-twocaches.xml | 1 + .../vircaps2xmldata/vircaps-x86_64-resctrl-skx.xml | 1 + tests/vircaps2xmldata/vircaps-x86_64-resctrl.xml | 1 + 15 files changed, 40 insertions(+) diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng index 66c5de62e5..52164d5ecb 100644 --- a/docs/schemas/capability.rng +++ b/docs/schemas/capability.rng @@ -39,6 +39,9 @@ <optional> <ref name='power_management'/> </optional> + <optional> + <ref name='iommu_support'/> + </optional> <optional> <ref name='migration'/> </optional> @@ -155,6 +158,16 @@ </element> </define> + <define name='iommu_support'> + <element name='iommu'> + <optional> + <attribute name='support'> + <ref name='virYesNo'/> + </attribute> + </optional> + </element> + </define> + <define name='migration'> <element name='migration_features'> <optional> diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index dd2fc77f91..0de1440349 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -1025,6 +1025,9 @@ virCapabilitiesFormatXML(virCapsPtr caps) virBufferAddLit(&buf, "<power_management/>\n"); } + virBufferAsprintf(&buf, "<iommu support='%s'/>\n", + caps->host.iommu ? "yes" : "no"); + if (caps->host.offlineMigrate) { virBufferAddLit(&buf, "<migration_features>\n"); virBufferAdjustIndent(&buf, 2); @@ -1743,3 +1746,9 @@ virCapabilitiesInitCaches(virCapsPtr caps) virBitmapFree(cpus); return ret; } + +void +virCapabilitiesHostInitIOMMU(virCapsPtr caps) +{ + caps->host.iommu = virHostHasIOMMU(); +} diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h index f0a06a24df..fe1b9ea455 100644 --- a/src/conf/capabilities.h +++ b/src/conf/capabilities.h @@ -183,6 +183,7 @@ struct _virCapsHost { int nPagesSize; /* size of pagesSize array */ unsigned int *pagesSize; /* page sizes support on the system */ unsigned char host_uuid[VIR_UUID_BUFLEN]; + bool iommu; }; typedef int (*virDomainDefNamespaceParse)(xmlDocPtr, xmlNodePtr, @@ -327,4 +328,6 @@ void virCapsHostCacheBankFree(virCapsHostCacheBankPtr ptr); int virCapabilitiesInitCaches(virCapsPtr caps); +void virCapabilitiesHostInitIOMMU(virCapsPtr caps); + #endif /* __VIR_CAPABILITIES_H */ diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index dacaf9d94b..99a14ab460 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -58,6 +58,7 @@ virCapabilitiesFreeMachines; virCapabilitiesFreeNUMAInfo; virCapabilitiesGetCpusForNodemask; virCapabilitiesGetNodeInfo; +virCapabilitiesHostInitIOMMU; virCapabilitiesHostSecModelAddBaseLabel; virCapabilitiesInitCaches; virCapabilitiesInitNUMA; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index b8764eacd8..26969ed3dc 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -948,6 +948,9 @@ virQEMUCapsInit(virFileCachePtr cache) if (virNodeSuspendGetTargetMask(&caps->host.powerMgmt) < 0) VIR_WARN("Failed to get host power management capabilities"); + /* Add IOMMU info */ + virCapabilitiesHostInitIOMMU(caps); + /* Add huge pages info */ if (virCapabilitiesInitPages(caps) < 0) VIR_WARN("Failed to get pages info"); diff --git a/src/test/test_driver.c b/src/test/test_driver.c index a43b9781eb..89121d4220 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -322,6 +322,8 @@ testBuildCapabilities(virConnectPtr conn) if (virCapabilitiesAddHostFeature(caps, "nonpae") < 0) goto error; + virCapabilitiesHostInitIOMMU(caps); + if (VIR_ALLOC_N(caps->host.pagesSize, 4) < 0) goto error; diff --git a/tests/qemucaps2xmldata/all_1.6.0-1.xml b/tests/qemucaps2xmldata/all_1.6.0-1.xml index 84d60008d8..efe86b9a12 100644 --- a/tests/qemucaps2xmldata/all_1.6.0-1.xml +++ b/tests/qemucaps2xmldata/all_1.6.0-1.xml @@ -5,6 +5,7 @@ <arch>i686</arch> </cpu> <power_management/> + <iommu support='no'/> </host> <guest> diff --git a/tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.xml b/tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.xml index 28762c263b..981344e6fd 100644 --- a/tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.xml +++ b/tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.xml @@ -5,6 +5,7 @@ <arch>i686</arch> </cpu> <power_management/> + <iommu support='no'/> </host> <guest> diff --git a/tests/vircaps2xmldata/vircaps-aarch64-basic.xml b/tests/vircaps2xmldata/vircaps-aarch64-basic.xml index ce156a364e..50466f9162 100644 --- a/tests/vircaps2xmldata/vircaps-aarch64-basic.xml +++ b/tests/vircaps2xmldata/vircaps-aarch64-basic.xml @@ -5,6 +5,7 @@ <arch>aarch64</arch> </cpu> <power_management/> + <iommu support='no'/> <migration_features> </migration_features> <topology> diff --git a/tests/vircaps2xmldata/vircaps-x86_64-basic.xml b/tests/vircaps2xmldata/vircaps-x86_64-basic.xml index 1f2c6659a5..e7be6def3e 100644 --- a/tests/vircaps2xmldata/vircaps-x86_64-basic.xml +++ b/tests/vircaps2xmldata/vircaps-x86_64-basic.xml @@ -5,6 +5,7 @@ <arch>x86_64</arch> </cpu> <power_management/> + <iommu support='no'/> <topology> <cells num='4'> <cell id='0'> diff --git a/tests/vircaps2xmldata/vircaps-x86_64-caches.xml b/tests/vircaps2xmldata/vircaps-x86_64-caches.xml index 0c6f3769a2..ca671a1640 100644 --- a/tests/vircaps2xmldata/vircaps-x86_64-caches.xml +++ b/tests/vircaps2xmldata/vircaps-x86_64-caches.xml @@ -5,6 +5,7 @@ <arch>x86_64</arch> </cpu> <power_management/> + <iommu support='no'/> <migration_features> <live/> </migration_features> diff --git a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-cdp.xml b/tests/vircaps2xmldata/vircaps-x86_64-resctrl-cdp.xml index 443917c62d..1d3df318c5 100644 --- a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-cdp.xml +++ b/tests/vircaps2xmldata/vircaps-x86_64-resctrl-cdp.xml @@ -5,6 +5,7 @@ <arch>x86_64</arch> </cpu> <power_management/> + <iommu support='no'/> <migration_features> <live/> </migration_features> diff --git a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-skx-twocaches.xml b/tests/vircaps2xmldata/vircaps-x86_64-resctrl-skx-twocaches.xml index d18665b24f..44c1042afe 100644 --- a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-skx-twocaches.xml +++ b/tests/vircaps2xmldata/vircaps-x86_64-resctrl-skx-twocaches.xml @@ -5,6 +5,7 @@ <arch>x86_64</arch> </cpu> <power_management/> + <iommu support='no'/> <migration_features> <live/> </migration_features> diff --git a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-skx.xml b/tests/vircaps2xmldata/vircaps-x86_64-resctrl-skx.xml index 0cd25e59a9..8382a26c7a 100644 --- a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-skx.xml +++ b/tests/vircaps2xmldata/vircaps-x86_64-resctrl-skx.xml @@ -5,6 +5,7 @@ <arch>x86_64</arch> </cpu> <power_management/> + <iommu support='no'/> <migration_features> <live/> </migration_features> diff --git a/tests/vircaps2xmldata/vircaps-x86_64-resctrl.xml b/tests/vircaps2xmldata/vircaps-x86_64-resctrl.xml index 7629259294..4840614e86 100644 --- a/tests/vircaps2xmldata/vircaps-x86_64-resctrl.xml +++ b/tests/vircaps2xmldata/vircaps-x86_64-resctrl.xml @@ -5,6 +5,7 @@ <arch>x86_64</arch> </cpu> <power_management/> + <iommu support='no'/> <migration_features> <live/> </migration_features> -- 2.17.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list