public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ardb@kernel.org>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: devel@edk2.groups.io, Jordan Justen <jordan.l.justen@intel.com>,
	 Oliver Steffen <osteffen@redhat.com>,
	Pawel Polawski <ppolawsk@redhat.com>,
	 Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Jiewen Yao <jiewen.yao@intel.com>
Subject: Re: [PATCH 1/3] OvmfPkg/PlatformInitLib: check PcdUse1GPageTable
Date: Mon, 22 May 2023 12:37:51 +0200	[thread overview]
Message-ID: <CAMj1kXHDZOAyiUk73JyDg6d181dLLPyi2eortWF2xkOaqaKDpg@mail.gmail.com> (raw)
In-Reply-To: <20230517102449.1334621-2-kraxel@redhat.com>

On Wed, 17 May 2023 at 12:24, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> If PcdUse1GPageTable is not enabled restrict the physical address space
> used to 1TB, to limit the amount of memory needed for identity mapping
> page tables.
>
> The same already happens in case the processor has no support for
> gigabyte pages.
>

Apologies for the noob question, but does this mean EDK2 maps the
entire address space 1:1, not just the region that as any DRAM in it?


> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf | 1 +
>  OvmfPkg/Library/PlatformInitLib/MemDetect.c         | 5 +++++
>  2 files changed, 6 insertions(+)
>
> diff --git a/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf b/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf
> index 86a82ad3e084..5a79d95b689c 100644
> --- a/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf
> +++ b/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf
> @@ -58,6 +58,7 @@ [LibraryClasses.X64]
>
>  [Pcd]
>    gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable
>
>  [FixedPcd]
>    gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase
> diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
> index acf90b4e93fd..1102b00ecbf0 100644
> --- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c
> +++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
> @@ -663,6 +663,11 @@ PlatformAddressWidthFromCpuid (
>        PhysBits = 40;
>      }
>
> +    if (!FixedPcdGetBool (PcdUse1GPageTable) && (PhysBits > 40)) {
> +      DEBUG ((DEBUG_INFO, "%a: limit PhysBits to 40 (PcdUse1GPageTable is false)\n", __func__));
> +      PhysBits = 40;
> +    }
> +
>      PlatformInfoHob->PhysMemAddressWidth = PhysBits;
>      PlatformInfoHob->FirstNonAddress     = LShiftU64 (1, PlatformInfoHob->PhysMemAddressWidth);
>    }
> --
> 2.40.1
>

  reply	other threads:[~2023-05-22 10:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-17 10:24 [PATCH 0/3] OvmfPkg: gigabyte page tweaks Gerd Hoffmann
2023-05-17 10:24 ` [PATCH 1/3] OvmfPkg/PlatformInitLib: check PcdUse1GPageTable Gerd Hoffmann
2023-05-22 10:37   ` Ard Biesheuvel [this message]
2023-05-22 11:18     ` Gerd Hoffmann
2023-05-17 10:24 ` [PATCH 2/3] OvmfPkg/OvmfPkgIa32X64: enable 1G pages Gerd Hoffmann
2023-05-17 10:24 ` [PATCH 3/3] OvmfPkg/MicrovmX64: " Gerd Hoffmann
2023-05-17 23:16 ` [edk2-devel] [PATCH 0/3] OvmfPkg: gigabyte page tweaks Pedro Falcato
2023-05-22  9:39   ` Gerd Hoffmann
2023-05-25 15:48 ` Ard Biesheuvel
2023-05-29 11:41   ` Ard Biesheuvel

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=CAMj1kXHDZOAyiUk73JyDg6d181dLLPyi2eortWF2xkOaqaKDpg@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