public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gerd Hoffmann" <kraxel@redhat.com>
To: devel@edk2.groups.io
Cc: Michael Roth <michael.roth@amd.com>,
	Jiewen Yao <jiewen.yao@intel.com>,
	 Liming Gao <gaoliming@byosoft.com.cn>,
	Laszlo Ersek <lersek@redhat.com>,
	 Tom Lendacky <thomas.lendacky@amd.com>,
	Paolo Bonzini <pbonzini@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: [edk2-devel] GuestPhysAddrSize questions (was: Re: [PATCH v4 3/3] OvmfPkg/PlatformInitLib: add 5-level paging) support
Date: Thu, 22 Feb 2024 12:24:17 +0100	[thread overview]
Message-ID: <32oty4asp3xrecjruatwm77fbevcaizswovjc5jqct5bdofwiq@sgff2gzgau7o> (raw)
In-Reply-To: <20240222105407.75735-4-kraxel@redhat.com>

  Hi,

> +    if (Cr4.Bits.LA57) {
> +      if (PhysBits > 48) {
> +        /*
> +         * Some Intel CPUs support 5-level paging, have more than 48
> +         * phys-bits but support only 4-level EPT, which effectively
> +         * limits guest phys-bits to 48.
> +         *
> +         * AMD Processors have a different but somewhat related
> +         * problem: They can handle guest phys-bits larger than 48
> +         * only in case the host runs in 5-level paging mode.
> +         *
> +         * Until we have some way to communicate that kind of
> +         * limitations from hypervisor to guest, limit phys-bits
> +         * to 48 unconditionally.
> +         */

So I'm looking for some communication path.  One option would be to use
some bits in the KVM cpuid leaves.  Another possible candidate is cpuid
leaf 0x80000008.

From the AMD APM (revision 3.35):

  CPUID Fn8000_0008_EAX Long Mode Size Identifiers
  ------------------------------------------------

  The value returned in EAX provides information about the maximum host
  and guest physical and linear address width (in bits) supported by the
  processor.

  Bits   FieldName        Description

  31:24  —                Reserved

  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.

  15:8  LinAddrSize       Maximum linear address size in bits.

  7:0   PhysAddrSize      Maximum physical address size in bits. When
                          GuestPhysAddrSize is zero, this field also
                          indicates the maximum guest physical address
                          size.

The description of the GuestPhysAddrSize is somewhat vague.  Is this a
value the hypervisor should use to figure how much address space it can
give to guests?  Or is this a value the hypervisor can set to inform the
guest about the available address space (which would be a solution to
the problem outlined in the comment above)?  Or both?

In case GuestPhysAddrSize should not be used this way:  Is it possible
allocate the currently reserved bits 31:24 for that purpose?

Tom?  Michael?

thanks & take care,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115801): https://edk2.groups.io/g/devel/message/115801
Mute This Topic: https://groups.io/mt/104506481/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2024-02-22 11:24 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   ` Gerd Hoffmann [this message]
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
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=32oty4asp3xrecjruatwm77fbevcaizswovjc5jqct5bdofwiq@sgff2gzgau7o \
    --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