qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: qemu-devel@nongnu.org, Aurelien Jarno <aurelien@aurel32.net>,
	Laurent Vivier <Laurent@vivier.eu>
Subject: [Qemu-devel] Re: [PATCH] Always swap endianness in DBDMA
Date: Tue, 22 Dec 2009 13:07:20 +0100	[thread overview]
Message-ID: <4B30B678.1060902@suse.de> (raw)
In-Reply-To: <20091222113626.GB16053@redhat.com>

Michael S. Tsirkin wrote:
> On Tue, Dec 22, 2009 at 11:24:18AM +0100, Alexander Graf wrote:
>   
>> When we get an MMIO request, we always get variables in host endianness. The
>> only time we need to actually reverse byte order is when we read bytes from
>> guest memory.
>>
>> Apparently the DBDMA implementation is different there. A lot of the logic
>> in there depends on values being big endian. Now, qemu does all the conversion
>> in the MMIO handlers for us already though, so it turns out that we're in
>> the same byte order from a C point of view, but cpu_to_be32 and be32_to_cpu
>> end up being nops.
>>
>> This makes the code work differently on x86 (little endian) than on ppc (big
>> endian). On x86 it works, on ppc it doesn't.
>>
>> This patch (while being seriously hacky and ugly) makes dbdma emulation work
>> on ppc hosts. I'll leave the real fixing to someone else.
>>     
>
> Come on, 
>
> #define cpu_to_dbdma32 bswap32
> #define dbdma_to_cpu32 bswap32
>
> and then
>
> s/cpu_to_be32/cpu_to_dbdma32/g
> s/be32_to_cpu/dbdma32_to_cpu/g
>
> is not too hard, is it?
>   

Well, if I'd want to do a sed'ish approach I'd just

s/cpu_to_be32/bswap32/g
s/be32_to_cpu/bswap32/g

The problem is that the whole define is just plain wrong which tells me
that the code is using the bswap functions incorrectly. This really
needs to be fixed by someone who knows the dbdma device. I don't see how
calling incorrect calls even more incorrect makes any difference.

Alex

  reply	other threads:[~2009-12-22 12:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-22 10:24 [Qemu-devel] [PATCH] Always swap endianness in DBDMA Alexander Graf
2009-12-22 11:36 ` [Qemu-devel] " Michael S. Tsirkin
2009-12-22 12:07   ` Alexander Graf [this message]
2009-12-22 12:47     ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B30B678.1060902@suse.de \
    --to=agraf@suse.de \
    --cc=Laurent@vivier.eu \
    --cc=aurelien@aurel32.net \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).