From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59498) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7Ojo-0007aF-TN for qemu-devel@nongnu.org; Wed, 16 Jul 2014 08:55:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X7Ojd-0006CE-A0 for qemu-devel@nongnu.org; Wed, 16 Jul 2014 08:55:12 -0400 Received: from mail-ie0-x233.google.com ([2607:f8b0:4001:c03::233]:59212) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7Ojd-0006C7-3c for qemu-devel@nongnu.org; Wed, 16 Jul 2014 08:55:01 -0400 Received: by mail-ie0-f179.google.com with SMTP id rl12so678148iec.24 for ; Wed, 16 Jul 2014 05:54:59 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Wed, 16 Jul 2014 14:54:45 +0200 Message-Id: <1405515290-12497-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH for-2.2 0/5] scsi: enable passthrough of vendor-specific commands List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: TAMUKI Shoichi Right now scsi-generic is parsing the CDB, in order to compute the expected number of bytes to be transferred. This is necessary if DMA is done by the HBA via scsi_req_data, but it prevents executing vendor-specific commands via scsi-generic because we don't know how to parse them. If DMA is delegated to the SCSI layer via get_sg_list, we know in advance how many bytes the guest will want to receive and we can pass the information straight from the guest to SG_IO. In this case, it is unnecessary to parse the CDB to get the same information. scsi-disk needs it to detect underruns and overruns, but scsi-generic and scsi-block can just ask the HBA about the transfer direction and size. This series introduces a new parse_cdb callback in both the device and the HBA. The latter is called by scsi_bus_parse_cdb, which devices can call for passthrough requests in their implementation of parse_cdb. Tamuki-san, can you please test if these patches are okay for your usecase? Paolo Paolo Bonzini (5): scsi-bus: prepare scsi_req_new for introduction of parse_cdb scsi-bus: introduce parse_cdb in SCSIDeviceClass and SCSIBusInfo scsi-block: extract scsi_block_is_passthrough scsi-block, scsi-generic: implement parse_cdb virtio-scsi: implement parse_cdb hw/scsi/scsi-bus.c | 68 ++++++++++++++++++++++++++++++++++---------------- hw/scsi/scsi-disk.c | 52 +++++++++++++++++++++++++++++--------- hw/scsi/scsi-generic.c | 7 ++++++ hw/scsi/virtio-scsi.c | 24 ++++++++++++++++++ include/hw/scsi/scsi.h | 7 ++++++ 5 files changed, 124 insertions(+), 34 deletions(-) -- 1.9.3