[libvirt] [PATCH] qemu_capabilities: Do not report USB as subsystem type if it is not available

Thomas Huth posted 1 patch 1 week ago
Test syntax-check failed
Failed in applying to current master (apply log)
src/qemu/qemu_capabilities.c               | 13 ++++++++++++-
tests/domaincapsdata/qemu_2.10.0.s390x.xml |  1 -
tests/domaincapsdata/qemu_2.11.0.s390x.xml |  1 -
tests/domaincapsdata/qemu_2.12.0.s390x.xml |  1 -
tests/domaincapsdata/qemu_2.7.0.s390x.xml  |  1 -
tests/domaincapsdata/qemu_2.8.0.s390x.xml  |  1 -
tests/domaincapsdata/qemu_2.9.0.s390x.xml  |  1 -
tests/domaincapsdata/qemu_3.0.0.s390x.xml  |  1 -
tests/domaincapsdata/qemu_4.0.0.s390x.xml  |  1 -
tests/domaincapsdata/qemu_4.2.0.s390x.xml  |  1 -
10 files changed, 12 insertions(+), 10 deletions(-)

[libvirt] [PATCH] qemu_capabilities: Do not report USB as subsystem type if it is not available

Posted by Thomas Huth 1 week ago
libvirt currently always reports that USB is available as a bus subsystem
type when running "virsh domcapabilities". However, this is not always
true, for example the qemu-system-s390x binary normally never has support
for USB. Thus we should only report that USB is available if there is
also a USB host controller available where we can attach USB devices.

Reported-by: Sebastian Mitterle <smitterl@redhat.com>
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1759849
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 src/qemu/qemu_capabilities.c               | 13 ++++++++++++-
 tests/domaincapsdata/qemu_2.10.0.s390x.xml |  1 -
 tests/domaincapsdata/qemu_2.11.0.s390x.xml |  1 -
 tests/domaincapsdata/qemu_2.12.0.s390x.xml |  1 -
 tests/domaincapsdata/qemu_2.7.0.s390x.xml  |  1 -
 tests/domaincapsdata/qemu_2.8.0.s390x.xml  |  1 -
 tests/domaincapsdata/qemu_2.9.0.s390x.xml  |  1 -
 tests/domaincapsdata/qemu_3.0.0.s390x.xml  |  1 -
 tests/domaincapsdata/qemu_4.0.0.s390x.xml  |  1 -
 tests/domaincapsdata/qemu_4.2.0.s390x.xml  |  1 -
 10 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index da0c7a257f..261cca19a7 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -5674,10 +5674,21 @@ virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCapsPtr qemuCaps,
                              VIR_DOMAIN_STARTUP_POLICY_OPTIONAL);
 
     VIR_DOMAIN_CAPS_ENUM_SET(hostdev->subsysType,
-                             VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB,
                              VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI,
                              VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI);
 
+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI) ||
+        virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX4_USB_UHCI) ||
+        virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_EHCI) ||
+        virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_USB_EHCI1) ||
+        virQEMUCapsGet(qemuCaps, QEMU_CAPS_VT82C686B_USB_UHCI) ||
+        virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI) ||
+        virQEMUCapsGet(qemuCaps, QEMU_CAPS_NEC_USB_XHCI) ||
+        virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QEMU_XHCI)) {
+        VIR_DOMAIN_CAPS_ENUM_SET(hostdev->subsysType,
+                             VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB);
+    }
+
     /* No virDomainHostdevCapsType for QEMU */
     virDomainCapsEnumClear(&hostdev->capsType);
 
diff --git a/tests/domaincapsdata/qemu_2.10.0.s390x.xml b/tests/domaincapsdata/qemu_2.10.0.s390x.xml
index bf3f13887f..b41ca5158c 100644
--- a/tests/domaincapsdata/qemu_2.10.0.s390x.xml
+++ b/tests/domaincapsdata/qemu_2.10.0.s390x.xml
@@ -168,7 +168,6 @@
         <value>optional</value>
       </enum>
       <enum name='subsysType'>
-        <value>usb</value>
         <value>pci</value>
         <value>scsi</value>
       </enum>
diff --git a/tests/domaincapsdata/qemu_2.11.0.s390x.xml b/tests/domaincapsdata/qemu_2.11.0.s390x.xml
index 9b3b18d320..ad4e6b0500 100644
--- a/tests/domaincapsdata/qemu_2.11.0.s390x.xml
+++ b/tests/domaincapsdata/qemu_2.11.0.s390x.xml
@@ -167,7 +167,6 @@
         <value>optional</value>
       </enum>
       <enum name='subsysType'>
-        <value>usb</value>
         <value>pci</value>
         <value>scsi</value>
       </enum>
