qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 2bcf4e: usb-serial: Move USB_TOKEN_IN into a


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 2bcf4e: usb-serial: Move USB_TOKEN_IN into a helper function
Date: Tue, 17 Mar 2020 07:45:12 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 2bcf4e9ff9a3f29b21e6d487d89264d191df5822
      
https://github.com/qemu/qemu/commit/2bcf4e9ff9a3f29b21e6d487d89264d191df5822
  Author: Jason Andryuk <address@hidden>
  Date:   2020-03-17 (Tue, 17 Mar 2020)

  Changed paths:
    M hw/usb/dev-serial.c

  Log Message:
  -----------
  usb-serial: Move USB_TOKEN_IN into a helper function

We'll be adding a loop, so move the code into a helper function.  breaks
are replaced with returns.  While making this change, add braces to
single line if statements to comply with coding style and keep
checkpatch happy.

Signed-off-by: Jason Andryuk <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 87db78f743668224ae9a5346229faed56ef7ff66
      
https://github.com/qemu/qemu/commit/87db78f743668224ae9a5346229faed56ef7ff66
  Author: Jason Andryuk <address@hidden>
  Date:   2020-03-17 (Tue, 17 Mar 2020)

  Changed paths:
    M hw/usb/dev-serial.c

  Log Message:
  -----------
  usb-serial: chunk data to wMaxPacketSize

usb-serial has issues with xHCI controllers where data is lost in the
VM.  Inspecting the URBs in the guest, EHCI starts every 64 byte boundary
(wMaxPacketSize) with a header.  EHCI hands packets into
usb_serial_token_in() with size 64, so these cannot cross the 64 byte
boundary.  The xHCI controller has packets of 512 bytes and the usb-serial
will just write through the 64 byte boundary.  In the guest, this means
data bytes are interpreted as header, so data bytes don't make it out
the serial interface.

Re-work usb_serial_token_in to chunk data into 64 byte units - 2 byte
header and 62 bytes data.  The Linux driver reads wMaxPacketSize to find
the chunk size, so we match that.

Real hardware was observed to pass in 512 byte URBs (496 bytes data +
8 * 2 byte headers).  Since usb-serial only buffers 384 bytes of data,
usb-serial will pass in 6 64 byte blocks and 1 12 byte partial block for
462 bytes max.

Signed-off-by: Jason Andryuk <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 30ad5fdd34d9cfc9f16e73e0229c133d7317a42a
      
https://github.com/qemu/qemu/commit/30ad5fdd34d9cfc9f16e73e0229c133d7317a42a
  Author: Jason Andryuk <address@hidden>
  Date:   2020-03-17 (Tue, 17 Mar 2020)

  Changed paths:
    M hw/usb/dev-serial.c

  Log Message:
  -----------
  usb-serial: Increase receive buffer to 496

A FTDI USB adapter on an xHCI controller can send 512 byte USB packets.
These are 8 * ( 2 bytes header + 62 bytes data).  A 384 byte receive
buffer is insufficient to fill a 512 byte packet, so bump the receive
size to 496 ( 512 - 2 * 8 ).

Signed-off-by: Jason Andryuk <address@hidden>
Reviewed-by: Samuel Thibault <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 647ee9877272d4359659e2595262db0e062c8ffc
      
https://github.com/qemu/qemu/commit/647ee9877272d4359659e2595262db0e062c8ffc
  Author: Jason Andryuk <address@hidden>
  Date:   2020-03-17 (Tue, 17 Mar 2020)

  Changed paths:
    M hw/usb/dev-serial.c

  Log Message:
  -----------
  usb-serial: Fix timeout closing the device

Linux guests wait ~30 seconds when closing the emulated /dev/ttyUSB0.
During that time, the kernel driver is sending many control URBs
requesting GetModemStat (5).  Real hardware returns a status with
FTDI_THRE (Transmitter Holding Register) and FTDI_TEMT (Transmitter
Empty) set.  QEMU leaves them clear, and it seems Linux is waiting for
FTDI_TEMT to be set to indicate the tx queue is empty before closing.

Set the bits when responding to a GetModemStat query and avoid the
shutdown delay.

Signed-off-by: Jason Andryuk <address@hidden>
Reviewed-by: Samuel Thibault <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 40c67636f67c2a89745f2e698522fe917326a952
      
https://github.com/qemu/qemu/commit/40c67636f67c2a89745f2e698522fe917326a952
  Author: Peter Maydell <address@hidden>
  Date:   2020-03-17 (Tue, 17 Mar 2020)

  Changed paths:
    M hw/usb/dev-serial.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/kraxel/tags/usb-20200317-pull-request' 
into staging

usb: bugfixes for usb-serial @ xhci.

# gpg: Signature made Tue 17 Mar 2020 09:50:04 GMT
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <address@hidden>" [full]
# gpg:                 aka "Gerd Hoffmann <address@hidden>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <address@hidden>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/usb-20200317-pull-request:
  usb-serial: Fix timeout closing the device
  usb-serial: Increase receive buffer to 496
  usb-serial: chunk data to wMaxPacketSize
  usb-serial: Move USB_TOKEN_IN into a helper function

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/3189e9d38c82...40c67636f67c



reply via email to

[Prev in Thread] Current Thread [Next in Thread]