Received: from eggs.gnu.org ([2001:4830:134:3::10]:34346) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0SW6-0001Gp-Ii for qemu-devel@nongnu.org; Wed, 11 May 2016 07:41:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b0SW0-0001Ge-E8 for qemu-devel@nongnu.org; Wed, 11 May 2016 07:41:25 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:34997) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0SVz-0001GU-Qq for qemu-devel@nongnu.org; Wed, 11 May 2016 07:41:20 -0400 Received: by mail-wm0-x242.google.com with SMTP id e201so8886822wme.2 for ; Wed, 11 May 2016 04:41:19 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Wed, 11 May 2016 13:41:09 +0200 Message-Id: <1462966873-30473-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 0/4] scsi-block: receive the right SCSI status on reads and writes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: hare@suse.de, vrozenfe@redhat.com, famz@redhat.com scsi-block uses the block layer for reads and writes in order to avoid allocating bounce buffers as big as the transferred data. We know how to split a large transfer to multiple reads and writes, and thus we can use scsi-disk.c's existing code to do I/O in multiple chunks (for non-s/g SCSI hosts) or through the DMA helpers (for s/g SCSI hosts). Unfortunately, this has the side effect of eating the SCSI status except in the very few cases where we can convert an errno code back to a SCSI status. It puts a big wrench in persistent reservations support in the guest, for example. Luckily, splitting a large transfer into multiple SBC commands is just as easy, and this is what the last patch does. It takes the original CDB, patches in a modified starting sector and sector count, and executes the SCSI command through blk_aio_ioctl. It is also easy to pass a QEMUIOVector to SG_IO, so that s/g SCSI hosts keep the performance. The other patches are preparatory work. Patch 2 modifies the DMA helpers to make the API more flexible, because the SCSI subsystem would like to have a SCSIRequest pointer passed to the I/O function instead of the BlockBackend pointer. Patches 1 and 3 introduce the two callbacks that scsi-block can override. This conflicts with Eric's work on the byte-based API; I plan to rebase it once those patches are in. In the meanwhile, I would especially appreciate the review of patch 2. Paolo Bonzini (4): scsi-disk: introduce a common base class dma-helpers: change BlockBackend to opaque value in DMAIOFunc scsi-disk: introduce dma_readv and dma_writev scsi-block: always use SG_IO dma-helpers.c | 51 +++++++++--- hw/ide/core.c | 12 +-- hw/ide/internal.h | 4 +- hw/ide/macio.c | 4 +- hw/scsi/scsi-disk.c | 229 ++++++++++++++++++++++++++++++++++++++++++--------- include/sysemu/dma.h | 11 +-- 6 files changed, 247 insertions(+), 64 deletions(-) -- 2.5.5