From: Jing Xiangfeng <jingxiangfeng@huawei.com>
To: <ardb@kernel.org>, <tglx@linutronix.de>, <mingo@redhat.com>,
<bp@alien8.de>, <hpa@zytor.com>, <x86@kernel.org>,
<dvhart@infradead.org>, <andy@infradead.org>
Cc: <linux-efi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<platform-driver-x86@vger.kernel.org>, <linux-mm@kvack.org>,
<wangkefeng.wang@huawei.com>, <jingxiangfeng@huawei.com>
Subject: [PATCH 1/2] efi: allow EFI_FAKE_MEMMAP on arm64 platform
Date: Fri, 21 Feb 2020 07:52:59 -0500 [thread overview]
Message-ID: <1582289580-24045-2-git-send-email-jingxiangfeng@huawei.com> (raw)
In-Reply-To: <1582289580-24045-1-git-send-email-jingxiangfeng@huawei.com>
Add a efi_fake_memmap call in efi_init on arm64.This is useful for
debugging of Address Range Mirroring feature on arm64 platform.
Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
---
arch/x86/include/asm/efi.h | 1 -
arch/x86/platform/efi/efi.c | 16 ----------------
drivers/firmware/efi/Kconfig | 2 +-
drivers/firmware/efi/arm-init.c | 1 +
drivers/firmware/efi/memmap.c | 16 ++++++++++++++++
include/linux/efi.h | 1 +
6 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 86169a2..127977f 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -158,7 +158,6 @@ extern void __iomem *__init efi_ioremap(unsigned long addr, unsigned long size,
extern struct efi_scratch efi_scratch;
extern void __init efi_set_executable(efi_memory_desc_t *md, bool executable);
extern int __init efi_memblock_x86_reserve_range(void);
-extern void __init efi_print_memmap(void);
extern void __init efi_memory_uc(u64 addr, unsigned long size);
extern void __init efi_map_region(efi_memory_desc_t *md);
extern void __init efi_map_region_fixed(efi_memory_desc_t *md);
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index ae923ee..4c8793d 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -317,22 +317,6 @@ static void __init efi_clean_memmap(void)
}
}
-void __init efi_print_memmap(void)
-{
- efi_memory_desc_t *md;
- int i = 0;
-
- for_each_efi_memory_desc(md) {
- char buf[64];
-
- pr_info("mem%02u: %s range=[0x%016llx-0x%016llx] (%lluMB)\n",
- i++, efi_md_typeattr_format(buf, sizeof(buf), md),
- md->phys_addr,
- md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT) - 1,
- (md->num_pages >> (20 - EFI_PAGE_SHIFT)));
- }
-}
-
static int __init efi_systab_init(u64 phys)
{
int size = efi_enabled(EFI_64BIT) ? sizeof(efi_system_table_64_t)
diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
index ecc83e2..9cf9a96 100644
--- a/drivers/firmware/efi/Kconfig
+++ b/drivers/firmware/efi/Kconfig
@@ -55,7 +55,7 @@ config EFI_RUNTIME_MAP
config EFI_FAKE_MEMMAP
bool "Enable EFI fake memory map"
- depends on EFI && X86
+ depends on EFI && (X86 || ARM64)
default n
help
Saying Y here will enable "efi_fake_mem" boot option.
diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c
index d99f5b0..ac00e7c 100644
--- a/drivers/firmware/efi/arm-init.c
+++ b/drivers/firmware/efi/arm-init.c
@@ -265,6 +265,7 @@ void __init efi_init(void)
}
reserve_regions();
+ efi_fake_memmap();
efi_esrt_init();
memblock_reserve(params.mmap & PAGE_MASK,
diff --git a/drivers/firmware/efi/memmap.c b/drivers/firmware/efi/memmap.c
index 2ff1883..0155bf0 100644
--- a/drivers/firmware/efi/memmap.c
+++ b/drivers/firmware/efi/memmap.c
@@ -376,3 +376,19 @@ void __init efi_memmap_insert(struct efi_memory_map *old_memmap, void *buf,
}
}
}
+
+void __init efi_print_memmap(void)
+{
+ efi_memory_desc_t *md;
+ int i = 0;
+
+ for_each_efi_memory_desc(md) {
+ char buf[64];
+
+ pr_info("mem%02u: %s range=[0x%016llx-0x%016llx] (%lluMB)\n",
+ i++, efi_md_typeattr_format(buf, sizeof(buf), md),
+ md->phys_addr,
+ md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT) - 1,
+ (md->num_pages >> (20 - EFI_PAGE_SHIFT)));
+ }
+}
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 7efd707..bf101e5 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -1142,6 +1142,7 @@ static inline bool __pure efi_soft_reserve_enabled(void)
return IS_ENABLED(CONFIG_EFI_SOFT_RESERVE)
&& __efi_soft_reserve_enabled();
}
+extern void __init efi_print_memmap(void);
#else
static inline bool efi_enabled(int feature)
{
--
1.8.3.1
next prev parent reply other threads:[~2020-02-20 3:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-21 12:52 [PATCH 0/2] arm64: Support to find mirrored memory ranges Jing Xiangfeng
2020-02-20 9:21 ` Ard Biesheuvel
2020-02-21 7:01 ` j00447129
2020-02-21 12:52 ` Jing Xiangfeng [this message]
2020-02-21 12:53 ` [PATCH 2/2] arm64/efi: support " Jing Xiangfeng
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-all 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=1582289580-24045-2-git-send-email-jingxiangfeng@huawei.com \
--to=jingxiangfeng@huawei.com \
--cc=andy@infradead.org \
--cc=ardb@kernel.org \
--cc=bp@alien8.de \
--cc=dvhart@infradead.org \
--cc=hpa@zytor.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@redhat.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=wangkefeng.wang@huawei.com \
--cc=x86@kernel.org \
/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