Commit 4890cc18 authored by Anshuman Khandual's avatar Anshuman Khandual Committed by Will Deacon

arm64/mm: Define defer_reserve_crashkernel()

Crash kernel memory reservation gets deferred, when either CONFIG_ZONE_DMA
or CONFIG_ZONE_DMA32 config is enabled on the platform. This deferral also
impacts overall linear mapping creation including the crash kernel itself.
Just encapsulate this deferral check in a new helper for better clarity.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
Link: https://lore.kernel.org/r/20220705062556.1845734-1-anshuman.khandual@arm.comSigned-off-by: default avatarWill Deacon <will@kernel.org>
parent af483947
...@@ -351,6 +351,11 @@ static inline void *phys_to_virt(phys_addr_t x) ...@@ -351,6 +351,11 @@ static inline void *phys_to_virt(phys_addr_t x)
}) })
void dump_mem_limit(void); void dump_mem_limit(void);
static inline bool defer_reserve_crashkernel(void)
{
return IS_ENABLED(CONFIG_ZONE_DMA) || IS_ENABLED(CONFIG_ZONE_DMA32);
}
#endif /* !ASSEMBLY */ #endif /* !ASSEMBLY */
/* /*
......
...@@ -389,7 +389,7 @@ void __init arm64_memblock_init(void) ...@@ -389,7 +389,7 @@ void __init arm64_memblock_init(void)
early_init_fdt_scan_reserved_mem(); early_init_fdt_scan_reserved_mem();
if (!IS_ENABLED(CONFIG_ZONE_DMA) && !IS_ENABLED(CONFIG_ZONE_DMA32)) if (!defer_reserve_crashkernel())
reserve_crashkernel(); reserve_crashkernel();
high_memory = __va(memblock_end_of_DRAM() - 1) + 1; high_memory = __va(memblock_end_of_DRAM() - 1) + 1;
...@@ -438,7 +438,7 @@ void __init bootmem_init(void) ...@@ -438,7 +438,7 @@ void __init bootmem_init(void)
* request_standard_resources() depends on crashkernel's memory being * request_standard_resources() depends on crashkernel's memory being
* reserved, so do it here. * reserved, so do it here.
*/ */
if (IS_ENABLED(CONFIG_ZONE_DMA) || IS_ENABLED(CONFIG_ZONE_DMA32)) if (defer_reserve_crashkernel())
reserve_crashkernel(); reserve_crashkernel();
memblock_dump_all(); memblock_dump_all();
......
...@@ -529,8 +529,7 @@ static void __init map_mem(pgd_t *pgdp) ...@@ -529,8 +529,7 @@ static void __init map_mem(pgd_t *pgdp)
#ifdef CONFIG_KEXEC_CORE #ifdef CONFIG_KEXEC_CORE
if (crash_mem_map) { if (crash_mem_map) {
if (IS_ENABLED(CONFIG_ZONE_DMA) || if (defer_reserve_crashkernel())
IS_ENABLED(CONFIG_ZONE_DMA32))
flags |= NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS; flags |= NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS;
else if (crashk_res.end) else if (crashk_res.end)
memblock_mark_nomap(crashk_res.start, memblock_mark_nomap(crashk_res.start,
...@@ -571,8 +570,7 @@ static void __init map_mem(pgd_t *pgdp) ...@@ -571,8 +570,7 @@ static void __init map_mem(pgd_t *pgdp)
* through /sys/kernel/kexec_crash_size interface. * through /sys/kernel/kexec_crash_size interface.
*/ */
#ifdef CONFIG_KEXEC_CORE #ifdef CONFIG_KEXEC_CORE
if (crash_mem_map && if (crash_mem_map && !defer_reserve_crashkernel()) {
!IS_ENABLED(CONFIG_ZONE_DMA) && !IS_ENABLED(CONFIG_ZONE_DMA32)) {
if (crashk_res.end) { if (crashk_res.end) {
__map_memblock(pgdp, crashk_res.start, __map_memblock(pgdp, crashk_res.start,
crashk_res.end + 1, crashk_res.end + 1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment