mirror-linux/arch/powerpc/mm
Ritesh Harjani (IBM) 0a8321dde0 powerpc/mem: Move CMA reservations to arch_mm_preinit
commit 4267739cab ("arch, mm: consolidate initialization of SPARSE memory model"),
changed the initialization order of "pageblock_order" from...
start_kernel()
    - setup_arch()
       - initmem_init()
         - sparse_init()
           - set_pageblock_order();  // this sets the pageblock_order
       - xxx_cma_reserve();

to...
start_kernel()
    - setup_arch()
       - xxx_cma_reserve();
    - mm_core_init_early()
       - free_area_init()
          - sparse_init()
             - set_pageblock_order() // this sets the pageblock_order.

So this means, pageblock_order is not initialized before these cma
reservation function calls, hence we are seeing CMA failures like...

[    0.000000] kvm_cma_reserve: reserving 3276 MiB for global area
[    0.000000] cma: pageblock_order not yet initialized. Called during early boot?
[    0.000000] cma: Failed to reserve 3276 MiB
....
[    0.000000][    T0] cma: pageblock_order not yet initialized. Called during early boot?
[    0.000000][    T0] cma: Failed to reserve 1024 MiB

This patch moves these CMA reservations to arch_mm_preinit() which
happens in mm_core_init() (which happens after pageblock_order is
initialized), but before the memblock moves the free memory to buddy.

Fixes: 4267739cab ("arch, mm: consolidate initialization of SPARSE memory model")
Suggested-by: Mike Rapoport <rppt@kernel.org>
Reported-and-tested-by: Sourabh Jain <sourabhjain@linux.ibm.com>
Closes: https://lore.kernel.org/linuxppc-dev/4c338a29-d190-44f3-8874-6cfa0a031f0b@linux.ibm.com/
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Tested-by: Dan Horák <dan@danny.cz>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/6e532cf0db5be99afbe20eed699163d5e86cd71f.1772303986.git.ritesh.list@gmail.com
2026-03-12 10:57:31 +05:30
..
book3s32 powerpc/32: Automatically adapt TASK_SIZE based on constraints 2026-01-07 09:31:05 +05:30
book3s64 Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
kasan kasan: introduce ARCH_DEFER_KASAN and unify static key across modes 2025-09-21 14:21:58 -07:00
nohash powerpc/32: Automatically adapt TASK_SIZE based on constraints 2026-01-07 09:31:05 +05:30
ptdump powerpc/32s: Fix segments setup when TASK_SIZE is not a multiple of 256M 2026-01-07 09:31:04 +05:30
Makefile mm: rename GENERIC_PTDUMP and PTDUMP_CORE 2025-03-17 00:05:32 -07:00
cacheflush.c powerpc: Fix typos 2024-05-08 00:21:30 +10:00
copro_fault.c cxl: Remove driver 2025-03-16 22:04:27 +11:00
dma-noncoherent.c
drmem.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
fault.c powerpc/mm/fault: Use str_write_read() helper function 2025-05-15 10:00:28 +05:30
hugetlbpage.c mm, arch: consolidate hugetlb CMA reservation 2026-01-26 20:02:19 -08:00
init-common.c book3s64/radix: Refactoring common kfence related functions 2024-10-23 18:53:20 +11:00
init_32.c
init_64.c mm/bootmem_info: export register_page_bootmem_memmap 2025-03-16 22:06:27 -07:00
ioremap.c - The 6 patch series "Enable strict percpu address space checks" from 2025-04-01 09:29:18 -07:00
ioremap_32.c
ioremap_64.c powerpc/io: Remove PCI_FIX_ADDR 2025-02-26 21:15:08 +05:30
maccess.c
mem.c powerpc/mem: Move CMA reservations to arch_mm_preinit 2026-03-12 10:57:31 +05:30
mmu_context.c powerpc/4xx: Remove CONFIG_BOOKE_OR_40x 2024-06-28 22:28:48 +10:00
mmu_decl.h powerpc: Remove core support for 40x 2024-06-28 22:28:47 +10:00
numa.c arch, mm: consolidate initialization of SPARSE memory model 2026-01-26 20:02:18 -08:00
pageattr.c powerpc: Don't ignore errors from set_memory_{n}p() in __kernel_map_pages() 2024-03-03 22:18:45 +11:00
pgtable-frag.c powerpc: mm: call ctor/dtor for kernel PTEs 2025-05-11 17:48:22 -07:00
pgtable.c powerpc/mm: support page table check 2026-01-26 20:02:36 -08:00
pgtable_32.c powerpc/32: Remove PAGE_KERNEL_TEXT to fix startup failure 2025-09-16 16:16:00 +05:30
pgtable_64.c mm/treewide: replace pXd_huge() with pXd_leaf() 2024-04-25 20:55:46 -07:00