提交 4c382376 编写于 作者: J Ján Tomko

qemu: format intel-iommu on the command line

<devices>
  <iommu model='intel'/>
</devices>

results in:

-device intel-iommu

https://bugzilla.redhat.com/show_bug.cgi?id=1235580
上级 8e7e7973
......@@ -6163,6 +6163,38 @@ qemuBuildBootCommandLine(virCommandPtr cmd,
}
static int
qemuBuildIOMMUCommandLine(virCommandPtr cmd,
const virDomainDef *def,
virQEMUCapsPtr qemuCaps)
{
if (!def->iommu)
return 0;
switch (def->iommu->model) {
case VIR_DOMAIN_IOMMU_MODEL_INTEL:
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_INTEL_IOMMU)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("IOMMU device: '%s' is not supported with "
"this QEMU binary"),
virDomainIOMMUModelTypeToString(def->iommu->model));
return -1;
}
if (!qemuDomainMachineIsQ35(def)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("IOMMU device: '%s' is only supported with "
"Q35 machines"),
virDomainIOMMUModelTypeToString(def->iommu->model));
return -1;
}
virCommandAddArgList(cmd, "-device", "intel-iommu", NULL);
case VIR_DOMAIN_IOMMU_MODEL_LAST:
break;
}
return 0;
}
static int
qemuBuildGlobalControllerCommandLine(virCommandPtr cmd,
const virDomainDef *def,
......@@ -9236,6 +9268,9 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
if (qemuBuildBootCommandLine(cmd, def, qemuCaps) < 0)
goto error;
if (qemuBuildIOMMUCommandLine(cmd, def, qemuCaps) < 0)
goto error;
if (qemuBuildGlobalControllerCommandLine(cmd, def, qemuCaps) < 0)
goto error;
......
LC_ALL=C \
PATH=/bin \
HOME=/home/test \
USER=test \
LOGNAME=test \
QEMU_AUDIO_DRV=none \
/usr/bin/qemu \
-name QEMUGuest1 \
-S \
-M q35 \
-m 214 \
-smp 1,sockets=1,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-nographic \
-nodefaults \
-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
-no-acpi \
-boot c \
-device intel-iommu \
-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 \
-device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x1
......@@ -2027,6 +2027,8 @@ mymain(void)
QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_USB_HUB);
DO_TEST("acpi-table", NONE);
DO_TEST("intel-iommu", QEMU_CAPS_DEVICE_PCI_BRIDGE,
QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_DEVICE_INTEL_IOMMU);
qemuTestDriverFree(&driver);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册