From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34553) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbnQF-0002Rt-SV for qemu-devel@nongnu.org; Fri, 23 Nov 2012 02:11:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TbnQB-0007lN-Dd for qemu-devel@nongnu.org; Fri, 23 Nov 2012 02:11:35 -0500 Received: from mail-bk0-f45.google.com ([209.85.214.45]:34200) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbnQB-0007lH-6q for qemu-devel@nongnu.org; Fri, 23 Nov 2012 02:11:31 -0500 Received: by mail-bk0-f45.google.com with SMTP id jk13so2589615bkc.4 for ; Thu, 22 Nov 2012 23:11:30 -0800 (PST) Date: Fri, 23 Nov 2012 08:11:28 +0100 From: Stefan Hajnoczi Message-ID: <20121123071128.GE22787@stefanha-thinkpad.hitronhub.home> References: <1353647324-19840-1-git-send-email-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1353647324-19840-1-git-send-email-david@gibson.dropbear.id.au> 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 Cc: pbonzini@redhat.com, aliguori@us.ibm.com, Paul 'Rusty' Russell , qemu-devel@nongnu.org On Fri, Nov 23, 2012 at 04:08:44PM +1100, David Gibson wrote: > 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 > --- > hw/virtio-scsi.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) Reviewed-by: Stefan Hajnoczi