On 06/23/2016 06:47 AM, Ján Tomko wrote: > Check whether QEMU supports -device intel-iommu > > https://bugzilla.redhat.com/show_bug.cgi?id=1235580 > --- > src/qemu/qemu_capabilities.c | 2 ++ > src/qemu/qemu_capabilities.h | 1 + > tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml | 1 + > tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml | 1 + > tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml | 1 + > 5 files changed, 6 insertions(+) > Your cover letter notes the qemu support -device option is broken and a "fix" is on qemu-devel (assuming it would go into QEMU 2.7). However, you've touched caps 2.4, 2.5, and 2.6. So, if -device is broken before qemu 2.7, what happens if we "pass" our capabilities checks and attempt to add using a broken mechanism? It seems one way to "detect" that the -device iommu is not broken is to not find the "iommu" property on the -machine command line (patch 5 of the qemu series) - a rather ugly means of detection. Or of course we could not care that it's broken? or we could document that although available prior to qemu 2.7, it really only works properly in 2.7 since as qemu-devel reviews pretty much note it wasn't something expected to be in production use yet. I don't think what's below is wrong, but I wonder if we need to add a means to detect things that have been discussed on the qemu-devel regarding the need to remove the machine attribute 'iommu'? If this is all possible, then perhaps we would have a helper API added that would detect the device flag and detect a missing iommu from machine properties and return true/false based on that (so that the "next" patch just calls it rather than checking the bit itself). John > diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c > index 4ed5b71..2076297 100644 > --- a/src/qemu/qemu_capabilities.c > +++ b/src/qemu/qemu_capabilities.c > @@ -336,6 +336,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, > "drive-detect-zeroes", > > "tls-creds-x509", /* 230 */ > + "intel-iommu", > ); > > > @@ -1564,6 +1565,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = { > { "pxb", QEMU_CAPS_DEVICE_PXB }, > { "pxb-pcie", QEMU_CAPS_DEVICE_PXB_PCIE }, > { "tls-creds-x509", QEMU_CAPS_OBJECT_TLS_CREDS_X509 }, > + { "intel-iommu", QEMU_CAPS_DEVICE_INTEL_IOMMU }, > }; > > static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBalloon[] = { > diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h > index affb639..da448e9 100644 > --- a/src/qemu/qemu_capabilities.h > +++ b/src/qemu/qemu_capabilities.h > @@ -370,6 +370,7 @@ typedef enum { > > /* 230 */ > QEMU_CAPS_OBJECT_TLS_CREDS_X509, /* -object tls-creds-x509 */ > + QEMU_CAPS_DEVICE_INTEL_IOMMU, /* -device intel-iommu */ > > QEMU_CAPS_LAST /* this must always be the last item */ > } virQEMUCapsFlags; > diff --git a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml > index 112ac95..98c260c 100644 > --- a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml > +++ b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml > @@ -182,6 +182,7 @@ > <flag name='qxl-vga.max_outputs'/> > <flag name='spice-unix'/> > <flag name='drive-detect-zeroes'/> > + <flag name='intel-iommu'/> > <version>2004000</version> > <kvmVersion>0</kvmVersion> > <package></package> > diff --git a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml > index 8157985..590c8c1 100644 > --- a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml > +++ b/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml > @@ -187,6 +187,7 @@ > <flag name='spice-unix'/> > <flag name='drive-detect-zeroes'/> > <flag name='tls-creds-x509'/> > + <flag name='intel-iommu'/> > <version>2005000</version> > <kvmVersion>0</kvmVersion> > <package></package> > diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml > index 1d503dd..128ac11 100644 > --- a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml > +++ b/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml > @@ -193,6 +193,7 @@ > <flag name='spice-unix'/> > <flag name='drive-detect-zeroes'/> > <flag name='tls-creds-x509'/> > + <flag name='intel-iommu'/> > <version>2006000</version> > <kvmVersion>0</kvmVersion> > <package></package> > -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list