diff mbox

[v2,03/10] xhci: Fix reset of MSI function

Message ID ccee74fdbf456ea9ad57619e6a16f4ad45ff8dd9.1336680504.git.jan.kiszka@siemens.com
State New
Headers show

Commit Message

Jan Kiszka May 10, 2012, 8:08 p.m. UTC
Call msi_reset on device reset as still required by the core.

CC: Gerd Hoffmann <kraxel@redhat.com>
CC: qemu-stable@nongnu.org
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 hw/usb/hcd-xhci.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

Comments

Gerd Hoffmann May 11, 2012, 8:16 a.m. UTC | #1
On 05/10/12 22:08, Jan Kiszka wrote:
> Call msi_reset on device reset as still required by the core.

Note: msi on xhci is disabled by default (and also broken as far I know).

> +static void xhci_reset(void *opaque)
> +{
> +    XHCIState *xhci = opaque;
> +

if (xhci->msi)

> +    msi_reset(&xhci->pci_dev);

}

> +    xhci_reset_full(xhci);
> +}

And can't we let the pci core handle it so we don't need ugly wrappers
like this?

cheers,
  Gerd
Jan Kiszka May 11, 2012, 1:07 p.m. UTC | #2
On 2012-05-11 05:16, Gerd Hoffmann wrote:
> On 05/10/12 22:08, Jan Kiszka wrote:
>> Call msi_reset on device reset as still required by the core.
> 
> Note: msi on xhci is disabled by default (and also broken as far I know).

OK, then we can likely skip this patch for 1.1/stable.

> 
>> +static void xhci_reset(void *opaque)
>> +{
>> +    XHCIState *xhci = opaque;
>> +
> 
> if (xhci->msi)

Oops.

> 
>> +    msi_reset(&xhci->pci_dev);
> 
> }
> 
>> +    xhci_reset_full(xhci);
>> +}
> 
> And can't we let the pci core handle it so we don't need ugly wrappers
> like this?

That's what patches later in the series do. But Michael was preferring
this approach for 1.1 and the cleanup for 1.2.

Jan
Gerd Hoffmann May 11, 2012, 1:19 p.m. UTC | #3
Hi,

>> And can't we let the pci core handle it so we don't need ugly wrappers
>> like this?
> 
> That's what patches later in the series do. But Michael was preferring
> this approach for 1.1 and the cleanup for 1.2.

Ah, ok, good.  Yea, lets leave it alone for 1.1 and fix it properly in 1.2

cheers,
  Gerd
diff mbox

Patch

diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 5cf1a64..c4079eb 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -2296,9 +2296,8 @@  static void xhci_update_port(XHCIState *xhci, XHCIPort *port, int is_detach)
     }
 }
 
-static void xhci_reset(void *opaque)
+static void xhci_reset_full(XHCIState *xhci)
 {
-    XHCIState *xhci = opaque;
     int i;
 
     DPRINTF("xhci: full reset\n");
@@ -2340,6 +2339,14 @@  static void xhci_reset(void *opaque)
     xhci->ev_buffer_get = 0;
 }
 
+static void xhci_reset(void *opaque)
+{
+    XHCIState *xhci = opaque;
+
+    msi_reset(&xhci->pci_dev);
+    xhci_reset_full(xhci);
+}
+
 static uint32_t xhci_cap_read(XHCIState *xhci, uint32_t reg)
 {
     DPRINTF("xhci_cap_read(0x%x)\n", reg);
@@ -2506,7 +2513,7 @@  static void xhci_oper_write(XHCIState *xhci, uint32_t reg, uint32_t val)
         }
         xhci->usbcmd = val & 0xc0f;
         if (val & USBCMD_HCRST) {
-            xhci_reset(xhci);
+            xhci_reset_full(xhci);
         }
         xhci_irq_update(xhci);
         break;