From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:58802) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QrU6F-00064P-Fh for qemu-devel@nongnu.org; Thu, 11 Aug 2011 08:11:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QrU6E-0003zi-NV for qemu-devel@nongnu.org; Thu, 11 Aug 2011 08:10:59 -0400 Received: from mail-ww0-f53.google.com ([74.125.82.53]:54836) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QrU6E-0003ze-J7 for qemu-devel@nongnu.org; Thu, 11 Aug 2011 08:10:58 -0400 Received: by wwf25 with SMTP id 25so1763668wwf.10 for ; Thu, 11 Aug 2011 05:10:57 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4E43C6CE.9070008@redhat.com> Date: Thu, 11 Aug 2011 14:10:54 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1312478089-806-1-git-send-email-pbonzini@redhat.com> <1312478089-806-6-git-send-email-pbonzini@redhat.com> <20110811075836.GB29542@stefanha-thinkpad.localdomain> In-Reply-To: <20110811075836.GB29542@stefanha-thinkpad.localdomain> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 05/10] dma-helpers: add dma_buf_read and dma_buf_write List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: qemu-devel@nongnu.org On 08/11/2011 09:58 AM, Stefan Hajnoczi wrote: > On Thu, Aug 04, 2011 at 07:14:43PM +0200, Paolo Bonzini wrote: >> These helpers do a full transfer from an in-memory buffer to >> target memory, with full support for MMIO areas. It will be used to store >> the reply of an emulated command into a QEMUSGList provided by the >> adapter. >> >> Signed-off-by: Paolo Bonzini >> --- >> cutils.c | 8 +++--- >> dma-helpers.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >> dma.h | 5 ++++ >> 3 files changed, 72 insertions(+), 4 deletions(-) > > I don't understand this patch. If we have a memory buffer that needs to > be transferred to target memory, then there is no need for bounce > buffers or cpu_physical_memory_map(). > > Can we use cpu_physical_memory_rw() on each sglist element instead? No > -EAGAIN necessary because the memory buffer already acts as the local > bounce buffer. Doh, you're obviously right. I don't know what I was thinking. :) What do you think about passing the residual bytes for short transfers? Should I look into updating BlockDriverCompletionFunc, or is the approach of patch 2 okay? If I have an excuse to learn more about Coccinelle, that can be fun. :) Paolo