Skip to content

Commit 7b3189a

Browse files
author
Fox Snowpatch
committed
1 parent f85c105 commit 7b3189a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

arch/powerpc/kernel/fadump.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,10 @@ static u64 __init fadump_locate_reserve_mem(u64 base, u64 size)
512512
phys_addr_t mstart, mend;
513513
int idx = 0;
514514
u64 i, ret = 0;
515+
unsigned long align = PAGE_SIZE;
516+
517+
if (IS_ENABLED(CONFIG_CMA) && !fw_dump.nocma)
518+
align = CMA_MIN_ALIGNMENT_BYTES;
515519

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

522526
if (mstart > base)
523-
base = PAGE_ALIGN(mstart);
527+
base = ALIGN(mstart, align);
524528

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

531535
base = mrngs[idx].base + mrngs[idx].size;
532-
base = PAGE_ALIGN(base);
536+
base = ALIGN(base, align);
533537
}
534538
}
535539

include/linux/cma.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <linux/init.h>
66
#include <linux/types.h>
77
#include <linux/numa.h>
8+
#include <linux/minmax.h>
89

910
#ifdef CONFIG_CMA_AREAS
1011
#define MAX_CMA_AREAS CONFIG_CMA_AREAS
@@ -17,7 +18,8 @@
1718
* -- can deal with only some pageblocks of a higher-order page being
1819
* MIGRATE_CMA, we can use pageblock_nr_pages.
1920
*/
20-
#define CMA_MIN_ALIGNMENT_PAGES pageblock_nr_pages
21+
#define CMA_MIN_ALIGNMENT_PAGES \
22+
(1ULL << min_not_zero(MAX_PAGE_ORDER, pageblock_order))
2123
#define CMA_MIN_ALIGNMENT_BYTES (PAGE_SIZE * CMA_MIN_ALIGNMENT_PAGES)
2224

2325
struct cma;

0 commit comments

Comments
 (0)