From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43462) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTpFX-0001PN-KW for qemu-devel@nongnu.org; Thu, 11 Feb 2016 06:17:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTpFT-0007JW-Ja for qemu-devel@nongnu.org; Thu, 11 Feb 2016 06:17:27 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:34750) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTpFT-0007JD-Ch for qemu-devel@nongnu.org; Thu, 11 Feb 2016 06:17:23 -0500 Received: by mail-wm0-x242.google.com with SMTP id p63so10001680wmp.1 for ; Thu, 11 Feb 2016 03:17:23 -0800 (PST) Sender: Paolo Bonzini References: <1450284917-10508-1-git-send-email-apyrgio@arrikto.com> <1450284917-10508-2-git-send-email-apyrgio@arrikto.com> From: Paolo Bonzini Message-ID: <56BC6DC0.4070204@redhat.com> Date: Thu, 11 Feb 2016 12:17:20 +0100 MIME-Version: 1.0 In-Reply-To: <1450284917-10508-2-git-send-email-apyrgio@arrikto.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 1/9] dma-helpers: Expose the sg mapping logic List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Pyrgiotis , qemu-devel@nongnu.org On 16/12/2015 17:55, Alex Pyrgiotis wrote: > +/* > + * Create a QEMUIOVector from a scatter-gather list. > + * > + * This function does not copy the data of the scatter-gather list. Instead, it > + * uses the dma_memory_map() function to map physical memory regions of the > + * virtual device (as interpreted by the guest kernel) into the address space > + * of the QEMU process, in order to have access to the data. > + */ > +static void dma_map_sg(DMAAIOCB *dbs) In special cases where the QEMUSGList includes MMIO regions, dma_map_sg might not be able to map the whole list. In this case, for regular I/O it is possible to break the operation in multiple steps---in fact, this breaking of requests is the main purpose of most of the code in dma-helpers.c. However, it is not possible to do the same for ioctls. This is actually the reason why no one has ever tried to make scsi-generic do anything but bounce-buffering. I think that your code breaks horribly in this case, and I don't see a way to fix it, except for reverting to bounce buffering. This would require major changes in your patches, and I'm not sure whether they are worth it for the single use case of tape devices... Paolo