Received: from [140.186.70.92] (port=45278 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PvFUL-000628-8I for qemu-devel@nongnu.org; Thu, 03 Mar 2011 15:51:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PvFUK-00073N-7y for qemu-devel@nongnu.org; Thu, 03 Mar 2011 15:51:09 -0500 Received: from hall.aurel32.net ([88.191.126.93]:35428) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PvFUJ-00073I-VT for qemu-devel@nongnu.org; Thu, 03 Mar 2011 15:51:08 -0500 Date: Thu, 3 Mar 2011 21:51:01 +0100 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH 1/2] virtio-net: fix cross-endianness support Message-ID: <20110303205101.GE19189@hall.aurel32.net> References: <1295119664-25920-1-git-send-email-aurelien@aurel32.net> <20110303191618.GC19189@hall.aurel32.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: Sender: Aurelien Jarno List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Anthony Liguori , Liu Yu-B13201 , "qemu-devel@nongnu.org" On Thu, Mar 03, 2011 at 07:50:03PM +0000, Stefan Hajnoczi wrote: > On Thu, Mar 3, 2011 at 7:16 PM, Aurelien Jarno wrote: > > The endianness handling in virtio-net is different than in virtio-blk. > > In virtio-blk we basically have to byteswap the data when the endianness > > of the guest is different than the one of the guest. If I am correct, in > > virtio-net it seems we have to byteswap the data solely depending on the > > guest endianness and independently on the host endianness. This is > > something quite weird that we don't have in cpu-all.h > > That sounds odd. Virtio is guest endian so the host must do > guest<->host endian conversion. Which bits of code make you think > otherwise? > That's exactly what my patch was doing, changing the ldx_le_p() into ldx_p(). In pratice it doesn't work. Basically, with ldlx_le_p(), it only works when the endianness of the guess and of the host are the same. With ldx_p() it only works when the host is little endian. That's how I conclude that byteswapping should only be done on big endian guests. I agree it's weird and should be validated by some real tests, I am planning to do that soon. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net