diff --git a/tests/domaincapsdata/qemu_2.12.0.s390x.xml b/tests/domaincapsdata/qemu_2.12.0.s390x.xml
index af7a04fb01..9736d6a42d 100644
--- a/tests/domaincapsdata/qemu_2.12.0.s390x.xml
+++ b/tests/domaincapsdata/qemu_2.12.0.s390x.xml
@@ -166,7 +166,6 @@
         <value>optional</value>
       </enum>
       <enum name='subsysType'>
-        <value>usb</value>
         <value>pci</value>
         <value>scsi</value>
       </enum>
diff --git a/tests/domaincapsdata/qemu_2.7.0.s390x.xml b/tests/domaincapsdata/qemu_2.7.0.s390x.xml
index 258000dbaf..b19a4c9fed 100644
--- a/tests/domaincapsdata/qemu_2.7.0.s390x.xml
+++ b/tests/domaincapsdata/qemu_2.7.0.s390x.xml
@@ -71,7 +71,6 @@
         <value>optional</value>
       </enum>
       <enum name='subsysType'>
-        <value>usb</value>
         <value>pci</value>
         <value>scsi</value>
       </enum>
diff --git a/tests/domaincapsdata/qemu_2.8.0.s390x.xml b/tests/domaincapsdata/qemu_2.8.0.s390x.xml
index cc858f538c..30d2f7ff1f 100644
--- a/tests/domaincapsdata/qemu_2.8.0.s390x.xml
+++ b/tests/domaincapsdata/qemu_2.8.0.s390x.xml
@@ -152,7 +152,6 @@
         <value>optional</value>
       </enum>
       <enum name='subsysType'>
-        <value>usb</value>
         <value>pci</value>
         <value>scsi</value>
       </enum>
diff --git a/tests/domaincapsdata/qemu_2.9.0.s390x.xml b/tests/domaincapsdata/qemu_2.9.0.s390x.xml
index fe2c023956..2476e95181 100644
--- a/tests/domaincapsdata/qemu_2.9.0.s390x.xml
+++ b/tests/domaincapsdata/qemu_2.9.0.s390x.xml
@@ -153,7 +153,6 @@
         <value>optional</value>
       </enum>
       <enum name='subsysType'>
-        <value>usb</value>
         <value>pci</value>
         <value>scsi</value>
       </enum>
diff --git a/tests/domaincapsdata/qemu_3.0.0.s390x.xml b/tests/domaincapsdata/qemu_3.0.0.s390x.xml
index 68bcafd62f..a297bf9ef1 100644
--- a/tests/domaincapsdata/qemu_3.0.0.s390x.xml
+++ b/tests/domaincapsdata/qemu_3.0.0.s390x.xml
@@ -173,7 +173,6 @@
         <value>optional</value>
       </enum>
       <enum name='subsysType'>
-        <value>usb</value>
         <value>pci</value>
         <value>scsi</value>
       </enum>
diff --git a/tests/domaincapsdata/qemu_4.0.0.s390x.xml b/tests/domaincapsdata/qemu_4.0.0.s390x.xml
index 4298b148fd..21ddd27cb9 100644
--- a/tests/domaincapsdata/qemu_4.0.0.s390x.xml
+++ b/tests/domaincapsdata/qemu_4.0.0.s390x.xml
@@ -178,7 +178,6 @@
         <value>optional</value>
       </enum>
       <enum name='subsysType'>
-        <value>usb</value>
         <value>pci</value>
         <value>scsi</value>
       </enum>
diff --git a/tests/domaincapsdata/qemu_4.2.0.s390x.xml b/tests/domaincapsdata/qemu_4.2.0.s390x.xml
index c6d92542c3..101d9d028b 100644
--- a/tests/domaincapsdata/qemu_4.2.0.s390x.xml
+++ b/tests/domaincapsdata/qemu_4.2.0.s390x.xml
@@ -172,7 +172,6 @@
         <value>optional</value>
       </enum>
       <enum name='subsysType'>
-        <value>usb</value>
         <value>pci</value>
         <value>scsi</value>
       </enum>
-- 
2.18.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] qemu_capabilities: Do not report USB as subsystem type if it is not available

Posted by Michal Privoznik 1 week ago
On 1/13/20 9:04 AM, Thomas Huth wrote:
> libvirt currently always reports that USB is available as a bus subsystem
> type when running "virsh domcapabilities". However, this is not always
> true, for example the qemu-system-s390x binary normally never has support
> for USB. Thus we should only report that USB is available if there is
> also a USB host controller available where we can attach USB devices.
> 
> Reported-by: Sebastian Mitterle <smitterl@redhat.com>
> Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1759849
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   src/qemu/qemu_capabilities.c               | 13 ++++++++++++-
>   tests/domaincapsdata/qemu_2.10.0.s390x.xml |  1 -
>   tests/domaincapsdata/qemu_2.11.0.s390x.xml |  1 -
>   tests/domaincapsdata/qemu_2.12.0.s390x.xml |  1 -
>   tests/domaincapsdata/qemu_2.7.0.s390x.xml  |  1 -
>   tests/domaincapsdata/qemu_2.8.0.s390x.xml  |  1 -
>   tests/domaincapsdata/qemu_2.9.0.s390x.xml  |  1 -
>   tests/domaincapsdata/qemu_3.0.0.s390x.xml  |  1 -
>   tests/domaincapsdata/qemu_4.0.0.s390x.xml  |  1 -
>   tests/domaincapsdata/qemu_4.2.0.s390x.xml  |  1 -
>   10 files changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index da0c7a257f..261cca19a7 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -5674,10 +5674,21 @@ virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCapsPtr qemuCaps,
>                                VIR_DOMAIN_STARTUP_POLICY_OPTIONAL);
>   
>       VIR_DOMAIN_CAPS_ENUM_SET(hostdev->subsysType,
> -                             VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB,
>                                VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI,
>                                VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI);
>   
> +    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI) ||
> +        virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX4_USB_UHCI) ||
> +        virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_EHCI) ||
> +        virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_USB_EHCI1) ||
> +        virQEMUCapsGet(qemuCaps, QEMU_CAPS_VT82C686B_USB_UHCI) ||
> +        virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI) ||
> +        virQEMUCapsGet(qemuCaps, QEMU_CAPS_NEC_USB_XHCI) ||
> +        virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QEMU_XHCI)) {
> +        VIR_DOMAIN_CAPS_ENUM_SET(hostdev->subsysType,
> +                             VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB);

A bit misaligned, but I will fix it before pushing.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] qemu_capabilities: Do not report USB as subsystem type if it is not available

Posted by Thomas Huth 1 week ago
On 13/01/2020 13.54, Michal Privoznik wrote:
> On 1/13/20 9:04 AM, Thomas Huth wrote:
>> libvirt currently always reports that USB is available as a bus subsystem
>> type when running "virsh domcapabilities". However, this is not always
>> true, for example the qemu-system-s390x binary normally never has support
>> for USB. Thus we should only report that USB is available if there is
>> also a USB host controller available where we can attach USB devices.
>>
>> Reported-by: Sebastian Mitterle <smitterl@redhat.com>
>> Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1759849
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>>   src/qemu/qemu_capabilities.c               | 13 ++++++++++++-
>>   tests/domaincapsdata/qemu_2.10.0.s390x.xml |  1 -
>>   tests/domaincapsdata/qemu_2.11.0.s390x.xml |  1 -
>>   tests/domaincapsdata/qemu_2.12.0.s390x.xml |  1 -
>>   tests/domaincapsdata/qemu_2.7.0.s390x.xml  |  1 -
>>   tests/domaincapsdata/qemu_2.8.0.s390x.xml  |  1 -
>>   tests/domaincapsdata/qemu_2.9.0.s390x.xml  |  1 -
>>   tests/domaincapsdata/qemu_3.0.0.s390x.xml  |  1 -
>>   tests/domaincapsdata/qemu_4.0.0.s390x.xml  |  1 -
>>   tests/domaincapsdata/qemu_4.2.0.s390x.xml  |  1 -
>>   10 files changed, 12 insertions(+), 10 deletions(-)
>>
>> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
>> index da0c7a257f..261cca19a7 100644
>> --- a/src/qemu/qemu_capabilities.c
>> +++ b/src/qemu/qemu_capabilities.c
>> @@ -5674,10 +5674,21 @@
>> virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCapsPtr qemuCaps,
>>                                VIR_DOMAIN_STARTUP_POLICY_OPTIONAL);
>>         VIR_DOMAIN_CAPS_ENUM_SET(hostdev->subsysType,
>> -                             VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB,
>>                                VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI,
>>                                VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI);
>>   +    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI) ||
>> +        virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX4_USB_UHCI) ||
>> +        virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_EHCI) ||
>> +        virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_USB_EHCI1) ||
>> +        virQEMUCapsGet(qemuCaps, QEMU_CAPS_VT82C686B_USB_UHCI) ||
>> +        virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI) ||
>> +        virQEMUCapsGet(qemuCaps, QEMU_CAPS_NEC_USB_XHCI) ||
>> +        virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QEMU_XHCI)) {
>> +        VIR_DOMAIN_CAPS_ENUM_SET(hostdev->subsysType,
>> +                             VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB);
> 
> A bit misaligned, but I will fix it before pushing.

Thanks a lot!

 Thomas

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list