The patch titled Subject: openrisc: prefer memblock APIs returning virtual address has been added to the -mm tree. Its filename is openrisc-prefer-memblock-apis-returning-virtual-address.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/openrisc-prefer-memblock-apis-returning-virtual-address.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/openrisc-prefer-memblock-apis-returning-virtual-address.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Mike Rapoport <rppt@xxxxxxxxxxxxx> Subject: openrisc: prefer memblock APIs returning virtual address Patch series "Refine memblock API", v2. Current memblock API is quite extensive and, which is more annoying, duplicated. Except the low-level functions that allow searching for a free memory region and marking it as reserved, memblock provides three (well, two and a half) sets of functions to allocate memory. There are several overlapping functions that return a physical address and there are functions that return virtual address. Those that return the virtual address may also clear the allocated memory. And, on top of all that, some allocators panic and some return NULL in case of error. This set tries to reduce the mess, and trim down the amount of memblock allocation methods. Patches 1-10 consolidate the functions that return physical address of the allocated memory Patches 11-13 are some trivial cleanups Patches 14-19 add checks for the return value of memblock_alloc*() and panics in case of errors. The patches 14-18 include some minor refactoring to have better readability of the resulting code and patch 19 is a mechanical addition of if (!ptr) panic(); after memblock_alloc*() calls. And, finally, patches 20 and 21 remove panic() calls memblock and _nopanic variants from memblock. This patch (of 21): The allocation of the page tables memory in openrics uses memblock_phys_alloc() and then converts the returned physical address to virtual one. Use memblock_alloc_raw() and add a panic() if the allocation fails. Link: http://lkml.kernel.org/r/1548057848-15136-2-git-send-email-rppt@xxxxxxxxxxxxx Signed-off-by: Mike Rapoport <rppt@xxxxxxxxxxxxx> Acked-by: Stafford Horne <shorne@xxxxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Christoph Hellwig <hch@xxxxxx> Cc: "David S. Miller" <davem@xxxxxxxxxxxxx> Cc: Dennis Zhou <dennis@xxxxxxxxxx> Cc: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> Cc: Greentime Hu <green.hu@xxxxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Cc: Guan Xuetao <gxt@xxxxxxxxxx> Cc: Guo Ren <guoren@xxxxxxxxxx> Cc: Heiko Carstens <heiko.carstens@xxxxxxxxxx> Cc: Mark Salter <msalter@xxxxxxxxxx> Cc: Matt Turner <mattst88@xxxxxxxxx> Cc: Max Filippov <jcmvbkbc@xxxxxxxxx> Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx> Cc: Michal Simek <monstr@xxxxxxxxx> Cc: Paul Burton <paul.burton@xxxxxxxx> Cc: Petr Mladek <pmladek@xxxxxxxx> Cc: Rich Felker <dalias@xxxxxxxx> Cc: Richard Weinberger <richard@xxxxxx> Cc: Rob Herring <robh+dt@xxxxxxxxxx> Cc: Russell King <linux@xxxxxxxxxxxxxxx> Cc: Tony Luck <tony.luck@xxxxxxxxx> Cc: Vineet Gupta <vgupta@xxxxxxxxxxxx> Cc: Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx> Cc: Christophe Leroy <christophe.leroy@xxxxxx> Cc: Guo Ren <ren_guo@xxxxxxxxx> [c-sky] Cc: Juergen Gross <jgross@xxxxxxxx> [Xen] Cc: Rob Herring <robh@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- arch/openrisc/mm/init.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/arch/openrisc/mm/init.c~openrisc-prefer-memblock-apis-returning-virtual-address +++ a/arch/openrisc/mm/init.c @@ -105,7 +105,10 @@ static void __init map_ram(void) } /* Alloc one page for holding PTE's... */ - pte = (pte_t *) __va(memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE)); + pte = memblock_alloc_raw(PAGE_SIZE, PAGE_SIZE); + if (!pte) + panic("%s: Failed to allocate page for PTEs\n", + __func__); set_pmd(pme, __pmd(_KERNPG_TABLE + __pa(pte))); /* Fill the newly allocated page with PTE'S */ _ Patches currently in -mm which might be from rppt@xxxxxxxxxxxxx are powerpc-prefer-memblock-apis-returning-virtual-address.patch microblaze-prefer-memblock-api-returning-virtual-address.patch sh-prefer-memblock-apis-returning-virtual-address.patch openrisc-simplify-pte_alloc_one_kernel.patch arch-simplify-several-early-memory-allocations.patch arm-s390-unicore32-remove-oneliner-wrappers-for-memblock_alloc.patch openrisc-prefer-memblock-apis-returning-virtual-address.patch memblock-replace-memblock_alloc_baseanywhere-with-memblock_phys_alloc.patch memblock-drop-memblock_alloc_base_nid.patch memblock-emphasize-that-memblock_alloc_range-returns-a-physical-address.patch memblock-memblock_phys_alloc_try_nid-dont-panic.patch memblock-memblock_phys_alloc-dont-panic.patch memblock-drop-__memblock_alloc_base.patch memblock-drop-memblock_alloc_base.patch memblock-refactor-internal-allocation-functions.patch memblock-make-memblock_find_in_range_node-and-choose_memblock_flags-static.patch arch-use-memblock_alloc-instead-of-memblock_alloc_fromsize-align-0.patch arch-dont-memset0-memory-returned-by-memblock_alloc.patch ia64-add-checks-for-the-return-value-of-memblock_alloc.patch sparc-add-checks-for-the-return-value-of-memblock_alloc.patch mm-percpu-add-checks-for-the-return-value-of-memblock_alloc.patch init-main-add-checks-for-the-return-value-of-memblock_alloc.patch swiotlb-add-checks-for-the-return-value-of-memblock_alloc.patch treewide-add-checks-for-the-return-value-of-memblock_alloc.patch memblock-memblock_alloc_try_nid-dont-panic.patch memblock-drop-memblock_alloc__nopanic-variants.patch