qemu: format address wdith on intel-iommu command line

Format the address width attribute. Depending on the version of
QEMU it is named 'aw-bits' or 'x-aw-bits'.

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:
Menno Lageman 2020-06-04 09:42:43 +02:00 committed by Michal Privoznik
parent 0e5c919397
commit dd1bc914f9
11 changed files with 51 additions and 0 deletions

View File

@ -593,6 +593,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
/* 375 */
"migration-param.xbzrle-cache-size",
"intel-iommu.aw-bits",
);
@ -1481,6 +1482,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsIntelIOMMU[] = {
{ "caching-mode", QEMU_CAPS_INTEL_IOMMU_CACHING_MODE, NULL },
{ "eim", QEMU_CAPS_INTEL_IOMMU_EIM, NULL },
{ "device-iotlb", QEMU_CAPS_INTEL_IOMMU_DEVICE_IOTLB, NULL },
{ "aw-bits", QEMU_CAPS_INTEL_IOMMU_AW_BITS, NULL },
};
static struct virQEMUCapsDevicePropsFlags virQEMUCapsObjectPropsVirtualCSSBridge[] = {

View File

@ -573,6 +573,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
/* 375 */
QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE, /* xbzrle-cache-size field in migrate-set-parameters */
QEMU_CAPS_INTEL_IOMMU_AW_BITS, /* intel-iommu.aw-bits */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;

View File

@ -6204,6 +6204,8 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd,
virBufferAsprintf(&opts, ",device-iotlb=%s",
virTristateSwitchTypeToString(iommu->iotlb));
}
if (iommu->aw_bits > 0)
virBufferAsprintf(&opts, ",aw-bits=%d", iommu->aw_bits);
virCommandAddArg(cmd, "-device");
virCommandAddArgBuffer(cmd, &opts);

View File

@ -3890,6 +3890,13 @@ qemuValidateDomainDeviceDefIOMMU(const virDomainIOMMUDef *iommu,
"with this QEMU binary"));
return -1;
}
if (iommu->aw_bits > 0 &&
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_INTEL_IOMMU_AW_BITS)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("iommu: aw_bits is not supported "
"with this QEMU binary"));
return -1;
}
return 0;
}

View File

@ -220,6 +220,7 @@
<flag name='migration-param.bandwidth'/>
<flag name='migration-param.downtime'/>
<flag name='migration-param.xbzrle-cache-size'/>
<flag name='intel-iommu.aw-bits'/>
<version>4000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100240</microcodeVersion>

View File

@ -226,6 +226,7 @@
<flag name='migration-param.bandwidth'/>
<flag name='migration-param.downtime'/>
<flag name='migration-param.xbzrle-cache-size'/>
<flag name='intel-iommu.aw-bits'/>
<version>4001000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100241</microcodeVersion>

View File

@ -234,6 +234,7 @@
<flag name='migration-param.bandwidth'/>
<flag name='migration-param.downtime'/>
<flag name='migration-param.xbzrle-cache-size'/>
<flag name='intel-iommu.aw-bits'/>
<version>4002000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100242</microcodeVersion>

View File

@ -240,6 +240,7 @@
<flag name='migration-param.bandwidth'/>
<flag name='migration-param.downtime'/>
<flag name='migration-param.xbzrle-cache-size'/>
<flag name='intel-iommu.aw-bits'/>
<version>5000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100241</microcodeVersion>

View File

@ -240,6 +240,7 @@
<flag name='migration-param.bandwidth'/>
<flag name='migration-param.downtime'/>
<flag name='migration-param.xbzrle-cache-size'/>
<flag name='intel-iommu.aw-bits'/>
<version>5000050</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100242</microcodeVersion>

View File

@ -0,0 +1,33 @@
LC_ALL=C \
PATH=/bin \
HOME=/tmp/lib/domain--1-QEMUGuest1 \
USER=test \
LOGNAME=test \
XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
QEMU_AUDIO_DRV=none \
/usr/bin/qemu-system-x86_64 \
-name guest=QEMUGuest1,debug-threads=on \
-S \
-object secret,id=masterKey0,format=raw,\
file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-machine q35,accel=kvm,usb=off,dump-guest-core=off,kernel_irqchip=split \
-cpu qemu64 \
-m 214 \
-overcommit mem-lock=off \
-smp 1,sockets=1,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-display none \
-no-user-config \
-nodefaults \
-chardev socket,id=charmonitor,fd=1729,server,nowait \
-mon chardev=charmonitor,id=monitor,mode=control \
-rtc base=utc \
-no-shutdown \
-no-acpi \
-boot strict=on \
-device intel-iommu,intremap=on,aw-bits=48 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on

View File

@ -3102,6 +3102,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_LATEST_PARSE_ERROR("intel-iommu-wrong-machine");
DO_TEST_CAPS_ARCH_LATEST("iommu-smmuv3", "aarch64");