Skip to content

Commit

Permalink
From patchwork series 427067
Browse files Browse the repository at this point in the history
  • Loading branch information
Fox Snowpatch committed Oct 8, 2024
1 parent f85c105 commit 7b3189a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions arch/powerpc/kernel/fadump.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,10 @@ static u64 __init fadump_locate_reserve_mem(u64 base, u64 size)
phys_addr_t mstart, mend;
int idx = 0;
u64 i, ret = 0;
unsigned long align = PAGE_SIZE;

if (IS_ENABLED(CONFIG_CMA) && !fw_dump.nocma)
align = CMA_MIN_ALIGNMENT_BYTES;

mrngs = reserved_mrange_info.mem_ranges;
for_each_free_mem_range(i, NUMA_NO_NODE, MEMBLOCK_NONE,
Expand All @@ -520,7 +524,7 @@ static u64 __init fadump_locate_reserve_mem(u64 base, u64 size)
i, mstart, mend, base);

if (mstart > base)
base = PAGE_ALIGN(mstart);
base = ALIGN(mstart, align);

while ((mend > base) && ((mend - base) >= size)) {
if (!overlaps_reserved_ranges(base, base+size, &idx)) {
Expand All @@ -529,7 +533,7 @@ static u64 __init fadump_locate_reserve_mem(u64 base, u64 size)
}

base = mrngs[idx].base + mrngs[idx].size;
base = PAGE_ALIGN(base);
base = ALIGN(base, align);
}
}

Expand Down
4 changes: 3 additions & 1 deletion include/linux/cma.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <linux/init.h>
#include <linux/types.h>
#include <linux/numa.h>
#include <linux/minmax.h>

#ifdef CONFIG_CMA_AREAS
#define MAX_CMA_AREAS CONFIG_CMA_AREAS
Expand All @@ -17,7 +18,8 @@
* -- can deal with only some pageblocks of a higher-order page being
* MIGRATE_CMA, we can use pageblock_nr_pages.
*/
#define CMA_MIN_ALIGNMENT_PAGES pageblock_nr_pages
#define CMA_MIN_ALIGNMENT_PAGES \
(1ULL << min_not_zero(MAX_PAGE_ORDER, pageblock_order))
#define CMA_MIN_ALIGNMENT_BYTES (PAGE_SIZE * CMA_MIN_ALIGNMENT_PAGES)

struct cma;
Expand Down

0 comments on commit 7b3189a

Please sign in to comment.