qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/2] usb-storage: improve debug logging
@ 2012-07-13  9:44 Gerd Hoffmann
  0 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2012-07-13  9:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/dev-storage.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
index 251e7de..f1d8082 100644
--- a/hw/usb/dev-storage.c
+++ b/hw/usb/dev-storage.c
@@ -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 {
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PULL 0/2] usb patch queue
@ 2012-08-07  8:59 Gerd Hoffmann
  2012-08-07  8:59 ` [Qemu-devel] [PATCH 1/2] usb-storage: improve debug logging Gerd Hoffmann
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2012-08-07  8:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

  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(-)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 1/2] usb-storage: improve debug logging
  2012-08-07  8:59 [Qemu-devel] [PULL 0/2] usb patch queue Gerd Hoffmann
@ 2012-08-07  8:59 ` Gerd Hoffmann
  2012-08-07  8:59 ` [Qemu-devel] [PATCH 2/2] usb-storage: fix SYNCHRONIZE_CACHE Gerd Hoffmann
  2012-08-07 15:36 ` [Qemu-devel] [PULL 0/2] usb patch queue Anthony Liguori
  2 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2012-08-07  8:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/dev-storage.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
index 7fa8b83..976fe1a 100644
--- a/hw/usb/dev-storage.c
+++ b/hw/usb/dev-storage.c
@@ -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 {
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 2/2] usb-storage: fix SYNCHRONIZE_CACHE
  2012-08-07  8:59 [Qemu-devel] [PULL 0/2] usb patch queue Gerd Hoffmann
  2012-08-07  8:59 ` [Qemu-devel] [PATCH 1/2] usb-storage: improve debug logging Gerd Hoffmann
@ 2012-08-07  8:59 ` Gerd Hoffmann
  2012-08-10 11:13   ` Michael Tokarev
  2012-08-07 15:36 ` [Qemu-devel] [PULL 0/2] usb patch queue Anthony Liguori
  2 siblings, 1 reply; 6+ messages in thread
From: Gerd Hoffmann @ 2012-08-07  8:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

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

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/dev-storage.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
index 976fe1a..ff48d91 100644
--- a/hw/usb/dev-storage.c
+++ b/hw/usb/dev-storage.c
@@ -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);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PULL 0/2] usb patch queue
  2012-08-07  8:59 [Qemu-devel] [PULL 0/2] usb patch queue Gerd Hoffmann
  2012-08-07  8:59 ` [Qemu-devel] [PATCH 1/2] usb-storage: improve debug logging Gerd Hoffmann
  2012-08-07  8:59 ` [Qemu-devel] [PATCH 2/2] usb-storage: fix SYNCHRONIZE_CACHE Gerd Hoffmann
@ 2012-08-07 15:36 ` Anthony Liguori
  2 siblings, 0 replies; 6+ messages in thread
From: Anthony Liguori @ 2012-08-07 15:36 UTC (permalink / raw)
  To: Gerd Hoffmann, qemu-devel

Gerd Hoffmann <kraxel@redhat.com> writes:

>   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

>
> 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(-)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] usb-storage: fix SYNCHRONIZE_CACHE
  2012-08-07  8:59 ` [Qemu-devel] [PATCH 2/2] usb-storage: fix SYNCHRONIZE_CACHE Gerd Hoffmann
@ 2012-08-10 11:13   ` Michael Tokarev
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Tokarev @ 2012-08-10 11:13 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel

On 07.08.2012 12:59, Gerd Hoffmann wrote:
> 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

> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/usb/dev-storage.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
> index 976fe1a..ff48d91 100644
> --- a/hw/usb/dev-storage.c
> +++ b/hw/usb/dev-storage.c
> @@ -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);

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-08-10 11:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-07  8:59 [Qemu-devel] [PULL 0/2] usb patch queue Gerd Hoffmann
2012-08-07  8:59 ` [Qemu-devel] [PATCH 1/2] usb-storage: improve debug logging Gerd Hoffmann
2012-08-07  8:59 ` [Qemu-devel] [PATCH 2/2] usb-storage: fix SYNCHRONIZE_CACHE Gerd Hoffmann
2012-08-10 11:13   ` Michael Tokarev
2012-08-07 15:36 ` [Qemu-devel] [PULL 0/2] usb patch queue Anthony Liguori
  -- strict thread matches above, loose matches on Subject: below --
2012-07-13  9:44 [Qemu-devel] [PATCH 1/2] usb-storage: improve debug logging Gerd Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).