Commit becd91d9 authored by Hari Bathini's avatar Hari Bathini Committed by Michael Ellerman

powerpc/fadump: remove RMA_START and RMA_END macros

RMA_START is defined as '0' and there is even a BUILD_BUG_ON() to
make sure it is never anything else. Remove this macro and use '0'
instead as code change is needed anyway when it has to be something
else. Also, remove unused RMA_END macro.
Signed-off-by: default avatarHari Bathini <hbathini@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/156821384096.5656.15026984053970204652.stgit@hbathini.in.ibm.com
parent b3bba79d
...@@ -10,14 +10,6 @@ ...@@ -10,14 +10,6 @@
#define _ASM_POWERPC_FADUMP_INTERNAL_H #define _ASM_POWERPC_FADUMP_INTERNAL_H
#ifndef CONFIG_PRESERVE_FA_DUMP #ifndef CONFIG_PRESERVE_FA_DUMP
/*
* The RMA region will be saved for later dumping when kernel crashes.
* RMA is Real Mode Area, the first block of logical memory address owned
* by logical partition, containing the storage that may be accessed with
* translate off.
*/
#define RMA_START 0x0
#define RMA_END (ppc64_rma_size)
/* The upper limit percentage for user specified boot memory size (25%) */ /* The upper limit percentage for user specified boot memory size (25%) */
#define MAX_BOOT_MEM_RATIO 4 #define MAX_BOOT_MEM_RATIO 4
......
...@@ -128,18 +128,22 @@ int __init early_init_dt_scan_fw_dump(unsigned long node, const char *uname, ...@@ -128,18 +128,22 @@ int __init early_init_dt_scan_fw_dump(unsigned long node, const char *uname,
* If fadump is registered, check if the memory provided * If fadump is registered, check if the memory provided
* falls within boot memory area and reserved memory area. * falls within boot memory area and reserved memory area.
*/ */
int is_fadump_memory_area(u64 addr, ulong size) int is_fadump_memory_area(u64 addr, unsigned long size)
{ {
u64 d_start = fw_dump.reserve_dump_area_start; u64 d_start, d_end;
u64 d_end = d_start + fw_dump.reserve_dump_area_size;
if (!fw_dump.dump_registered) if (!fw_dump.dump_registered)
return 0; return 0;
if (!size)
return 0;
d_start = fw_dump.reserve_dump_area_start;
d_end = d_start + fw_dump.reserve_dump_area_size;
if (((addr + size) > d_start) && (addr <= d_end)) if (((addr + size) > d_start) && (addr <= d_end))
return 1; return 1;
return (addr + size) > RMA_START && addr <= fw_dump.boot_memory_size; return (addr <= fw_dump.boot_memory_size);
} }
int should_fadump_crash(void) int should_fadump_crash(void)
...@@ -771,14 +775,14 @@ static int fadump_setup_crash_memory_ranges(void) ...@@ -771,14 +775,14 @@ static int fadump_setup_crash_memory_ranges(void)
crash_mrange_info.mem_range_cnt = 0; crash_mrange_info.mem_range_cnt = 0;
/* /*
* add the first memory chunk (RMA_START through boot_memory_size) as * add the first memory chunk (0 through boot_memory_size) as
* a separate memory chunk. The reason is, at the time crash firmware * a separate memory chunk. The reason is, at the time crash firmware
* will move the content of this memory chunk to different location * will move the content of this memory chunk to different location
* specified during fadump registration. We need to create a separate * specified during fadump registration. We need to create a separate
* program header for this chunk with the correct offset. * program header for this chunk with the correct offset.
*/ */
ret = fadump_add_mem_range(&crash_mrange_info, ret = fadump_add_mem_range(&crash_mrange_info,
RMA_START, fw_dump.boot_memory_size); 0, fw_dump.boot_memory_size);
if (ret) if (ret)
return ret; return ret;
...@@ -787,11 +791,9 @@ static int fadump_setup_crash_memory_ranges(void) ...@@ -787,11 +791,9 @@ static int fadump_setup_crash_memory_ranges(void)
end = start + (u64)reg->size; end = start + (u64)reg->size;
/* /*
* skip the first memory chunk that is already added (RMA_START * skip the first memory chunk that is already added
* through boot_memory_size). This logic needs a relook if and * (0 through boot_memory_size).
* when RMA_START changes to a non-zero value.
*/ */
BUILD_BUG_ON(RMA_START != 0);
if (start < fw_dump.boot_memory_size) { if (start < fw_dump.boot_memory_size) {
if (end > fw_dump.boot_memory_size) if (end > fw_dump.boot_memory_size)
start = fw_dump.boot_memory_size; start = fw_dump.boot_memory_size;
...@@ -815,7 +817,7 @@ static int fadump_setup_crash_memory_ranges(void) ...@@ -815,7 +817,7 @@ static int fadump_setup_crash_memory_ranges(void)
*/ */
static inline unsigned long fadump_relocate(unsigned long paddr) static inline unsigned long fadump_relocate(unsigned long paddr)
{ {
if (paddr > RMA_START && paddr < fw_dump.boot_memory_size) if ((paddr > 0) && (paddr < fw_dump.boot_memory_size))
return fw_dump.boot_mem_dest_addr + paddr; return fw_dump.boot_mem_dest_addr + paddr;
else else
return paddr; return paddr;
...@@ -883,11 +885,11 @@ static int fadump_create_elfcore_headers(char *bufp) ...@@ -883,11 +885,11 @@ static int fadump_create_elfcore_headers(char *bufp)
phdr->p_flags = PF_R|PF_W|PF_X; phdr->p_flags = PF_R|PF_W|PF_X;
phdr->p_offset = mbase; phdr->p_offset = mbase;
if (mbase == RMA_START) { if (mbase == 0) {
/* /*
* The entire RMA region will be moved by firmware * The entire real memory region will be moved by
* to the specified destination_address. Hence set * firmware to the specified destination_address.
* the correct offset. * Hence set the correct offset.
*/ */
phdr->p_offset = fw_dump.boot_mem_dest_addr; phdr->p_offset = fw_dump.boot_mem_dest_addr;
} }
......
...@@ -106,7 +106,7 @@ static u64 rtas_fadump_init_mem_struct(struct fw_dump *fadump_conf) ...@@ -106,7 +106,7 @@ static u64 rtas_fadump_init_mem_struct(struct fw_dump *fadump_conf)
fdm.rmr_region.request_flag = cpu_to_be32(RTAS_FADUMP_REQUEST_FLAG); fdm.rmr_region.request_flag = cpu_to_be32(RTAS_FADUMP_REQUEST_FLAG);
fdm.rmr_region.source_data_type = fdm.rmr_region.source_data_type =
cpu_to_be16(RTAS_FADUMP_REAL_MODE_REGION); cpu_to_be16(RTAS_FADUMP_REAL_MODE_REGION);
fdm.rmr_region.source_address = cpu_to_be64(RMA_START); fdm.rmr_region.source_address = cpu_to_be64(0);
fdm.rmr_region.source_len = cpu_to_be64(fadump_conf->boot_memory_size); fdm.rmr_region.source_len = cpu_to_be64(fadump_conf->boot_memory_size);
fdm.rmr_region.destination_address = cpu_to_be64(addr); fdm.rmr_region.destination_address = cpu_to_be64(addr);
addr += fadump_conf->boot_memory_size; addr += fadump_conf->boot_memory_size;
......
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