From: "Chao Li" <lichao@loongson.cn>
To: devel@edk2.groups.io, lixianglai@loongson.cn
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>,
Bibo Mao <maobibo@loongson.cn>,
Leif Lindholm <quic_llindhol@quicinc.com>,
Liming Gao <gaoliming@byosoft.com.cn>,
Michael D Kinney <michael.d.kinney@intel.com>
Subject: Re: [edk2-devel] [edk2-platforms] Platform/Loongson: Pre-allocate 0-4K memory during the Pei phase
Date: Tue, 6 Jun 2023 09:28:58 +0800 [thread overview]
Message-ID: <d511ff47-2a24-f514-f5ef-4cd53ff9f41e@loongson.cn> (raw)
In-Reply-To: <a23155714e7dd8e9f0031c6d21438ecb9d7b3424.1685618333.git.lixianglai@loongson.cn>
[-- Attachment #1: Type: text/plain, Size: 2233 bytes --]
Reviewed-by: Chao Li <lichao@loongson.cn>
Thanks,
Chao
在 2023/6/1 19:19, xianglai 写道:
> When 0 address protection is enabled,
> 0-4k memory needs to be preallocated to
> prevent UEFI applications from allocating use,
> such as grub.
>
> Cc: Ard Biesheuvel<ardb+tianocore@kernel.org>
> Cc: Bibo Mao<maobibo@loongson.cn>
> Cc: Chao Li<lichao@loongson.cn>
> Cc: Leif Lindholm<quic_llindhol@quicinc.com>
> Cc: Liming Gao<gaoliming@byosoft.com.cn>
> Cc: Michael D Kinney<michael.d.kinney@intel.com>
> Signed-off-by: xianglai li<lixianglai@loongson.cn>
> ---
> .../LoongArchQemuPkg/PlatformPei/MemDetect.c | 13 +++++++++++++
> .../LoongArchQemuPkg/PlatformPei/PlatformPei.inf | 1 +
> 2 files changed, 14 insertions(+)
>
> diff --git a/Platform/Loongson/LoongArchQemuPkg/PlatformPei/MemDetect.c b/Platform/Loongson/LoongArchQemuPkg/PlatformPei/MemDetect.c
> index fad4cff8d8..7e6a4a3aa9 100644
> --- a/Platform/Loongson/LoongArchQemuPkg/PlatformPei/MemDetect.c
> +++ b/Platform/Loongson/LoongArchQemuPkg/PlatformPei/MemDetect.c
> @@ -101,4 +101,17 @@ InitializeRamRegions (
>
> AddMemoryRangeHob ( pEntry->BaseAddr, pEntry->BaseAddr + pEntry->Length);
> }
> +
> + //
> + //When 0 address protection is enabled,
> + //0-4k memory needs to be preallocated to prevent UEFI applications from allocating use,
> + //such as grub
> + //
> + if (PcdGet8 (PcdNullPointerDetectionPropertyMask) & BIT0) {
> + BuildMemoryAllocationHob (
> + 0,
> + EFI_PAGE_SIZE,
> + EfiBootServicesData
> + );
> + }
> }
> diff --git a/Platform/Loongson/LoongArchQemuPkg/PlatformPei/PlatformPei.inf b/Platform/Loongson/LoongArchQemuPkg/PlatformPei/PlatformPei.inf
> index 268efac585..6cc3513b63 100644
> --- a/Platform/Loongson/LoongArchQemuPkg/PlatformPei/PlatformPei.inf
> +++ b/Platform/Loongson/LoongArchQemuPkg/PlatformPei/PlatformPei.inf
> @@ -59,6 +59,7 @@
> gLoongArchQemuPkgTokenSpaceGuid.PcdDeviceTreeBase
> gLoongArchQemuPkgTokenSpaceGuid.PcdDeviceTreePadding
> gLoongArchQemuPkgTokenSpaceGuid.PcdRtcBaseAddress
> + gEfiMdeModulePkgTokenSpaceGuid.PcdNullPointerDetectionPropertyMask
>
> [FixedPcd]
> gLoongArchQemuPkgTokenSpaceGuid.PcdFlashDxeFvBase
[-- Attachment #2: Type: text/html, Size: 3464 bytes --]
prev parent reply other threads:[~2023-06-06 1:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-01 11:19 [edk2-platforms] Platform/Loongson: Pre-allocate 0-4K memory during the Pei phase xianglai
2023-06-06 1:28 ` Chao Li [this message]
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=d511ff47-2a24-f514-f5ef-4cd53ff9f41e@loongson.cn \
--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