On 03/23/2017 11:26 AM, Ján Tomko wrote: > Format the caching-mode option for the intel-iommu device, > based on its <driver caching> attribute value. > > https://bugzilla.redhat.com/show_bug.cgi?id=1427005 > --- > src/qemu/qemu_capabilities.c | 2 ++ > src/qemu/qemu_capabilities.h | 1 + > src/qemu/qemu_command.c | 10 ++++++++++ > tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 + > .../qemuxml2argv-intel-iommu-caching.args | 19 +++++++++++++++++++ > tests/qemuxml2argvtest.c | 5 +++++ > 6 files changed, 38 insertions(+) > create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-caching.args > > diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c > index e9cc754..6a884d1 100644 > --- a/src/qemu/qemu_capabilities.c > +++ b/src/qemu/qemu_capabilities.c > @@ -365,6 +365,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, > "query-cpu-definitions", /* 250 */ > "kernel-irqchip", > "intel-iommu-intremap", > + "intel-iommu-caching", > ); Once merge conflicts are resolved, you'll find this needs the /* 255 */ > > > @@ -1735,6 +1736,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsUSBNECXHCI[] = { > > static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsIntelIOMMU[] = { > { "intremap", QEMU_CAPS_INTEL_IOMMU_INTREMAP }, > + { "caching-mode", QEMU_CAPS_INTEL_IOMMU_CACHING }, > }; > > /* see documentation for virQEMUCapsQMPSchemaGetByPath for the query format */ > diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h > index 16db17f..8ab2ee0 100644 > --- a/src/qemu/qemu_capabilities.h > +++ b/src/qemu/qemu_capabilities.h > @@ -401,6 +401,7 @@ typedef enum { > QEMU_CAPS_QUERY_CPU_DEFINITIONS, /* qmp query-cpu-definitions */ > QEMU_CAPS_MACHINE_KERNEL_IRQCHIP, /* -machine kernel_irqchip */ > QEMU_CAPS_INTEL_IOMMU_INTREMAP, /* intel-iommu.intremap */ > + QEMU_CAPS_INTEL_IOMMU_CACHING, /* intel-iommu.caching-mode */ Likewise, a /* 255 */ comment before this next grouping. > > QEMU_CAPS_LAST /* this must always be the last item */ > } virQEMUCapsFlags; > diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c > index ddd889d..57d4408 100644 > --- a/src/qemu/qemu_command.c > +++ b/src/qemu/qemu_command.c > @@ -6662,6 +6662,16 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd, > virBufferAsprintf(&opts, ",intremap=%s", > virTristateSwitchTypeToString(iommu->intremap)); > } > + if (iommu->caching) { Similar to previous - w/r/t VIR_TRISTATE_SWITCH_ABSENT and presence and setting of the irqchip value. John > + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_INTEL_IOMMU_CACHING)) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", > + _("iommu: caching mode is not supported " > + "with this QEMU binary")); > + goto cleanup; > + } > + virBufferAsprintf(&opts, ",caching-mode=%s", > + virTristateSwitchTypeToString(iommu->caching)); > + } > case VIR_DOMAIN_IOMMU_MODEL_LAST: > break; > } > diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml > index 0798b7d..533bbcc 100644 > --- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml > +++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml > @@ -207,6 +207,7 @@ > <flag name='query-cpu-definitions'/> > <flag name='kernel-irqchip'/> > <flag name='intel-iommu-intremap'/> > + <flag name='intel-iommu-caching'/> > <version>2008090</version> > <kvmVersion>0</kvmVersion> > <package> (v2.9.0-rc0-142-g940a8ce)</package> > diff --git a/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-caching.args b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-caching.args > new file mode 100644 > index 0000000..59cb8a1 > --- /dev/null > +++ b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-caching.args > @@ -0,0 +1,19 @@ > +LC_ALL=C \ > +PATH=/bin \ > +HOME=/home/test \ > +USER=test \ > +LOGNAME=test \ > +QEMU_AUDIO_DRV=none \ > +/usr/bin/qemu \ > +-name QEMUGuest1 \ > +-S \ > +-machine q35,accel=tcg \ > +-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,intremap=on,caching-mode=on > diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c > index 2051af9..44eed34 100644 > --- a/tests/qemuxml2argvtest.c > +++ b/tests/qemuxml2argvtest.c > @@ -2480,6 +2480,11 @@ mymain(void) > QEMU_CAPS_MACHINE_KERNEL_IRQCHIP, > QEMU_CAPS_INTEL_IOMMU_INTREMAP, > QEMU_CAPS_DEVICE_INTEL_IOMMU); > + DO_TEST("intel-iommu-caching", > + QEMU_CAPS_MACHINE_OPT, > + QEMU_CAPS_DEVICE_INTEL_IOMMU, > + QEMU_CAPS_INTEL_IOMMU_INTREMAP, > + QEMU_CAPS_INTEL_IOMMU_CACHING); > > DO_TEST("cpu-hotplug-startup", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS); > > -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list