Skip to content
  • Gerd Hoffmann's avatar
    7da76e12
    xhci: fix event queue IRQ handling · 7da76e12
    Gerd Hoffmann authored
    
    
    The qemu xhci emulation doesn't handle the ERDP_EHB flag correctly.
    
    When the host adapter queues a new event the ERDP_EHB flag is set.  The
    flag is cleared (via w1c) by the guest when it updates the ERDP (event
    ring dequeue pointer) register to notify the host adapter which events
    it has fetched.
    
    An IRQ must be raised in case the ERDP_EHB flag flips from clear to set.
    If the flag is set already (which implies there are events queued up
    which are not yet processed by the guest) xhci must *not* raise a IRQ.
    
    Qemu got that wrong and raised an IRQ on every event, thereby generating
    spurious interrupts in case we've queued events faster than the guest
    processed them.  This patch fixes that.
    
    With that change in place we also have to check ERDP updates, to see
    whenever the guest has fetched all queued events.  In case there are
    still pending events set ERDP_EHB and raise an IRQ again, to make sure
    the events don't linger unseen forever.
    
    The linux kernel driver and the microsoft windows driver (shipped with
    win8+) can deal with the spurious interrupts without problems.  The
    renesas windows driver (v2.1.39) which can be used on older windows
    versions is quite upset though.  It does spurious ERDP updates now and
    then (not every time, seems we must hit a race window for this to
    happen), which in turn makes the qemu xhci emulation think the event
    ring is full.  Things go south from here ...
    
    tl;dr: This is the "fix xhci on win7" patch.
    
    Cc: M.Cerveny@computer.org
    Cc: 1373228@bugs.launchpad.net
    Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
    Message-id: 1486104705-13761-1-git-send-email-kraxel@redhat.com
    7da76e12
    xhci: fix event queue IRQ handling
    Gerd Hoffmann authored
    
    
    The qemu xhci emulation doesn't handle the ERDP_EHB flag correctly.
    
    When the host adapter queues a new event the ERDP_EHB flag is set.  The
    flag is cleared (via w1c) by the guest when it updates the ERDP (event
    ring dequeue pointer) register to notify the host adapter which events
    it has fetched.
    
    An IRQ must be raised in case the ERDP_EHB flag flips from clear to set.
    If the flag is set already (which implies there are events queued up
    which are not yet processed by the guest) xhci must *not* raise a IRQ.
    
    Qemu got that wrong and raised an IRQ on every event, thereby generating
    spurious interrupts in case we've queued events faster than the guest
    processed them.  This patch fixes that.
    
    With that change in place we also have to check ERDP updates, to see
    whenever the guest has fetched all queued events.  In case there are
    still pending events set ERDP_EHB and raise an IRQ again, to make sure
    the events don't linger unseen forever.
    
    The linux kernel driver and the microsoft windows driver (shipped with
    win8+) can deal with the spurious interrupts without problems.  The
    renesas windows driver (v2.1.39) which can be used on older windows
    versions is quite upset though.  It does spurious ERDP updates now and
    then (not every time, seems we must hit a race window for this to
    happen), which in turn makes the qemu xhci emulation think the event
    ring is full.  Things go south from here ...
    
    tl;dr: This is the "fix xhci on win7" patch.
    
    Cc: M.Cerveny@computer.org
    Cc: 1373228@bugs.launchpad.net
    Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
    Message-id: 1486104705-13761-1-git-send-email-kraxel@redhat.com
Loading