qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/1] scsi-disk: passthrough VERIFY command


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 1/1] scsi-disk: passthrough VERIFY command
Date: Fri, 16 Dec 2016 11:10:00 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1


On 16/12/2016 08:55, Junlian Bell wrote:
> When a scsi-disk object receives VERIFY command with BYTCHK bit being zero,
> scsi_block_is_passthrough returns false and finally makes req being proceeded
> by scsi_block_dma_command. Because scsi_block_dma_command has removed process
> of VERIFY, QEMU will abort in this function.
> 
> This patch makes all VERIFY passthrough to solve this problom.
> 
> Signed-off-by: Junlian Bell <address@hidden>
> ---
>  hw/scsi/scsi-disk.c | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
> index a96319138a..f30f97f976 100644
> --- a/hw/scsi/scsi-disk.c
> +++ b/hw/scsi/scsi-disk.c
> @@ -2690,13 +2690,6 @@ static bool scsi_block_is_passthrough(SCSIDiskState 
> *s, uint8_t *buf)
>      case VERIFY_10:
>      case VERIFY_12:
>      case VERIFY_16:
> -        /* Check if BYTCHK == 0x01 (data-out buffer contains data
> -         * for the number of logical blocks specified in the length
> -         * field).  For other modes, do not use scatter/gather operation.
> -         */
> -        if ((buf[1] & 6) != 2) {
> -            return false;
> -        }
>          break;
>  
>      case READ_6:
> 

Does this work too?

diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index a963191..676164d 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -2157,6 +2157,13 @@ static int32_t scsi_disk_dma_command(SCSIRequest
*req, uint8_t *buf)
         DPRINTF("Write %s(sector %" PRId64 ", count %u)\n",
                 (command & 0xe) == 0xe ? "And Verify " : "",
                 r->req.cmd.lba, len);
+    case VERIFY_10:
+    case VERIFY_12:
+    case VERIFY_16:
+        /* We get here only for BYTCHK=00 and only for scsi-block.  As
+         * far as DMA is concerned, we can treat it as a write, and
+         * scsi_block_do_sgio will send VERIFY commands.
+         */
         if (r->req.cmd.buf[1] & 0xe0) {
             goto illegal_request;
         }

Thanks,

Paolo



reply via email to

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