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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B00DC43334 for ; Fri, 10 Jun 2022 09:22:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 92C906B014B; Fri, 10 Jun 2022 05:22:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8B4CA6B014C; Fri, 10 Jun 2022 05:22:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 72ED38D0085; Fri, 10 Jun 2022 05:22:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 5E1ED6B014B for ; Fri, 10 Jun 2022 05:22:36 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 2F3EC207E1 for ; Fri, 10 Jun 2022 09:22:36 +0000 (UTC) X-FDA: 79561785912.04.FD46B82 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf27.hostedemail.com (Postfix) with ESMTP id 2691740075 for ; Fri, 10 Jun 2022 09:22:35 +0000 (UTC) Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LKFlS4W3FzRhtr; Fri, 10 Jun 2022 17:19:16 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggpemm500020.china.huawei.com (7.185.36.49) 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 17:22:30 +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 17:22:28 +0800 Message-ID: <93222719-fcee-2a78-8822-b49944bf1b8b@huawei.com> Date: Fri, 10 Jun 2022 17:22:28 +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 1/6] efi: Make efi_find_mirror() public Content-Language: en-US To: Wupeng Ma , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , References: <20220607093805.1354256-1-mawupeng1@huawei.com> <20220607093805.1354256-2-mawupeng1@huawei.com> From: Kefeng Wang In-Reply-To: <20220607093805.1354256-2-mawupeng1@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1654852955; a=rsa-sha256; cv=none; b=sBFKSWAGlK6sNX0TcDpTnu0zrjH9iKubEt9wktjIcYJpwG/DDLm5JpPiutBKafrStbtiE6 M2AsIdX807x0+bRbOkg+/0NhJ0bGO1f+7MVab18U4tJRj4HgFkDMu8pyT3j3OQ84uYh8zg piEkZ46W2UX8xuEWKBtzfe7mDW0HLXc= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf27.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1654852955; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9HWsxvAzYmKSlsPcVRmUsgy4UOeFcsTfpiLC+YE1crM=; b=bH8RZDdfopegbks3fHlqH3vahL2hDOletGBUQKg+l99rQzj1fB/53c6Wx0weUmPvr9A+My BQUF0eLfJ/ImUAOHFPGpC9VQNOKlOeWt4Sg9hUz5v5eBd6uVRK74s8Nb45ekhyqwX9vorE RLR973T9n9x2ai96Gq3cHzpQtOY+kXU= X-Stat-Signature: rsz5dkx1fchq7cffoc97p6cf9a4qhq1f X-Rspamd-Queue-Id: 2691740075 X-Rspam-User: X-Rspamd-Server: rspam10 Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf27.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com X-HE-Tag: 1654852955-214867 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2022/6/7 17:38, Wupeng Ma wrote: > From: Ma Wupeng > > Commit b05b9f5f9dcf ("x86, mirror: x86 enabling - find mirrored memory > ranges") introduce the efi_find_mirror function on x86. In order to reuse > the API we make it public in preparation for arm64 to support mirrord > memory. Reviewed-by: Kefeng Wang > Signed-off-by: Ma Wupeng > --- > arch/x86/include/asm/efi.h | 4 ---- > arch/x86/platform/efi/efi.c | 23 ----------------------- > drivers/firmware/efi/efi.c | 23 +++++++++++++++++++++++ > include/linux/efi.h | 3 +++ > 4 files changed, 26 insertions(+), 27 deletions(-) > > diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h > index 71943dce691e..eb90206eae80 100644 > --- a/arch/x86/include/asm/efi.h > +++ b/arch/x86/include/asm/efi.h > @@ -383,7 +383,6 @@ static inline bool efi_is_64bit(void) > extern bool efi_reboot_required(void); > extern bool efi_is_table_address(unsigned long phys_addr); > > -extern void efi_find_mirror(void); > extern void efi_reserve_boot_services(void); > #else > static inline void parse_efi_setup(u64 phys_addr, u32 data_len) {} > @@ -395,9 +394,6 @@ static inline bool efi_is_table_address(unsigned long phys_addr) > { > return false; > } > -static inline void efi_find_mirror(void) > -{ > -} > static inline void efi_reserve_boot_services(void) > { > } > diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c > index 1591d67e0bcd..6e598bd78eef 100644 > --- a/arch/x86/platform/efi/efi.c > +++ b/arch/x86/platform/efi/efi.c > @@ -108,29 +108,6 @@ static int __init setup_add_efi_memmap(char *arg) > } > early_param("add_efi_memmap", setup_add_efi_memmap); > > -void __init efi_find_mirror(void) > -{ > - efi_memory_desc_t *md; > - u64 mirror_size = 0, total_size = 0; > - > - if (!efi_enabled(EFI_MEMMAP)) > - return; > - > - for_each_efi_memory_desc(md) { > - unsigned long long start = md->phys_addr; > - unsigned long long size = md->num_pages << EFI_PAGE_SHIFT; > - > - total_size += size; > - if (md->attribute & EFI_MEMORY_MORE_RELIABLE) { > - memblock_mark_mirror(start, size); > - mirror_size += size; > - } > - } > - if (mirror_size) > - pr_info("Memory: %lldM/%lldM mirrored memory\n", > - mirror_size>>20, total_size>>20); > -} > - > /* > * Tell the kernel about the EFI memory map. This might include > * more than the max 128 entries that can fit in the passed in e820 > diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c > index 860534bcfdac..79c232e07de7 100644 > --- a/drivers/firmware/efi/efi.c > +++ b/drivers/firmware/efi/efi.c > @@ -446,6 +446,29 @@ static int __init efisubsys_init(void) > > subsys_initcall(efisubsys_init); > > +void __init efi_find_mirror(void) > +{ > + efi_memory_desc_t *md; > + u64 mirror_size = 0, total_size = 0; > + > + if (!efi_enabled(EFI_MEMMAP)) > + return; > + > + for_each_efi_memory_desc(md) { > + unsigned long long start = md->phys_addr; > + unsigned long long size = md->num_pages << EFI_PAGE_SHIFT; > + > + total_size += size; > + if (md->attribute & EFI_MEMORY_MORE_RELIABLE) { > + memblock_mark_mirror(start, size); > + mirror_size += size; > + } > + } > + if (mirror_size) > + pr_info("Memory: %lldM/%lldM mirrored memory\n", > + mirror_size>>20, total_size>>20); > +} > + > /* > * Find the efi memory descriptor for a given physical address. Given a > * physical address, determine if it exists within an EFI Memory Map entry, > diff --git a/include/linux/efi.h b/include/linux/efi.h > index 7d9b0bb47eb3..53f64c14a525 100644 > --- a/include/linux/efi.h > +++ b/include/linux/efi.h > @@ -872,6 +872,7 @@ static inline bool efi_rt_services_supported(unsigned int mask) > { > return (efi.runtime_supported_mask & mask) == mask; > } > +extern void efi_find_mirror(void); > #else > static inline bool efi_enabled(int feature) > { > @@ -889,6 +890,8 @@ static inline bool efi_rt_services_supported(unsigned int mask) > { > return false; > } > + > +static inline void efi_find_mirror(void) {} > #endif > > extern int efi_status_to_err(efi_status_t status);