[PATCH] arm64: mm: set ZONE_DMA size based on early IORT scan

Catalin Marinas catalin.marinas at arm.com
Mon Oct 12 05:28:21 EDT 2020


On Sat, Oct 10, 2020 at 11:31:53AM +0200, Ard Biesheuvel wrote:
> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> index f0599ae73b8d..829fa63c3d72 100644
> --- a/arch/arm64/mm/init.c
> +++ b/arch/arm64/mm/init.c
> @@ -191,6 +191,14 @@ 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
> +	if (IS_ENABLED(CONFIG_ACPI)) {
> +		extern unsigned int acpi_iort_get_zone_dma_size(void);

Nitpick: can we add this prototype to include/linux/acpi_iort.h?

> +
> +		zone_dma_bits = min(zone_dma_bits,
> +				    acpi_iort_get_zone_dma_size());
> +		arm64_dma_phys_limit = max_zone_phys(zone_dma_bits);
> +	}
> +
>  	max_zone_pfns[ZONE_DMA] = PFN_DOWN(arm64_dma_phys_limit);

I think we should initialise zone_dma_bits slightly earlier via
arm64_memblock_init(). We'll eventually have reserve_crashkernel()
called before this and it will make use of arm64_dma_phys_limit for
"low" reservations:

https://lore.kernel.org/linux-arm-kernel/20200907134745.25732-7-chenzhou10@huawei.com/

-- 
Catalin



More information about the linux-arm-kernel mailing list