From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Laszlo Ersek <lersek@redhat.com>
Cc: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
"Leif Lindholm" <leif.lindholm@linaro.org>,
"Auger Eric" <eric.auger@redhat.com>,
"Andrew Jones" <drjones@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Julien Grall" <julien.grall@linaro.org>
Subject: Re: [PATCH v2 00/13] ArmPkg, ArmVirtPkg: lift 40-bit IPA space limit
Date: Tue, 27 Nov 2018 13:13:15 +0100 [thread overview]
Message-ID: <CAKv+Gu96JdKjtkpB13PBPe+BNcEiw9v+LY+VqvNGnER9Sp9=VA@mail.gmail.com> (raw)
In-Reply-To: <006d48a9-8102-3e57-1f3b-20e8082ae612@redhat.com>
On Tue, 27 Nov 2018 at 13:11, Laszlo Ersek <lersek@redhat.com> wrote:
>
> On 11/26/18 23:37, Ard Biesheuvel wrote:
> > The ArmVirtQemu targets currently limit the size of the IPA space to
> > 40 bits because that is all what KVM supports. However, this is about
> > to change, and so we need to update the code if we want to ensure that
> > our UEFI firmware builds can keep running on systems that set values
> > other than 40 (which could be > 40 or < 40)
> >
> > So refactor the way we deal with this limit, both for bare metal and for
> > virtual targets, so that
> > a) the range of the GCD memory map is based directly on the CPU's PA range
> > b) the range of the 1:1 mapping in the page tables is based on the CPU's PA
> > range (unless it exceeds what the architecture permits for 4k pages)
> > c) PcdPrePiCpuMemorySize is no longer needed, and can be removed.
> >
> > Patch #1 introduces ARM_MMU_IDMAP_RANGE and ArmGetPhysicalAddressBits ()
> > in ArmLib.
>
> OK, so the crucial piece of info I missed under v1 was that given the
> fixed 4KB page size under UEFI, we might not be able to identity map all
> the memory that the CPU would otherwise be capable of addressing
> (assuming the OS set up a larger page size).
>
> However... that seems to leave us with a conundrum. (I'm 100% sure it is
> nothing new to you, but it is new to me.)
>
> If we size the GCD memory space map exactly to what we can identity map
> under UEFI, then the UEFI memmap will not advertize the rest of the RAM
> to the OS, and the memory will be unusable.
>
> On the other hand, if we size the GCD to the exact RAM size (part of
> which could be out of reach for the CPU *under UEFI*, using 4KB pages),
> then the OS will be happy. But, what happens when gBS->AllocatePages()
> is served from such a high (>48bits) address range, and then the client
> module tries to access the (not mapped) chunk?
>
That is an excellent question, given that IA32 and ARM are in exactly
the same boat with [L]PAE.
> Hm... Actually, once this becomes a practical problem, I think we can
> take care of it, in a platform PEIM. Namely, just pre-allocate the
> entire inaccessible / unmappable range (beyond 48-bits) as Boot Services
> Data type memory. That will keep the rest of the firmware out (no
> well-behaving module will read or write memory that it didn't allocate),
> and the OS will be happy to release and reuse that memory.
>
> Does this make sense?
>
I will look into how IA32 and ARM deal with this at the moment. Well spotted!
> I'd like to be sure that I understand this right, before starting my v2
> review.
>
> Thanks!
> Laszlo
next prev parent reply other threads:[~2018-11-27 12:13 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-26 22:37 [PATCH v2 00/13] ArmPkg, ArmVirtPkg: lift 40-bit IPA space limit Ard Biesheuvel
2018-11-26 22:37 ` [PATCH v2 01/13] ArmPkg/ArmLib: add support for reading the max physical address space size Ard Biesheuvel
2018-11-26 22:43 ` Philippe Mathieu-Daudé
2018-11-26 23:02 ` Philippe Mathieu-Daudé
2018-11-26 23:03 ` Ard Biesheuvel
2018-11-27 12:26 ` Ard Biesheuvel
2018-11-27 14:51 ` Auger Eric
2018-11-26 22:37 ` [PATCH v2 02/13] ArmVirtPkg: refactor reading of the " Ard Biesheuvel
2018-11-26 22:37 ` [PATCH v2 03/13] ArmPkg/ArmMmuLib: take the CPU supported maximum PA space into account Ard Biesheuvel
2018-11-26 22:37 ` [PATCH v2 04/13] ArmPkg/CpuPei: base GCD memory space size on CPU's PA range Ard Biesheuvel
2018-11-26 22:37 ` [PATCH v2 05/13] ArmPlatformPkg/PrePi: " Ard Biesheuvel
2018-11-26 22:37 ` [PATCH v2 06/13] ArmVirtPkg/PrePi: " Ard Biesheuvel
2018-11-26 22:37 ` [PATCH v2 07/13] BeagleBoardPkg/PrePi: " Ard Biesheuvel
2018-11-26 22:37 ` [PATCH v2 08/13] EmbeddedPkg/PrePiHobLib: " Ard Biesheuvel
2018-11-26 22:37 ` [PATCH v2 09/13] ArmPlatformPkg/PlatformPei: drop unused PCD references Ard Biesheuvel
2018-11-26 22:37 ` [PATCH v2 10/13] EmbeddedPkg/PrePiLib: drop unused PCD reference Ard Biesheuvel
2018-11-26 22:37 ` [PATCH v2 11/13] ArmVirtPkg/QemuVirtMemInfoLib: ignore PcdPrePiCpuMemorySize Ard Biesheuvel
2018-11-26 22:38 ` [PATCH v2 12/13] ArmVirtPkg: drop PcdPrePiCpuMemorySize assignments from all platforms Ard Biesheuvel
2018-11-26 22:38 ` [PATCH v2 13/13] EmbeddedPkg/EmbeddedPkg.dec: drop PcdPrePiCpuMemorySize declarations Ard Biesheuvel
2018-11-27 12:11 ` [PATCH v2 00/13] ArmPkg, ArmVirtPkg: lift 40-bit IPA space limit Laszlo Ersek
2018-11-27 12:13 ` Ard Biesheuvel [this message]
2018-11-27 14:35 ` 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='CAKv+Gu96JdKjtkpB13PBPe+BNcEiw9v+LY+VqvNGnER9Sp9=VA@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