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=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_RED 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 E2B14C433E6 for ; Sun, 7 Mar 2021 15:25:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8445C6510A for ; Sun, 7 Mar 2021 15:25:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8445C6510A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1A3BB6B007B; Sun, 7 Mar 2021 10:25:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 153A16B007D; Sun, 7 Mar 2021 10:25:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F0F326B007E; Sun, 7 Mar 2021 10:25:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0198.hostedemail.com [216.40.44.198]) by kanga.kvack.org (Postfix) with ESMTP id C7E7E6B007B for ; Sun, 7 Mar 2021 10:25:58 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 88A9A8249980 for ; Sun, 7 Mar 2021 15:25:58 +0000 (UTC) X-FDA: 77893453596.24.5A80AEE Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf30.hostedemail.com (Postfix) with ESMTP id D1EAAE000107 for ; Sun, 7 Mar 2021 15:25:53 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 91C0A65105; Sun, 7 Mar 2021 15:25:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615130757; bh=qMt2ZYEDmvgLayuuE3eRvVYgnzeUJqjO0YYaCuCmmd8=; h=Subject:To:Cc:From:Date:In-Reply-To:From; b=F2ksuzdLnoLN855JIqVTRNKv/RvKfQpPLZCBm2kdWAvspCKN+qc9xaoMiTWzSdY4b jbIKezMJsF2etVV6mErLaQSikcZU5g7NFXxBavHn1893FbVoUpDRWyfKkSvRqFtbtq iyczxF4m4P4ggJ/B4dwphLMNgvVKdnzm31eMfnDg= Subject: Patch "arm64: mm: Set ZONE_DMA size based on devicetree's dma-ranges" has been added to the 5.10-stable tree To: akpm@linux-foundation.org,anshuman.khandual@arm.com,aou@eecs.berkeley.edu,ardb@kernel.org,bhelgaas@google.com,catalin.marinas@arm.com,frowand.list@gmail.com,gregkh@linuxfoundation.org,guohanjun@huawei.com,guro@fb.com,jingxiangfeng@huawei.com,lenb@kernel.org,linux-arm-kernel@lists.infradead.org,linux-mm@kvack.org,linux-riscv@lists.infradead.org,lorenzo.pieralisi@arm.com,nsaenzjulienne@suse.de,palmer@dabbelt.com,paul.walmsley@sifive.com,rjw@rjwysocki.net,robh+dt@kernel.org,rppt@kernel.org,song.bao.hua@hisilicon.com,sudeep.holla@arm.com,wangkefeng.wang@huawei.com,will@kernel.org Cc: From: Date: Sun, 07 Mar 2021 16:25:44 +0100 In-Reply-To: <20210303073319.2215839-6-jingxiangfeng@huawei.com> Message-ID: <161513074423216@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 X-stable: commit X-Patchwork-Hint: ignore X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: D1EAAE000107 X-Stat-Signature: kfmyuudiexbwbd7rcwxb3rrgc43samgg Received-SPF: none (linuxfoundation.org>: No applicable sender policy available) receiver=imf30; identity=mailfrom; envelope-from=""; helo=mail.kernel.org; client-ip=198.145.29.99 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615130753-992465 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This is a note to let you know that I've just added the patch titled arm64: mm: Set ZONE_DMA size based on devicetree's dma-ranges to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=3Dlinux/kernel/git/stable/stable-queue.g= it;a=3Dsummary The filename of the patch is: arm64-mm-set-zone_dma-size-based-on-devicetree-s-dma-ranges.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From foo@baz Sun Mar 7 04:22:37 PM CET 2021 From: Jing Xiangfeng Date: Wed, 3 Mar 2021 15:33:17 +0800 Subject: arm64: mm: Set ZONE_DMA size based on devicetree's dma-ranges To: , , , , , , , , , , , , , , , , , , , Cc: , , , , , , , , Message-ID: <20210303073319.2215839-6-jingxiangfeng@huawei.com> From: Nicolas Saenz Julienne commit 8424ecdde7df99d5426e1a1fd9f0fb36f4183032 upstream We recently introduced a 1 GB sized ZONE_DMA to cater for platforms incorporating masters that can address less than 32 bits of DMA, in particular the Raspberry Pi 4, which has 4 or 8 GB of DRAM, but has peripherals that can only address up to 1 GB (and its PCIe host bridge can only access the bottom 3 GB) The DMA layer also needs to be able to allocate memory that is guaranteed to meet those DMA constraints, for bounce buffering as well as allocating the backing for consistent mappings. This is why the 1 GB ZONE_DMA was introduced recently. Unfortunately, it turns out the having a 1 GB ZONE_DMA as well as a ZONE_DMA32 causes problems with kdump, and potentially in other places where allocations cannot cross zone boundaries. Therefore, we should avoid having two separate DMA zones when possible. So, with the help of of_dma_get_max_cpu_address() get the topmost physical address accessible to all DMA masters in system and use that information to fine-tune ZONE_DMA's size. In the absence of addressing limited masters ZONE_DMA will span the whole 32-bit address space, otherwise, in the case of the Raspberry Pi 4 it'll only span the 30-bit address space, and have ZONE_DMA32 cover the rest of the 32-bit address space. Signed-off-by: Nicolas Saenz Julienne Link: https://lore.kernel.org/r/20201119175400.9995-6-nsaenzjulienne@suse= .de Signed-off-by: Catalin Marinas Cc: Signed-off-by: Jing Xiangfeng Signed-off-by: Greg Kroah-Hartman --- arch/arm64/mm/init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -42,8 +42,6 @@ #include #include =20 -#define ARM64_ZONE_DMA_BITS 30 - /* * We need to be able to catch inadvertent references to memstart_addr * that occur (potentially in generic code) before arm64_memblock_init() @@ -188,9 +186,11 @@ static phys_addr_t __init max_zone_phys( static void __init zone_sizes_init(unsigned long min, unsigned long max) { unsigned long max_zone_pfns[MAX_NR_ZONES] =3D {0}; + unsigned int __maybe_unused dt_zone_dma_bits; =20 #ifdef CONFIG_ZONE_DMA - zone_dma_bits =3D ARM64_ZONE_DMA_BITS; + dt_zone_dma_bits =3D fls64(of_dma_get_max_cpu_address(NULL)); + zone_dma_bits =3D min(32U, dt_zone_dma_bits); arm64_dma_phys_limit =3D max_zone_phys(zone_dma_bits); max_zone_pfns[ZONE_DMA] =3D PFN_DOWN(arm64_dma_phys_limit); #endif Patches currently in stable-queue which might be from jingxiangfeng@huawe= i.com are queue-5.10/of-unittest-add-test-for-of_dma_get_max_cpu_address.patch queue-5.10/mm-remove-examples-from-enum-zone_type-comment.patch queue-5.10/arm64-mm-set-zone_dma-size-based-on-devicetree-s-dma-ranges.pa= tch queue-5.10/of-address-introduce-of_dma_get_max_cpu_address.patch queue-5.10/arm64-mm-move-zone_dma_bits-initialization-into-zone_sizes_ini= t.patch queue-5.10/arm64-mm-set-zone_dma-size-based-on-early-iort-scan.patch queue-5.10/arm64-mm-move-reserve_crashkernel-into-mem_init.patch