qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: "Richard W.M. Jones" <rjones@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>
Cc: libvir-list@redhat.com, Michal Privoznik <mprivozn@redhat.com>,
	acatan@amazon.com, qemu-devel@nongnu.org, armbru@redhat.com
Subject: Re: [PATCH 0/1] vmx: Fix <genid/> mapping
Date: Mon, 4 Oct 2021 16:50:51 +0200	[thread overview]
Message-ID: <ecfdc6cc-c411-851f-afb6-ac301d722d99@redhat.com> (raw)
In-Reply-To: <20211004095912.GP7596@redhat.com>

On 10/04/21 11:59, Richard W.M. Jones wrote:
> It turns out that changing the qemu implementation is painful,
> particularly if we wish to maintain backwards compatibility of the
> command line and live migration.
>
> Instead I opted to document comprehensively what all the
> different hypervisors do:
>
>   https://github.com/libguestfs/virt-v2v/blob/master/docs/vm-generation-id-across-hypervisors.txt

> Unfortunately QEMU made a significant mistake when implementing this
> feature.  Because the string is 128 bits wrong, they decided it must
                                  ^^^^^^^^^^^^^^

Haha, that's a great typo :)

> be a UUID (as you can see above there is no evidence that Microsoft
> who wrote the original spec thought it was).  Following from this
> incorrect assumption, they stated that the "UUID" must be supplied to
> qemu in big endian format and must be byteswapped when writing it to
> guest memory.  Their documentation says that they only do this for
> little endian guests, but this is not true of their implementation
> which byte swaps it for all guests.

I don't think this is what section "Endian-ness Considerations" in
"docs/specs/vmgenid.txt" says. That text says that the *device* uses
little-endian format. That's independent of the endianness of *CPU* of
the particular guest architecture.

So the byte-swapping in the QEMU code occurs unconditionally because
QEMU's UUID type is inherently big endian, and the device model in
question is fixed little endian. The guest CPU's endianness is
irrelevant as far as the device is concerned.

If a BE guest CPU intends to read the generation ID and to interpret it
as a set of integers, then the guest CPU is supposed to byte-swap the
appropriate fields itself.

> References

I suggest adding two links in this section, namely to:
- docs/specs/vmgenid.txt
- hw/acpi/vmgenid.c

Thanks,
Laszlo



  reply	other threads:[~2021-10-04 14:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1632900578.git.mprivozn@redhat.com>
2021-09-29  9:20 ` [PATCH 0/1] vmx: Fix <genid/> mapping Richard W.M. Jones
2021-09-29  9:33   ` Daniel P. Berrangé
2021-09-29  9:46     ` Richard W.M. Jones
2021-09-29 10:07       ` Daniel P. Berrangé
2021-09-29 10:24         ` Richard W.M. Jones
2021-09-29 10:24       ` Richard W.M. Jones
2021-09-29  9:57     ` Richard W.M. Jones
2021-09-29 10:10       ` Daniel P. Berrangé
2021-09-29 10:34         ` Richard W.M. Jones
2021-09-30  7:33           ` Richard W.M. Jones
2021-09-30  8:35             ` Laszlo Ersek
2021-09-30  8:47             ` Daniel P. Berrangé
2021-09-30  9:16               ` Richard W.M. Jones
2021-10-04  9:59                 ` Richard W.M. Jones
2021-10-04 14:50                   ` Laszlo Ersek [this message]
2021-10-04 14:59                     ` Richard W.M. Jones

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=ecfdc6cc-c411-851f-afb6-ac301d722d99@redhat.com \
    --to=lersek@redhat.com \
    --cc=acatan@amazon.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=mprivozn@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@redhat.com \
    /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).