From: Ruimei Yan Date: Fri, 21 May 2021 02:42:23 +0000 (+0800) Subject: hw/usb: hcd-xhci-pci: Raise MSI/MSI-X interrupts only when told to X-Git-Tag: v6.1.0~142^2~1 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3c6151cd11ae7e4a7dae10f8c17ab1fe2f0a73bf;p=qemu-nvme.git hw/usb: hcd-xhci-pci: Raise MSI/MSI-X interrupts only when told to At present MSI / MSI-X interrupts are triggered regardless of the irq level. We should have checked the level to determine whether the interrupt needs to be delivered. The level check logic was present in early versions of the xhci model, but got dropped later by a rework of interrupt handling under commit 4c4abe7cc903 ("xhci: rework interrupt handling"). Fixes: 4c4abe7cc903 ("xhci: rework interrupt handling") Signed-off-by: Ruimei Yan Signed-off-by: Bin Meng Message-Id: <20210521024224.2277634-1-bmeng.cn@gmail.com> Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Gerd Hoffmann --- diff --git a/hw/usb/hcd-xhci-pci.c b/hw/usb/hcd-xhci-pci.c index 9421734d0f..b6acd1790c 100644 --- a/hw/usb/hcd-xhci-pci.c +++ b/hw/usb/hcd-xhci-pci.c @@ -67,12 +67,13 @@ static void xhci_pci_intr_raise(XHCIState *xhci, int n, bool level) msi_enabled(pci_dev))) { pci_set_irq(pci_dev, level); } - if (msix_enabled(pci_dev)) { + + if (msix_enabled(pci_dev) && level) { msix_notify(pci_dev, n); return; } - if (msi_enabled(pci_dev)) { + if (msi_enabled(pci_dev) && level) { msi_notify(pci_dev, n); return; }