From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49196) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfIil-0003Sj-M6 for qemu-devel@nongnu.org; Sun, 02 Dec 2012 18:13:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TfIik-0002gO-GH for qemu-devel@nongnu.org; Sun, 02 Dec 2012 18:13:11 -0500 Received: from ozlabs.org ([203.10.76.45]:39863) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfIik-0002gA-5Q for qemu-devel@nongnu.org; Sun, 02 Dec 2012 18:13:10 -0500 From: Rusty Russell In-Reply-To: <1353647324-19840-1-git-send-email-david@gibson.dropbear.id.au> References: <1353647324-19840-1-git-send-email-david@gibson.dropbear.id.au> Date: Mon, 03 Dec 2012 08:38:55 +1030 Message-ID: <87lidgjedk.fsf@rustcorp.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH] virtio-scsi Fix some endian bugs with virtio-scsi List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson , pbonzini@redhat.com, aliguori@us.ibm.com Cc: qemu-devel@nongnu.org David Gibson writes: > The virtio-scsi specification does not specify the correct endianness for > fields in the request structure. It's therefore best to assume that it is > "guest native" endian since that's the (stupid and poorly defined) norm in > virtio. > > However, the qemu device for virtio-scsi has no byteswaps at all, and so > will break if the guest has different endianness from the host. This patch > fixes it by adding tswap() calls for the sense_len and resid fields in > the request structure. In theory status_qualifier needs swaps as well, > but that field is never actually touched. The tag field is a uint64_t, but > since its value is completely arbitrary, it might as well be uint8_t[8] > and so it does not need swapping. > > Cc: Paolo Bonzini > Cc: Paul 'Rusty' Russell > Signed-off-by: David Gibson Good catch, thanks for this David. Cheers, Rusty.