Received: from eggs.gnu.org ([2001:4830:134:3::10]:53846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVaqa-0005z1-0n for qemu-devel@nongnu.org; Wed, 11 Mar 2015 03:14:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVaqV-0003gj-Uq for qemu-devel@nongnu.org; Wed, 11 Mar 2015 03:14:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56896) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVaqV-0003ga-Lc for qemu-devel@nongnu.org; Wed, 11 Mar 2015 03:14:23 -0400 Date: Wed, 11 Mar 2015 15:14:16 +0800 From: Fam Zheng Message-ID: <20150311071416.GI1437@ad.nay.redhat.com> References: <1424295164-4774-1-git-send-email-mst@redhat.com> <1424295164-4774-41-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1424295164-4774-41-git-send-email-mst@redhat.com> Subject: Re: [Qemu-devel] [PULL 40/96] virtio-scsi: use standard-headers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , "Michael S. Tsirkin" Cc: Peter Maydell , Juan Quintela , qemu-devel@nongnu.org, Anthony Liguori , dgilbert@redhat.com On Wed, 02/18 22:48, Michael S. Tsirkin wrote: > Drop duplicated code. > > Signed-off-by: Michael S. Tsirkin > Acked-by: Paolo Bonzini Michael, this breaks virtio-scsi-pci: qemu-system-x86_64: wrong size for virtio-scsi headers Because: > - > -/* SCSI command request, followed by CDB and data-out */ > -typedef struct { > - uint8_t lun[8]; /* Logical Unit Number */ > - uint64_t tag; /* Command identifier */ > - uint8_t task_attr; /* Task attribute */ > - uint8_t prio; > - uint8_t crn; This doesn't have the cdb array (it is dynamically alloated and appended to the end of VirtIOSCSIReq, the allocation size depends on guest configured cdb_size)... > -} QEMU_PACKED VirtIOSCSICmdReq; > - > -typedef struct { > - uint32_t num_queues; > - uint32_t seg_max; > - uint32_t max_sectors; > - uint32_t cmd_per_lun; > - uint32_t event_info_size; > - uint32_t sense_size; > - uint32_t cdb_size; > - uint16_t max_channel; > - uint16_t max_target; > - uint32_t max_lun; > -} QEMU_PACKED VirtIOSCSIConfig; > +typedef struct virtio_scsi_cmd_req VirtIOSCSICmdReq; But in virtio_scsi_cmd_req: /* SCSI command request, followed by data-out */ struct virtio_scsi_cmd_req { uint8_t lun[8]; /* Logical Unit Number */ __virtio64 tag; /* Command identifier */ uint8_t task_attr; /* Task attribute */ uint8_t prio; /* SAM command priority field */ uint8_t crn; uint8_t cdb[VIRTIO_SCSI_CDB_SIZE]; } QEMU_PACKED; the cdb array is fixed and inlined. Fam