qemu-devel
[Top][All Lists]
Advanced

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

Re: Failure prints during format or mounting a usb storage device


From: Paul Zimmerman
Subject: Re: Failure prints during format or mounting a usb storage device
Date: Wed, 8 Jul 2020 00:57:48 -0700



On Wed, Jul 8, 2020 at 12:29 AM Gerd Hoffmann <kraxel@redhat.com> wrote:
  Hi,

> > Why does 7ad3d51ebb8a522ffcad391c4bef281245739dde look at short-not-ok?
>
> Because the patch changes dev-storage to terminate the transfer if a
> short packet is received, so I figured 'short-not-ok' should affect
> that behavior.

I don't think so.  dev-storage should not need to look at short-not-ok.

> I guess instead I could add another flag that only hcd-dwc2 sets. Does
> that sound OK to you?

Sounds like that'll be another workaround.  dev-storage should not need
to know what kind of host adapter is used ...

A usb-storage transfer looks like this:

  (1) out transfer with the command (USB_MSDM_CBW)
  (2) data transfer, might be:
      - out (USB_MSDM_DATAOUT) for writes, or
      - in (USB_MSDM_DATAIN) for reads, or
      - nothing.
      depending on the scsi command.
  (3) in transfer with the status (USB_MSDM_CSW).

(1) and (3) usually fit into a single usb packet.
(2) can be multiple usb packets.

The critical case seem to be reads, i.e. we have in transfers for
both (2) and (3), and the transition from USB_MSDM_DATAIN state to
USB_MSDM_CSW state.

What is the sequence of usb packets submitted by the guest to hcd-dwc2
for reads?  Where exactly does it expect a short transfer?

DWC2 needs a short transfer to indicate the end of all IN transfers
that are not an exact multiple of max packet size. This means that
the guest USB driver submits all read requests not with the actual
length of the read, but with a length that is rounded up to a
multiple of MPS.

IIRC, without the dev-storage patch, the very first SCSI command
would get stuck waiting for the CSW, because the CSW is not a
multiple of MPS. I will have to work on getting a debug trace for
you, I'll get back to you with that.

Thanks,
Paul


reply via email to

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