mirror of https://gitee.com/openkylin/libvirt.git
conf: add address width attribute to iommu
Add a new aw_bits attribute to the iommu device to control the address width of the intel-iommu Signed-off-by Menno Lageman <menno.lageman@oracle.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
36b1e8669d
commit
0e5c919397
|
@ -9377,6 +9377,15 @@ qemu-kvm -net nic,model=? /dev/null
|
|||
<span class="since">Since 3.5.0</span> (QEMU/KVM only)
|
||||
</p>
|
||||
</dd>
|
||||
<dt><code>aw_bits</code></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The <code>aw_bits</code> attribute can be used to set
|
||||
the address width to allow mapping larger iova addresses
|
||||
in the guest.
|
||||
<span class="since">Since 6.5.0</span> (QEMU/KVM only)
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
|
|
@ -4749,6 +4749,11 @@
|
|||
<ref name="virOnOff"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="aw_bits">
|
||||
<ref name="uint8"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
</element>
|
||||
</optional>
|
||||
</element>
|
||||
|
|
|
@ -16905,6 +16905,15 @@ virDomainIOMMUDefParseXML(xmlNodePtr node,
|
|||
}
|
||||
iommu->eim = val;
|
||||
}
|
||||
|
||||
VIR_FREE(tmp);
|
||||
if ((tmp = virXMLPropString(driver, "aw_bits"))) {
|
||||
if (virStrToLong_ui(tmp, NULL, 10, &iommu->aw_bits) < 0) {
|
||||
virReportError(VIR_ERR_XML_ERROR, _("unknown aw_bits value: %s"), tmp);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return g_steal_pointer(&iommu);
|
||||
|
@ -23989,6 +23998,14 @@ virDomainIOMMUDefCheckABIStability(virDomainIOMMUDefPtr src,
|
|||
virTristateSwitchTypeToString(src->iotlb));
|
||||
return false;
|
||||
}
|
||||
if (src->aw_bits != dst->aw_bits) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Target domain IOMMU device aw_bits value '%d' "
|
||||
"does not match source '%d'"),
|
||||
dst->aw_bits, src->aw_bits);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -28992,6 +29009,10 @@ virDomainIOMMUDefFormat(virBufferPtr buf,
|
|||
virBufferAsprintf(&driverAttrBuf, " iotlb='%s'",
|
||||
virTristateSwitchTypeToString(iommu->iotlb));
|
||||
}
|
||||
if (iommu->aw_bits > 0) {
|
||||
virBufferAsprintf(&driverAttrBuf, " aw_bits='%d'",
|
||||
iommu->aw_bits);
|
||||
}
|
||||
|
||||
virXMLFormatElement(&childBuf, "driver", &driverAttrBuf, NULL);
|
||||
|
||||
|
|
|
@ -2454,6 +2454,7 @@ struct _virDomainIOMMUDef {
|
|||
virTristateSwitch caching_mode;
|
||||
virTristateSwitch eim;
|
||||
virTristateSwitch iotlb;
|
||||
unsigned int aw_bits;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<domain type='kvm'>
|
||||
<name>QEMUGuest1</name>
|
||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
<memory unit='KiB'>219100</memory>
|
||||
<currentMemory unit='KiB'>219100</currentMemory>
|
||||
<vcpu placement='static'>1</vcpu>
|
||||
<os>
|
||||
<type arch='x86_64' machine='q35'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<features>
|
||||
<ioapic driver='qemu'/>
|
||||
</features>
|
||||
<cpu mode='custom' match='exact' check='none'>
|
||||
<model fallback='forbid'>qemu64</model>
|
||||
</cpu>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||
<controller type='pci' index='0' model='pcie-root'/>
|
||||
<controller type='usb' index='0' model='none'/>
|
||||
<controller type='sata' index='0'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
|
||||
</controller>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<input type='keyboard' bus='ps2'/>
|
||||
<memballoon model='none'/>
|
||||
<iommu model='intel'>
|
||||
<driver intremap='on' aw_bits='48'/>
|
||||
</iommu>
|
||||
</devices>
|
||||
</domain>
|
|
@ -0,0 +1 @@
|
|||
../qemuxml2argvdata/intel-iommu-aw-bits.xml
|
|
@ -1323,6 +1323,7 @@ mymain(void)
|
|||
DO_TEST_CAPS_LATEST("intel-iommu-caching-mode");
|
||||
DO_TEST_CAPS_LATEST("intel-iommu-eim");
|
||||
DO_TEST_CAPS_LATEST("intel-iommu-device-iotlb");
|
||||
DO_TEST_CAPS_LATEST("intel-iommu-aw-bits");
|
||||
DO_TEST_CAPS_ARCH_LATEST("iommu-smmuv3", "aarch64");
|
||||
|
||||
DO_TEST("cpu-check-none", NONE);
|
||||
|
|
Loading…
Reference in New Issue