From: Laszlo Ersek <lersek@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>
Cc: Drew Jones <drjones@redhat.com>,
Gerd Hoffmann <kraxel@redhat.com>,
qemu devel list <qemu-devel@nongnu.org>,
Alexander Graf <agraf@suse.de>
Subject: Re: [Qemu-devel] [PATCH] fw_cfg: fix endianness in fw_cfg_data_mem_read() / _write()
Date: Wed, 31 Dec 2014 18:04:03 +0100 [thread overview]
Message-ID: <54A42C83.1090807@redhat.com> (raw)
In-Reply-To: <54A42304.7030909@redhat.com>
On 12/31/14 17:23, Paolo Bonzini wrote:
>
>
> On 31/12/2014 16:17, Peter Maydell wrote:
>> On 31 December 2014 at 14:07, Laszlo Ersek <lersek@redhat.com> wrote:
>>>> Of course this also renders the issue mostly moot -- if none of us can
>>>> test the code on a BE host, then that use case simply doesn't exist in
>>>> practice.
>> If you can give me a test image and a command line I can test
>> it on one of the PPC64 boxes in the GCC compile farm.
>
> You can follow the qtest steps in the commit messages of
> 6c87e3d5967a1d731b5f591a8f0ee6c319c14ca8:
>
> $ arm-softmmu/qemu-system-arm -M virt -machine accel=qtest \
> -qtest stdio -uuid 4600cb32-38ec-4b2f-8acb-81c6ea54f2d8
> writew 0x9020008 0x0200
> readl 0x9020000
>
> The readl should return "OK 0x000000004600cb32".
The -uuid switch parses the UUID string with qemu_uuid_parse() into the
qemu_uuid array, and the first four bytes are stored with
"%02hhx%02hhx%02hhx%02hhx"; ie. byte-wise.
The fw_cfg_init1() function adds these bytes as a string (== saves a
reference to qemu_uuid), with fw_cfg_add_bytes(). Good.
I looked at the "readl" command implementation in
qtest_process_command(). I don't know what it intends to do.
*If* it prints the number that the guest CPU sees immediately when it
performs the wide read, then it should print 0x0000000032cb0046, on both
big and little endian hosts; assuming a little endian guest.
Namely, the fw_cfg (sub)string in question is [0x46, 0x00, 0xcb, 0x32].
The device is big endian, and the register accessor function should
return the 0x4600cb32 host value in qemu. The guest CPU should see the
same byte array [0x46, 0x00, 0xcb, 0x32], whose direct interpretation in
the little endian guest is 0x32cb0046.
... I think this is a good test case for what we *think* should happen :)
I think the following will happen if Peter executes this test:
- With the current code, QEMU will print different values when the host
endianness changes.
- With the patch under discussion, QEMU will print 0x0000000032cb0046 on
both host endiannesses.
Thanks
Laszlo
next prev parent reply other threads:[~2014-12-31 17:04 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-31 11:21 [Qemu-devel] [PATCH] fw_cfg: fix endianness in fw_cfg_data_mem_read() / _write() Laszlo Ersek
2014-12-31 13:20 ` Paolo Bonzini
2014-12-31 14:07 ` Laszlo Ersek
2014-12-31 15:17 ` Peter Maydell
2014-12-31 16:23 ` Paolo Bonzini
2014-12-31 17:04 ` Laszlo Ersek [this message]
2014-12-31 17:56 ` Paolo Bonzini
2014-12-31 17:29 ` Peter Maydell
2014-12-31 19:25 ` Paolo Bonzini
2014-12-31 19:32 ` Laszlo Ersek
2014-12-31 16:27 ` Laszlo Ersek
2014-12-31 17:17 ` Peter Maydell
2014-12-31 17:37 ` Peter Maydell
2014-12-31 17:59 ` Laszlo Ersek
2014-12-31 18:08 ` Ard Biesheuvel
2014-12-31 18:25 ` Peter Maydell
2015-01-01 10:27 ` Ard Biesheuvel
2014-12-31 18:26 ` Laszlo Ersek
2014-12-31 17:44 ` Peter Maydell
2014-12-31 17:58 ` Laszlo Ersek
2014-12-31 18:22 ` Laszlo Ersek
2015-01-05 15:24 ` Peter Maydell
2015-01-05 15:33 ` Laszlo Ersek
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=54A42C83.1090807@redhat.com \
--to=lersek@redhat.com \
--cc=agraf@suse.de \
--cc=drjones@redhat.com \
--cc=kraxel@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.