arm64: mm: move dma_contiguous_reserve() to be after paging_init()

Song Bao Hua (Barry Song) song.bao.hua at hisilicon.com
Wed Sep 16 20:57:37 EDT 2020



> -----Original Message-----
> From: ndesaulniers via sendgmr
> [mailto:ndesaulniers at ndesaulniers1.mtv.corp.google.com] On Behalf Of Nick
> Desaulniers
> Sent: Thursday, September 17, 2020 12:20 PM
> To: Song Bao Hua (Barry Song) <song.bao.hua at hisilicon.com>
> Cc: akpm at linux-foundation.org; guro at fb.com;
> linux-arm-kernel at lists.infradead.org; linux-mm at kvack.org; Linuxarm
> <linuxarm at huawei.com>; mike.kravetz at oracle.com; sfr at canb.auug.org.au;
> will at kernel.org; ardb at kernel.org; clang-built-linux at googlegroups.com
> Subject: Re: arm64: mm: move dma_contiguous_reserve() to be after
> paging_init()
> 
> It looks like that change referenced may also break arm32 boots with today's
> next?
> 
> The following allows me to boot, but I have no idea if it's incorrect or not.
> 

This is probably incorrect on arm32 as dma_contiguous_early_fixup() is done after
dma_contiguous_remap() in paging_init(). That means dma_contiguous_remap() gets an
empty list.
For arm64, there isn't early_fixup() and remap().

> diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
> index 45f9d5ec2360..7118b98c1f5f 100644
> --- a/arch/arm/mm/init.c
> +++ b/arch/arm/mm/init.c
> @@ -226,9 +226,6 @@ void __init arm_memblock_init(const struct
> machine_desc *mdesc)
>         early_init_fdt_reserve_self();
>         early_init_fdt_scan_reserved_mem();
> 
> -       /* reserve memory for DMA contiguous allocations */
> -       dma_contiguous_reserve(arm_dma_limit);
> -
>         arm_memblock_steal_permitted = false;
>         memblock_dump_all();
>  }
> @@ -248,6 +245,9 @@ void __init bootmem_init(void)
>          */
>         sparse_init();
> 
> +       /* reserve memory for DMA contiguous allocations */
> +       dma_contiguous_reserve(arm_dma_limit);
> +
>         /*
>          * Now free the memory - free_area_init needs
>          * the sparse mem_map arrays initialized by sparse_init()

Thanks
Barry



More information about the linux-arm-kernel mailing list