qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] virtio-scsi: actually honor sense_size from con


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] virtio-scsi: actually honor sense_size from configuration space
Date: Fri, 07 Mar 2014 09:40:39 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

Il 07/03/2014 08:40, Fam Zheng ha scritto:
On Thu, 03/06 11:27, Paolo Bonzini wrote:
We were always truncating the sense size to 96 bytes.

Signed-off-by: Paolo Bonzini <address@hidden>
---
 hw/scsi/virtio-scsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 6610b3a..b0d7517 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -304,6 +304,8 @@ static void virtio_scsi_command_complete(SCSIRequest *r, 
uint32_t status,
                                          size_t resid)
 {
     VirtIOSCSIReq *req = r->hba_private;
+    VirtIOSCSI *s = req->dev;
+    VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
     uint32_t sense_len;

     if (r->io_canceled) {
@@ -317,7 +319,7 @@ static void virtio_scsi_command_complete(SCSIRequest *r, 
uint32_t status,
     } else {
         req->resp.cmd->resid = 0;
         sense_len = scsi_req_get_sense(r, req->resp.cmd->sense,
-                                       VIRTIO_SCSI_SENSE_SIZE);
+                                       vs->sense_size);
         req->resp.cmd->sense_len = tswap32(sense_len);
     }
     virtio_scsi_complete_req(req);


Do we need to increase VIRTIO_SCSI_SENSE_SIZE as well?

    $ git grep -n VIRTIO_SCSI_SENSE_SIZE
    hw/scsi/virtio-scsi.c:463:    vs->sense_size = VIRTIO_SCSI_SENSE_SIZE;
    hw/scsi/virtio-scsi.c:609:    s->sense_size = VIRTIO_SCSI_SENSE_SIZE;
    include/hw/virtio/virtio-scsi.h:40:#define VIRTIO_SCSI_SENSE_SIZE  96

No, that's the default value and it's defined by the spec to be 96.

The OS can change it if they want.

Paolo



reply via email to

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