From: "Paolo Bonzini" <pbonzini@redhat.com>
To: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>,
devel@edk2.groups.io, Michael Roth <michael.roth@amd.com>,
Jiewen Yao <jiewen.yao@intel.com>,
Liming Gao <gaoliming@byosoft.com.cn>,
Laszlo Ersek <lersek@redhat.com>,
Ard Biesheuvel <ardb+tianocore@kernel.org>,
Min Xu <min.m.xu@intel.com>, Erdem Aktas <erdemaktas@google.com>,
Oliver Steffen <osteffen@redhat.com>,
Ard Biesheuvel <ardb@kernel.org>
Subject: Re: [edk2-devel] GuestPhysAddrSize questions
Date: Wed, 06 Mar 2024 14:45:33 -0800 [thread overview]
Message-ID: <CABgObfZTTmv5b_r0ZSVpm1jT4GVkP5oFKMajxZqs=YJ5SUh1Fg@mail.gmail.com> (raw)
In-Reply-To: <9e7e617c-d398-81b4-2c92-6b3a092e354c@amd.com>
On Mon, Mar 4, 2024 at 6:24 PM Tom Lendacky <thomas.lendacky@amd.com> wrote:
>
> On 3/4/24 07:09, Gerd Hoffmann wrote:
> > Hi,
> >
> >>> 23:16 GuestPhysAddrSize Maximum guest physical address size in bits.
> >>> This number applies only to guests using nested
> >>> paging. When this field is zero, refer to the
> >>> PhysAddrSize field for the maximum guest
> >>> physical address size. See “Secure Virtual
> >>> Machine” in APM Volume 2.
> >
> >> I believe the main purpose of GuestPhysAddrSize was for software use (for
> >> nested virtualization) and that the hardware itself has always returned zero
> >> for that value. So you should be able to use that field. Adding @Paolo for
> >> his thoughts.
> >
> > Reviewers mentioned this is meant for nested guests, i.e. (if I
> > understand this correctly) the l0 hypervisor can use that to tell
> > the l1 hypervisor what the l2 guest phys-bits should be.
> >
> > Is this nested virtualization use documented somewhere? Tried to
> > search for GuestPhysAddrSize or Fn8000_0008_EAX in APM Volume 2,
> > found nothing.
>
> Right, and I don't think you'll see anything added to the APM that will
> state how it can be used by software. The APM is an architectural
> definition and won't talk about hypervisors and using nested paging, etc.
I don't think that's a problem. The problem is that the definition in
the APM is ambiguous and can mean one of three things:
1) it can be a suggested value for PhysAddrSize (bits 7:0) of guests
that use nested paging. This would imply that in a nested page guest,
with GuestPhysAddrSize=48, setting bits 51:48 would cause a
#PF(reserved) exception.
2) it can be equivalent to LinAddrSize (bits 15:8) but for nested page
tables. This would imply that, with GuestPhysAddrSize=48, VMRUN would
fail if hCR4.LA57=1.
3) it can be what I propose above: the architecture defined a
situation that can only happen when using nested paging (on AMD:
host_CR4.LA57=0, PhysAddrSize=52), and GuestPhysAddrSize is an
architectural way to explain the situation to guests.
The message above suggests that the intended meaning is (1). That is
because "the l0 hypervisor can use that to tell the l1 hypervisor what
the l2 guest phys-bits should be" is exactly the same as "the
processor can use that to tell the hypervisor what the guest phys-bits
should be" (just shifted one level down).
However, there are no processors that implement (1) or (2), so my
suggestion is to clarify that the intended meaning is (3). Do you
agree that the above proposal is a plausible interpretation of what is
already in the APM, but clearer? And do you think there is a way for
the clarification to make it into the APM?
Paolo
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116465): https://edk2.groups.io/g/devel/message/116465
Mute This Topic: https://groups.io/mt/104510523/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2024-03-06 22:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-22 10:54 [edk2-devel] [PATCH v4 0/3] OvmfPkg: Add support for 5-level paging Gerd Hoffmann
2024-02-22 10:54 ` [edk2-devel] [PATCH v4 1/3] MdeModulePkg/DxeIplPeim: fix PcdUse5LevelPageTable assert Gerd Hoffmann
2024-03-01 12:44 ` [edk2-devel] 回复: " gaoliming via groups.io
2024-02-22 10:54 ` [edk2-devel] [PATCH v4 2/3] MdeModulePkg/DxeIplPeim: rename variable Gerd Hoffmann
2024-03-01 12:44 ` [edk2-devel] 回复: " gaoliming via groups.io
2024-02-22 10:54 ` [edk2-devel] [PATCH v4 3/3] OvmfPkg/PlatformInitLib: add 5-level paging support Gerd Hoffmann
2024-02-22 11:24 ` [edk2-devel] GuestPhysAddrSize questions (was: Re: [PATCH v4 3/3] OvmfPkg/PlatformInitLib: add 5-level paging) support Gerd Hoffmann
2024-02-22 15:44 ` [edk2-devel] GuestPhysAddrSize questions Lendacky, Thomas via groups.io
2024-02-22 16:13 ` Paolo Bonzini
2024-02-22 17:39 ` Paolo Bonzini
2024-03-04 13:09 ` Gerd Hoffmann
2024-03-04 17:23 ` Lendacky, Thomas via groups.io
2024-03-06 22:45 ` Paolo Bonzini [this message]
2024-02-27 12:54 ` [edk2-devel] [PATCH v4 0/3] OvmfPkg: Add support for 5-level paging Laszlo Ersek
2024-02-29 10:16 ` 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-list 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='CABgObfZTTmv5b_r0ZSVpm1jT4GVkP5oFKMajxZqs=YJ5SUh1Fg@mail.gmail.com' \
--to=devel@edk2.groups.io \
/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