mirror of https://gitee.com/openkylin/libvirt.git
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:
parent
1597e155b2
commit
dc34e78e21
|
@ -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>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -58,6 +58,7 @@ virCapabilitiesFreeMachines;
|
|||
virCapabilitiesFreeNUMAInfo;
|
||||
virCapabilitiesGetCpusForNodemask;
|
||||
virCapabilitiesGetNodeInfo;
|
||||
virCapabilitiesHostInitIOMMU;
|
||||
virCapabilitiesHostSecModelAddBaseLabel;
|
||||
virCapabilitiesInitCaches;
|
||||
virCapabilitiesInitNUMA;
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<arch>i686</arch>
|
||||
</cpu>
|
||||
<power_management/>
|
||||
<iommu support='no'/>
|
||||
</host>
|
||||
|
||||
<guest>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<arch>i686</arch>
|
||||
</cpu>
|
||||
<power_management/>
|
||||
<iommu support='no'/>
|
||||
</host>
|
||||
|
||||
<guest>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<arch>aarch64</arch>
|
||||
</cpu>
|
||||
<power_management/>
|
||||
<iommu support='no'/>
|
||||
<migration_features>
|
||||
</migration_features>
|
||||
<topology>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<arch>x86_64</arch>
|
||||
</cpu>
|
||||
<power_management/>
|
||||
<iommu support='no'/>
|
||||
<topology>
|
||||
<cells num='4'>
|
||||
<cell id='0'>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<arch>x86_64</arch>
|
||||
</cpu>
|
||||
<power_management/>
|
||||
<iommu support='no'/>
|
||||
<migration_features>
|
||||
<live/>
|
||||
</migration_features>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<arch>x86_64</arch>
|
||||
</cpu>
|
||||
<power_management/>
|
||||
<iommu support='no'/>
|
||||
<migration_features>
|
||||
<live/>
|
||||
</migration_features>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<arch>x86_64</arch>
|
||||
</cpu>
|
||||
<power_management/>
|
||||
<iommu support='no'/>
|
||||
<migration_features>
|
||||
<live/>
|
||||
</migration_features>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<arch>x86_64</arch>
|
||||
</cpu>
|
||||
<power_management/>
|
||||
<iommu support='no'/>
|
||||
<migration_features>
|
||||
<live/>
|
||||
</migration_features>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<arch>x86_64</arch>
|
||||
</cpu>
|
||||
<power_management/>
|
||||
<iommu support='no'/>
|
||||
<migration_features>
|
||||
<live/>
|
||||
</migration_features>
|
||||
|
|
Loading…
Reference in New Issue