mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
hw/usb: hcd-xhci-pci: Fix spec violation of IP flag for MSI/MSI-X
Per xHCI spec v1.2 chapter 4.17.5 page 296: If MSI or MSI-X interrupts are enabled, Interrupt Pending (IP) shall be cleared automatically when the PCI dword write generated by the interrupt assertion is complete. Currently QEMU does not clear the IP flag in the MSI / MSI-X mode. This causes subsequent spurious interrupt to be delivered to guests. To solve this, we change the xhci intr_raise() hook routine to have a bool return value that is passed to its caller (the xhci core), with true indicating that IP should be self-cleared. Fixes:62c6ae04cf
("xhci: Initial xHCI implementation") Fixes:4c47f80063
("xhci: add msix support") Signed-off-by: Ruimei Yan <ruimei.yan@windriver.com> [bmeng: move IP clear codes from xhci pci to xhci core] Signed-off-by: Bin Meng <bin.meng@windriver.com> Message-Id: <20210521024224.2277634-2-bmeng.cn@gmail.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
3c6151cd11
commit
fc967aad40
4 changed files with 15 additions and 7 deletions
|
@ -57,7 +57,7 @@ static void xhci_pci_intr_update(XHCIState *xhci, int n, bool enable)
|
|||
}
|
||||
}
|
||||
|
||||
static void xhci_pci_intr_raise(XHCIState *xhci, int n, bool level)
|
||||
static bool xhci_pci_intr_raise(XHCIState *xhci, int n, bool level)
|
||||
{
|
||||
XHCIPciState *s = container_of(xhci, XHCIPciState, xhci);
|
||||
PCIDevice *pci_dev = PCI_DEVICE(s);
|
||||
|
@ -70,13 +70,15 @@ static void xhci_pci_intr_raise(XHCIState *xhci, int n, bool level)
|
|||
|
||||
if (msix_enabled(pci_dev) && level) {
|
||||
msix_notify(pci_dev, n);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (msi_enabled(pci_dev) && level) {
|
||||
msi_notify(pci_dev, n);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void xhci_pci_reset(DeviceState *dev)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue