diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 07d0fa5c70b3ccad864e8d5ac3167ec1377a4011..83f00086406c8d3840fc2942f537e165bc61115d 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -9377,6 +9377,15 @@ qemu-kvm -net nic,model=? /dev/null
Since 3.5.0 (QEMU/KVM only)
+ aw_bits
+
+
+ The aw_bits
attribute can be used to set
+ the address width to allow mapping larger iova addresses
+ in the guest.
+ Since 6.5.0 (QEMU/KVM only)
+
+
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index e3bf7f5d5585de9ebbcc186499ff5aa70279a5f3..2e65340311beb0ebdb145803bab5e9c218cd7dc4 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4749,6 +4749,11 @@
+
+
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e9336fd72d791f5ad090617ef15b4f86655e1db1..ef083d4d4da3b02967b130fe6cf02807ba3857cc 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -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);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 41715c75f2733af5bf58293c859385e28bce7328..bfafd36be31f8a037b624d06f2c55b589bfbce1e 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2454,6 +2454,7 @@ struct _virDomainIOMMUDef {
virTristateSwitch caching_mode;
virTristateSwitch eim;
virTristateSwitch iotlb;
+ unsigned int aw_bits;
};
typedef enum {
diff --git a/tests/qemuxml2argvdata/intel-iommu-aw-bits.xml b/tests/qemuxml2argvdata/intel-iommu-aw-bits.xml
new file mode 100644
index 0000000000000000000000000000000000000000..23e3ef581677659ef73cb81d95d1e3740df280cb
--- /dev/null
+++ b/tests/qemuxml2argvdata/intel-iommu-aw-bits.xml
@@ -0,0 +1,35 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219100
+ 219100
+ 1
+
+ hvm
+
+
+
+
+
+
+ qemu64
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2xmloutdata/intel-iommu-aw-bits.x86_64-latest.xml b/tests/qemuxml2xmloutdata/intel-iommu-aw-bits.x86_64-latest.xml
new file mode 120000
index 0000000000000000000000000000000000000000..dbd1dfd97a66f267c6a279ccfe99f4a5b01e6d86
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/intel-iommu-aw-bits.x86_64-latest.xml
@@ -0,0 +1 @@
+../qemuxml2argvdata/intel-iommu-aw-bits.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 2b61a6459e2731bd683d4515ce34c128b4dc5ef5..e16ff44ef7b9bf87100bc024c780adcc5d7a9568 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -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);