Skip to content

Commit b7bb460

Browse files
sourabhjainsmaddy-kerneldev
authored andcommitted
powerpc/fadump: fix additional param memory reservation for HASH MMU
Commit 683eab9 ("powerpc/fadump: setup additional parameters for dump capture kernel") introduced the additional parameter feature in fadump for HASH MMU with the understanding that GRUB does not use the memory area between 640MB and 768MB for its operation. However, the third patch in this series ("powerpc: increase MIN RMA size for CAS negotiation") changes the MIN RMA size to 768MB, allowing GRUB to use memory up to 768MB. This makes the fadump reservation for the additional parameter feature for HASH MMU unreliable. To address this, adjust the memory range for the additional parameter in fadump for HASH MMU. This will ensure that GRUB does not overwrite the memory reserved for fadump's additional parameter in HASH MMU. The new policy for the memory range for the additional parameter in HASH MMU is that the first memory block must be larger than the MIN_RMA size, as the bootloader can use memory up to the MIN_RMA size. The range should be between MIN_RMA and the RMA size (ppc64_rma_size), and it must not overlap with the fadump reserved area. Reviewed-by: Mahesh Salgaonkar <[email protected]> Signed-off-by: Sourabh Jain <[email protected]> Reviewed-by: Hari Bathini <[email protected]> Signed-off-by: Madhavan Srinivasan <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 0bdd7ff commit b7bb460

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

arch/powerpc/kernel/fadump.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <asm/fadump-internal.h>
3434
#include <asm/setup.h>
3535
#include <asm/interrupt.h>
36+
#include <asm/prom.h>
3637

3738
/*
3839
* The CPU who acquired the lock to trigger the fadump crash should
@@ -1764,19 +1765,19 @@ void __init fadump_setup_param_area(void)
17641765
range_end = memblock_end_of_DRAM();
17651766
} else {
17661767
/*
1767-
* Passing additional parameters is supported for hash MMU only
1768-
* if the first memory block size is 768MB or higher.
1768+
* Memory range for passing additional parameters for HASH MMU
1769+
* must meet the following conditions:
1770+
* 1. The first memory block size must be higher than the
1771+
* minimum RMA (MIN_RMA) size. Bootloader can use memory
1772+
* upto RMA size. So it should be avoided.
1773+
* 2. The range should be between MIN_RMA and RMA size (ppc64_rma_size)
1774+
* 3. It must not overlap with the fadump reserved area.
17691775
*/
1770-
if (ppc64_rma_size < 0x30000000)
1776+
if (ppc64_rma_size < MIN_RMA*1024*1024)
17711777
return;
17721778

1773-
/*
1774-
* 640 MB to 768 MB is not used by PFW/bootloader. So, try reserving
1775-
* memory for passing additional parameters in this range to avoid
1776-
* being stomped on by PFW/bootloader.
1777-
*/
1778-
range_start = 0x2A000000;
1779-
range_end = range_start + 0x4000000;
1779+
range_start = MIN_RMA * 1024 * 1024;
1780+
range_end = min(ppc64_rma_size, fw_dump.boot_mem_top);
17801781
}
17811782

17821783
fw_dump.param_area = memblock_phys_alloc_range(COMMAND_LINE_SIZE,

0 commit comments

Comments
 (0)