Re: [PATCH v3 2/6] arm64/mirror: arm64 enabling - find mirrored memory ranges

From: Kefeng Wang
Date: Fri Jun 10 2022 - 06:24:46 EST



On 2022/6/10 17:34, Ard Biesheuvel wrote:
On Fri, 10 Jun 2022 at 11:27, Kefeng Wang <wangkefeng.wang@xxxxxxxxxx> wrote:

On 2022/6/7 17:38, Wupeng Ma wrote:
From: Ma Wupeng <mawupeng1@xxxxxxxxxx>

Commit b05b9f5f9dcf ("x86, mirror: x86 enabling - find mirrored memory ranges")
introduced mirrored memory support for x86 and this could be used on arm64.

Since we only support this feature on arm64, efi_find_mirror() won't be placed
into efi_init(), which is used by riscv/arm/arm64, it is added in setup_arch()
to scan the memory map and mark mirrored memory in memblock.
Move into efi_init() looks better, it won't bring negative effects on
arm/riscv.

but let's maintainer to make a decision.

Reviewed-by: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx>

I don't disagree with that in principle, but x86 calls the efi fake
memmap stuff between efi_init() and efi_find_mirror(), and I already
indicated that I don't want to enable fake memmap on !X86.

I mean move into efi_init() in drivers/firmware/efi/efi-init.c which only used

in arm32/arm64/riscv.


But I do think there is some room for improvement here: we could move
things like efi_mokvar_table_init() and efi_esrt_init() into
efi_init() as well, and make efi_fake_memmap() do nothing on !X86 so
we can move it into efi_init() too.

x86 has own efi_init() in arch/x86/platform/efi/efi.c, it seams that all the above

function could move into x86's own efi_init(), not sure, but we could do it later

if it possible.


Signed-off-by: Ma Wupeng <mawupeng1@xxxxxxxxxx>
---
Documentation/admin-guide/kernel-parameters.txt | 2 +-
arch/arm64/kernel/setup.c | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 8090130b544b..e3537646b6f7 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -2301,7 +2301,7 @@

keepinitrd [HW,ARM]

- kernelcore= [KNL,X86,IA-64,PPC]
+ kernelcore= [KNL,X86,IA-64,PPC,ARM64]
Format: nn[KMGTPE] | nn% | "mirror"
This parameter specifies the amount of memory usable by
the kernel for non-movable allocations. The requested
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index cf3a759f10d4..6e9acd7ecf0f 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -328,6 +328,7 @@ void __init __no_sanitize_address setup_arch(char **cmdline_p)

xen_early_init();
efi_init();
+ efi_find_mirror();

if (!efi_enabled(EFI_BOOT) && ((u64)_text % MIN_KIMG_ALIGN) != 0)
pr_warn(FW_BUG "Kernel image misaligned at boot, please fix your bootloader!");
.