From patchwork Tue Apr 23 16:14:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 13640331 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BAA0AC4345F for ; Tue, 23 Apr 2024 16:14:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=CcZYbUeX1qJIHz6zkJuFF7gIVKdAV4K2lhBOC8ndsXA=; b=cBkG8gV3pBZigP P58QOccG4dPRIb0+hGGH0iJJZbJ2lMkwsdy8bnPUE+ZYNh6Koi3BrzCYHaAF6q06vzMdv7OPeDeBA JEUi986xmwvWeUR4QhzoisEBKGbPp7FjIwLm0tE/aJm23nGu2aZW34CVB4alN65in6atvfJWbuIvV 12T6pPxJC138lVW7wDrS1DQ55xiXhuLBfWV/yFDXPrySDbJaE5qoARm14Lqt87LRXeDuySyqdge/k gNBEPD8w4EDP8TOoqgKI3qaG6azymQKm6ky+cb4+ePS060YURRyJuT2r/fbJk4hN59F9v/sils29u ujUBSwChVO3ZyBYbtSFA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzIn6-00000000gXN-2pG4; Tue, 23 Apr 2024 16:14:44 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzIms-00000000gO2-1x3i for linux-arm-kernel@lists.infradead.org; Tue, 23 Apr 2024 16:14:34 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 57BDACE117E; Tue, 23 Apr 2024 16:14:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47E89C116B1; Tue, 23 Apr 2024 16:14:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713888866; bh=MF9MVVzEWCkDsJuADHSSNcmrmA+7PiShcDl8I7RBoxc=; h=From:To:Cc:Subject:Date:From; b=Rnp7POTRChNVWoSOXbUa2zBnh+rlPche521eDQGL2p8mhuvEiKZsZDk87UD5BXypF mmETVh4VNB5hs4LnXDXqUOAj8fbPCoOJfEl0vaDZZ0OSMuoIaOUgNa/XUOCVPw0K5s IylTEhSZ2UYn01X9oq9G3oP/rQq+qTXA74DlswQcH1omX9ZJ6O8xvdVswOMsStjDY9 FQWVZCIQnr6inXW4w6HRuC4mVd3pS5mU1YpsQMRuG6aeBVGml++KC9ccSOMPpsr2F1 UhHppXuYNw974WA5nHM9/5I1WQuEdGO3MdND7qsFreQrkfcnZ3OKUH6LkdaoITtz+N NJ19JgsfD8UjQ== From: "Rob Herring (Arm)" To: Sinan Kaya , Bjorn Andersson , Konrad Dybcio , Vinod Koul Cc: Dan Carpenter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] dmaengine: qcom: Drop hidma DT support Date: Tue, 23 Apr 2024 11:14:11 -0500 Message-ID: <20240423161413.481670-1-robh@kernel.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_091432_603895_A0ADB26E X-CRM114-Status: GOOD ( 21.54 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The DT support in hidma has been broken since commit 37fa4905d22a ("dmaengine: qcom_hidma: simplify DT resource parsing") in 2018. The issue is the of_address_to_resource() calls bail out on success rather than failure. This driver is for a defunct QCom server platform where DT use was limited to start with. As it seems no one has noticed the breakage, just remove the DT support altogether. Reported-by: Dan Carpenter Signed-off-by: Rob Herring (Arm) Reviewed-by: Konrad Dybcio Reviewed-by: Jeffrey Hugo --- drivers/dma/qcom/hidma.c | 11 ---- drivers/dma/qcom/hidma_mgmt.c | 109 +--------------------------------- 2 files changed, 1 insertion(+), 119 deletions(-) diff --git a/drivers/dma/qcom/hidma.c b/drivers/dma/qcom/hidma.c index 202ac95227cb..721b4ac0857a 100644 --- a/drivers/dma/qcom/hidma.c +++ b/drivers/dma/qcom/hidma.c @@ -50,7 +50,6 @@ #include #include #include -#include #include #include #include @@ -947,22 +946,12 @@ static const struct acpi_device_id hidma_acpi_ids[] = { MODULE_DEVICE_TABLE(acpi, hidma_acpi_ids); #endif -static const struct of_device_id hidma_match[] = { - {.compatible = "qcom,hidma-1.0",}, - {.compatible = "qcom,hidma-1.1", .data = (void *)(HIDMA_MSI_CAP),}, - {.compatible = "qcom,hidma-1.2", - .data = (void *)(HIDMA_MSI_CAP | HIDMA_IDENTITY_CAP),}, - {}, -}; -MODULE_DEVICE_TABLE(of, hidma_match); - static struct platform_driver hidma_driver = { .probe = hidma_probe, .remove_new = hidma_remove, .shutdown = hidma_shutdown, .driver = { .name = "hidma", - .of_match_table = hidma_match, .acpi_match_table = ACPI_PTR(hidma_acpi_ids), }, }; diff --git a/drivers/dma/qcom/hidma_mgmt.c b/drivers/dma/qcom/hidma_mgmt.c index 1d675f31252b..bb883e138ebf 100644 --- a/drivers/dma/qcom/hidma_mgmt.c +++ b/drivers/dma/qcom/hidma_mgmt.c @@ -7,12 +7,7 @@ #include #include -#include #include -#include -#include -#include -#include #include #include #include @@ -327,115 +322,13 @@ static const struct acpi_device_id hidma_mgmt_acpi_ids[] = { MODULE_DEVICE_TABLE(acpi, hidma_mgmt_acpi_ids); #endif -static const struct of_device_id hidma_mgmt_match[] = { - {.compatible = "qcom,hidma-mgmt-1.0",}, - {}, -}; -MODULE_DEVICE_TABLE(of, hidma_mgmt_match); - static struct platform_driver hidma_mgmt_driver = { .probe = hidma_mgmt_probe, .driver = { .name = "hidma-mgmt", - .of_match_table = hidma_mgmt_match, .acpi_match_table = ACPI_PTR(hidma_mgmt_acpi_ids), }, }; -#if defined(CONFIG_OF) && defined(CONFIG_OF_IRQ) -static int object_counter; - -static int __init hidma_mgmt_of_populate_channels(struct device_node *np) -{ - struct platform_device *pdev_parent = of_find_device_by_node(np); - struct platform_device_info pdevinfo; - struct device_node *child; - struct resource *res; - int ret = 0; - - /* allocate a resource array */ - res = kcalloc(3, sizeof(*res), GFP_KERNEL); - if (!res) - return -ENOMEM; - - for_each_available_child_of_node(np, child) { - struct platform_device *new_pdev; - - ret = of_address_to_resource(child, 0, &res[0]); - if (!ret) - goto out; - - ret = of_address_to_resource(child, 1, &res[1]); - if (!ret) - goto out; - - ret = of_irq_to_resource(child, 0, &res[2]); - if (ret <= 0) - goto out; - - memset(&pdevinfo, 0, sizeof(pdevinfo)); - pdevinfo.fwnode = &child->fwnode; - pdevinfo.parent = pdev_parent ? &pdev_parent->dev : NULL; - pdevinfo.name = child->name; - pdevinfo.id = object_counter++; - pdevinfo.res = res; - pdevinfo.num_res = 3; - pdevinfo.data = NULL; - pdevinfo.size_data = 0; - pdevinfo.dma_mask = DMA_BIT_MASK(64); - new_pdev = platform_device_register_full(&pdevinfo); - if (IS_ERR(new_pdev)) { - ret = PTR_ERR(new_pdev); - goto out; - } - new_pdev->dev.of_node = child; - of_dma_configure(&new_pdev->dev, child, true); - /* - * It is assumed that calling of_msi_configure is safe on - * platforms with or without MSI support. - */ - of_msi_configure(&new_pdev->dev, child); - } - - kfree(res); - - return ret; - -out: - of_node_put(child); - kfree(res); - - return ret; -} -#endif - -static int __init hidma_mgmt_init(void) -{ -#if defined(CONFIG_OF) && defined(CONFIG_OF_IRQ) - struct device_node *child; - - for_each_matching_node(child, hidma_mgmt_match) { - /* device tree based firmware here */ - hidma_mgmt_of_populate_channels(child); - } -#endif - /* - * We do not check for return value here, as it is assumed that - * platform_driver_register must not fail. The reason for this is that - * the (potential) hidma_mgmt_of_populate_channels calls above are not - * cleaned up if it does fail, and to do this work is quite - * complicated. In particular, various calls of of_address_to_resource, - * of_irq_to_resource, platform_device_register_full, of_dma_configure, - * and of_msi_configure which then call other functions and so on, must - * be cleaned up - this is not a trivial exercise. - * - * Currently, this module is not intended to be unloaded, and there is - * no module_exit function defined which does the needed cleanup. For - * this reason, we have to assume success here. - */ - platform_driver_register(&hidma_mgmt_driver); - - return 0; -} -module_init(hidma_mgmt_init); +module_platform_driver(hidma_mgmt_driver); MODULE_LICENSE("GPL v2"); From patchwork Tue Apr 23 16:14:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 13640332 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 88377C10F1A for ; Tue, 23 Apr 2024 16:15:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Cnmuo2jDXvfZtiLB1aYXk+C3b8hM1+CWy+kLzc3V3KE=; b=1OXWgxx4NqOzp1 4GYRKVbsXkEuOYX9CtroINN473RkpfaR7UYM8/LDyIPhri7v8V3gy1aHHrSWzulloGUaWnBEOVkLG /j8xoKuX4senku+3Y80UUaWmpWaWTlc8sBaWq7REm89MbJX9dQ4/a9iqG1OJgGYB/qlX3Kx3/K1Ys +vNFWU9uF1iTEQjL7jP+1NLhciy71hWsGMP2PTSZBoldTIJjkwz3DE5Xp6HWqs8QR7F86YCC0WJM+ fwh3M9VmLjaNkUbf2dqY36H6lQ2I2+RkVty8TKcFA26ggItoLIVmRaVqkuFIiJLKEbSGC8D09OX+7 MwXuPSaWKMIVLOewb27A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzInU-00000000gjh-0lTQ; Tue, 23 Apr 2024 16:15:08 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzInQ-00000000ggw-3AtS for linux-arm-kernel@lists.infradead.org; Tue, 23 Apr 2024 16:15:06 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id ADAD3CE0E12; Tue, 23 Apr 2024 16:14:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADA4DC116B1; Tue, 23 Apr 2024 16:14:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713888898; bh=t7XLkcm58+fVaHmvoGJBrl7ku5VBGktXbbg2zBpZuc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pg4DuW3RNJCx0k8isuY+Ww1E+jHZuB8iSnEvLhywPSku0gOCtXY+EiNIimYtjcHyb czaYkSR80eGrk3Gir/VJZw6eLCXDEGuDsfk3hUp/YJQCQoPCgCTixRfd+RCBtvKUy0 NVlvAlwVCLOSwJyTxKriGkPfgSZ4xpFvVfIqqnt9cfwkq84eJuxaRdTaHWVxV4WSFM 95bmMcyDqNaq0EPKZZgPS9fb+MLJXEGN76oVZeu0ilgwflUtvMhEaWBtVZw0/Z6RX/ uWz7868bxHwjmKEmotlqb9vHKR9la8g6bsorfYZA49AkyX2g6DEa/dnzpEa8JBmiyp o0s+c5pz3u0TA== From: "Rob Herring (Arm)" To: Sinan Kaya , Bjorn Andersson , Konrad Dybcio , Vinod Koul , Krzysztof Kozlowski , Conor Dooley Cc: Dan Carpenter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] dt-bindings: dma: Drop unused QCom hidma binding Date: Tue, 23 Apr 2024 11:14:12 -0500 Message-ID: <20240423161413.481670-2-robh@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240423161413.481670-1-robh@kernel.org> References: <20240423161413.481670-1-robh@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_091505_217396_4D26BB91 X-CRM114-Status: GOOD ( 16.23 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The QCom hidma binding was used on a defunct QCom server platform which mainly used ACPI. DT support in the Linux driver has been broken since 2018, so it seems this binding is unused and can be dropped. Signed-off-by: Rob Herring (Arm) Acked-by: Konrad Dybcio Reviewed-by: Jeffrey Hugo --- .../bindings/dma/qcom_hidma_mgmt.txt | 95 ------------------- 1 file changed, 95 deletions(-) delete mode 100644 Documentation/devicetree/bindings/dma/qcom_hidma_mgmt.txt diff --git a/Documentation/devicetree/bindings/dma/qcom_hidma_mgmt.txt b/Documentation/devicetree/bindings/dma/qcom_hidma_mgmt.txt deleted file mode 100644 index 1ae4748730a8..000000000000 --- a/Documentation/devicetree/bindings/dma/qcom_hidma_mgmt.txt +++ /dev/null @@ -1,95 +0,0 @@ -Qualcomm Technologies HIDMA Management interface - -Qualcomm Technologies HIDMA is a high speed DMA device. It only supports -memcpy and memset capabilities. It has been designed for virtualized -environments. - -Each HIDMA HW instance consists of multiple DMA channels. These channels -share the same bandwidth. The bandwidth utilization can be partitioned -among channels based on the priority and weight assignments. - -There are only two priority levels and 15 weigh assignments possible. - -Other parameters here determine how much of the system bus this HIDMA -instance can use like maximum read/write request and number of bytes to -read/write in a single burst. - -Main node required properties: -- compatible: "qcom,hidma-mgmt-1.0"; -- reg: Address range for DMA device -- dma-channels: Number of channels supported by this DMA controller. -- max-write-burst-bytes: Maximum write burst in bytes that HIDMA can - occupy the bus for in a single transaction. A memcpy requested is - fragmented to multiples of this amount. This parameter is used while - writing into destination memory. Setting this value incorrectly can - starve other peripherals in the system. -- max-read-burst-bytes: Maximum read burst in bytes that HIDMA can - occupy the bus for in a single transaction. A memcpy request is - fragmented to multiples of this amount. This parameter is used while - reading the source memory. Setting this value incorrectly can starve - other peripherals in the system. -- max-write-transactions: This value is how many times a write burst is - applied back to back while writing to the destination before yielding - the bus. -- max-read-transactions: This value is how many times a read burst is - applied back to back while reading the source before yielding the bus. -- channel-reset-timeout-cycles: Channel reset timeout in cycles for this SOC. - Once a reset is applied to the HW, HW starts a timer for reset operation - to confirm. If reset is not completed within this time, HW reports reset - failure. - -Sub-nodes: - -HIDMA has one or more DMA channels that are used to move data from one -memory location to another. - -When the OS is not in control of the management interface (i.e. it's a guest), -the channel nodes appear on their own, not under a management node. - -Required properties: -- compatible: must contain "qcom,hidma-1.0" for initial HW or - "qcom,hidma-1.1"/"qcom,hidma-1.2" for MSI capable HW. -- reg: Addresses for the transfer and event channel -- interrupts: Should contain the event interrupt -- desc-count: Number of asynchronous requests this channel can handle -- iommus: required a iommu node - -Optional properties for MSI: -- msi-parent : See the generic MSI binding described in - devicetree/bindings/interrupt-controller/msi.txt for a description of the - msi-parent property. - -Example: - -Hypervisor OS configuration: - - hidma-mgmt@f9984000 = { - compatible = "qcom,hidma-mgmt-1.0"; - reg = <0xf9984000 0x15000>; - dma-channels = <6>; - max-write-burst-bytes = <1024>; - max-read-burst-bytes = <1024>; - max-write-transactions = <31>; - max-read-transactions = <31>; - channel-reset-timeout-cycles = <0x500>; - - hidma_24: dma-controller@5c050000 { - compatible = "qcom,hidma-1.0"; - reg = <0 0x5c050000 0x0 0x1000>, - <0 0x5c0b0000 0x0 0x1000>; - interrupts = <0 389 0>; - desc-count = <10>; - iommus = <&system_mmu>; - }; - }; - -Guest OS configuration: - - hidma_24: dma-controller@5c050000 { - compatible = "qcom,hidma-1.0"; - reg = <0 0x5c050000 0x0 0x1000>, - <0 0x5c0b0000 0x0 0x1000>; - interrupts = <0 389 0>; - desc-count = <10>; - iommus = <&system_mmu>; - };