On Mon, 12 Oct 2020 at 13:37, Catalin Marinas <catalin.marinas@xxxxxxx> wrote: > > On Sat, Oct 10, 2020 at 05:12:31PM +0200, Nicolas Saenz Julienne wrote: > > diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c > > index f6902a2b4ea6..0eca5865dcb1 100644 > > --- a/arch/arm64/mm/init.c > > +++ b/arch/arm64/mm/init.c > > @@ -196,14 +196,16 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max) > > unsigned long max_zone_pfns[MAX_NR_ZONES] = {0}; > > > > #ifdef CONFIG_ZONE_DMA > > + zone_dma_bits = ARM64_ZONE_DMA_BITS; > > + > > if (IS_ENABLED(CONFIG_ACPI)) { > > extern unsigned int acpi_iort_get_zone_dma_size(void); > > > > zone_dma_bits = min(zone_dma_bits, > > acpi_iort_get_zone_dma_size()); > > - arm64_dma_phys_limit = max_zone_phys(zone_dma_bits); > > } > > > > + arm64_dma_phys_limit = max_zone_phys(zone_dma_bits); > > max_zone_pfns[ZONE_DMA] = PFN_DOWN(arm64_dma_phys_limit); > > #endif > > #ifdef CONFIG_ZONE_DMA32 > > @@ -394,11 +396,6 @@ void __init arm64_memblock_init(void) > > > > early_init_fdt_scan_reserved_mem(); > > > > - if (IS_ENABLED(CONFIG_ZONE_DMA)) { > > - zone_dma_bits = ARM64_ZONE_DMA_BITS; > > - arm64_dma_phys_limit = max_zone_phys(ARM64_ZONE_DMA_BITS); > > - } > > arm64_dma_phys_limit is used by memblock_alloc_low() (via > ARCH_LOW_ADDRESS_LIMIT). I think it's too late to leave its > initialisation to zone_sizes_init(). > The only generic caller of memblock_alloc_low() is swiotlb_init(), which is called much later. So at that point, we definitely need ARCH_LOW_ADDRESS_LIMIT to be set correctly, but that means doing it in zone_sizes_init() is early enough. So the only problematic reference seems to be crashkernel_reserve() afaict.