From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C1BEC433E0 for ; Mon, 11 Jan 2021 16:58:32 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 160852242A for ; Mon, 11 Jan 2021 16:58:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 160852242A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mOcp66EERTfSQmeWXOKfPz2pm9+gQ6b7c+J18wxGRvs=; b=NxhYkT4uNVk8TatumRHJKBpRh ukTfNCk2pfyFDw81dVxahXG9JJCmA4v8xjQP2/J0QLVCtTAYKjdHF7d9Uhf4MpNdR0Vr/TWpxfemq 6NMvv15+895YF+rJtvxrAERAmGg4bzfgr648Aw4YYFLCu59lakOl11bQQldKg0UuPnGOpQ6mFaQy3 8Rpa+UWK4uIn9b1VgnQr+RUBdIhzhpl0i7UQirFNsK/1Gc777v8dXozxa+5v7gMbsIZwzlu09FsE7 zaYt87GAZVFNjV/QYhSYNVuwx07ie5ewGKJoFki8TUApFgHtU8chcb5ObNenXq6yMjpWW81Vju62y a+Msf/sYg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kz0VI-0007ug-Ap; Mon, 11 Jan 2021 16:57:16 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kz0VF-0007te-Pw for linux-arm-kernel@lists.infradead.org; Mon, 11 Jan 2021 16:57:14 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2D6D02250F; Mon, 11 Jan 2021 16:57:11 +0000 (UTC) Date: Mon, 11 Jan 2021 16:57:08 +0000 From: Catalin Marinas To: linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] arm64: Remove arm64_dma32_phys_limit and its uses Message-ID: <20210111165707.GA17941@gaia> References: <20210107184032.11815-1-catalin.marinas@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210107184032.11815-1-catalin.marinas@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210111_115713_923851_43503254 X-CRM114-Status: GOOD ( 23.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chen Zhou , Robin Murphy , Will Deacon , Nicolas Saenz Julienne Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Jan 07, 2021 at 06:40:32PM +0000, Catalin Marinas wrote: > With the introduction of a dynamic ZONE_DMA range based on DT or IORT > information, there's no need for CMA allocations from the wider > ZONE_DMA32 since on most platforms ZONE_DMA will cover the 32-bit > addressable range. Remove the arm64_dma32_phys_limit and set > arm64_dma_phys_limit to cover the smallest DMA range required on the > platform. CMA allocation and crashkernel reservation now goes in > the dynamically sized ZONE_DMA. > > Signed-off-by: Catalin Marinas > Cc: Nicolas Saenz Julienne > Cc: Chen Zhou > --- > > This patch goes on top of the ARCH_LOW_ADDRESS_LIMIT fix from Nicolas, > already in the arm64 for-next/fixes which fixes a 5.5 issue with > !CONFIG_ZONE_DMA. The changes here depend on the patches in 5.11-rc1. > While they look mostly like clean-ups, they still fix a potential issue > with !CONFIG_ZONE_DMA32 configurations where arm64_dma32_phys_limit > would be equal to PHYS_MASK but we still have a limited ZONE_DMA. In > addition, it now allows proper CMA and crashkernel reservations for > RPi4. [...] > @@ -394,16 +399,9 @@ void __init arm64_memblock_init(void) > > early_init_fdt_scan_reserved_mem(); > > - if (IS_ENABLED(CONFIG_ZONE_DMA32)) > - arm64_dma32_phys_limit = max_zone_phys(32); > - else > - arm64_dma32_phys_limit = PHYS_MASK + 1; > - > reserve_elfcorehdr(); > > high_memory = __va(memblock_end_of_DRAM() - 1) + 1; > - > - dma_contiguous_reserve(arm64_dma32_phys_limit); > } > > void __init bootmem_init(void) > @@ -438,6 +436,11 @@ void __init bootmem_init(void) > sparse_init(); > zone_sizes_init(min, max); > > + /* > + * Reserve the CMA area after arm64_dma_phys_limit was initialised. > + */ > + dma_contiguous_reserve(arm64_dma_phys_limit); Prior to this patch, disabling CONFIG_ZONE_DMA32 leads to CMA allocation from the whole RAM as arm64_dma32_phys_limit becomes PHYS_MASK+1. With this patch (which I plan to merge in 5.11-rc4), we limit the CMA allocation to the 32-bit addressable RAM (if any) even if we don't describe anything in DT or IORT since ZONE_DMA is capped at 32-bit. We could relax this so that ZONE_DMA can be expanded beyond 32-bit with ZONE_DMA32 disabled and no DT/IORT information. Is there a real use-case for such configuration? We might as well make ZONE_DMA depend on ZONE_DMA32 (though given the EXPERT dependency, people should know what they are doing...). An alternative would be to change max_zone_phys() to avoid the U32_MAX cap if ZONE_DMA32 is disabled but I don't think it's worth as I don't see much point in a kernel config with ZONE_DMA enabled and ZONE_DMA32 disabled. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel