qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-8.1] hw/usb/hcd-xhci-pci: Fail if user requested MSIX but it can't be used
@ 2023-07-19 14:17 Philippe Mathieu-Daudé
  2023-08-25  8:02 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-07-19 14:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Philippe Mathieu-Daudé

Do not silently ignore the user request of using MSIX.
Remove the TODO. Coverity reported this as CID 1508725.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/usb/hcd-xhci-pci.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/hw/usb/hcd-xhci-pci.c b/hw/usb/hcd-xhci-pci.c
index 643d4643e4..416656b78c 100644
--- a/hw/usb/hcd-xhci-pci.c
+++ b/hw/usb/hcd-xhci-pci.c
@@ -155,11 +155,22 @@ static void usb_xhci_pci_realize(struct PCIDevice *dev, Error **errp)
     }
 
     if (s->msix != ON_OFF_AUTO_OFF) {
-        /* TODO check for errors, and should fail when msix=on */
-        msix_init(dev, s->xhci.numintrs,
-                  &s->xhci.mem, 0, OFF_MSIX_TABLE,
-                  &s->xhci.mem, 0, OFF_MSIX_PBA,
-                  0x90, NULL);
+        ret = msix_init(dev, s->xhci.numintrs,
+                        &s->xhci.mem, 0, OFF_MSIX_TABLE,
+                        &s->xhci.mem, 0, OFF_MSIX_PBA,
+                        0x90, &err);
+        if (ret < 0) {
+            if (s->msi == ON_OFF_AUTO_ON) {
+                /* Can't satisfy user's explicit msi=on request, fail */
+                error_append_hint(&err, "You might have to use msi=auto"
+                                        " (default) or msi=off with this"
+                                        " machine type.\n");
+                error_propagate(errp, err);
+                return;
+            }
+            /* report that msix is not supported, but do not error out */
+            warn_report_err(err);
+        }
     }
     s->xhci.as = pci_get_address_space(dev);
 }
-- 
2.38.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH for-8.1] hw/usb/hcd-xhci-pci: Fail if user requested MSIX but it can't be used
  2023-07-19 14:17 [PATCH for-8.1] hw/usb/hcd-xhci-pci: Fail if user requested MSIX but it can't be used Philippe Mathieu-Daudé
@ 2023-08-25  8:02 ` Philippe Mathieu-Daudé
  2023-08-31  8:22   ` [PATCH] " Philippe Mathieu-Daudé
  0 siblings, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-08-25  8:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Michael S. Tsirkin

Ping?

On 19/7/23 16:17, Philippe Mathieu-Daudé wrote:
> Do not silently ignore the user request of using MSIX.
> Remove the TODO. Coverity reported this as CID 1508725.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/usb/hcd-xhci-pci.c | 21 ++++++++++++++++-----
>   1 file changed, 16 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/usb/hcd-xhci-pci.c b/hw/usb/hcd-xhci-pci.c
> index 643d4643e4..416656b78c 100644
> --- a/hw/usb/hcd-xhci-pci.c
> +++ b/hw/usb/hcd-xhci-pci.c
> @@ -155,11 +155,22 @@ static void usb_xhci_pci_realize(struct PCIDevice *dev, Error **errp)
>       }
>   
>       if (s->msix != ON_OFF_AUTO_OFF) {
> -        /* TODO check for errors, and should fail when msix=on */
> -        msix_init(dev, s->xhci.numintrs,
> -                  &s->xhci.mem, 0, OFF_MSIX_TABLE,
> -                  &s->xhci.mem, 0, OFF_MSIX_PBA,
> -                  0x90, NULL);
> +        ret = msix_init(dev, s->xhci.numintrs,
> +                        &s->xhci.mem, 0, OFF_MSIX_TABLE,
> +                        &s->xhci.mem, 0, OFF_MSIX_PBA,
> +                        0x90, &err);
> +        if (ret < 0) {
> +            if (s->msi == ON_OFF_AUTO_ON) {
> +                /* Can't satisfy user's explicit msi=on request, fail */
> +                error_append_hint(&err, "You might have to use msi=auto"
> +                                        " (default) or msi=off with this"
> +                                        " machine type.\n");
> +                error_propagate(errp, err);
> +                return;
> +            }
> +            /* report that msix is not supported, but do not error out */
> +            warn_report_err(err);
> +        }
>       }
>       s->xhci.as = pci_get_address_space(dev);
>   }



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] hw/usb/hcd-xhci-pci: Fail if user requested MSIX but it can't be used
  2023-08-25  8:02 ` Philippe Mathieu-Daudé
@ 2023-08-31  8:22   ` Philippe Mathieu-Daudé
  2023-08-31  8:24     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-08-31  8:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Michael S. Tsirkin

kind ping?

On 25/8/23 10:02, Philippe Mathieu-Daudé wrote:
> Ping?
> 
> On 19/7/23 16:17, Philippe Mathieu-Daudé wrote:
>> Do not silently ignore the user request of using MSIX.
>> Remove the TODO. Coverity reported this as CID 1508725.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>>   hw/usb/hcd-xhci-pci.c | 21 ++++++++++++++++-----
>>   1 file changed, 16 insertions(+), 5 deletions(-)
>>
>> diff --git a/hw/usb/hcd-xhci-pci.c b/hw/usb/hcd-xhci-pci.c
>> index 643d4643e4..416656b78c 100644
>> --- a/hw/usb/hcd-xhci-pci.c
>> +++ b/hw/usb/hcd-xhci-pci.c
>> @@ -155,11 +155,22 @@ static void usb_xhci_pci_realize(struct 
>> PCIDevice *dev, Error **errp)
>>       }
>>       if (s->msix != ON_OFF_AUTO_OFF) {
>> -        /* TODO check for errors, and should fail when msix=on */
>> -        msix_init(dev, s->xhci.numintrs,
>> -                  &s->xhci.mem, 0, OFF_MSIX_TABLE,
>> -                  &s->xhci.mem, 0, OFF_MSIX_PBA,
>> -                  0x90, NULL);
>> +        ret = msix_init(dev, s->xhci.numintrs,
>> +                        &s->xhci.mem, 0, OFF_MSIX_TABLE,
>> +                        &s->xhci.mem, 0, OFF_MSIX_PBA,
>> +                        0x90, &err);
>> +        if (ret < 0) {
>> +            if (s->msi == ON_OFF_AUTO_ON) {
>> +                /* Can't satisfy user's explicit msi=on request, fail */
>> +                error_append_hint(&err, "You might have to use msi=auto"
>> +                                        " (default) or msi=off with 
>> this"
>> +                                        " machine type.\n");
>> +                error_propagate(errp, err);
>> +                return;
>> +            }
>> +            /* report that msix is not supported, but do not error 
>> out */
>> +            warn_report_err(err);
>> +        }
>>       }
>>       s->xhci.as = pci_get_address_space(dev);
>>   }
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] hw/usb/hcd-xhci-pci: Fail if user requested MSIX but it can't be used
  2023-08-31  8:22   ` [PATCH] " Philippe Mathieu-Daudé
@ 2023-08-31  8:24     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-08-31  8:24 UTC (permalink / raw)
  To: qemu-devel, Markus Armbruster, Marc-André Lureau
  Cc: Gerd Hoffmann, Michael S. Tsirkin

Cc'ing Markus and Marc-André

On 31/8/23 10:22, Philippe Mathieu-Daudé wrote:
> kind ping?
> 
> On 25/8/23 10:02, Philippe Mathieu-Daudé wrote:
>> Ping?
>>
>> On 19/7/23 16:17, Philippe Mathieu-Daudé wrote:
>>> Do not silently ignore the user request of using MSIX.
>>> Remove the TODO. Coverity reported this as CID 1508725.
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>> ---
>>>   hw/usb/hcd-xhci-pci.c | 21 ++++++++++++++++-----
>>>   1 file changed, 16 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/hw/usb/hcd-xhci-pci.c b/hw/usb/hcd-xhci-pci.c
>>> index 643d4643e4..416656b78c 100644
>>> --- a/hw/usb/hcd-xhci-pci.c
>>> +++ b/hw/usb/hcd-xhci-pci.c
>>> @@ -155,11 +155,22 @@ static void usb_xhci_pci_realize(struct 
>>> PCIDevice *dev, Error **errp)
>>>       }
>>>       if (s->msix != ON_OFF_AUTO_OFF) {
>>> -        /* TODO check for errors, and should fail when msix=on */
>>> -        msix_init(dev, s->xhci.numintrs,
>>> -                  &s->xhci.mem, 0, OFF_MSIX_TABLE,
>>> -                  &s->xhci.mem, 0, OFF_MSIX_PBA,
>>> -                  0x90, NULL);
>>> +        ret = msix_init(dev, s->xhci.numintrs,
>>> +                        &s->xhci.mem, 0, OFF_MSIX_TABLE,
>>> +                        &s->xhci.mem, 0, OFF_MSIX_PBA,
>>> +                        0x90, &err);
>>> +        if (ret < 0) {
>>> +            if (s->msi == ON_OFF_AUTO_ON) {
>>> +                /* Can't satisfy user's explicit msi=on request, 
>>> fail */
>>> +                error_append_hint(&err, "You might have to use 
>>> msi=auto"
>>> +                                        " (default) or msi=off with 
>>> this"
>>> +                                        " machine type.\n");
>>> +                error_propagate(errp, err);
>>> +                return;
>>> +            }
>>> +            /* report that msix is not supported, but do not error 
>>> out */
>>> +            warn_report_err(err);
>>> +        }
>>>       }
>>>       s->xhci.as = pci_get_address_space(dev);
>>>   }
>>
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-31  8:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-19 14:17 [PATCH for-8.1] hw/usb/hcd-xhci-pci: Fail if user requested MSIX but it can't be used Philippe Mathieu-Daudé
2023-08-25  8:02 ` Philippe Mathieu-Daudé
2023-08-31  8:22   ` [PATCH] " Philippe Mathieu-Daudé
2023-08-31  8:24     ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).