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=-14.0 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 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 78BE6C433E0 for ; Mon, 11 Jan 2021 17:37:08 +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 112FB225AB for ; Mon, 11 Jan 2021 17:37:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 112FB225AB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de 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-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:References:In-Reply-To:Date:To:From:Subject:Message-ID:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=F613jR8eBnNmm0gI3CUrAMUzbUdUKNF3aDD8KezDYb8=; b=umG0D+1xSTk2XmlJ2TdrCMIu0 BUFVP43eZVvqYtHuQWdy83XtQTuTvTyQE4iAqxjttAAe6rq4EoGvzaSDbLHtrOyNhf0K63EkQ7ogd kA4jYkMZrhicarPR0FVlZS/a8tDxU2DMCM2SQZjhOF//KcqDn/Mz+D8RcPawkRVvSw188Zly0OUJP h3XBIsqe3txr4Qq5JA7OsOl9iswo/15ZUp6cqVGAkc1WJVHEJZqGU6ruFmWDr18xxu3fMJ4kNQQNI cDYACyyhyOBqS/qaQ2nC7BoIPm6k0D8rjEj95uHOmwTXqPVBzXOyEkzuD4haUpueY1tsTrIQdw9NJ kzHzY9p7g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kz165-0001mo-Bf; Mon, 11 Jan 2021 17:35:17 +0000 Received: from mx2.suse.de ([195.135.220.15]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kz161-0001li-QK for linux-arm-kernel@lists.infradead.org; Mon, 11 Jan 2021 17:35:15 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 6EC16AE65; Mon, 11 Jan 2021 17:35:12 +0000 (UTC) Message-ID: Subject: Re: [PATCH] arm64: Remove arm64_dma32_phys_limit and its uses From: Nicolas Saenz Julienne To: Catalin Marinas , linux-arm-kernel@lists.infradead.org Date: Mon, 11 Jan 2021 18:35:11 +0100 In-Reply-To: <20210111165707.GA17941@gaia> References: <20210107184032.11815-1-catalin.marinas@arm.com> <20210111165707.GA17941@gaia> User-Agent: Evolution 3.38.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210111_123514_111659_47B0532C X-CRM114-Status: GOOD ( 31.59 ) 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 Content-Type: multipart/mixed; boundary="===============3289552957643248567==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============3289552957643248567== Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-qTYJwjc7NRhII9jjuDOS" --=-qTYJwjc7NRhII9jjuDOS Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 2021-01-11 at 16:57 +0000, Catalin Marinas wrote: > 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. > >=20 > > Signed-off-by: Catalin Marinas > > Cc: Nicolas Saenz Julienne > > Cc: Chen Zhou > > --- > >=20 > > 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) > > =C2=A0 > >=20 > > =C2=A0 early_init_fdt_scan_reserved_mem(); > > =C2=A0 > >=20 > > - if (IS_ENABLED(CONFIG_ZONE_DMA32)) > > - arm64_dma32_phys_limit =3D max_zone_phys(32); > > - else > > - arm64_dma32_phys_limit =3D PHYS_MASK + 1; > > - > > =C2=A0 reserve_elfcorehdr(); > > =C2=A0 > >=20 > > =C2=A0 high_memory =3D __va(memblock_end_of_DRAM() - 1) + 1; > > - > > - dma_contiguous_reserve(arm64_dma32_phys_limit); > > =C2=A0} > > =C2=A0 > >=20 > > =C2=A0void __init bootmem_init(void) > > @@ -438,6 +436,11 @@ void __init bootmem_init(void) > > =C2=A0 sparse_init(); > > =C2=A0 zone_sizes_init(min, max); > > =C2=A0 > >=20 > > + /* > > + * Reserve the CMA area after arm64_dma_phys_limit was initialised. > > + */ > > + dma_contiguous_reserve(arm64_dma_phys_limit); >=20 > 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? AFAIK there is a good amount of PCIe cards that depend on 32-bit addressing= . So expanding ZONE_DMA beyond 32-bit would potentially break those. That said I don't have any concrete example of people using this. > We might as well make ZONE_DMA depend on ZONE_DMA32 (though given the EXP= ERT > dependency, people should know what they are doing...). I guess in the long run it'll make things easier to mantain, so it has its value. > 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. Agree, it seems a pointless configuration. On top of that, AFAIK, there isn= 't any drawback to having a zero sized ZONE_DMA32. Regards, Nicolas --=-qTYJwjc7NRhII9jjuDOS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEErOkkGDHCg2EbPcGjlfZmHno8x/4FAl/8jE8ACgkQlfZmHno8 x/4Fiwf+K0c4vqyAqfqWTrxgUAiQoRLWo4Uu6xsAEscBeJvrIv5rwg4vn6b7KLo6 7cE+/a+kw1KaLpWVoLYS8t0apgsUeF9wW4RIY0wFr1gIT0yi0zKtOPNP/T4g500Z dBDRWY9T1lNcEKwkOZ83G86yGUYt6FCToEfnAWTTTv73Ht3d5n5lYKWPjZkvwx4s 32izUZGIbebzfyG5pi0+ea8MpAAJg9F5DmFGMmJ6S14MeBdeR34J2d94Luz4TeZn nBnP/tZdsR33S765D9GoUFaALHL3U6+Vg6O/YmVhb4twEIq+JX3q5ISlZTdWYxgi kQbn3vyJVIpO1CM8e22TWi0xI0GRZg== =P4xB -----END PGP SIGNATURE----- --=-qTYJwjc7NRhII9jjuDOS-- --===============3289552957643248567== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============3289552957643248567==--