Skip to contentSkip to conversation

usb patch queue

GIT PULL In review Gerd Hoffmann 3 participants 5 messages Aug 7, 2012 – Aug 10, 2012

lore
Share & tools
lore
#0 lore raw

Hi,

This is the usb patch queue, pretty small this time, carrying a little fix for usb-storage.

please pull,
Gerd

Gerd Hoffmann (2):
usb-storage: improve debug logging
usb-storage: fix SYNCHRONIZE_CACHE

 hw/usb/dev-storage.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

The following changes since commit 0b8db8fe15d17a529a5ea90614c11e9f031dfee8:

slirp: fix build on mingw32 (2012-08-06 19:31:55 -0500)

are available in the git repository at:
git://git.kraxel.org/qemu usb.58

Gerd Hoffmann (2):
usb-storage: improve debug logging
usb-storage: fix SYNCHRONIZE_CACHE

 hw/usb/dev-storage.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
#1 lore raw

PATCH 1/2 usb-storage: improve debug logging

---
 hw/usb/dev-storage.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
hw/usb/dev-storage.c +6 -2
index 7fa8b83..976fe1a 100644
@@ -383,6 +383,9 @@ static int usb_msd_handle_data(USBDevice *dev, USBPacket *p)
             assert(le32_to_cpu(s->csw.residue) == 0);
             s->scsi_len = 0;
             s->req = scsi_req_new(s->scsi_dev, tag, 0, cbw.cmd, NULL);
+#ifdef DEBUG_MSD
+            scsi_req_print(s->req);
+#endif
             scsi_req_enqueue(s->req);
             if (s->req && s->req->cmd.xfer != SCSI_XFER_NONE) {
                 scsi_req_continue(s->req);
@@ -410,7 +413,7 @@ static int usb_msd_handle_data(USBDevice *dev, USBPacket *p)
                 }
             }
             if (p->result < p->iov.size) {
-                DPRINTF("Deferring packet %p\n", p);
+                DPRINTF("Deferring packet %p [wait data-out]\n", p);
                 s->packet = p;
                 ret = USB_RET_ASYNC;
             } else {
@@ -445,6 +448,7 @@ static int usb_msd_handle_data(USBDevice *dev, USBPacket *p)
 
             if (s->req) {
                 /* still in flight */
+                DPRINTF("Deferring packet %p [wait status]\n", p);
                 s->packet = p;
                 ret = USB_RET_ASYNC;
             } else {
@@ -471,7 +475,7 @@ static int usb_msd_handle_data(USBDevice *dev, USBPacket *p)
                 }
             }
             if (p->result < p->iov.size) {
-                DPRINTF("Deferring packet %p\n", p);
+                DPRINTF("Deferring packet %p [wait data-in]\n", p);
                 s->packet = p;
                 ret = USB_RET_ASYNC;
             } else {
Signature · 1 line
1.7.1
#2 lore raw

PATCH 2/2 usb-storage: fix SYNCHRONIZE_CACHE

In reply to Gerd Hoffmann

Commit 59310659073d85745854f2f10c4292555c5a1c51 is incomplete, we'll arrive in the scsi command complete callback in CSW state and must handle that case correctly.

---
 hw/usb/dev-storage.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
hw/usb/dev-storage.c +3 -0
index 976fe1a..ff48d91 100644
@@ -247,6 +247,9 @@ static void usb_msd_command_complete(SCSIRequest *req, uint32_t status, size_t r
                the status read packet.  */
             usb_msd_send_status(s, p);
             s->mode = USB_MSDM_CBW;
+        } else if (s->mode == USB_MSDM_CSW) {
+            usb_msd_send_status(s, p);
+            s->mode = USB_MSDM_CBW;
         } else {
             if (s->data_len) {
                 int len = (p->iov.size - p->result);
Signature · 1 line
1.7.1
#3 lore raw

Re: [Qemu-devel] [PATCH 2/2] usb-storage: fix SYNCHRONIZE_CACHE

Quoted 3 lines · Gerd Hoffmann

Commit 59310659073d85745854f2f10c4292555c5a1c51 is incomplete, we'll arrive in the scsi command complete callback in CSW state and must handle that case correctly.

It appears to be 1.1-stable material, rigt?
What's the outcome of the issue -- guest-triggerable qemu crashing?

Thanks,

/mjt

Quoted 19 lines
---
 hw/usb/dev-storage.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
hw/usb/dev-storage.c +3 -0
index 976fe1a..ff48d91 100644
@@ -247,6 +247,9 @@ static void usb_msd_command_complete(SCSIRequest *req, uint32_t status, size_t r
                the status read packet.  */
             usb_msd_send_status(s, p);
             s->mode = USB_MSDM_CBW;
+        } else if (s->mode == USB_MSDM_CSW) {
+            usb_msd_send_status(s, p);
+            s->mode = USB_MSDM_CBW;
         } else {
             if (s->data_len) {
                 int len = (p->iov.size - p->result);
#4 lore raw
In reply to Gerd Hoffmann
Quoted 7 lines · Gerd Hoffmann

Hi,

This is the usb patch queue, pretty small this time, carrying a little fix for usb-storage.

please pull,
Gerd

Pulled. Thanks.

Regards,

Anthony Liguori

Quoted 21 lines

Gerd Hoffmann (2):
usb-storage: improve debug logging
usb-storage: fix SYNCHRONIZE_CACHE

 hw/usb/dev-storage.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

The following changes since commit 0b8db8fe15d17a529a5ea90614c11e9f031dfee8:

slirp: fix build on mingw32 (2012-08-06 19:31:55 -0500)

are available in the git repository at:
git://git.kraxel.org/qemu usb.58

Gerd Hoffmann (2):
usb-storage: improve debug logging
usb-storage: fix SYNCHRONIZE_CACHE

 hw/usb/dev-storage.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)