qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu devel list <qemu-devel@nongnu.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Drew Jones <drjones@redhat.com>, Alexander Graf <agraf@suse.de>,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] fw_cfg: fix endianness in fw_cfg_data_mem_read() / _write()
Date: Wed, 31 Dec 2014 19:22:54 +0100	[thread overview]
Message-ID: <54A43EFE.4030205@redhat.com> (raw)
In-Reply-To: <54A4395D.1040401@redhat.com>

On 12/31/14 18:58, Laszlo Ersek wrote:
> On 12/31/14 18:44, Peter Maydell wrote:
>> On 31 December 2014 at 17:17, Peter Maydell <peter.maydell@linaro.org> wrote:
>>> Unpatched QEMU + QEMU_EFI.fd.v4 : doesn't boot (doesn't load kernel)
>>> Patched QEMU + QEMU_EFI.fd.v4_noswizzle : boots OK (dracut-initqueue
>>> starts downloading things).
>>
>> Just noticed you asked for the full matrix of tests:
>> patched QEMU + fd.v4 : doesn't boot (doesn't load kernel)
>> unpatched + noswizzle : boots OK
>>
>> That's a bit confusing...
> 
> It's not confusing. When you run unpatched qemu *on a big endian host*,
> that's identical to what the patched code does *on a big endian host*.
> 
> The full matrix actually has 8 elements (3 dimensions with 2 values per
> dimension) -- host endianness, patched qemu vs. unpatched qemu, and
> swizzling vs. non-swizzling firmware.

To elaborate a bit more (I hope I can manage after several glasses of wine):

The central idea is that the firmware should not swizzle directly in the
transport code. It should only swizzle dependent on the individual
integer encodings in the payload for a given key. QEMU's read accessor
should build the host-endian representation of the big-endian
interpretation of the fw_cfg *(sub)string*. This is what the patch does.

The matrix is (guest endianness is invariably LE):

qemu     firmware swizzles       host        boots
patched  (== firmware is buggy)  endianness
-------  ----------------------  ----------  -------------------------
0        0                       BE          yes (your test #4)
0        0                       LE          no (tested right now)

0        1                       BE          no (your test #1)
0        1                       LE          yes (my earliest test)

1        0                       BE          yes (your test #2)
1        0                       LE          yes (my test for this p.)

1        1                       BE          no (your test #3)
1        1                       LE          no (tested right now)

Thanks
Laszlo

  reply	other threads:[~2014-12-31 18:23 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
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 [this message]
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=54A43EFE.4030205@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 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).