From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58141) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZC3FP-0003Ed-34 for qemu-devel@nongnu.org; Mon, 06 Jul 2015 06:03:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZC3FL-0007Ez-Ku for qemu-devel@nongnu.org; Mon, 06 Jul 2015 06:03:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45181) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZC3FL-0007EU-Fi for qemu-devel@nongnu.org; Mon, 06 Jul 2015 06:03:31 -0400 Date: Mon, 6 Jul 2015 13:03:27 +0300 From: "Michael S. Tsirkin" Message-ID: <20150706125811-mutt-send-email-mst@redhat.com> References: <1435842022-13980-1-git-send-email-mst@redhat.com> <5595876E.2040803@redhat.com> <20150702205556-mutt-send-email-mst@redhat.com> <55958AE2.1020600@redhat.com> <20150704230256-mutt-send-email-mst@redhat.com> <559A3246.7020103@redhat.com> <20150706105048-mutt-send-email-mst@redhat.com> <559A4067.3060109@redhat.com> <20150706120539-mutt-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH] virtio-pci: implement cfg capability List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Paolo Bonzini , =?iso-8859-1?Q?Herv=E9?= Poussineau , QEMU Developers On Mon, Jul 06, 2015 at 10:11:18AM +0100, Peter Maydell wrote: > On 6 July 2015 at 10:06, Michael S. Tsirkin wrote: > > On Mon, Jul 06, 2015 at 10:46:31AM +0200, Paolo Bonzini wrote: > >> Why host endian and not device (in this case little) endian? > > > It's the endian of the originator of the transaction. > > And emulated device code is all compiled in host endian-ness. > > But address_space_rw() is just the "memcpy bytes to the > target's memory" operation -- if you have a pile of bytes > then there are no endianness concerns. If you don't have > a pile of bytes then you need to know the structure of > the data you're DMAing around, and you should probably > have a loop doing things with the specify-the-width functions. > > thanks > -- PMM Absolutely. But what if DMA happens to target another device and not memory? Device needs some endian-ness so it needs to be converted to that. -- MST