capabilities: Extend capabilities with iommu_support

Signed-off-by: Filip Alac <filipalac@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Filip Alac 2018-06-01 10:15:59 +02:00 committed by Michal Privoznik
parent 1597e155b2
commit dc34e78e21
15 changed files with 41 additions and 0 deletions

View File

@ -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>

View File

@ -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,10 @@ virCapabilitiesInitCaches(virCapsPtr caps)
virBitmapFree(cpus);
return ret;
}
void
virCapabilitiesHostInitIOMMU(virCapsPtr caps)
{
caps->host.iommu = virHostHasIOMMU();
}

View File

@ -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 */

View File

@ -58,6 +58,7 @@ virCapabilitiesFreeMachines;
virCapabilitiesFreeNUMAInfo;
virCapabilitiesGetCpusForNodemask;
virCapabilitiesGetNodeInfo;
virCapabilitiesHostInitIOMMU;
virCapabilitiesHostSecModelAddBaseLabel;
virCapabilitiesInitCaches;
virCapabilitiesInitNUMA;

View File

@ -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");

View File

@ -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;

View File

@ -5,6 +5,7 @@
<arch>i686</arch>
</cpu>
<power_management/>
<iommu support='no'/>
</host>
<guest>

View File

@ -5,6 +5,7 @@
<arch>i686</arch>
</cpu>
<power_management/>
<iommu support='no'/>
</host>
<guest>

View File

@ -5,6 +5,7 @@
<arch>aarch64</arch>
</cpu>
<power_management/>
<iommu support='no'/>
<migration_features>
</migration_features>
<topology>

View File

@ -5,6 +5,7 @@
<arch>x86_64</arch>
</cpu>
<power_management/>
<iommu support='no'/>
<topology>
<cells num='4'>
<cell id='0'>

View File

@ -5,6 +5,7 @@
<arch>x86_64</arch>
</cpu>
<power_management/>
<iommu support='no'/>
<migration_features>
<live/>
</migration_features>

View File

@ -5,6 +5,7 @@
<arch>x86_64</arch>
</cpu>
<power_management/>
<iommu support='no'/>
<migration_features>
<live/>
</migration_features>

View File

@ -5,6 +5,7 @@
<arch>x86_64</arch>
</cpu>
<power_management/>
<iommu support='no'/>
<migration_features>
<live/>
</migration_features>

View File

@ -5,6 +5,7 @@
<arch>x86_64</arch>
</cpu>
<power_management/>
<iommu support='no'/>
<migration_features>
<live/>
</migration_features>

View File

@ -5,6 +5,7 @@
<arch>x86_64</arch>
</cpu>
<power_management/>
<iommu support='no'/>
<migration_features>
<live/>
</migration_features>