From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 392CAC433EF for ; Fri, 10 Jun 2022 10:24:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245102AbiFJKYn (ORCPT ); Fri, 10 Jun 2022 06:24:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245446AbiFJKYl (ORCPT ); Fri, 10 Jun 2022 06:24:41 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79E7027C; Fri, 10 Jun 2022 03:24:39 -0700 (PDT) Received: from dggpemm500021.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LKH9j4GNGzjXTF; Fri, 10 Jun 2022 18:23:37 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggpemm500021.china.huawei.com (7.185.36.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 10 Jun 2022 18:24:37 +0800 Received: from [10.174.177.243] (10.174.177.243) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 10 Jun 2022 18:24:35 +0800 Message-ID: <174f988c-ea14-9f10-40e1-7bdddcef5d35@huawei.com> Date: Fri, 10 Jun 2022 18:24:35 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v3 2/6] arm64/mirror: arm64 enabling - find mirrored memory ranges Content-Language: en-US To: Ard Biesheuvel CC: Wupeng Ma , Jonathan Corbet , "Will Deacon" , Catalin Marinas , "Thomas Gleixner" , Ingo Molnar , "Borislav Petkov" , Dave Hansen , X86 ML , "H. Peter Anvin" , Darren Hart , Andy Shevchenko , Mike Rapoport , Andrew Morton , Paul Walmsley , Palmer Dabbelt , Albert Ou , "Paul E. McKenney" , Kees Cook , , Randy Dunlap , , Stephen Boyd , Wei Liu , Robin Murphy , David Hildenbrand , "Anshuman Khandual" , Zhen Lei , , Huacai Chen , "Geert Uytterhoeven" , , "Linux Doc Mailing List" , Linux Kernel Mailing List , Linux ARM , linux-efi , , "Linux Memory Management List" , linux-riscv References: <20220607093805.1354256-1-mawupeng1@huawei.com> <20220607093805.1354256-3-mawupeng1@huawei.com> From: Kefeng Wang In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On 2022/6/10 17:34, Ard Biesheuvel wrote: > On Fri, 10 Jun 2022 at 11:27, Kefeng Wang wrote: >> >> On 2022/6/7 17:38, Wupeng Ma wrote: >>> From: Ma Wupeng >>> >>> 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 >> > 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 >>> --- >>> 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!"); > .