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_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 A0744C433E0 for ; Sun, 7 Mar 2021 15:27:41 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 3978C65106 for ; Sun, 7 Mar 2021 15:27:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3978C65106 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:In-Reply-To:Date:From:Cc:To: Subject:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References:List-Owner; bh=J57UKrZ7r6mG5J+Z0IFQABhNa7L8jHsEsI9jJTZjMhg=; b=i40UC/6we2A5kiVViU70/tN7c HWrLTp2EY2eCDc3jCdGfehm4vGuONyzgwDEIvLy00AeSzCRQPGAHdIsCMYdVJoB3KCVH/Tdj6G7Ea 5X/XUGh3Goc/DwhWMNuDmzS1pQRBB2J7tGe9IaObjUgVokip8W05WVMzg7vPRr724odHMts2nq7dD 79FzNfdAGasrJrFMrjThTVEJ1wTgHXWoznh+iAa9n0kuhNbxHArYtA8Bau/Q6v5Z9Fz0iVnES3QuG odRfeFBmm05ElH1rvY5gZ3QEZ4mDSYugMzG22kGEnV7XYirG1MpNGaDkuKin+V2+XTnz16U8JVVF9 UXa/aKTdQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lIvJX-00AgvN-5c; Sun, 07 Mar 2021 15:27:27 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lIvIG-00AgCs-PH; Sun, 07 Mar 2021 15:26:12 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id E29476510E; Sun, 7 Mar 2021 15:26:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615130767; bh=LhVeJz3t8c0DEpinyjEhuhv7yJDBXsqtZOtL3d5lANQ=; h=Subject:To:Cc:From:Date:In-Reply-To:From; b=MLfpuTfWSkLsRaM731bPoxaWCXvyWtkrP0gZS9Brbs/nTtxRkkrcFNt2ySzHisNzR gJawj2dun2EVtwFG6x1BtlC/LqfJaiG/Mt1z5aQQFPT0PXaWYGG9nCkCHeSCL+MxE+ JEo4099Ergy56XpC9XhSm+LzqEvyuaK8qptXWfP8= Subject: Patch "of/address: Introduce of_dma_get_max_cpu_address()" 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, robh@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:46 +0100 In-Reply-To: <20210303073319.2215839-4-jingxiangfeng@huawei.com> Message-ID: <1615130746136116@kroah.com> MIME-Version: 1.0 X-stable: commit X-Patchwork-Hint: ignore X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210307_152610_819511_723147CB X-CRM114-Status: GOOD ( 15.36 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org This is a note to let you know that I've just added the patch titled of/address: Introduce of_dma_get_max_cpu_address() to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: of-address-introduce-of_dma_get_max_cpu_address.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:15 +0800 Subject: of/address: Introduce of_dma_get_max_cpu_address() To: , , , , , , , , , , , , , , , , , , , Cc: , , , , , , , , , Rob Herring Message-ID: <20210303073319.2215839-4-jingxiangfeng@huawei.com> From: Nicolas Saenz Julienne commit 964db79d6c186cc2ecc6ae46f98eed7e0ea8cf71 upstream Introduce of_dma_get_max_cpu_address(), which provides the highest CPU physical address addressable by all DMA masters in the system. It's specially useful for setting memory zones sizes at early boot time. Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Rob Herring Link: https://lore.kernel.org/r/20201119175400.9995-4-nsaenzjulienne@suse.de Signed-off-by: Catalin Marinas Cc: Signed-off-by: Jing Xiangfeng Signed-off-by: Greg Kroah-Hartman --- drivers/of/address.c | 42 ++++++++++++++++++++++++++++++++++++++++++ include/linux/of.h | 7 +++++++ 2 files changed, 49 insertions(+) --- a/drivers/of/address.c +++ b/drivers/of/address.c @@ -1025,6 +1025,48 @@ out: #endif /* CONFIG_HAS_DMA */ /** + * of_dma_get_max_cpu_address - Gets highest CPU address suitable for DMA + * @np: The node to start searching from or NULL to start from the root + * + * Gets the highest CPU physical address that is addressable by all DMA masters + * in the sub-tree pointed by np, or the whole tree if NULL is passed. If no + * DMA constrained device is found, it returns PHYS_ADDR_MAX. + */ +phys_addr_t __init of_dma_get_max_cpu_address(struct device_node *np) +{ + phys_addr_t max_cpu_addr = PHYS_ADDR_MAX; + struct of_range_parser parser; + phys_addr_t subtree_max_addr; + struct device_node *child; + struct of_range range; + const __be32 *ranges; + u64 cpu_end = 0; + int len; + + if (!np) + np = of_root; + + ranges = of_get_property(np, "dma-ranges", &len); + if (ranges && len) { + of_dma_range_parser_init(&parser, np); + for_each_of_range(&parser, &range) + if (range.cpu_addr + range.size > cpu_end) + cpu_end = range.cpu_addr + range.size - 1; + + if (max_cpu_addr > cpu_end) + max_cpu_addr = cpu_end; + } + + for_each_available_child_of_node(np, child) { + subtree_max_addr = of_dma_get_max_cpu_address(child); + if (max_cpu_addr > subtree_max_addr) + max_cpu_addr = subtree_max_addr; + } + + return max_cpu_addr; +} + +/** * of_dma_is_coherent - Check if device is coherent * @np: device node * --- a/include/linux/of.h +++ b/include/linux/of.h @@ -558,6 +558,8 @@ int of_map_id(struct device_node *np, u3 const char *map_name, const char *map_mask_name, struct device_node **target, u32 *id_out); +phys_addr_t of_dma_get_max_cpu_address(struct device_node *np); + #else /* CONFIG_OF */ static inline void of_core_init(void) @@ -995,6 +997,11 @@ static inline int of_map_id(struct devic return -EINVAL; } +static inline phys_addr_t of_dma_get_max_cpu_address(struct device_node *np) +{ + return PHYS_ADDR_MAX; +} + #define of_match_ptr(_ptr) NULL #define of_match_node(_matches, _node) NULL #endif /* CONFIG_OF */ Patches currently in stable-queue which might be from jingxiangfeng@huawei.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.patch 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_init.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 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv 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_RED autolearn=unavailable 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 68975C433E0 for ; Sun, 7 Mar 2021 15:28:53 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 EF0A264E02 for ; Sun, 7 Mar 2021 15:28:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EF0A264E02 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:In-Reply-To:Date:From:Cc:To: Subject:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References:List-Owner; bh=J7rD+l1CJI2MycFcxadu+40PArEvqXZ33JeSCekLkT8=; b=YYzca6fyVyZTT/iKGZO5eSepH lpubnbu/diY+HSoV+K03Xlbfy38uCA9DAjoW4Mgeg2gDjKEJzzhp0cL9HxFZ7Sm0XKt0543eYROkP Iu3dFkOlYYkiabDTr9NedNi6lQhDsXXKRuGg09lE31SBX6BuuGhD5xr2zYsTV3RZ2WjJUeFEDLz02 9+ehJVM+lPpJk66CYcutflIEKR+XQzhaWwKYZmRVHjU1msUezHKQYglj/n5lv/L3vTuZt3ALwpXYx sQBQXpERgwgnWxLvBztpbzQxQLokBzh5i6adiZY00cTPWvjvnnIpt1/Ko2uvNGd33ihBdby4e4oEU Lfn4nrNZg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lIvJN-00Agnl-L1; Sun, 07 Mar 2021 15:27:17 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lIvIG-00AgCs-PH; Sun, 07 Mar 2021 15:26:12 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id E29476510E; Sun, 7 Mar 2021 15:26:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615130767; bh=LhVeJz3t8c0DEpinyjEhuhv7yJDBXsqtZOtL3d5lANQ=; h=Subject:To:Cc:From:Date:In-Reply-To:From; b=MLfpuTfWSkLsRaM731bPoxaWCXvyWtkrP0gZS9Brbs/nTtxRkkrcFNt2ySzHisNzR gJawj2dun2EVtwFG6x1BtlC/LqfJaiG/Mt1z5aQQFPT0PXaWYGG9nCkCHeSCL+MxE+ JEo4099Ergy56XpC9XhSm+LzqEvyuaK8qptXWfP8= Subject: Patch "of/address: Introduce of_dma_get_max_cpu_address()" 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, robh@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:46 +0100 In-Reply-To: <20210303073319.2215839-4-jingxiangfeng@huawei.com> Message-ID: <1615130746136116@kroah.com> MIME-Version: 1.0 X-stable: commit X-Patchwork-Hint: ignore X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210307_152610_819511_723147CB X-CRM114-Status: GOOD ( 15.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 This is a note to let you know that I've just added the patch titled of/address: Introduce of_dma_get_max_cpu_address() to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: of-address-introduce-of_dma_get_max_cpu_address.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:15 +0800 Subject: of/address: Introduce of_dma_get_max_cpu_address() To: , , , , , , , , , , , , , , , , , , , Cc: , , , , , , , , , Rob Herring Message-ID: <20210303073319.2215839-4-jingxiangfeng@huawei.com> From: Nicolas Saenz Julienne commit 964db79d6c186cc2ecc6ae46f98eed7e0ea8cf71 upstream Introduce of_dma_get_max_cpu_address(), which provides the highest CPU physical address addressable by all DMA masters in the system. It's specially useful for setting memory zones sizes at early boot time. Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Rob Herring Link: https://lore.kernel.org/r/20201119175400.9995-4-nsaenzjulienne@suse.de Signed-off-by: Catalin Marinas Cc: Signed-off-by: Jing Xiangfeng Signed-off-by: Greg Kroah-Hartman --- drivers/of/address.c | 42 ++++++++++++++++++++++++++++++++++++++++++ include/linux/of.h | 7 +++++++ 2 files changed, 49 insertions(+) --- a/drivers/of/address.c +++ b/drivers/of/address.c @@ -1025,6 +1025,48 @@ out: #endif /* CONFIG_HAS_DMA */ /** + * of_dma_get_max_cpu_address - Gets highest CPU address suitable for DMA + * @np: The node to start searching from or NULL to start from the root + * + * Gets the highest CPU physical address that is addressable by all DMA masters + * in the sub-tree pointed by np, or the whole tree if NULL is passed. If no + * DMA constrained device is found, it returns PHYS_ADDR_MAX. + */ +phys_addr_t __init of_dma_get_max_cpu_address(struct device_node *np) +{ + phys_addr_t max_cpu_addr = PHYS_ADDR_MAX; + struct of_range_parser parser; + phys_addr_t subtree_max_addr; + struct device_node *child; + struct of_range range; + const __be32 *ranges; + u64 cpu_end = 0; + int len; + + if (!np) + np = of_root; + + ranges = of_get_property(np, "dma-ranges", &len); + if (ranges && len) { + of_dma_range_parser_init(&parser, np); + for_each_of_range(&parser, &range) + if (range.cpu_addr + range.size > cpu_end) + cpu_end = range.cpu_addr + range.size - 1; + + if (max_cpu_addr > cpu_end) + max_cpu_addr = cpu_end; + } + + for_each_available_child_of_node(np, child) { + subtree_max_addr = of_dma_get_max_cpu_address(child); + if (max_cpu_addr > subtree_max_addr) + max_cpu_addr = subtree_max_addr; + } + + return max_cpu_addr; +} + +/** * of_dma_is_coherent - Check if device is coherent * @np: device node * --- a/include/linux/of.h +++ b/include/linux/of.h @@ -558,6 +558,8 @@ int of_map_id(struct device_node *np, u3 const char *map_name, const char *map_mask_name, struct device_node **target, u32 *id_out); +phys_addr_t of_dma_get_max_cpu_address(struct device_node *np); + #else /* CONFIG_OF */ static inline void of_core_init(void) @@ -995,6 +997,11 @@ static inline int of_map_id(struct devic return -EINVAL; } +static inline phys_addr_t of_dma_get_max_cpu_address(struct device_node *np) +{ + return PHYS_ADDR_MAX; +} + #define of_match_ptr(_ptr) NULL #define of_match_node(_matches, _node) NULL #endif /* CONFIG_OF */ Patches currently in stable-queue which might be from jingxiangfeng@huawei.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.patch 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_init.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 F3F5AC433E0 for ; Sun, 7 Mar 2021 15:26:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 914AE65105 for ; Sun, 7 Mar 2021 15:26:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 914AE65105 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 303106B008A; Sun, 7 Mar 2021 10:26:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 28C486B0092; Sun, 7 Mar 2021 10:26:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 105C26B0093; Sun, 7 Mar 2021 10:26:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0089.hostedemail.com [216.40.44.89]) by kanga.kvack.org (Postfix) with ESMTP id E1DCF6B008A for ; Sun, 7 Mar 2021 10:26:09 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 9C4672481 for ; Sun, 7 Mar 2021 15:26:09 +0000 (UTC) X-FDA: 77893454058.25.9E0FE59 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf01.hostedemail.com (Postfix) with ESMTP id 6AD15200038B for ; Sun, 7 Mar 2021 15:26:08 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id E29476510E; Sun, 7 Mar 2021 15:26:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615130767; bh=LhVeJz3t8c0DEpinyjEhuhv7yJDBXsqtZOtL3d5lANQ=; h=Subject:To:Cc:From:Date:In-Reply-To:From; b=MLfpuTfWSkLsRaM731bPoxaWCXvyWtkrP0gZS9Brbs/nTtxRkkrcFNt2ySzHisNzR gJawj2dun2EVtwFG6x1BtlC/LqfJaiG/Mt1z5aQQFPT0PXaWYGG9nCkCHeSCL+MxE+ JEo4099Ergy56XpC9XhSm+LzqEvyuaK8qptXWfP8= Subject: Patch "of/address: Introduce of_dma_get_max_cpu_address()" 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,robh@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:46 +0100 In-Reply-To: <20210303073319.2215839-4-jingxiangfeng@huawei.com> Message-ID: <1615130746136116@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: rspam03 X-Rspamd-Queue-Id: 6AD15200038B X-Stat-Signature: 3mw3eudwxk33qbkofxpp3hjo4ycji3rz Received-SPF: none (linuxfoundation.org>: No applicable sender policy available) receiver=imf01; identity=mailfrom; envelope-from=""; helo=mail.kernel.org; client-ip=198.145.29.99 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615130768-682590 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 of/address: Introduce of_dma_get_max_cpu_address() 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: of-address-introduce-of_dma_get_max_cpu_address.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:15 +0800 Subject: of/address: Introduce of_dma_get_max_cpu_address() To: , , , , , , , , , , , , , , , , , , , Cc: , , , , , , , , , Rob Herring Message-ID: <20210303073319.2215839-4-jingxiangfeng@huawei.com> From: Nicolas Saenz Julienne commit 964db79d6c186cc2ecc6ae46f98eed7e0ea8cf71 upstream Introduce of_dma_get_max_cpu_address(), which provides the highest CPU physical address addressable by all DMA masters in the system. It's specially useful for setting memory zones sizes at early boot time. Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Rob Herring Link: https://lore.kernel.org/r/20201119175400.9995-4-nsaenzjulienne@suse= .de Signed-off-by: Catalin Marinas Cc: Signed-off-by: Jing Xiangfeng Signed-off-by: Greg Kroah-Hartman --- drivers/of/address.c | 42 ++++++++++++++++++++++++++++++++++++++++++ include/linux/of.h | 7 +++++++ 2 files changed, 49 insertions(+) --- a/drivers/of/address.c +++ b/drivers/of/address.c @@ -1025,6 +1025,48 @@ out: #endif /* CONFIG_HAS_DMA */ =20 /** + * of_dma_get_max_cpu_address - Gets highest CPU address suitable for DM= A + * @np: The node to start searching from or NULL to start from the root + * + * Gets the highest CPU physical address that is addressable by all DMA = masters + * in the sub-tree pointed by np, or the whole tree if NULL is passed. I= f no + * DMA constrained device is found, it returns PHYS_ADDR_MAX. + */ +phys_addr_t __init of_dma_get_max_cpu_address(struct device_node *np) +{ + phys_addr_t max_cpu_addr =3D PHYS_ADDR_MAX; + struct of_range_parser parser; + phys_addr_t subtree_max_addr; + struct device_node *child; + struct of_range range; + const __be32 *ranges; + u64 cpu_end =3D 0; + int len; + + if (!np) + np =3D of_root; + + ranges =3D of_get_property(np, "dma-ranges", &len); + if (ranges && len) { + of_dma_range_parser_init(&parser, np); + for_each_of_range(&parser, &range) + if (range.cpu_addr + range.size > cpu_end) + cpu_end =3D range.cpu_addr + range.size - 1; + + if (max_cpu_addr > cpu_end) + max_cpu_addr =3D cpu_end; + } + + for_each_available_child_of_node(np, child) { + subtree_max_addr =3D of_dma_get_max_cpu_address(child); + if (max_cpu_addr > subtree_max_addr) + max_cpu_addr =3D subtree_max_addr; + } + + return max_cpu_addr; +} + +/** * of_dma_is_coherent - Check if device is coherent * @np: device node * --- a/include/linux/of.h +++ b/include/linux/of.h @@ -558,6 +558,8 @@ int of_map_id(struct device_node *np, u3 const char *map_name, const char *map_mask_name, struct device_node **target, u32 *id_out); =20 +phys_addr_t of_dma_get_max_cpu_address(struct device_node *np); + #else /* CONFIG_OF */ =20 static inline void of_core_init(void) @@ -995,6 +997,11 @@ static inline int of_map_id(struct devic return -EINVAL; } =20 +static inline phys_addr_t of_dma_get_max_cpu_address(struct device_node = *np) +{ + return PHYS_ADDR_MAX; +} + #define of_match_ptr(_ptr) NULL #define of_match_node(_matches, _node) NULL #endif /* CONFIG_OF */ 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