Skip to content

Commit

Permalink
ehci: fix Interrupt Threshold Control implementation
Browse files Browse the repository at this point in the history
First, not all interrupts are subject to Interrupt Threshold Control,
some of them must be delivered without delay.

Second, Interrupt Threshold Control state must be part of vmstate,
otherwise we might loose IRQs on migration.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
  • Loading branch information
kraxel committed Aug 16, 2012
1 parent 0daf530 commit 6d3b6d3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions hw/usb/hcd-ehci.c
Expand Up @@ -575,7 +575,12 @@ static inline void ehci_update_irq(EHCIState *s)
/* flag interrupt condition */
static inline void ehci_raise_irq(EHCIState *s, int intr)
{
s->usbsts_pending |= intr;
if (intr & (USBSTS_PCD | USBSTS_FLR | USBSTS_HSE)) {
s->usbsts |= intr;
ehci_update_irq(s);
} else {
s->usbsts_pending |= intr;
}
}

/*
Expand Down Expand Up @@ -2466,13 +2471,16 @@ static int usb_ehci_post_load(void *opaque, int version_id)

static const VMStateDescription vmstate_ehci = {
.name = "ehci",
.version_id = 1,
.version_id = 2,
.minimum_version_id = 1,
.post_load = usb_ehci_post_load,
.fields = (VMStateField[]) {
VMSTATE_PCI_DEVICE(dev, EHCIState),
/* mmio registers */
VMSTATE_UINT32(usbcmd, EHCIState),
VMSTATE_UINT32(usbsts, EHCIState),
VMSTATE_UINT32_V(usbsts_pending, EHCIState, 2),
VMSTATE_UINT32_V(usbsts_frindex, EHCIState, 2),
VMSTATE_UINT32(usbintr, EHCIState),
VMSTATE_UINT32(frindex, EHCIState),
VMSTATE_UINT32(ctrldssegment, EHCIState),
Expand Down

0 comments on commit 6d3b6d3

Please sign in to comment.