Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/kraxel/tags/usb-20210528-pull-r…
Browse files Browse the repository at this point in the history
…equest' into staging

usb: bugfixes for hid and xhci.

# gpg: Signature made Fri 28 May 2021 15:21:51 BST
# gpg:                using RSA key A0328CFFB93A17A79901FE7D4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <[email protected]>" [full]
# gpg:                 aka "Gerd Hoffmann <[email protected]>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <[email protected]>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/usb-20210528-pull-request:
  hw/usb: hcd-xhci-pci: Fix spec violation of IP flag for MSI/MSI-X
  hw/usb: hcd-xhci-pci: Raise MSI/MSI-X interrupts only when told to
  hw/input/hid: Add support for keys of jp106 keyboard.

Signed-off-by: Peter Maydell <[email protected]>
  • Loading branch information
pm215 committed May 30, 2021
2 parents f9dc72d + fc967aa commit 5284892
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
4 changes: 2 additions & 2 deletions hw/input/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ static const uint8_t hid_usage_keys[0x100] = {
0x45, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e,
0xe8, 0xe9, 0x71, 0x72, 0x73, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xe3, 0xe7, 0x65,
0x88, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x00,
0x00, 0x8a, 0x00, 0x8b, 0x00, 0x89, 0xe7, 0x65,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand Down
13 changes: 8 additions & 5 deletions hw/usb/hcd-xhci-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -67,15 +67,18 @@ 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;
return true;
}

if (msi_enabled(pci_dev)) {
if (msi_enabled(pci_dev) && level) {
msi_notify(pci_dev, n);
return;
return true;
}

return false;
}

static void xhci_pci_reset(DeviceState *dev)
Expand Down
4 changes: 3 additions & 1 deletion hw/usb/hcd-xhci-sysbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
#include "hw/acpi/aml-build.h"
#include "hw/irq.h"

static void xhci_sysbus_intr_raise(XHCIState *xhci, int n, bool level)
static bool xhci_sysbus_intr_raise(XHCIState *xhci, int n, bool level)
{
XHCISysbusState *s = container_of(xhci, XHCISysbusState, xhci);

qemu_set_irq(s->irq[n], level);

return false;
}

void xhci_sysbus_reset(DeviceState *dev)
Expand Down
8 changes: 6 additions & 2 deletions hw/usb/hcd-xhci.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,9 @@ static void xhci_intr_update(XHCIState *xhci, int v)
level = 1;
}
if (xhci->intr_raise) {
xhci->intr_raise(xhci, 0, level);
if (xhci->intr_raise(xhci, 0, level)) {
xhci->intr[0].iman &= ~IMAN_IP;
}
}
}
if (xhci->intr_update) {
Expand Down Expand Up @@ -579,7 +581,9 @@ static void xhci_intr_raise(XHCIState *xhci, int v)
return;
}
if (xhci->intr_raise) {
xhci->intr_raise(xhci, v, true);
if (xhci->intr_raise(xhci, v, true)) {
xhci->intr[v].iman &= ~IMAN_IP;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion hw/usb/hcd-xhci.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ typedef struct XHCIState {
uint32_t flags;
uint32_t max_pstreams_mask;
void (*intr_update)(XHCIState *s, int n, bool enable);
void (*intr_raise)(XHCIState *s, int n, bool level);
bool (*intr_raise)(XHCIState *s, int n, bool level);
DeviceState *hostOpaque;

/* Operational Registers */
Expand Down

0 comments on commit 5284892

Please sign in to comment.