From patchwork Mon Jun 17 10:03:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13700467 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2047.outbound.protection.outlook.com [40.107.244.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EE6318FDAE for ; Mon, 17 Jun 2024 10:04:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718618681; cv=fail; b=sbTbAoh0OIuChe8F76SRxYn4fbg0kLLGWreTmiV2iT5FCYCB6oVB7/KGdoJkeZ7GbxEtjR+Xs5V4LtK8bPKwHgSWtkmknAcMiJT9nR+3XEQBT2dzwIuQej/Od13HzgznHonXs+QtjnJmK5WNwpSpPMkQrukAeA0jG5nlzeFvcX0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718618681; c=relaxed/simple; bh=FReLNjKDrIKMcjD3rH+iuacICf1uyTTymYJGZ9gzFVY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LdczOoJbd5FXzuzNbt3KsClNOxeagI8QpQo30rPpsjf1YMF4eUquh4v1waJeF+/5vSzq77GsX0V+Ujf/oNErTSso3c+ElRuKKz525LiOb/sMHC43fSOQRNI6Yy6pgtcQXY2PalKR588gqCdxOyS9quA/xn2va7CaqXxmqYACQ7g= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=5U6uT2Bu; arc=fail smtp.client-ip=40.107.244.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="5U6uT2Bu" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JZmSo3y98Ox5J2yG95S8TNvuWHY9wbsTRliZhlTpZ3B630NFi8YD+GEqnOUIos0Ufpefmq6UjmKn+mAd7U1ed61g2V6bvMGCHlgRCiZIZ4gqdV2+EwdUPvSK4WsaHTaWe5cOxIrxay8DH4qtcHKmRRrdMD2+B9mRNDjflCig6hcRgh5B0c56fDxGgLjqOLXKYuAaP78B1PVqSpQJtkmEKyuaHdr0EPj/y1/gczSCgHBcU+Muo3IxJczzAedflSjnNcEXdx4U/pcTGeR3BjwTxad9BkPe/lQ5fs5DtKLBs6wSMvbUWbgGgZC3okEffBDzCKwN3tJTdf4FZdX8pZHguA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cqHHpNafa3pV0IaSbdtF6gDz0atdqid9p4eg5mEQxXU=; b=aNzXW944bw4MVe/bh1fVQCfAbCrdmUCdeiPFUBC3MirYSCh1qEhv9ANhIkuAvrVgwEV0zlWsk5CnR2Tk/gwU9quQLeOWkdh2qpCKmi7HDxeHB+2ZGP2Ym2/2Cb/sT9YUOru6hOOS+vZ6kbJdLPVeIuDEOCClLhwNrHUk6ALW/fQMR12Ue+BGvQnJ2eXDrbAmKBtHEcopdpX+n/+RSAUpDO4MLVcz8G9yygMN2UufnU2OhYd1STJTE+zV/1fUNtan52ohhpCdQc2BuVmmKbUIyJgRxweWPNswacxd0oL5Ket1lmr/HmYkKgpwfntMIv/kxj4M271EnHTOmLYwjf/jsw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cqHHpNafa3pV0IaSbdtF6gDz0atdqid9p4eg5mEQxXU=; b=5U6uT2BuE8GNaWwUwl62jPxMog83x4+sTkjY1hvNUrWcF9bNShZ4yiuuu80as3PlBjGEhDDoGMblccEoSiCo8XPa34weLqCSXO8n97A73K258yCDdSE1AUawUVbCinp6OwVFDprWUMncqxNrwm1NLDACCCnx9s3yZtMab5+d1A0= Received: from BN9PR03CA0180.namprd03.prod.outlook.com (2603:10b6:408:f4::35) by PH7PR12MB9174.namprd12.prod.outlook.com (2603:10b6:510:2ed::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 10:04:37 +0000 Received: from BN3PEPF0000B36F.namprd21.prod.outlook.com (2603:10b6:408:f4:cafe::d8) by BN9PR03CA0180.outlook.office365.com (2603:10b6:408:f4::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30 via Frontend Transport; Mon, 17 Jun 2024 10:04:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN3PEPF0000B36F.mail.protection.outlook.com (10.167.243.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7719.0 via Frontend Transport; Mon, 17 Jun 2024 10:04:36 +0000 Received: from jatayu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 17 Jun 2024 05:04:34 -0500 From: Basavaraj Natikar To: , CC: , , Basavaraj Natikar Subject: [PATCH v2 1/7] dmaengine: Move AMD DMA driver to separate directory Date: Mon, 17 Jun 2024 15:33:53 +0530 Message-ID: <20240617100359.2550541-2-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240617100359.2550541-1-Basavaraj.Natikar@amd.com> References: <20240617100359.2550541-1-Basavaraj.Natikar@amd.com> Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B36F:EE_|PH7PR12MB9174:EE_ X-MS-Office365-Filtering-Correlation-Id: 968518b7-5388-4f68-6186-08dc8eb4e51c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|82310400023|1800799021|36860700010; X-Microsoft-Antispam-Message-Info: ZA7cE6fRjtRMsZSFiwiOc3fR0hn8Yh339ElbzCv1MLewLKgvpMgvHKBdJmBwwRkqAi0p7xqHp7+kxqmpHOCPVCzz4vqA0PKMKe1gWE8KwO9Q+q4x1W0EdP9rtl/0Cx8gT6I90eaqee4O334uZIdrBjMg6SfE8xW33+HOBWjX4e6+f52mD+MulFmfYVtuEpgvK8MLDHPqDHTL5C334p32rU26E7h+C1z4f4+2VE4ta6o0sOHO+ef3bZdc8qVs2DLu5nCctyuhSpItya+HKFdiBKyrXpxjHH8/bg7JsBMh9u2prH/PwuOLyCA7py9EK45DjUgnYG57G9WVy2sNa8/XZnsiocikllyr+eOZNo9lLlaalMXmxLQD4QlZB3UI1X/6jA5zEJYSepD9saAVDmWdkg69RYs5saefxJ+JJdWzP/L+gyv1YejRZrz7507QBpxeg81VKW4tcaKVJbF6M16szYqH46JvXQtqb98q09FiHQYt1Q/X9VmIqoI/gN/Avyjjvs/5yOlik1RSYeoePUCwPJsH53BfEfoCtD+Qk5eQjhB3vvGcBW/z140I/hHxvkgUsdg9S+7aKozB6dpP/SR1WVnJZxwbQiS7zztMu3wjvkVzecH0FOSZgC40VZjIMbDMD2TCO//fTuCE72l0o59co3HL53Ej07DxL5HabvYrnQBjP9xKDX+yLqSMWxKesbk5jm3i0yYbyCzQxaBscP9E6LMwOGvKGe60VReDBExAnFBnM/PqUB2qWURc9C6EqImpArkNbGoClYBjhivJN5NmJfrrNYXLTz4uZr8wW2U9cBKIu71hTIlt0tlGBUz7l2vUmwGhfiQkTbcZCatXVVma57pvu2V7fxrSCYZNNc8Cp8mJCl9bww74z0IfdPWLzZBsa52xgZwUlSM3iWMDG/XmOrryQwc2jgGPc1gpb445nZHYI84UeEuTCTJQkppSU3olH8YZoStjyagFDZwcPC0yTtWhE2aAs8A5qgXWubaWo1SBl9D775Dracmi2VpGCbkuCqKkDOLRSDGo7mT3FIuerHV+1vaeYlknfPLA3+mD9PCQydVx9s9Ym5ZOhpDnF1NLrxhUwGtmMKShYRc3Rf617olGKXkl5ulTw9nQ51367NHhZDQJBtK8G59swVfYZVajLOGFJZo8p7keHM4X5aqRlE61KtqPFSk9XlEnCRu94SEWTRCwChtANf9rTpipn6LtdrvxTwxHHAOf/YHdxSDrkzIcQE2jn/A9LxPT2xTV89MA+n3BM7xAl6c9P+3cp8kwhArKNwVUCp/mtI1ULZXg5ftnuLLG6WmKSMpvR9eDibTkU6IQfHrEW+hfHgDMDqJYmWX8DY4rZacIFi8+RoFfKC/OQHvq2IfOt9+5SMlhP0A= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230037)(376011)(82310400023)(1800799021)(36860700010);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 10:04:36.8242 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 968518b7-5388-4f68-6186-08dc8eb4e51c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN3PEPF0000B36F.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB9174 Currently, AMD PTDMA driver is single DMA driver supported and newer AMD platforms supports newer DMA engine. Hence move the current drivers to separate directory. This would also mean the newer driver submissions to AMD DMA driver in the future will also land in AMD specific directory. Reviewed-by: Raju Rangoju Signed-off-by: Basavaraj Natikar --- MAINTAINERS | 2 +- drivers/dma/Kconfig | 4 ++-- drivers/dma/Makefile | 2 +- drivers/dma/amd/Kconfig | 5 +++++ drivers/dma/amd/Makefile | 6 ++++++ drivers/dma/{ => amd}/ptdma/Kconfig | 0 drivers/dma/{ => amd}/ptdma/Makefile | 0 drivers/dma/{ => amd}/ptdma/ptdma-debugfs.c | 0 drivers/dma/{ => amd}/ptdma/ptdma-dev.c | 0 drivers/dma/{ => amd}/ptdma/ptdma-dmaengine.c | 3 +-- drivers/dma/{ => amd}/ptdma/ptdma-pci.c | 0 drivers/dma/{ => amd}/ptdma/ptdma.h | 2 +- 12 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 drivers/dma/amd/Kconfig create mode 100644 drivers/dma/amd/Makefile rename drivers/dma/{ => amd}/ptdma/Kconfig (100%) rename drivers/dma/{ => amd}/ptdma/Makefile (100%) rename drivers/dma/{ => amd}/ptdma/ptdma-debugfs.c (100%) rename drivers/dma/{ => amd}/ptdma/ptdma-dev.c (100%) rename drivers/dma/{ => amd}/ptdma/ptdma-dmaengine.c (99%) rename drivers/dma/{ => amd}/ptdma/ptdma-pci.c (100%) rename drivers/dma/{ => amd}/ptdma/ptdma.h (99%) diff --git a/MAINTAINERS b/MAINTAINERS index cf9c9221c388..c500c0567779 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1113,7 +1113,7 @@ AMD PTDMA DRIVER M: Basavaraj Natikar L: dmaengine@vger.kernel.org S: Maintained -F: drivers/dma/ptdma/ +F: drivers/dma/amd/ptdma/ AMD SEATTLE DEVICE TREE SUPPORT M: Suravee Suthikulpanit diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index 002a5ec80620..ac6e9d3828b7 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig @@ -752,8 +752,6 @@ source "drivers/dma/bestcomm/Kconfig" source "drivers/dma/mediatek/Kconfig" -source "drivers/dma/ptdma/Kconfig" - source "drivers/dma/qcom/Kconfig" source "drivers/dma/dw/Kconfig" @@ -772,6 +770,8 @@ source "drivers/dma/fsl-dpaa2-qdma/Kconfig" source "drivers/dma/lgm/Kconfig" +source "drivers/dma/amd/Kconfig" + # clients comment "DMA Clients" depends on DMA_ENGINE diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile index 802ca916f05f..c59948a0dc7c 100644 --- a/drivers/dma/Makefile +++ b/drivers/dma/Makefile @@ -16,7 +16,7 @@ obj-$(CONFIG_DMATEST) += dmatest.o obj-$(CONFIG_ALTERA_MSGDMA) += altera-msgdma.o obj-$(CONFIG_AMBA_PL08X) += amba-pl08x.o obj-$(CONFIG_AMCC_PPC440SPE_ADMA) += ppc4xx/ -obj-$(CONFIG_AMD_PTDMA) += ptdma/ +obj-y += amd/ obj-$(CONFIG_APPLE_ADMAC) += apple-admac.o obj-$(CONFIG_AT_HDMAC) += at_hdmac.o obj-$(CONFIG_AT_XDMAC) += at_xdmac.o diff --git a/drivers/dma/amd/Kconfig b/drivers/dma/amd/Kconfig new file mode 100644 index 000000000000..8246b463bcf7 --- /dev/null +++ b/drivers/dma/amd/Kconfig @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# AMD DMA Drivers + +source "drivers/dma/amd/ptdma/Kconfig" diff --git a/drivers/dma/amd/Makefile b/drivers/dma/amd/Makefile new file mode 100644 index 000000000000..dd7257ba7e06 --- /dev/null +++ b/drivers/dma/amd/Makefile @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# AMD DMA drivers +# + +obj-$(CONFIG_AMD_PTDMA) += ptdma/ diff --git a/drivers/dma/ptdma/Kconfig b/drivers/dma/amd/ptdma/Kconfig similarity index 100% rename from drivers/dma/ptdma/Kconfig rename to drivers/dma/amd/ptdma/Kconfig diff --git a/drivers/dma/ptdma/Makefile b/drivers/dma/amd/ptdma/Makefile similarity index 100% rename from drivers/dma/ptdma/Makefile rename to drivers/dma/amd/ptdma/Makefile diff --git a/drivers/dma/ptdma/ptdma-debugfs.c b/drivers/dma/amd/ptdma/ptdma-debugfs.c similarity index 100% rename from drivers/dma/ptdma/ptdma-debugfs.c rename to drivers/dma/amd/ptdma/ptdma-debugfs.c diff --git a/drivers/dma/ptdma/ptdma-dev.c b/drivers/dma/amd/ptdma/ptdma-dev.c similarity index 100% rename from drivers/dma/ptdma/ptdma-dev.c rename to drivers/dma/amd/ptdma/ptdma-dev.c diff --git a/drivers/dma/ptdma/ptdma-dmaengine.c b/drivers/dma/amd/ptdma/ptdma-dmaengine.c similarity index 99% rename from drivers/dma/ptdma/ptdma-dmaengine.c rename to drivers/dma/amd/ptdma/ptdma-dmaengine.c index f79240734807..a2e7c2cec15e 100644 --- a/drivers/dma/ptdma/ptdma-dmaengine.c +++ b/drivers/dma/amd/ptdma/ptdma-dmaengine.c @@ -10,8 +10,7 @@ */ #include "ptdma.h" -#include "../dmaengine.h" -#include "../virt-dma.h" +#include "../../dmaengine.h" static inline struct pt_dma_chan *to_pt_chan(struct dma_chan *dma_chan) { diff --git a/drivers/dma/ptdma/ptdma-pci.c b/drivers/dma/amd/ptdma/ptdma-pci.c similarity index 100% rename from drivers/dma/ptdma/ptdma-pci.c rename to drivers/dma/amd/ptdma/ptdma-pci.c diff --git a/drivers/dma/ptdma/ptdma.h b/drivers/dma/amd/ptdma/ptdma.h similarity index 99% rename from drivers/dma/ptdma/ptdma.h rename to drivers/dma/amd/ptdma/ptdma.h index 21b4bf895200..2690a32fc7cb 100644 --- a/drivers/dma/ptdma/ptdma.h +++ b/drivers/dma/amd/ptdma/ptdma.h @@ -22,7 +22,7 @@ #include #include -#include "../virt-dma.h" +#include "../../virt-dma.h" #define MAX_PT_NAME_LEN 16 #define MAX_DMAPOOL_NAME_LEN 32 From patchwork Mon Jun 17 10:03:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13700469 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2088.outbound.protection.outlook.com [40.107.236.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 193C118FDAE for ; Mon, 17 Jun 2024 10:04:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.88 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718618689; cv=fail; b=uXNpm/ndzTdZmwXm+kB+w44b7o3frn4q5prjEbp+/v8kPB4btcA1bU06/2T+jl+LzH4ckgPuy+31o5bi++crCiGdvg+FA/0uWBecwgIFbjnOVJcwAsRzpSeNkuQeM0+VVjcbeRMOXQJC0ywYK+hh38OdvxUTdC+z2AqcVuG4jGw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718618689; c=relaxed/simple; bh=bTI5OdQwXuD7jcouNu4rR0QyYag2F+br2RVgko+KQJw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rFUAbH3qn97ZGSbcVL2sY3oNu5zNSqoHUiOJRgwlwqEku1ZqY3MUoVYCeJd6vf01Uah+u1C2cEy7fqRkcJLTNhZvRVBgVXY95F29t4vCoDstccyxUTOfNa6O0t0jWJ96Dz/smAyKSy8+VEtUNn9q6UxcGskvOZp33hoNoSP/a88= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=cEdD9cNo; arc=fail smtp.client-ip=40.107.236.88 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="cEdD9cNo" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OgG8ejEJ+rqYwcALDsZ858J1ObJJFHIyQdlE5KdoflLV0hbQOrfn4xE1hbE90fzsS2L9X7y+FvsFeECNTPWgi350+R39FgcsPv7DoXLVyAzD02FfplEUoJyX1NySW4zx9OeFSvKeV3Gt9wMDFmADKRDE+u5WWLPKpyegVwD34FEna1bRDTCtrt9c5gVrJcdCQFNDOXpelJ++fPQ9fwQP2zawwYjE/YopzH5mI15iD5H9CK7je53ylvUA18qjaV9vItzzU5Ln6OIcieI+YgtqTengeYBsuTWHDBPy3rDkNpY8q4aVrwLILdD8yettM44ckLzsm75vLF4wviXXQp2j3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LRYm/CPfZXzSFmvHYVr51zHvI4V4z9hRELOZcG9CGaQ=; b=AK7XRrkLBGhn3KqzhXt0bIFDWvdWJjJJEi7Pgzr8EtyY7tyRQqFT+v9Q9GnIijAzcxqYFuNUjpaT0qgPgkEb0eisJ40LuQ2tWgvHJNlo3xi9dZZRiz1tgAnMt1ALz17nAQuXuIxJJ/GHsiM2mT/2hyDiXkGNH/uEOwR+tPp2lUVKBRgO4gdGJFBb/FPeNS9NeAa1hxFTQctOm9qnWClMul46CQJlE7uFA1OpvD5/ZXCZSizZPkNl0SGU/tHtlNPCSlZdXYZ1A9xOPFbzo/tk+CYJDn540sK3x2gA067H/iSh6mxxnhyTPXeMR8s4FIQ1svwmMTA3WdY3or0n1IAHhw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LRYm/CPfZXzSFmvHYVr51zHvI4V4z9hRELOZcG9CGaQ=; b=cEdD9cNoBAWzJYRh/lzzG79L6esaqzobp0HPbBj4uVGBQVT+jHANySYaax1KgMONA6CJsMOXvadMthNwD8PTjhP9ZfRPYLY5vCZkirUJEuighlwbQTYpIDQWyj0DQ3+b0EB1wpkv/7kQZ7ZDvHD39jZLcr2rQzx3pPxeyjVpHkQ= Received: from BL1P223CA0017.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:2c4::22) by BL1PR12MB5874.namprd12.prod.outlook.com (2603:10b6:208:396::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 10:04:42 +0000 Received: from BN3PEPF0000B371.namprd21.prod.outlook.com (2603:10b6:208:2c4:cafe::c4) by BL1P223CA0017.outlook.office365.com (2603:10b6:208:2c4::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31 via Frontend Transport; Mon, 17 Jun 2024 10:04:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN3PEPF0000B371.mail.protection.outlook.com (10.167.243.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7719.0 via Frontend Transport; Mon, 17 Jun 2024 10:04:41 +0000 Received: from jatayu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 17 Jun 2024 05:04:36 -0500 From: Basavaraj Natikar To: , CC: , , Basavaraj Natikar Subject: [PATCH v2 2/7] dmaengine: ae4dma: Add AMD ae4dma controller driver Date: Mon, 17 Jun 2024 15:33:54 +0530 Message-ID: <20240617100359.2550541-3-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240617100359.2550541-1-Basavaraj.Natikar@amd.com> References: <20240617100359.2550541-1-Basavaraj.Natikar@amd.com> Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B371:EE_|BL1PR12MB5874:EE_ X-MS-Office365-Filtering-Correlation-Id: 7ce57dc4-7913-4028-3c83-08dc8eb4e82c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|36860700010|82310400023|1800799021; X-Microsoft-Antispam-Message-Info: aueH9IiS3ZyJ+ZN6T+HZZmYf1TRLf6OhkDVsNZytebPPcXOcp1UbiAlT1G6hd+sMb+liY0/bKYYH76m93MLHYnQ+zFZJHFIh+N1j2OiEE4cm1Hnz0XR/ftOqMEhUJVyvXHE1OODLvMcmHdQuzH3hjffJp9vJStYRfxrxtcfGrpGm4xdwY9b26Qk5Ywwdz/aj0PzfY6H+FsPoCJUJCb5Gm7Yn7DtZaJreRPNprDzXLaT3ibYhqmfh1wmZYwvQePx/MYdz3Jc688jj1znW90hoskUMGUV7JvLbqu1N4NNtYBhCdolyNQ9A21ZnQUZrhXNDXT2Pv9WifXg2sqK0X/xKslgkUkt04zve7YgqZ7fyFsSiv9BazompzPe7f3eLArZxmbO2amO61NnujnnoM4m3ZxeZ1poJ/BlloVFXbMoTiF4tAoY61D3VTJWZR7TLH8nSMYTpzyxNezN/EBnoHR+Om6PNYxKzDlFHmKvsERyhQXJAPsfQNJqjmdA/s+p2tgkU42JDpr9+DOrF2KO/T38SKujvfRbss4nrWwPrKwRthdCRDIuuNkPpoC6Kpqw3IH3eyEDc2/U0pfsbWpaqIqaIm/PnPLeRRmpx0QfLVyhzu9ytoUyW5tpzYfmNXhT4xXUjJKq8UHMX9fwbmzT6VVQklXp3s2m8o5C3o/MGVXLybNj+/g5hknPkSIRBL9IgXFuLUt/mwiU70EgKlKZwZXk/nXyQwDsvjl8Y5U4j/tXFBDMcHgsjJXB9oTpfaocMP1VkTb5DVr9RIfWTRulTWryBs/7MD53m5jOn7rttf9TDU5XVmqymwQikH0cXXX905Z4ty9YNs5PqStq9EJzIpj4aRu3XdyLrHQbc8b0LMEo5bxHBMfhFAK0Q85j4bFOg8gkjXBtxJPed1KIqioXwMbYc79zQ8QbJGLKsyg3DeaG0Xg5yINSu1zP95PsPDjePe2ZC9oKNW9vCKvnxgZtBmOsK6nDzRO+rmnVJwm5CT1DtdWxLud+zHqy8z9l81pMlWEdgISlWDqPezs5JAxG26eROH0IBmNG7eP9sLDIAYW3v1IDVC8bz/m3zptPe81RBNTKbbHhq0WTWR2Xymg37qPrQvZkUmwEOd065CCH2C5DBmHY+/0mDLo0XlUJH3+aQka912XXe4K76WO1rtQICssBQscwnR8uyZLVQdGAje2s5Rhno76RP+RJTepBuQLLw8X5Z5K1eI06tXM71EM0+p8Wr9cfWWfpSdV8X2J4liZEplOO7H1tIeJnPiuxkNKY2seIjRvL4ah5JvEprCjvMO6Aii1qDMinJStxQBvyFXsq5JMxUosGiKxYR93PucTwFkb3CvznwDe/fUJdMt18jbb+eBtTg4cmsxuYA8gQwB/5dIqjv5MqKn3SaF/d0LPu3ilAWWv/kMMtruV2THLG3UmrX2g== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230037)(376011)(36860700010)(82310400023)(1800799021);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 10:04:41.9457 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7ce57dc4-7913-4028-3c83-08dc8eb4e82c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN3PEPF0000B371.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5874 Add support for AMD AE4DMA controller. It performs high-bandwidth memory to memory and IO copy operation. Device commands are managed via a circular queue of 'descriptors', each of which specifies source and destination addresses for copying a single buffer of data. Reviewed-by: Raju Rangoju Signed-off-by: Basavaraj Natikar --- MAINTAINERS | 6 + drivers/dma/amd/Kconfig | 1 + drivers/dma/amd/Makefile | 1 + drivers/dma/amd/ae4dma/Kconfig | 13 ++ drivers/dma/amd/ae4dma/Makefile | 10 ++ drivers/dma/amd/ae4dma/ae4dma-dev.c | 206 ++++++++++++++++++++++++++++ drivers/dma/amd/ae4dma/ae4dma-pci.c | 190 +++++++++++++++++++++++++ drivers/dma/amd/ae4dma/ae4dma.h | 77 +++++++++++ drivers/dma/amd/common/amd_dma.h | 26 ++++ 9 files changed, 530 insertions(+) create mode 100644 drivers/dma/amd/ae4dma/Kconfig create mode 100644 drivers/dma/amd/ae4dma/Makefile create mode 100644 drivers/dma/amd/ae4dma/ae4dma-dev.c create mode 100644 drivers/dma/amd/ae4dma/ae4dma-pci.c create mode 100644 drivers/dma/amd/ae4dma/ae4dma.h create mode 100644 drivers/dma/amd/common/amd_dma.h diff --git a/MAINTAINERS b/MAINTAINERS index c500c0567779..0d222d1ca83f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -947,6 +947,12 @@ L: linux-edac@vger.kernel.org S: Supported F: drivers/ras/amd/atl/* +AMD AE4DMA DRIVER +M: Basavaraj Natikar +L: dmaengine@vger.kernel.org +S: Maintained +F: drivers/dma/amd/ae4dma/ + AMD AXI W1 DRIVER M: Kris Chaplin R: Thomas Delev diff --git a/drivers/dma/amd/Kconfig b/drivers/dma/amd/Kconfig index 8246b463bcf7..8c25a3ed6b94 100644 --- a/drivers/dma/amd/Kconfig +++ b/drivers/dma/amd/Kconfig @@ -3,3 +3,4 @@ # AMD DMA Drivers source "drivers/dma/amd/ptdma/Kconfig" +source "drivers/dma/amd/ae4dma/Kconfig" diff --git a/drivers/dma/amd/Makefile b/drivers/dma/amd/Makefile index dd7257ba7e06..8049b06a9ff5 100644 --- a/drivers/dma/amd/Makefile +++ b/drivers/dma/amd/Makefile @@ -4,3 +4,4 @@ # obj-$(CONFIG_AMD_PTDMA) += ptdma/ +obj-$(CONFIG_AMD_AE4DMA) += ae4dma/ diff --git a/drivers/dma/amd/ae4dma/Kconfig b/drivers/dma/amd/ae4dma/Kconfig new file mode 100644 index 000000000000..cf8db4dac98d --- /dev/null +++ b/drivers/dma/amd/ae4dma/Kconfig @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0 +config AMD_AE4DMA + tristate "AMD AE4DMA Engine" + depends on X86_64 && PCI + select DMA_ENGINE + select DMA_VIRTUAL_CHANNELS + help + Enable support for the AMD AE4DMA controller. This controller + provides DMA capabilities to perform high bandwidth memory to + memory and IO copy operations. It performs DMA transfer through + queue-based descriptor management. This DMA controller is intended + to be used with AMD Non-Transparent Bridge devices and not for + general purpose peripheral DMA. diff --git a/drivers/dma/amd/ae4dma/Makefile b/drivers/dma/amd/ae4dma/Makefile new file mode 100644 index 000000000000..e918f85a80ec --- /dev/null +++ b/drivers/dma/amd/ae4dma/Makefile @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# AMD AE4DMA driver +# + +obj-$(CONFIG_AMD_AE4DMA) += ae4dma.o + +ae4dma-objs := ae4dma-dev.o + +ae4dma-$(CONFIG_PCI) += ae4dma-pci.o diff --git a/drivers/dma/amd/ae4dma/ae4dma-dev.c b/drivers/dma/amd/ae4dma/ae4dma-dev.c new file mode 100644 index 000000000000..958bdab8db59 --- /dev/null +++ b/drivers/dma/amd/ae4dma/ae4dma-dev.c @@ -0,0 +1,206 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * AMD AE4DMA driver + * + * Copyright (c) 2024, Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * Author: Basavaraj Natikar + */ + +#include "ae4dma.h" + +static unsigned int max_hw_q = 1; +module_param(max_hw_q, uint, 0444); +MODULE_PARM_DESC(max_hw_q, "max hw queues supported by engine (any non-zero value, default: 1)"); + +static char *ae4_error_codes[] = { + "", + "ERR 01: INVALID HEADER DW0", + "ERR 02: INVALID STATUS", + "ERR 03: INVALID LENGTH - 4 BYTE ALIGNMENT", + "ERR 04: INVALID SRC ADDR - 4 BYTE ALIGNMENT", + "ERR 05: INVALID DST ADDR - 4 BYTE ALIGNMENT", + "ERR 06: INVALID ALIGNMENT", + "ERR 07: INVALID DESCRIPTOR", +}; + +static void ae4_log_error(struct pt_device *d, int e) +{ + if (e <= 7) + dev_info(d->dev, "AE4DMA error: %s (0x%x)\n", ae4_error_codes[e], e); + else if (e > 7 && e <= 15) + dev_info(d->dev, "AE4DMA error: %s (0x%x)\n", "INVALID DESCRIPTOR", e); + else if (e > 15 && e <= 31) + dev_info(d->dev, "AE4DMA error: %s (0x%x)\n", "INVALID DESCRIPTOR", e); + else if (e > 31 && e <= 63) + dev_info(d->dev, "AE4DMA error: %s (0x%x)\n", "INVALID DESCRIPTOR", e); + else if (e > 63 && e <= 127) + dev_info(d->dev, "AE4DMA error: %s (0x%x)\n", "PTE ERROR", e); + else if (e > 127 && e <= 255) + dev_info(d->dev, "AE4DMA error: %s (0x%x)\n", "PTE ERROR", e); + else + dev_info(d->dev, "Unknown AE4DMA error"); +} + +static void ae4_check_status_error(struct ae4_cmd_queue *ae4cmd_q, int idx) +{ + struct pt_cmd_queue *cmd_q = &ae4cmd_q->cmd_q; + struct ae4dma_desc desc; + u8 status; + + memcpy(&desc, &cmd_q->qbase[idx], sizeof(struct ae4dma_desc)); + /* Synchronize ordering */ + dma_rmb(); + status = desc.dw1.status; + if (status && status != AE4_DESC_COMPLETED) { + cmd_q->cmd_error = desc.dw1.err_code; + if (cmd_q->cmd_error) + ae4_log_error(cmd_q->pt, cmd_q->cmd_error); + } +} + +static void ae4_pending_work(struct work_struct *work) +{ + struct ae4_cmd_queue *ae4cmd_q = container_of(work, struct ae4_cmd_queue, p_work.work); + struct pt_cmd_queue *cmd_q = &ae4cmd_q->cmd_q; + struct pt_cmd *cmd; + u32 cridx, dridx; + + while (true) { + wait_event_interruptible(ae4cmd_q->q_w, + ((atomic64_read(&ae4cmd_q->done_cnt)) < + atomic64_read(&ae4cmd_q->intr_cnt))); + + atomic64_inc(&ae4cmd_q->done_cnt); + + mutex_lock(&ae4cmd_q->cmd_lock); + + cridx = readl(cmd_q->reg_control + 0x0C); + dridx = atomic_read(&ae4cmd_q->dridx); + + while ((dridx != cridx) && !list_empty(&ae4cmd_q->cmd)) { + cmd = list_first_entry(&ae4cmd_q->cmd, struct pt_cmd, entry); + list_del(&cmd->entry); + + ae4_check_status_error(ae4cmd_q, dridx); + cmd->pt_cmd_callback(cmd->data, cmd->ret); + + atomic64_dec(&ae4cmd_q->q_cmd_count); + dridx = (dridx + 1) % CMD_Q_LEN; + atomic_set(&ae4cmd_q->dridx, dridx); + /* Synchronize ordering */ + dma_mb(); + + complete_all(&ae4cmd_q->cmp); + } + + mutex_unlock(&ae4cmd_q->cmd_lock); + } +} + +static irqreturn_t ae4_core_irq_handler(int irq, void *data) +{ + struct ae4_cmd_queue *ae4cmd_q = data; + struct pt_cmd_queue *cmd_q; + struct pt_device *pt; + u32 status; + + cmd_q = &ae4cmd_q->cmd_q; + pt = cmd_q->pt; + + pt->total_interrupts++; + atomic64_inc(&ae4cmd_q->intr_cnt); + + wake_up(&ae4cmd_q->q_w); + + status = readl(cmd_q->reg_control + 0x14); + if (status & BIT(0)) { + status &= GENMASK(31, 1); + writel(status, cmd_q->reg_control + 0x14); + } + + return IRQ_HANDLED; +} + +void ae4_destroy_work(struct ae4_device *ae4) +{ + struct ae4_cmd_queue *ae4cmd_q; + int i; + + for (i = 0; i < ae4->cmd_q_count; i++) { + ae4cmd_q = &ae4->ae4cmd_q[i]; + + if (!ae4cmd_q->pws) + break; + + cancel_delayed_work_sync(&ae4cmd_q->p_work); + destroy_workqueue(ae4cmd_q->pws); + } +} + +int ae4_core_init(struct ae4_device *ae4) +{ + struct pt_device *pt = &ae4->pt; + struct ae4_cmd_queue *ae4cmd_q; + struct device *dev = pt->dev; + struct pt_cmd_queue *cmd_q; + int i, ret = 0; + + writel(max_hw_q, pt->io_regs); + + for (i = 0; i < max_hw_q; i++) { + ae4cmd_q = &ae4->ae4cmd_q[i]; + ae4cmd_q->id = ae4->cmd_q_count; + ae4->cmd_q_count++; + + cmd_q = &ae4cmd_q->cmd_q; + cmd_q->pt = pt; + + /* Preset some register values (Q size is 32byte (0x20)) */ + cmd_q->reg_control = pt->io_regs + ((i + 1) * 0x20); + + ret = devm_request_irq(dev, ae4->ae4_irq[i], ae4_core_irq_handler, 0, + dev_name(pt->dev), ae4cmd_q); + if (ret) + return ret; + + cmd_q->qsize = Q_SIZE(sizeof(struct ae4dma_desc)); + + cmd_q->qbase = dmam_alloc_coherent(dev, cmd_q->qsize, &cmd_q->qbase_dma, + GFP_KERNEL); + if (!cmd_q->qbase) + return -ENOMEM; + } + + for (i = 0; i < ae4->cmd_q_count; i++) { + ae4cmd_q = &ae4->ae4cmd_q[i]; + + cmd_q = &ae4cmd_q->cmd_q; + + /* Preset some register values (Q size is 32byte (0x20)) */ + cmd_q->reg_control = pt->io_regs + ((i + 1) * 0x20); + + /* Update the device registers with queue information. */ + writel(CMD_Q_LEN, cmd_q->reg_control + 0x08); + + cmd_q->qdma_tail = cmd_q->qbase_dma; + writel(lower_32_bits(cmd_q->qdma_tail), cmd_q->reg_control + 0x18); + writel(upper_32_bits(cmd_q->qdma_tail), cmd_q->reg_control + 0x1C); + + INIT_LIST_HEAD(&ae4cmd_q->cmd); + init_waitqueue_head(&ae4cmd_q->q_w); + + ae4cmd_q->pws = alloc_ordered_workqueue("ae4dma_%d", WQ_MEM_RECLAIM, ae4cmd_q->id); + if (!ae4cmd_q->pws) { + ae4_destroy_work(ae4); + return -ENOMEM; + } + INIT_DELAYED_WORK(&ae4cmd_q->p_work, ae4_pending_work); + queue_delayed_work(ae4cmd_q->pws, &ae4cmd_q->p_work, usecs_to_jiffies(100)); + + init_completion(&ae4cmd_q->cmp); + } + + return ret; +} diff --git a/drivers/dma/amd/ae4dma/ae4dma-pci.c b/drivers/dma/amd/ae4dma/ae4dma-pci.c new file mode 100644 index 000000000000..ddebf0609c4d --- /dev/null +++ b/drivers/dma/amd/ae4dma/ae4dma-pci.c @@ -0,0 +1,190 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * AMD AE4DMA driver + * + * Copyright (c) 2024, Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * Author: Basavaraj Natikar + */ + +#include "ae4dma.h" + +static int ae4_get_msi_irq(struct ae4_device *ae4) +{ + struct pt_device *pt = &ae4->pt; + struct device *dev = pt->dev; + struct pci_dev *pdev; + int ret, i; + + pdev = to_pci_dev(dev); + ret = pci_enable_msi(pdev); + if (ret) + return ret; + + for (i = 0; i < MAX_AE4_HW_QUEUES; i++) + ae4->ae4_irq[i] = pdev->irq; + + return 0; +} + +static int ae4_get_msix_irqs(struct ae4_device *ae4) +{ + struct ae4_msix *ae4_msix = ae4->ae4_msix; + struct pt_device *pt = &ae4->pt; + struct device *dev = pt->dev; + struct pci_dev *pdev; + int v, i, ret; + + pdev = to_pci_dev(dev); + + for (v = 0; v < ARRAY_SIZE(ae4_msix->msix_entry); v++) + ae4_msix->msix_entry[v].entry = v; + + ret = pci_enable_msix_range(pdev, ae4_msix->msix_entry, 1, v); + if (ret < 0) + return ret; + + ae4_msix->msix_count = ret; + + for (i = 0; i < MAX_AE4_HW_QUEUES; i++) + ae4->ae4_irq[i] = ae4_msix->msix_entry[i].vector; + + return 0; +} + +static int ae4_get_irqs(struct ae4_device *ae4) +{ + struct pt_device *pt = &ae4->pt; + struct device *dev = pt->dev; + int ret; + + ret = ae4_get_msix_irqs(ae4); + if (!ret) + return 0; + + /* Couldn't get MSI-X vectors, try MSI */ + dev_err(dev, "could not enable MSI-X (%d), trying MSI\n", ret); + ret = ae4_get_msi_irq(ae4); + if (!ret) + return 0; + + /* Couldn't get MSI interrupt */ + dev_err(dev, "could not enable MSI (%d)\n", ret); + + return ret; +} + +static void ae4_free_irqs(struct ae4_device *ae4) +{ + struct ae4_msix *ae4_msix; + struct pci_dev *pdev; + struct pt_device *pt; + struct device *dev; + int i; + + if (ae4) { + pt = &ae4->pt; + dev = pt->dev; + pdev = to_pci_dev(dev); + + ae4_msix = ae4->ae4_msix; + if (ae4_msix && ae4_msix->msix_count) + pci_disable_msix(pdev); + else if (pdev->irq) + pci_disable_msi(pdev); + + for (i = 0; i < MAX_AE4_HW_QUEUES; i++) + ae4->ae4_irq[i] = 0; + } +} + +static void ae4_deinit(struct ae4_device *ae4) +{ + ae4_free_irqs(ae4); +} + +static int ae4_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) +{ + struct device *dev = &pdev->dev; + struct ae4_device *ae4; + struct pt_device *pt; + int bar_mask; + int ret = 0; + + ae4 = devm_kzalloc(dev, sizeof(*ae4), GFP_KERNEL); + if (!ae4) + return -ENOMEM; + + ae4->ae4_msix = devm_kzalloc(dev, sizeof(struct ae4_msix), GFP_KERNEL); + if (!ae4->ae4_msix) + return -ENOMEM; + + ret = pcim_enable_device(pdev); + if (ret) + goto ae4_error; + + bar_mask = pci_select_bars(pdev, IORESOURCE_MEM); + ret = pcim_iomap_regions(pdev, bar_mask, "ae4dma"); + if (ret) + goto ae4_error; + + pt = &ae4->pt; + pt->dev = dev; + + pt->io_regs = pcim_iomap_table(pdev)[0]; + if (!pt->io_regs) { + ret = -ENOMEM; + goto ae4_error; + } + + ret = ae4_get_irqs(ae4); + if (ret) + goto ae4_error; + + pci_set_master(pdev); + + dma_set_mask_and_coherent(dev, DMA_BIT_MASK(48)); + + dev_set_drvdata(dev, ae4); + + ret = ae4_core_init(ae4); + if (ret) + goto ae4_error; + + return 0; + +ae4_error: + ae4_deinit(ae4); + + return ret; +} + +static void ae4_pci_remove(struct pci_dev *pdev) +{ + struct ae4_device *ae4 = dev_get_drvdata(&pdev->dev); + + ae4_destroy_work(ae4); + ae4_deinit(ae4); +} + +static const struct pci_device_id ae4_pci_table[] = { + { PCI_VDEVICE(AMD, 0x14C8), }, + { PCI_VDEVICE(AMD, 0x14DC), }, + { PCI_VDEVICE(AMD, 0x149B), }, + /* Last entry must be zero */ + { 0, } +}; +MODULE_DEVICE_TABLE(pci, ae4_pci_table); + +static struct pci_driver ae4_pci_driver = { + .name = "ae4dma", + .id_table = ae4_pci_table, + .probe = ae4_pci_probe, + .remove = ae4_pci_remove, +}; + +module_pci_driver(ae4_pci_driver); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("AMD AE4DMA driver"); diff --git a/drivers/dma/amd/ae4dma/ae4dma.h b/drivers/dma/amd/ae4dma/ae4dma.h new file mode 100644 index 000000000000..24b1253ad570 --- /dev/null +++ b/drivers/dma/amd/ae4dma/ae4dma.h @@ -0,0 +1,77 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * AMD AE4DMA driver + * + * Copyright (c) 2024, Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * Author: Basavaraj Natikar + */ +#ifndef __AE4DMA_H__ +#define __AE4DMA_H__ + +#include "../common/amd_dma.h" + +#define MAX_AE4_HW_QUEUES 16 + +#define AE4_DESC_COMPLETED 0x3 + +struct ae4_msix { + int msix_count; + struct msix_entry msix_entry[MAX_AE4_HW_QUEUES]; +}; + +struct ae4_cmd_queue { + struct ae4_device *ae4; + struct pt_cmd_queue cmd_q; + struct list_head cmd; + /* protect command operations */ + struct mutex cmd_lock; + struct delayed_work p_work; + struct workqueue_struct *pws; + struct completion cmp; + wait_queue_head_t q_w; + atomic64_t intr_cnt; + atomic64_t done_cnt; + atomic64_t q_cmd_count; + atomic_t dridx; + unsigned int id; +}; + +union dwou { + u32 dw0; + struct dword0 { + u8 byte0; + u8 byte1; + u16 timestamp; + } dws; +}; + +struct dword1 { + u8 status; + u8 err_code; + u16 desc_id; +}; + +struct ae4dma_desc { + union dwou dwouv; + struct dword1 dw1; + u32 length; + u32 rsvd; + u32 src_hi; + u32 src_lo; + u32 dst_hi; + u32 dst_lo; +}; + +struct ae4_device { + struct pt_device pt; + struct ae4_msix *ae4_msix; + struct ae4_cmd_queue ae4cmd_q[MAX_AE4_HW_QUEUES]; + unsigned int ae4_irq[MAX_AE4_HW_QUEUES]; + unsigned int cmd_q_count; +}; + +int ae4_core_init(struct ae4_device *ae4); +void ae4_destroy_work(struct ae4_device *ae4); +#endif diff --git a/drivers/dma/amd/common/amd_dma.h b/drivers/dma/amd/common/amd_dma.h new file mode 100644 index 000000000000..f9f396cd4371 --- /dev/null +++ b/drivers/dma/amd/common/amd_dma.h @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * AMD DMA Driver common + * + * Copyright (c) 2024, Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * Author: Basavaraj Natikar + */ + +#ifndef AMD_DMA_H +#define AMD_DMA_H + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../ptdma/ptdma.h" +#include "../../virt-dma.h" + +#endif From patchwork Mon Jun 17 10:03:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13700468 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2069.outbound.protection.outlook.com [40.107.100.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7AE418C326 for ; Mon, 17 Jun 2024 10:04:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718618687; cv=fail; b=iT2KX4/nve0lgc5M8pWHreV4x1tSO//YpdyTvd/rVoN3JbBdRyCRI1KkXAdS+aaVaSWpwT7ZJ6xx+W07eA2JH7Uunft0zuR0ayWzuL91oUViy7ar7dZONdJVc1AN+b7gc12sxTz4/N/HJp0O4nZ7JkiXFq1wkEnZ9sKebSt0Wk8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718618687; c=relaxed/simple; bh=4XvKQapPEUF5pkSLTb1aWLP0kMNLu60W44TNQQeWDDI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fao4ZHX9RiTBCrBossvbgxgg5jUDhu8PM4oPOQvGFDV9fWMOp24/52KF1i6LtewO+gIRwwELwLJm8wpr6OUVPWhSNXULraC1FAAuKbCxuABG/VlIOzOpuUqrcRgKsdFXORQNpMX0s65zRAca7f++xcsnveVoNFjjNIFPmKYcMjs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=sscLI2eD; arc=fail smtp.client-ip=40.107.100.69 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="sscLI2eD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CBs/W9RPLlQlnL1JM36STeZWybMX5PfzQN/wKnl9TI1iSDK0N4UiGNQMuXO5q0uRnVKpH5D+ruPPOuTw5zIsZVDzthnbn+PVQTXbE6hhjAKR8bPx6mcI2OJe1xVqp1sRXTec5VbJzn+0MzZRpkEcMS/SukBzS2WqZYWNPS3c3nHY0CLUTtX5KMAoCfBipl9+ahKbueKx/AIuPk06ATLgqcXVg1W+0LsQIq/OgLGkf9AblwMAbqTKZHtYKkXTFur5n0PGMx6izON6uIb9J/3Jnftbo/1bhCzhSWUNgeLlKW7E3SKxJ7+dJMYgoEeCyol7miXtuC+RJtNHDo+Y0FVa7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BbQXzQE3n8D8KEX3AtDQ2WMnNc3I3YLOo/iaQhTrQ/I=; b=b/lkk7Nq6QCSLdJ/4hDGwwR9SDtxOwQuziK5g4TVbrKZo/lChSvrh62VQ6KeSFfGxrst4yoiPqfCOWytElUw6w7bPZtMPuIuplud6hOeohs5u3pbiI/KspDPHJuVaytL3ZQn+WvTDDAJULwnzg/RnfbOAsFx0cTf7z6ub7B1+xxq86xGSomYS6CS7UYMzQoyWuHuJOZFt5ufQZDCCM5byEUvP56yuSdNKPEDYurP/fjmRSgbKBldyZjCjgWrBX+AlT4vwwT2+r2N+s5AhjLh8IddZ2X0yOyVA8yhvcs8jBOBW1+X61Pa4uPEqSytLpXy1/T9BxQ2H49IZFayUNSujA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BbQXzQE3n8D8KEX3AtDQ2WMnNc3I3YLOo/iaQhTrQ/I=; b=sscLI2eDaanBXHE9wDjaflb3cLQ3X4VYuNJMKobKicqYzmaPM5bumEP0EGqNe0GLEKTOJUbw3N5wp9Q9/ih0zfqdnPxo0S87ErIPHFerPADlbpslBHJGQmQ7SftA+QT1w9x28MD6l0qhoR6QJgXWIFjfgPH61w0eZ5rkelJ9ztg= Received: from BL1P223CA0025.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:2c4::30) by CH3PR12MB8911.namprd12.prod.outlook.com (2603:10b6:610:169::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 10:04:43 +0000 Received: from BN3PEPF0000B371.namprd21.prod.outlook.com (2603:10b6:208:2c4:cafe::4f) by BL1P223CA0025.outlook.office365.com (2603:10b6:208:2c4::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30 via Frontend Transport; Mon, 17 Jun 2024 10:04:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN3PEPF0000B371.mail.protection.outlook.com (10.167.243.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7719.0 via Frontend Transport; Mon, 17 Jun 2024 10:04:43 +0000 Received: from jatayu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 17 Jun 2024 05:04:38 -0500 From: Basavaraj Natikar To: , CC: , , Basavaraj Natikar Subject: [PATCH v2 3/7] dmaengine: ptdma: Move common functions to common code Date: Mon, 17 Jun 2024 15:33:55 +0530 Message-ID: <20240617100359.2550541-4-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240617100359.2550541-1-Basavaraj.Natikar@amd.com> References: <20240617100359.2550541-1-Basavaraj.Natikar@amd.com> Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B371:EE_|CH3PR12MB8911:EE_ X-MS-Office365-Filtering-Correlation-Id: c3abc2b4-ca0d-4f42-5c22-08dc8eb4e8ce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|36860700010|1800799021|82310400023; X-Microsoft-Antispam-Message-Info: QKNONxJ5vW5p35a34VhFrhs1Td+hIgSgIIMEeZvC5ZapAJYl2N06N7wVEVWs83AUEtfr6sxxyQU6IVWqxA48NyziQtNjg2zi7kWatYbN8rkwvH52OsmUXw8NZCk/rUjglMPLqDln/BE95VawQ3tBhLkb0lCV8QLqkYz77nH79wC7XW2bPZPvAFTYsXrCuBo7RUmLC7cjL2kRqSDcUCBFksOaTK6dfCrvmAx5H6WnYRU//78+OspnpVjH7ifj59bKurNvt53pm5DRh4EDSLU03sS4LjZsRb5fQB+a75+Eu1ZCXW9YxkpLMXA7CGJ6gJa9+uLb83qK75pWwMphdolgVzP5ecx/zUhW0AUTebRkT29laJ8ueZtFGgvXG8bAkTuz2RDn8Suj54n0Yap8Q4nKK/L7T1O10AeoD4t0Q0CkukOf/D0v5KW15A87U77UfBABXOm7wQguL/+XshfjQZXj5WYFUl24ttdmycXRr9Y+0kpoS2Dx7TZi8CikOIzzjQOOqT6POjKlco9OpyS2TXBAVGxnKxCqdyFs5CrUunLmxINP0CQxPqsIGP23j4k9h/nD35QPGOKf/lQAWmuR9vZh7ZeFas9Jnh1Pru2LPoa6znusN4dgLU2syGDw8rwUiOPqfeJMeL/9lCiOrzQzyrTWPaU/UtuOXZUuplHHYvTm7AobJLw5FnsTjVLfX8co5mrVtUw8k239YYEjtliVVkypTYjgpRGqPZZ7RiWynrgJKcs11mFPVYdugVPPtcACchukdwg9VAsdJIC/ELX3zYbh1v3ZcnyDqcr2ZOuqtMjQbxY9RlKRe4gItenv1mr40gSTtXAit7Kw/hG5cLOkZpjzMfpQE/RCYewodaLmxyHBRk2QD51pKy9wdguMFueXi+J6iw/weCP/uAybYG+waFm6FISRqk8yGzMxzkMCPPQd3uDqu4DGTmGt4isGnxd7gaCOuMSQoFUfdIhtTwiy5mxRGlrWkMgnEuTZXgthzsyph6D87GNxtypiaxcjBbj2YnNf7A41Xt9kxFvpvKQCvVKgZTn+hs4P3GEj/WTIT8NNGwMMbVGlQyMxHFf6ckozRlJiDXLSUtzxLMHCDWQhK0udSoKYpy+ZKXTAP4Ep6mSwgUHsZqplBotHHKeDm825urRU/GBOh1eNmuFaAaw/nfKt/8cZFMGsu/XD3rxsLRjXXXeVnZGSdMaamx4muv6NFXrdeVqwIeam9dB1PMGFBKaB4HuEhGsGJTk9mqXeblWkaHqvbWJCaGuFECZ5v4+YoNDx2bUJX20DP9sOu0nfrLjp0Bec2AEVhrLLJms9NmHV/+nkAEKrtyveN1xCuezcszFZMlTfsXOTu6x76zsBa3G6sRkY9d2CaZkezHxGCatsqIuT8Oz2GJZfBt5wI+mNwuS1oV8sNIFQO/SqSiI/rI0hxg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230037)(376011)(36860700010)(1800799021)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 10:04:43.0082 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c3abc2b4-ca0d-4f42-5c22-08dc8eb4e8ce X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN3PEPF0000B371.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8911 To focus on reusability of ptdma code across modules extract common functions into reusable modules. Reviewed-by: Raju Rangoju Signed-off-by: Basavaraj Natikar --- MAINTAINERS | 1 + drivers/dma/amd/common/amd_dma.c | 23 +++++++++++++++++++++++ drivers/dma/amd/common/amd_dma.h | 3 +++ drivers/dma/amd/ptdma/Makefile | 2 +- drivers/dma/amd/ptdma/ptdma-dev.c | 14 +------------- drivers/dma/amd/ptdma/ptdma-dmaengine.c | 3 +-- drivers/dma/amd/ptdma/ptdma.h | 2 -- 7 files changed, 30 insertions(+), 18 deletions(-) create mode 100644 drivers/dma/amd/common/amd_dma.c diff --git a/MAINTAINERS b/MAINTAINERS index 0d222d1ca83f..3000ea780db4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -952,6 +952,7 @@ M: Basavaraj Natikar L: dmaengine@vger.kernel.org S: Maintained F: drivers/dma/amd/ae4dma/ +F: drivers/dma/amd/common/ AMD AXI W1 DRIVER M: Kris Chaplin diff --git a/drivers/dma/amd/common/amd_dma.c b/drivers/dma/amd/common/amd_dma.c new file mode 100644 index 000000000000..3552d36fa8b9 --- /dev/null +++ b/drivers/dma/amd/common/amd_dma.c @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * AMD DMA Driver common + * + * Copyright (c) 2024, Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * Author: Basavaraj Natikar + */ + +#include "../common/amd_dma.h" + +void pt_start_queue(struct pt_cmd_queue *cmd_q) +{ + /* Turn on the run bit */ + iowrite32(cmd_q->qcontrol | CMD_Q_RUN, cmd_q->reg_control); +} + +void pt_stop_queue(struct pt_cmd_queue *cmd_q) +{ + /* Turn off the run bit */ + iowrite32(cmd_q->qcontrol & ~CMD_Q_RUN, cmd_q->reg_control); +} diff --git a/drivers/dma/amd/common/amd_dma.h b/drivers/dma/amd/common/amd_dma.h index f9f396cd4371..44251918f157 100644 --- a/drivers/dma/amd/common/amd_dma.h +++ b/drivers/dma/amd/common/amd_dma.h @@ -23,4 +23,7 @@ #include "../ptdma/ptdma.h" #include "../../virt-dma.h" +void pt_start_queue(struct pt_cmd_queue *cmd_q); +void pt_stop_queue(struct pt_cmd_queue *cmd_q); + #endif diff --git a/drivers/dma/amd/ptdma/Makefile b/drivers/dma/amd/ptdma/Makefile index ce5410268a9a..42606d7302e6 100644 --- a/drivers/dma/amd/ptdma/Makefile +++ b/drivers/dma/amd/ptdma/Makefile @@ -5,6 +5,6 @@ obj-$(CONFIG_AMD_PTDMA) += ptdma.o -ptdma-objs := ptdma-dev.o ptdma-dmaengine.o ptdma-debugfs.o +ptdma-objs := ptdma-dev.o ptdma-dmaengine.o ptdma-debugfs.o ../common/amd_dma.o ptdma-$(CONFIG_PCI) += ptdma-pci.o diff --git a/drivers/dma/amd/ptdma/ptdma-dev.c b/drivers/dma/amd/ptdma/ptdma-dev.c index a2bf13ff18b6..506b3dfca549 100644 --- a/drivers/dma/amd/ptdma/ptdma-dev.c +++ b/drivers/dma/amd/ptdma/ptdma-dev.c @@ -17,7 +17,7 @@ #include #include -#include "ptdma.h" +#include "../common/amd_dma.h" /* Human-readable error strings */ static char *pt_error_codes[] = { @@ -54,18 +54,6 @@ static void pt_log_error(struct pt_device *d, int e) dev_err(d->dev, "PTDMA error: %s (0x%x)\n", pt_error_codes[e], e); } -void pt_start_queue(struct pt_cmd_queue *cmd_q) -{ - /* Turn on the run bit */ - iowrite32(cmd_q->qcontrol | CMD_Q_RUN, cmd_q->reg_control); -} - -void pt_stop_queue(struct pt_cmd_queue *cmd_q) -{ - /* Turn off the run bit */ - iowrite32(cmd_q->qcontrol & ~CMD_Q_RUN, cmd_q->reg_control); -} - static int pt_core_execute_cmd(struct ptdma_desc *desc, struct pt_cmd_queue *cmd_q) { bool soc = FIELD_GET(DWORD0_SOC, desc->dw0); diff --git a/drivers/dma/amd/ptdma/ptdma-dmaengine.c b/drivers/dma/amd/ptdma/ptdma-dmaengine.c index a2e7c2cec15e..66ea10499643 100644 --- a/drivers/dma/amd/ptdma/ptdma-dmaengine.c +++ b/drivers/dma/amd/ptdma/ptdma-dmaengine.c @@ -9,8 +9,7 @@ * Author: Gary R Hook */ -#include "ptdma.h" -#include "../../dmaengine.h" +#include "../common/amd_dma.h" static inline struct pt_dma_chan *to_pt_chan(struct dma_chan *dma_chan) { diff --git a/drivers/dma/amd/ptdma/ptdma.h b/drivers/dma/amd/ptdma/ptdma.h index 2690a32fc7cb..b4f9ee83b074 100644 --- a/drivers/dma/amd/ptdma/ptdma.h +++ b/drivers/dma/amd/ptdma/ptdma.h @@ -322,8 +322,6 @@ int pt_core_perform_passthru(struct pt_cmd_queue *cmd_q, struct pt_passthru_engine *pt_engine); void pt_check_status_trans(struct pt_device *pt, struct pt_cmd_queue *cmd_q); -void pt_start_queue(struct pt_cmd_queue *cmd_q); -void pt_stop_queue(struct pt_cmd_queue *cmd_q); static inline void pt_core_disable_queue_interrupts(struct pt_device *pt) { From patchwork Mon Jun 17 10:03:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13700470 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2078.outbound.protection.outlook.com [40.107.220.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 075D618C326 for ; Mon, 17 Jun 2024 10:04:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.78 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718618689; cv=fail; b=OQbQhZjfsj7ThDtI4Z4Zpx8g0bU6a2WeXba/mT0PmR44lxqPWqkCkwxs2ZUfRTFvpknXUQc89aE5D7Gesk8zm/5j5/9P20GwfcW2E1jtMfPRok7mZK9oV+/mTy+RxraiUQEd3juhFQ5blDLgZKKmoEezPYByh9m9A2NA5NLwoQs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718618689; c=relaxed/simple; bh=GJdCAMcp5b/y9yqRWXiHjD5Ho1F7GWfORT266acLJxc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rHeclC08B0cFKBscBiQdHKQFZy/knwWIvR9Rs7Xy7TzW/xLDsyYheP1b8yMV4zcfklai8heHg8eYX/S5zR9vbDwxx4YQZTj+0LpXHE2N1Aga+AIXFbQTKIUbk+lIEOii+L8A4BMnx/Sk8DuSviWLzJ4Ily8MTki/4c13gK+9rMI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=M7P7x22Z; arc=fail smtp.client-ip=40.107.220.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="M7P7x22Z" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mmqLpjrxMYPs+mncDDU9j9AqqzpaxIW7e6znOQz9tAvb02h6p2CBuJ1o/Abr8/KiCkhOjpiDFRkw6WhPaEuj7FVHeBb1tfj3j0DhfUwmEs2FWQLIvoGuppJKlomHFmlrbUAfLY124NgYlbqNBJImWOoJdXN8yyNeIO6wZrQ4TlbO7CLYtyANRaIZU0K6fo2TkW9lrJQBRdenTUjCTwlJgLgDwMDmxDIQh16NAiOzwjvjvJl7qPsFuaMwoxm2liIiBuliox1eiwC0eo0XBH9UYO8cIUL08yo3Y7Z99qT7xS/3qTQDQI7KP14MV5/kakPrtyIbkZhqG48wRr+5jjnvkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FgjaKKJoqv9HPDvKiBAf/IVsK7ldU9fAser3h1hU9jA=; b=Oxx5wET40gOllBKGcNhunZojHwSK9LAEtWc+80PUkKPnITbb1fahEGM/lBFmMEtixpm8KTboMOGGMjN5sJFV3vunF/L7axC4sAK/pHunogxBHE+oz0YlVv8FCEFwk7f8Kywno3cTDk7/SxCR3w3IjGEs8bzuWgjM+wWWu0W+WWkyltrzWnviAspPmvUlba4ReV7kQwM+RYTOrjKNvcyt2JdzDxHw7gAvuDVqVz77wxcFoTP3pMy53cAU+NskiDkDj7hZ9ZR0FuZHUquK4uerteWz8M+gL31vUlhL7wlHva1Q6AbTJeBehUyFFHFj1pvwCtLD8CA2GRzfdKz3quwZ6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FgjaKKJoqv9HPDvKiBAf/IVsK7ldU9fAser3h1hU9jA=; b=M7P7x22ZKWx4HrV6Sb5634cLfcWcdK+4GTzYYwrBJZTvjWOWf6yRky5Ux4zMBjnHzuYLECosBIWo0C579KBjSDUp4HuW+yIPVOFKSWeQs7tDzyFBGBMBidbOCX/aESMZrRZwTxtGKCtW9rJhaPAxVDCv/3Z6GrabJQeP4/ZLQZE= Received: from BL1P223CA0021.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:2c4::26) by MW3PR12MB4427.namprd12.prod.outlook.com (2603:10b6:303:52::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31; Mon, 17 Jun 2024 10:04:44 +0000 Received: from BN3PEPF0000B371.namprd21.prod.outlook.com (2603:10b6:208:2c4:cafe::e0) by BL1P223CA0021.outlook.office365.com (2603:10b6:208:2c4::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30 via Frontend Transport; Mon, 17 Jun 2024 10:04:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN3PEPF0000B371.mail.protection.outlook.com (10.167.243.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7719.0 via Frontend Transport; Mon, 17 Jun 2024 10:04:43 +0000 Received: from jatayu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 17 Jun 2024 05:04:40 -0500 From: Basavaraj Natikar To: , CC: , , Basavaraj Natikar Subject: [PATCH v2 4/7] dmaengine: ptdma: Extend ptdma to support multi-channel and version Date: Mon, 17 Jun 2024 15:33:56 +0530 Message-ID: <20240617100359.2550541-5-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240617100359.2550541-1-Basavaraj.Natikar@amd.com> References: <20240617100359.2550541-1-Basavaraj.Natikar@amd.com> Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B371:EE_|MW3PR12MB4427:EE_ X-MS-Office365-Filtering-Correlation-Id: b3981478-81c8-46f8-a73f-08dc8eb4e91a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|36860700010|376011|82310400023|1800799021; X-Microsoft-Antispam-Message-Info: byrtIK5LZmwmqC/YzgGBW93UwK8rza4uBbkxjov0cZL+D988II28pJMNf8kgTFLYdvpvBbBujE2BDC7mO31Q7n5xAK7ydiG5qztVet5vr72OIcCVEyR9nECYKZg6cNKOevuY48Ylf1jD8bXkDcwIaQAuPWjeTnv1ITNyO0Qdn+IXPAfYa8ibKSJ6ukijdyRqh6ixFcXuFSiRFrgU5phFsm166iloKJxQWiqH6DltHH7UsFDFiO3gUASmiOtDjcYhtJIMy23leXFEG8kUKyzcZoaGVwNt2qj8VBzycElSSrTTfc36qd2NfFep/6Sj4r1QUTj6h8sw2w8+G8Lxma6CsarRa6wOLeUqqOs2/bq0nez7wOlWx2jEJBTkG5Xa+13GuZYBAuvj2ApVhS27Zq3Gx4trKuM9Rf/4D694ILpG3tk70irTnLwlTp12DGJwxY6s/QIg757/couE5999vRsbeBtFp6SBoy5RnuSHJ7op29f96f6OIrcZo53boJpDlRJvQ7kjqx0wd1lHjAcQflRvEbsrt90Gi0LB/VJ0+yN3SCi1VPpKz/RouIntFKLVxOqHaQOlCwFl9hLfU5Hp5qSjSb07xKZYLtMKimszCthPCjlk9PGDM64BFMuSyO0HfretxQ7M8lv24wFaQ2LrXADGqnkinXDyaUhRXUoUfrs9ex+WmJuc3tSmtcfGGPplYsTM9jkFXz5g+D+5ox+KISLH6myuatKEgmm600POEeCKm26ivMAdccv6ZCKUjdrW6uKAtyhc+ABE26pdjEuSQ7NW3wVadCEIvWmLhWQPOeUESFyu01zTj1BzU5INseINrsUUO8jKYJYLahjMgySUGPm2DyuhcPx0YEZk6E+UqS43DUZvrEkLGBPyOVsY8tZcaZMyod+2pjfz+8dnwYQpmCuRUJks0zkDUbRPJc8i8czykNdXS49wXfjG8pv5EwFhTo+TXMncKKsXnJqT15r7RaJ93Ek8yXaie5+JU5XOi0iQrwG29UK/j1PI4cAE+EJYGCyh0+sJ44CdYjOeSwFGDtY4/PVe+yiaaeQ57qVFaHTpZZtX8HfM9Ykmah6HajOBal5zUrMj2zSAQPVBFrmcsn1zesBlQQzjgfROTTixLdJnqKuonImrBYNH0G2GQxxakmbbTRQt8FjMU+K5ZMJBBX/gCSQx3TP6i1fvD/VGZ7wP+SS5F7twTV0QSRbnirwuUKqYoYwdeu8ydP8L64teaRAFoDusPfN4DnLl2kwxQI7lK/KE+9T3pipdp86xwqDOCOiu458CoMWI/tpwCQXcfMouF3BwJ3ks9oCsuKEtSBvoERvmRaDjgxjTXFSLW4TKgq8U8eM4yx4/KQAg+W3zwW0vR9xAW61b7Je8o+Kh4OagE4F9Jx8D10X5GYD1DoZhIBz/ASjI3i68CgD6oOOJpHxrcg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230037)(36860700010)(376011)(82310400023)(1800799021);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 10:04:43.5082 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b3981478-81c8-46f8-a73f-08dc8eb4e91a X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN3PEPF0000B371.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4427 To support multi-channel functionality with AE4DMA engine, extend the PTDMA code with reusable components. Reviewed-by: Raju Rangoju Signed-off-by: Basavaraj Natikar --- drivers/dma/amd/ae4dma/ae4dma.h | 1 + drivers/dma/amd/common/amd_dma.h | 1 + drivers/dma/amd/ptdma/ptdma-dmaengine.c | 105 +++++++++++++++++++----- drivers/dma/amd/ptdma/ptdma.h | 2 + 4 files changed, 89 insertions(+), 20 deletions(-) diff --git a/drivers/dma/amd/ae4dma/ae4dma.h b/drivers/dma/amd/ae4dma/ae4dma.h index 24b1253ad570..4e4584e152a1 100644 --- a/drivers/dma/amd/ae4dma/ae4dma.h +++ b/drivers/dma/amd/ae4dma/ae4dma.h @@ -15,6 +15,7 @@ #define MAX_AE4_HW_QUEUES 16 #define AE4_DESC_COMPLETED 0x3 +#define AE4_DMA_VERSION 4 struct ae4_msix { int msix_count; diff --git a/drivers/dma/amd/common/amd_dma.h b/drivers/dma/amd/common/amd_dma.h index 44251918f157..40f18fc912ae 100644 --- a/drivers/dma/amd/common/amd_dma.h +++ b/drivers/dma/amd/common/amd_dma.h @@ -21,6 +21,7 @@ #include #include "../ptdma/ptdma.h" +#include "../ae4dma/ae4dma.h" #include "../../virt-dma.h" void pt_start_queue(struct pt_cmd_queue *cmd_q); diff --git a/drivers/dma/amd/ptdma/ptdma-dmaengine.c b/drivers/dma/amd/ptdma/ptdma-dmaengine.c index 66ea10499643..90ca02fd5f8f 100644 --- a/drivers/dma/amd/ptdma/ptdma-dmaengine.c +++ b/drivers/dma/amd/ptdma/ptdma-dmaengine.c @@ -43,7 +43,24 @@ static void pt_do_cleanup(struct virt_dma_desc *vd) kmem_cache_free(pt->dma_desc_cache, desc); } -static int pt_dma_start_desc(struct pt_dma_desc *desc) +static struct pt_cmd_queue *pt_get_cmd_queue(struct pt_device *pt, struct pt_dma_chan *chan) +{ + struct ae4_cmd_queue *ae4cmd_q; + struct pt_cmd_queue *cmd_q; + struct ae4_device *ae4; + + if (pt->ver == AE4_DMA_VERSION) { + ae4 = container_of(pt, struct ae4_device, pt); + ae4cmd_q = &ae4->ae4cmd_q[chan->id]; + cmd_q = &ae4cmd_q->cmd_q; + } else { + cmd_q = &pt->cmd_q; + } + + return cmd_q; +} + +static int pt_dma_start_desc(struct pt_dma_desc *desc, struct pt_dma_chan *chan) { struct pt_passthru_engine *pt_engine; struct pt_device *pt; @@ -54,7 +71,9 @@ static int pt_dma_start_desc(struct pt_dma_desc *desc) pt_cmd = &desc->pt_cmd; pt = pt_cmd->pt; - cmd_q = &pt->cmd_q; + + cmd_q = pt_get_cmd_queue(pt, chan); + pt_engine = &pt_cmd->passthru; pt->tdata.cmd = pt_cmd; @@ -149,7 +168,7 @@ static void pt_cmd_callback(void *data, int err) if (!desc) break; - ret = pt_dma_start_desc(desc); + ret = pt_dma_start_desc(desc, chan); if (!ret) break; @@ -184,7 +203,10 @@ static struct pt_dma_desc *pt_create_desc(struct dma_chan *dma_chan, { struct pt_dma_chan *chan = to_pt_chan(dma_chan); struct pt_passthru_engine *pt_engine; + struct pt_device *pt = chan->pt; + struct ae4_cmd_queue *ae4cmd_q; struct pt_dma_desc *desc; + struct ae4_device *ae4; struct pt_cmd *pt_cmd; desc = pt_alloc_dma_desc(chan, flags); @@ -192,7 +214,7 @@ static struct pt_dma_desc *pt_create_desc(struct dma_chan *dma_chan, return NULL; pt_cmd = &desc->pt_cmd; - pt_cmd->pt = chan->pt; + pt_cmd->pt = pt; pt_engine = &pt_cmd->passthru; pt_cmd->engine = PT_ENGINE_PASSTHRU; pt_engine->src_dma = src; @@ -203,6 +225,14 @@ static struct pt_dma_desc *pt_create_desc(struct dma_chan *dma_chan, desc->len = len; + if (pt->ver == AE4_DMA_VERSION) { + ae4 = container_of(pt, struct ae4_device, pt); + ae4cmd_q = &ae4->ae4cmd_q[chan->id]; + mutex_lock(&ae4cmd_q->cmd_lock); + list_add_tail(&pt_cmd->entry, &ae4cmd_q->cmd); + mutex_unlock(&ae4cmd_q->cmd_lock); + } + return desc; } @@ -260,8 +290,11 @@ static enum dma_status pt_tx_status(struct dma_chan *c, dma_cookie_t cookie, struct dma_tx_state *txstate) { - struct pt_device *pt = to_pt_chan(c)->pt; - struct pt_cmd_queue *cmd_q = &pt->cmd_q; + struct pt_dma_chan *chan = to_pt_chan(c); + struct pt_device *pt = chan->pt; + struct pt_cmd_queue *cmd_q; + + cmd_q = pt_get_cmd_queue(pt, chan); pt_check_status_trans(pt, cmd_q); return dma_cookie_status(c, cookie, txstate); @@ -270,10 +303,13 @@ pt_tx_status(struct dma_chan *c, dma_cookie_t cookie, static int pt_pause(struct dma_chan *dma_chan) { struct pt_dma_chan *chan = to_pt_chan(dma_chan); + struct pt_device *pt = chan->pt; + struct pt_cmd_queue *cmd_q; unsigned long flags; spin_lock_irqsave(&chan->vc.lock, flags); - pt_stop_queue(&chan->pt->cmd_q); + cmd_q = pt_get_cmd_queue(pt, chan); + pt_stop_queue(cmd_q); spin_unlock_irqrestore(&chan->vc.lock, flags); return 0; @@ -283,10 +319,13 @@ static int pt_resume(struct dma_chan *dma_chan) { struct pt_dma_chan *chan = to_pt_chan(dma_chan); struct pt_dma_desc *desc = NULL; + struct pt_device *pt = chan->pt; + struct pt_cmd_queue *cmd_q; unsigned long flags; spin_lock_irqsave(&chan->vc.lock, flags); - pt_start_queue(&chan->pt->cmd_q); + cmd_q = pt_get_cmd_queue(pt, chan); + pt_start_queue(cmd_q); desc = pt_next_dma_desc(chan); spin_unlock_irqrestore(&chan->vc.lock, flags); @@ -300,11 +339,17 @@ static int pt_resume(struct dma_chan *dma_chan) static int pt_terminate_all(struct dma_chan *dma_chan) { struct pt_dma_chan *chan = to_pt_chan(dma_chan); + struct pt_device *pt = chan->pt; + struct pt_cmd_queue *cmd_q; unsigned long flags; - struct pt_cmd_queue *cmd_q = &chan->pt->cmd_q; LIST_HEAD(head); - iowrite32(SUPPORTED_INTERRUPTS, cmd_q->reg_control + 0x0010); + cmd_q = pt_get_cmd_queue(pt, chan); + if (pt->ver == AE4_DMA_VERSION) + pt_stop_queue(cmd_q); + else + iowrite32(SUPPORTED_INTERRUPTS, cmd_q->reg_control + 0x0010); + spin_lock_irqsave(&chan->vc.lock, flags); vchan_get_all_descriptors(&chan->vc, &head); spin_unlock_irqrestore(&chan->vc.lock, flags); @@ -317,14 +362,24 @@ static int pt_terminate_all(struct dma_chan *dma_chan) int pt_dmaengine_register(struct pt_device *pt) { - struct pt_dma_chan *chan; struct dma_device *dma_dev = &pt->dma_dev; - char *cmd_cache_name; + struct ae4_cmd_queue *ae4cmd_q = NULL; + struct ae4_device *ae4 = NULL; + struct pt_dma_chan *chan; char *desc_cache_name; - int ret; + char *cmd_cache_name; + int ret, i; + + if (pt->ver == AE4_DMA_VERSION) + ae4 = container_of(pt, struct ae4_device, pt); + + if (ae4) + pt->pt_dma_chan = devm_kcalloc(pt->dev, ae4->cmd_q_count, + sizeof(*pt->pt_dma_chan), GFP_KERNEL); + else + pt->pt_dma_chan = devm_kzalloc(pt->dev, sizeof(*pt->pt_dma_chan), + GFP_KERNEL); - pt->pt_dma_chan = devm_kzalloc(pt->dev, sizeof(*pt->pt_dma_chan), - GFP_KERNEL); if (!pt->pt_dma_chan) return -ENOMEM; @@ -366,9 +421,6 @@ int pt_dmaengine_register(struct pt_device *pt) INIT_LIST_HEAD(&dma_dev->channels); - chan = pt->pt_dma_chan; - chan->pt = pt; - /* Set base and prep routines */ dma_dev->device_free_chan_resources = pt_free_chan_resources; dma_dev->device_prep_dma_memcpy = pt_prep_dma_memcpy; @@ -380,8 +432,21 @@ int pt_dmaengine_register(struct pt_device *pt) dma_dev->device_terminate_all = pt_terminate_all; dma_dev->device_synchronize = pt_synchronize; - chan->vc.desc_free = pt_do_cleanup; - vchan_init(&chan->vc, dma_dev); + if (ae4) { + for (i = 0; i < ae4->cmd_q_count; i++) { + chan = pt->pt_dma_chan + i; + ae4cmd_q = &ae4->ae4cmd_q[i]; + chan->id = ae4cmd_q->id; + chan->pt = pt; + chan->vc.desc_free = pt_do_cleanup; + vchan_init(&chan->vc, dma_dev); + } + } else { + chan = pt->pt_dma_chan; + chan->pt = pt; + chan->vc.desc_free = pt_do_cleanup; + vchan_init(&chan->vc, dma_dev); + } ret = dma_async_device_register(dma_dev); if (ret) diff --git a/drivers/dma/amd/ptdma/ptdma.h b/drivers/dma/amd/ptdma/ptdma.h index b4f9ee83b074..3ef290b78448 100644 --- a/drivers/dma/amd/ptdma/ptdma.h +++ b/drivers/dma/amd/ptdma/ptdma.h @@ -184,6 +184,7 @@ struct pt_dma_desc { struct pt_dma_chan { struct virt_dma_chan vc; struct pt_device *pt; + unsigned int id; }; struct pt_cmd_queue { @@ -262,6 +263,7 @@ struct pt_device { unsigned long total_interrupts; struct pt_tasklet_data tdata; + int ver; }; /* From patchwork Mon Jun 17 10:03:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13700471 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2042.outbound.protection.outlook.com [40.107.220.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DCA32190687 for ; Mon, 17 Jun 2024 10:04:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718618690; cv=fail; b=SNiBVaF4DHlUJrK5rMYCc+RjYlY966g08GXc/Sdl5X634P1welI58uboQMewaBorIQhtPKsq3pMRl7M4DM53An7L5xahmqKXF+JBo6sfv3sVlt8Ceo7CVplh5aDzBTLZmzcht5/jBQJeNdUdBo8wDFIySTLiICJpDI8xax9CAZ8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718618690; c=relaxed/simple; bh=ztpJmfqVbUOGa7W3TtDXm5JLCyZsKW71QvXxVyCBLBk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nza5y9d8A+zdGs84ftrOJ0vjwlDG9mvtwpe40m5Li1HBEpsqODwbJ23F52dhqDMLDJs8iWJCOM4C7weZnS5Uk70aaI2TjeEe1NZGHuzGP3OqGoda5x08fgrj0nMPG7EHRTLye2ApVqpXdrxhObXq3ZaSEuytNQrizIhl3qKArNg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=IFGumnjA; arc=fail smtp.client-ip=40.107.220.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="IFGumnjA" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m/05LNvFgE++khURAQ4zCGvE3ezXS3r2meCDS/YsKlXG8t9cyXLoCJv7Ouu/GRD4inL3vzex9tvLe5iwo9Fg0ybXngNSnhxzAKzS5CAOUaBovkYSPMIBnYHE49qrHn1S+plTzqUdUkVGnRIvU5DZGNklsYDw+G0EVXvnS1Vkfreo8fvrEk8w9gXRq6Zi7USzGmO4bZIFvn2Hmr7kGr7yp/tLPkVUDqG5R/OEJDOtQOBlsfaiavFLqCk1mQ4LO3qg2LPxkDj0q82rzE0gq4F94vUWj9Ga0U+/WDIEewEhOaERPPrLxlVUXsplyLSyhj/eZGcxkCBhfC7s3qzczPFzXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bYdWJctlb3s4wIMAPgocMmjQYrnbSaxKlcOZA4IhhCU=; b=ACVPKYUwkQpZjLD6rZ082x3N8Kg0+LgonN0u9PJ1GhX3W+CIvGVhr2XZwwWzOztf6nLTTDQsglQiSjqpBeBoY4qF0LW9Blk4pdTQvmUqDZftNPSHenbBHQPGz7HG5yz0qhjYi24v8v8dqHiOu5SPCboKLBg1Z85CpXYNwbxirEARD43GtOr70wniwFhaPz/fTgu17dT8xPO+ZZeFY/i+U6bLcvblp4YU94Hco6rscSDTfeBWoK6KU+L+jHPwvdjOGeakMYOBmoC5tyF/2Mh06/+mLjwW0qNOM2TJG/Eh0W7GZ88HRMrT0FZpKas6SNIifZdLEbG4fUDzKNpnNrMTNQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bYdWJctlb3s4wIMAPgocMmjQYrnbSaxKlcOZA4IhhCU=; b=IFGumnjAQqRdy5HB/ZMuBPQVVf3zaVdFMy67sG3BH4UeLnXGZla0TmRbSCJTznHkQontMEix79LBwxxfgb7jPDUG2ILHBuoGA6Il6rUJdnqEj3+PbQEMfych384PGCsEdBV2EkvUc+Pv912+5j60ZYc4xPb+8NARMjpJ5fsw3X4= Received: from BN0PR02CA0010.namprd02.prod.outlook.com (2603:10b6:408:e4::15) by MN0PR12MB6293.namprd12.prod.outlook.com (2603:10b6:208:3c2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31; Mon, 17 Jun 2024 10:04:45 +0000 Received: from BN3PEPF0000B36E.namprd21.prod.outlook.com (2603:10b6:408:e4:cafe::ab) by BN0PR02CA0010.outlook.office365.com (2603:10b6:408:e4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30 via Frontend Transport; Mon, 17 Jun 2024 10:04:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN3PEPF0000B36E.mail.protection.outlook.com (10.167.243.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7719.0 via Frontend Transport; Mon, 17 Jun 2024 10:04:44 +0000 Received: from jatayu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 17 Jun 2024 05:04:42 -0500 From: Basavaraj Natikar To: , CC: , , Basavaraj Natikar Subject: [PATCH v2 5/7] dmaengine: ae4dma: Register AE4DMA using pt_dmaengine_register Date: Mon, 17 Jun 2024 15:33:57 +0530 Message-ID: <20240617100359.2550541-6-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240617100359.2550541-1-Basavaraj.Natikar@amd.com> References: <20240617100359.2550541-1-Basavaraj.Natikar@amd.com> Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B36E:EE_|MN0PR12MB6293:EE_ X-MS-Office365-Filtering-Correlation-Id: 16fedb41-7766-4180-7dab-08dc8eb4e9fc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|36860700010|376011|82310400023|1800799021; X-Microsoft-Antispam-Message-Info: 1W+6uh17qEIu9sgzRCO4U+RlEIMQxOzZ1F7uhqFaRJ/RqztN1wybQBotOmgboxcWyB/oCPkfeOwqe7FwZaV4YH9tYPBxGNlDP1krQzejaWX1IvImcROcnBSRFSCAQR67SHyztEfoVjo14CgSt/91S7+JUox6ohvqY+Ioa/F2UOEw5+9N4pJHKeLd0QTcHb2WdFbZrmL7Kt0LYJajxgUq0QuD8jTav/h0wU2/BevjEyJvmeRlmzIkWt80kViDAuHGrdskjXYQXDzZyWCD3A1opV7kEQS9yY4s631MqK7PowZF40WHDRXoXBmK3i0W6pudKjb9TVDFTOtNnLmW77hGh4HRGNcv6aBR2g7lIYRHRED4/S5eHhuEuZRK73HTo6f4l9QmQUbLwVq/InqyDyTEqW2VXK9c3RF18arbNG7yjdriN8+i3UO4tgdnqSBt/lyczeeDxcThZF6QB9ifyLx4vLJN5KmmXF6Yu1RyaSRIWkqeBR1ZT4AhVXjjOpW7y0z038aAjniWuVF50FBPEAsOxibFtdOvngtMtvy511KYjExUJqTle8VyZ0+FyRTk+WV1vft0ceWepymGNdQSWWCBk78CaXm7PdkNELHxCGdT+eKWSl2SbUnyXfjSry6TFeNEvzIwmPmM3+vmwSS40dVDBZ0cV2L59VeeMU25zUdQb4Z20VmflqVznbARAhD5vY64qbvLGah+itJeTaE8GDYt+AJnArvylUBGBXDcdmDArHhsqCoRLJ2m1RWYUfo3R7qAZVhmbaF04/7YvMjPXHV9ObV3GK9g7rs6BZO0PPKWZFei0EHwI1XNeiq9Xmr4gI0ZhwAJNRzV2Dv4m2RTHzn6VcpeLf0RJvBfDPAJ6yeShJ8rKVUORrgTI+rNFy0e5YmSln3cpQURNWksz4LWNYhfJpZx/+4c0T+YGqNYqB0X5zW5ngvcs7OByePBNz1IApMHTJuzrOzvV+30962UZ76rL2MPoKIXm41VTXnELJ95tZVfxhnGwQdbbTT1Y9uzDn+rQj8vY7m2CR2KY3oX0UvFpMHqOMLDdf3IZeLoDXWrX0wj+93+Z61hUxvnTzwz2Qvr25nfmqd/4tSwtgood3bTs2/D0CVlm3Ds++CZf3XPg8XC5MRmvPBiVLS8dThHM7In4gIlDD/e9f+lHNxmcITFWOx4F5B1Fvn024B7H2vL8GIHCGkdeYtf7VcIrs7ECCXlj+fQ1wPd0tuv45Sh+vTv9n3Dzqqh9C3mrxEarxGGMWJVTBOdE8Nm4tld/6dfvilYJxFZUDndNgt69QeGlqmL75L4ks1MPNPT+XqSoMfv4/nymgo/iDr2Qhsa1UHW5/c15WPWMOPU0VyZDbMHiODg87a3x28jWOyZAlgtdqZtBhqAcQhJLbH1YJGMjZay9vRRPxSuNPMoqb6V8Gdq/CdIMg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230037)(36860700010)(376011)(82310400023)(1800799021);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 10:04:44.9882 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 16fedb41-7766-4180-7dab-08dc8eb4e9fc X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN3PEPF0000B36E.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6293 Use the pt_dmaengine_register function to register a AE4DMA DMA engine. Reviewed-by: Raju Rangoju Signed-off-by: Basavaraj Natikar --- drivers/dma/amd/ae4dma/Makefile | 2 +- drivers/dma/amd/ae4dma/ae4dma-dev.c | 73 +++++++++++++++++++++++++++++ drivers/dma/amd/ae4dma/ae4dma-pci.c | 1 + drivers/dma/amd/ae4dma/ae4dma.h | 2 + 4 files changed, 77 insertions(+), 1 deletion(-) diff --git a/drivers/dma/amd/ae4dma/Makefile b/drivers/dma/amd/ae4dma/Makefile index e918f85a80ec..165d1c74b732 100644 --- a/drivers/dma/amd/ae4dma/Makefile +++ b/drivers/dma/amd/ae4dma/Makefile @@ -5,6 +5,6 @@ obj-$(CONFIG_AMD_AE4DMA) += ae4dma.o -ae4dma-objs := ae4dma-dev.o +ae4dma-objs := ae4dma-dev.o ../ptdma/ptdma-dmaengine.o ../common/amd_dma.o ae4dma-$(CONFIG_PCI) += ae4dma-pci.o diff --git a/drivers/dma/amd/ae4dma/ae4dma-dev.c b/drivers/dma/amd/ae4dma/ae4dma-dev.c index 958bdab8db59..77c37649d8d1 100644 --- a/drivers/dma/amd/ae4dma/ae4dma-dev.c +++ b/drivers/dma/amd/ae4dma/ae4dma-dev.c @@ -60,6 +60,15 @@ static void ae4_check_status_error(struct ae4_cmd_queue *ae4cmd_q, int idx) } } +void pt_check_status_trans(struct pt_device *pt, struct pt_cmd_queue *cmd_q) +{ + struct ae4_cmd_queue *ae4cmd_q = container_of(cmd_q, struct ae4_cmd_queue, cmd_q); + int i; + + for (i = 0; i < CMD_Q_LEN; i++) + ae4_check_status_error(ae4cmd_q, i); +} + static void ae4_pending_work(struct work_struct *work) { struct ae4_cmd_queue *ae4cmd_q = container_of(work, struct ae4_cmd_queue, p_work.work); @@ -123,6 +132,66 @@ static irqreturn_t ae4_core_irq_handler(int irq, void *data) return IRQ_HANDLED; } +static int ae4_core_execute_cmd(struct ae4dma_desc *desc, struct ae4_cmd_queue *ae4cmd_q) +{ + bool soc = FIELD_GET(DWORD0_SOC, desc->dwouv.dw0); + struct pt_cmd_queue *cmd_q = &ae4cmd_q->cmd_q; + u32 tail_wi; + + if (soc) { + desc->dwouv.dw0 |= FIELD_PREP(DWORD0_IOC, desc->dwouv.dw0); + desc->dwouv.dw0 &= ~DWORD0_SOC; + } + + mutex_lock(&ae4cmd_q->cmd_lock); + + tail_wi = atomic_read(&ae4cmd_q->tail_wi); + memcpy(&cmd_q->qbase[tail_wi], desc, sizeof(struct ae4dma_desc)); + + atomic64_inc(&ae4cmd_q->q_cmd_count); + + tail_wi = (tail_wi + 1) % CMD_Q_LEN; + + atomic_set(&ae4cmd_q->tail_wi, tail_wi); + /* Synchronize ordering */ + mb(); + + writel(tail_wi, cmd_q->reg_control + 0x10); + /* Synchronize ordering */ + mb(); + + mutex_unlock(&ae4cmd_q->cmd_lock); + + wake_up(&ae4cmd_q->q_w); + + return 0; +} + +int pt_core_perform_passthru(struct pt_cmd_queue *cmd_q, + struct pt_passthru_engine *pt_engine) +{ + struct ae4_cmd_queue *ae4cmd_q = container_of(cmd_q, struct ae4_cmd_queue, cmd_q); + struct ae4dma_desc desc; + + cmd_q->cmd_error = 0; + cmd_q->total_pt_ops++; + memset(&desc, 0, sizeof(desc)); + desc.dwouv.dws.byte0 = CMD_AE4_DESC_DW0_VAL; + + desc.dw1.status = 0; + desc.dw1.err_code = 0; + desc.dw1.desc_id = 0; + + desc.length = pt_engine->src_len; + + desc.src_lo = upper_32_bits(pt_engine->src_dma); + desc.src_hi = lower_32_bits(pt_engine->src_dma); + desc.dst_lo = upper_32_bits(pt_engine->dst_dma); + desc.dst_hi = lower_32_bits(pt_engine->dst_dma); + + return ae4_core_execute_cmd(&desc, ae4cmd_q); +} + void ae4_destroy_work(struct ae4_device *ae4) { struct ae4_cmd_queue *ae4cmd_q; @@ -202,5 +271,9 @@ int ae4_core_init(struct ae4_device *ae4) init_completion(&ae4cmd_q->cmp); } + ret = pt_dmaengine_register(pt); + if (ret) + ae4_destroy_work(ae4); + return ret; } diff --git a/drivers/dma/amd/ae4dma/ae4dma-pci.c b/drivers/dma/amd/ae4dma/ae4dma-pci.c index ddebf0609c4d..5450fa551eea 100644 --- a/drivers/dma/amd/ae4dma/ae4dma-pci.c +++ b/drivers/dma/amd/ae4dma/ae4dma-pci.c @@ -131,6 +131,7 @@ static int ae4_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) pt = &ae4->pt; pt->dev = dev; + pt->ver = AE4_DMA_VERSION; pt->io_regs = pcim_iomap_table(pdev)[0]; if (!pt->io_regs) { diff --git a/drivers/dma/amd/ae4dma/ae4dma.h b/drivers/dma/amd/ae4dma/ae4dma.h index 4e4584e152a1..f1b6dcc1d8c3 100644 --- a/drivers/dma/amd/ae4dma/ae4dma.h +++ b/drivers/dma/amd/ae4dma/ae4dma.h @@ -16,6 +16,7 @@ #define AE4_DESC_COMPLETED 0x3 #define AE4_DMA_VERSION 4 +#define CMD_AE4_DESC_DW0_VAL 2 struct ae4_msix { int msix_count; @@ -36,6 +37,7 @@ struct ae4_cmd_queue { atomic64_t done_cnt; atomic64_t q_cmd_count; atomic_t dridx; + atomic_t tail_wi; unsigned int id; }; From patchwork Mon Jun 17 10:03:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13700473 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2080.outbound.protection.outlook.com [40.107.92.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 29C951922C7 for ; Mon, 17 Jun 2024 10:04:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718618693; cv=fail; b=mri7VdFDN8VzOa06Aw9zbYFVKC3YqnncNQw2dvPgr2B5jl358RWtzMKB/vyWKdxCvFDV1qJcT7AUgcu52zVh5XW1+KLq3uQZb6yPyKYL+XiiHGZ1riMX38SJ92bx5rfdu64Mo/bBfpXuqqgjzaQP+kqFHvD7kPlJ0YIh2/9RSRU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718618693; c=relaxed/simple; bh=b0aowZT5jOnuAEJvm1jtpE5bCOc6J1cqlzYDaL7Savc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Q517KIByWh2EvfoyqkyBi81HAFbR2pu31l7mvB15zpGIGVvQKuS1DwcpqNX6Cf7FyMWZn+rSj+G/TCmvMby09h9Gvx5bincT7O6wZ9VwcWf7+FP8YA7F54+pDZRmaCsqluIiuLMByIE8KObW/oYu0ajN3pd/5fKps1Qonv0TS/A= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=ZgpN5o99; arc=fail smtp.client-ip=40.107.92.80 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="ZgpN5o99" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZAAEEyFHvJHlaALny7TtyD6f68KyK1QggjPHK/pDdhnqGNSc6cJ8qUwRYpfFLRTvYhfTT2c5c+v/HjdQkFnRdPmvTT+RZd+K36HFyCpsmN0libKgHwyZQDDtzSoAtvPRuHgeL4Gd+V2m2v0rXWmIrC68FZsmLz74HI8M0TUYDYdcVpIzgzVWARnCt8Cguvv9KgUuyMHXWvNSGyLrcj5d6PxoHO2gnxu0Ae/d/GhjkA72YQ3oH53vDH0B618+r827ihfNLy9SmclllwM6/0AmZpy3828t+b+b7wDnh+MtiCSThCsB2do1vqNX1bQpNL18w8ecyczzLRedArXUAucS2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AfVuBQfuvb3Z3ecPjWRpAmSCUYkcHH5s6Ftzphrc9fM=; b=OlazVwE+0Tf9kmgrueEmRZqyZREhfPESNFqRHaUvFPJrbjxs1NHYIoj86Y6HC2aA6MY8dEYYkqGi1Pe6gOW0H7/MuXauzX9gb+Xjfcf4OtlbF9oS/4YXgUSUu2Lb0NGB+igXzI4Z4xnTHa60a8UmtJhqylQPWOwpqKuM48xiGVkZUWPlOr3aL1JHPoaGxFT+TJevhFJAWamVSQ6giSLpVZHD+4d2HoEZ4dk+GpF3Hy5rbI25vVEzCXGrwYjm1arjFiAqjJnLfnOsggOE+jWFy94h9ZF8fkgX8q+5hcrU44C5Y9tE6TZrCw28v5g1WbiAttzH1In+SnsgR11Zqk2VhQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AfVuBQfuvb3Z3ecPjWRpAmSCUYkcHH5s6Ftzphrc9fM=; b=ZgpN5o99fHoBKrHxFSisZwGHWh2vJZ0vvYu1YQVDroB8u5kp5VZ8d/C11BDQriLEFL4sTGFzIrZQXZuPr1EjvZo1DL4yIjhTIIUAYSc7FsKncc48aGy+LE+ehvkAIsSD8f/w1AI3qboi3RBay0M9QNouse9NbCXlEBuZ5shY9Io= Received: from BN8PR07CA0029.namprd07.prod.outlook.com (2603:10b6:408:ac::42) by MN0PR12MB6002.namprd12.prod.outlook.com (2603:10b6:208:37e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 10:04:47 +0000 Received: from BN3PEPF0000B373.namprd21.prod.outlook.com (2603:10b6:408:ac:cafe::94) by BN8PR07CA0029.outlook.office365.com (2603:10b6:408:ac::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30 via Frontend Transport; Mon, 17 Jun 2024 10:04:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN3PEPF0000B373.mail.protection.outlook.com (10.167.243.170) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7719.0 via Frontend Transport; Mon, 17 Jun 2024 10:04:47 +0000 Received: from jatayu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 17 Jun 2024 05:04:44 -0500 From: Basavaraj Natikar To: , CC: , , Basavaraj Natikar Subject: [PATCH v2 6/7] dmaengine: ptdma: Extend ptdma-debugfs to support multi-queue Date: Mon, 17 Jun 2024 15:33:58 +0530 Message-ID: <20240617100359.2550541-7-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240617100359.2550541-1-Basavaraj.Natikar@amd.com> References: <20240617100359.2550541-1-Basavaraj.Natikar@amd.com> Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B373:EE_|MN0PR12MB6002:EE_ X-MS-Office365-Filtering-Correlation-Id: f579f4e1-36c7-498d-ad3b-08dc8eb4eb2e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|36860700010|376011|1800799021|82310400023; X-Microsoft-Antispam-Message-Info: a7dSmXJQtRQMZ70paPc0XugKJ1za9x5m3SpPQiIsKarEUV6SKYPDIQoaDhNmX1US4GL8Mex5Zs54FO1ZwEDN0yvcLmn1pTYCmK/w6S/pCHU6bNEOvzHSItyRKrjl+RqiQ1KYtFcgTZWLIG06X8zYK/UEnh153ndHUswdQpCBcHMf8GC7pV7EuTzDksqrw25GUgNnQ1fk/UlXAnnKz+UsAEtaPsEJ8t93MWWC5X5bUjVPa4767sVwIyL4rQI2kGiU0Y4ZGV+GdaQXq9u4PoD1J12CLyMboCOOqTp+W1YsJbuXjcFoSKsvCrTtcg3EuSavbY427PKcpm/DgPG/Hns2Oe9E74uc0ZpE3lh3jlTxUK6b6O70uOr0HAuDOuZFLK5Nfi5krlxoIXsRcrl1EfO46JD8jYPhoHig07Jlc/m1Kh9jJaAZOUE4V8cT7VURNv5ei38GXFLGweirpvjpwBh41gJddq3BkQmlUxIbHZYSuVXYyWKe/WOE0iQmfJPEZk7bH08tdCNSGVZm0JEVJcsIrepTOHqXRI5kbrcphf+STd2DfnIFzyn0O/dIRHy12FZ8GKFBYwUQlOTyOHUhJs5jNqvMbpVLmm45jNfi1HCJMiVT6wCfiYKPYlPgvkVv+X8YaAsZJNuhiNT8kqTZIkLnmnX/qoWNVgzADTtouBJY1tPKs6XzyKWmAucvni0vXJcUWt6AEeCyCjIDXs0JVUPH5Ca/tJENDrd7fSn/peTu96P6icvitKMZFVWNvqK34BJkzxVX+UqCj7DOPTa9QE6rcrxGs2H+HuDk/MtE3aqrYRk5Inz6esSgE6KLVNKEtkDou1yRNtFWTmsLF646jsgU9rYthtd0rqM+stymJVq+4yvR27JxHXtxfAHMqSqrK89HmtrrWLjlFXc45PehSzat6FSAtQYphdyh5WJRY199cQe3PZ7vFVNUuDtBaJNPQeWGuqVQH3USc8OtgmUGU+ixcxQ8vtD9zflX1915me8Ylanjs3HXDF+mWdefnJQtYW9jW9m3/uG4dlpnHHgC7L6c4wLLzg7vg9FEwPrZKg8kVtL6ohbrf4kLklbcagryb3PDNnsOhSzChvu6i0fJDq6myMJsIWsuKp4SBPby/KZbZ3QX/TKzcWMS3apHLtwBC58+Yp/Sr3OAZt4NgRMxyh/Gr/dDtGvjnORdopIm9NNlGH0TdiQLBsm6Mna6pnp7zYI1pcfSX8DqfQU4E3FbWhtpap/nekwr3VGasOw1ujdLyVNgB986sNxAxg6/zl+i0/nI0s7uRFlJftkRzFeW5AIjT+dU7KBOhguc0jeiRVHEGwon3a5Zkn3Ob5b3J9NlJotQaiHQJfBJElw39lc21zVjPi6xYyxLRH6zYMSrzB19GIY= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230037)(36860700010)(376011)(1800799021)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 10:04:47.0105 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f579f4e1-36c7-498d-ad3b-08dc8eb4eb2e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN3PEPF0000B373.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6002 To support multi-channel functionality with AE4DMA engine, extend the ptdma-debugfs with reusable components. Reviewed-by: Raju Rangoju Signed-off-by: Basavaraj Natikar --- drivers/dma/amd/ptdma/ptdma-debugfs.c | 76 +++++++++++++++++++-------- 1 file changed, 55 insertions(+), 21 deletions(-) diff --git a/drivers/dma/amd/ptdma/ptdma-debugfs.c b/drivers/dma/amd/ptdma/ptdma-debugfs.c index c8307d3044a3..9aa7a49ae5be 100644 --- a/drivers/dma/amd/ptdma/ptdma-debugfs.c +++ b/drivers/dma/amd/ptdma/ptdma-debugfs.c @@ -12,7 +12,7 @@ #include #include -#include "ptdma.h" +#include "../common/amd_dma.h" /* DebugFS helpers */ #define RI_VERSION_NUM 0x0000003F @@ -23,11 +23,19 @@ static int pt_debugfs_info_show(struct seq_file *s, void *p) { struct pt_device *pt = s->private; + struct ae4_device *ae4; unsigned int regval; seq_printf(s, "Device name: %s\n", dev_name(pt->dev)); - seq_printf(s, " # Queues: %d\n", 1); - seq_printf(s, " # Cmds: %d\n", pt->cmd_count); + + if (pt->ver == AE4_DMA_VERSION) { + ae4 = container_of(pt, struct ae4_device, pt); + seq_printf(s, " # Queues: %d\n", ae4->cmd_q_count); + seq_printf(s, " # Cmds per queue: %d\n", CMD_Q_LEN); + } else { + seq_printf(s, " # Queues: %d\n", 1); + seq_printf(s, " # Cmds: %d\n", pt->cmd_count); + } regval = ioread32(pt->io_regs + CMD_PT_VERSION); @@ -55,6 +63,7 @@ static int pt_debugfs_stats_show(struct seq_file *s, void *p) static int pt_debugfs_queue_show(struct seq_file *s, void *p) { struct pt_cmd_queue *cmd_q = s->private; + struct pt_device *pt; unsigned int regval; if (!cmd_q) @@ -62,18 +71,24 @@ static int pt_debugfs_queue_show(struct seq_file *s, void *p) seq_printf(s, " Pass-Thru: %ld\n", cmd_q->total_pt_ops); - regval = ioread32(cmd_q->reg_control + 0x000C); - - seq_puts(s, " Enabled Interrupts:"); - if (regval & INT_EMPTY_QUEUE) - seq_puts(s, " EMPTY"); - if (regval & INT_QUEUE_STOPPED) - seq_puts(s, " STOPPED"); - if (regval & INT_ERROR) - seq_puts(s, " ERROR"); - if (regval & INT_COMPLETION) - seq_puts(s, " COMPLETION"); - seq_puts(s, "\n"); + pt = cmd_q->pt; + if (pt->ver == AE4_DMA_VERSION) { + regval = readl(cmd_q->reg_control + 0x4); + seq_printf(s, " Enabled Interrupts:: status 0x%x\n", regval); + } else { + regval = ioread32(cmd_q->reg_control + 0x000C); + + seq_puts(s, " Enabled Interrupts:"); + if (regval & INT_EMPTY_QUEUE) + seq_puts(s, " EMPTY"); + if (regval & INT_QUEUE_STOPPED) + seq_puts(s, " STOPPED"); + if (regval & INT_ERROR) + seq_puts(s, " ERROR"); + if (regval & INT_COMPLETION) + seq_puts(s, " COMPLETION"); + seq_puts(s, "\n"); + } return 0; } @@ -84,8 +99,12 @@ DEFINE_SHOW_ATTRIBUTE(pt_debugfs_stats); void ptdma_debugfs_setup(struct pt_device *pt) { - struct pt_cmd_queue *cmd_q; struct dentry *debugfs_q_instance; + struct ae4_cmd_queue *ae4cmd_q; + struct pt_cmd_queue *cmd_q; + struct ae4_device *ae4; + char name[30]; + int i; if (!debugfs_initialized()) return; @@ -96,11 +115,26 @@ void ptdma_debugfs_setup(struct pt_device *pt) debugfs_create_file("stats", 0400, pt->dma_dev.dbg_dev_root, pt, &pt_debugfs_stats_fops); - cmd_q = &pt->cmd_q; - debugfs_q_instance = - debugfs_create_dir("q", pt->dma_dev.dbg_dev_root); + if (pt->ver == AE4_DMA_VERSION) { + ae4 = container_of(pt, struct ae4_device, pt); + for (i = 0; i < ae4->cmd_q_count; i++) { + ae4cmd_q = &ae4->ae4cmd_q[i]; + cmd_q = &ae4cmd_q->cmd_q; + + snprintf(name, 29, "q%d", ae4cmd_q->id); + + debugfs_q_instance = + debugfs_create_dir(name, pt->dma_dev.dbg_dev_root); - debugfs_create_file("stats", 0400, debugfs_q_instance, cmd_q, - &pt_debugfs_queue_fops); + debugfs_create_file("stats", 0400, debugfs_q_instance, cmd_q, + &pt_debugfs_queue_fops); + } + } else { + debugfs_q_instance = + debugfs_create_dir("q", pt->dma_dev.dbg_dev_root); + cmd_q = &pt->cmd_q; + debugfs_create_file("stats", 0400, debugfs_q_instance, cmd_q, + &pt_debugfs_queue_fops); + } } From patchwork Mon Jun 17 10:03:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13700472 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2070.outbound.protection.outlook.com [40.107.244.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 931A8190687 for ; Mon, 17 Jun 2024 10:04:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.70 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718618693; cv=fail; b=tT1dHy2oKu++w51FSCjK/TpZwz4o7r3MBjAkgCNDk+5Vg9MFLcXchRxiFj1MCCkV3HcV5FpP69LAMDEKx5cCTFMSY+wR99NgAjOVbBoC3U4G9ahgnocG5Vd0cJWJIbkP2yQTiGKdfItqHBNY4Esihj8V5hanwtE/dcMJtHhVKVw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718618693; c=relaxed/simple; bh=3toA92OZ6DVWH+glzIqT9ndarbU/okeC6x4v2mFcvyM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JhKN9bDe+6SERR41RXZG8GSpPAW6sFpF+QLUO5qIoRwrzwcLxYdRWbNzodfite77XIgzM2h7SKySO27NatyxljwUo2VZZGmG7H8dDBXCDvXPELfZNtqlDJISc7EXR8DLW7E8YC+dfrDmtLK65XuKhg5nrmevUBtLhSuLeiLtJqE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=r8niQR/A; arc=fail smtp.client-ip=40.107.244.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="r8niQR/A" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n84ZLzVyYtAeqNr43ELoi/w3Rumyqp1RsZ5xskHzv3Osr6PbLc96gZ9reqzGO8iCyyy0IQKGVXkVr4ndyBiOHsxYQwKTI9JBCBBXuOQ3bLTHIoVjUt8WejsAZKhW06Rnyl5a3nTsCpLm2ydYDUSpDVTG1D6jzzkhIVJUeZPlvdXtRKb3fZ0fQSmsbOoDASmd9dh4ByOJKUIZ3uyMVqBWLK9Z5MAAQMFBkIvAoEoJMw0YTGyp8Qe2UEbNSTItYqE1YluFSg5A4U/LCcDNK9OjvSxHXsL6f16GTx6IkEwfFRPZDt9fl6cyIvAPMsnxPkrTcx/qpufphhUwinDExhqQOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tpAkxtDte0CSjWjVZ6dsaikB/BIAr7JrgOapNmUR3Mc=; b=mGKaH7wSRDgXzapPF1JKt1rBQgmEqhAK8YK4PJaPtRYY9eZam5z/X4Wi2R30tNOAPmMhvq9EvRW3zE4IIHwDvl81duNVU8qPiE0dWRR9Zoj1u2fXvb2eyfu5EoR8Fs3KJiiiToxB9VrriH8W3ntcMSho45dJGx9fGlY7UDxvj/67HT9q/B4HhTIUJl/Jp9B5xChDuuVXVRG0+gzt4g2PZGKGd0iVYWmiDVrVRj+ZQixqhBArdYWPumnleqoOwhiTCbo6E+SYFon1Pt0CQkNnaDmp1aVIzoWHVLugq/KRMS9tfMRty/mB7JkWjjtCeDi0xpFWVJoFHg7Q8xxMHfBn7w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tpAkxtDte0CSjWjVZ6dsaikB/BIAr7JrgOapNmUR3Mc=; b=r8niQR/ANFkvyScdpc4LZUHgHyt6vsZXEgcXDB+7NzOWs5dhZPptC87kWTW6Upx2egD6Nj34T7x6oDykKdc3ZUWZmn3aAXbqUTXKuxp5WJi5cI8yCcoKiiog1DZltslqqCzRtQf3cbRYNoTdZ5SQ4CToPZgX8g7eJaWX/xjNMJc= Received: from BL1P223CA0025.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:2c4::30) by PH7PR12MB9201.namprd12.prod.outlook.com (2603:10b6:510:2e8::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 10:04:49 +0000 Received: from BN3PEPF0000B371.namprd21.prod.outlook.com (2603:10b6:208:2c4:cafe::b5) by BL1P223CA0025.outlook.office365.com (2603:10b6:208:2c4::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30 via Frontend Transport; Mon, 17 Jun 2024 10:04:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN3PEPF0000B371.mail.protection.outlook.com (10.167.243.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7719.0 via Frontend Transport; Mon, 17 Jun 2024 10:04:49 +0000 Received: from jatayu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 17 Jun 2024 05:04:46 -0500 From: Basavaraj Natikar To: , CC: , , Basavaraj Natikar Subject: [PATCH v2 7/7] dmaengine: ae4dma: Register debugfs using ptdma_debugfs_setup Date: Mon, 17 Jun 2024 15:33:59 +0530 Message-ID: <20240617100359.2550541-8-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240617100359.2550541-1-Basavaraj.Natikar@amd.com> References: <20240617100359.2550541-1-Basavaraj.Natikar@amd.com> Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B371:EE_|PH7PR12MB9201:EE_ X-MS-Office365-Filtering-Correlation-Id: 793bec5a-33b7-4a90-e227-08dc8eb4ec61 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|1800799021|376011|36860700010|82310400023; X-Microsoft-Antispam-Message-Info: vfe9n3wrOOLXNylwQwgVugAwBUeRksqyDaPSRM94lAxr+a7Ow54D8D1E7hf24HOSfYl2PtrqLEnGZfHD9y3HQGkyMOA8I1qkIbskQXysuzwwHfXvzsVAnSG7iDWMZtPjocPdgc/lPTcqEoO0X60dGaZTH4UksJc/6aKuur/XtZmD4SWiCtKd9IHQBfxKFLmS8H9Yyc2eiWHEVMeSP6XvULlJU7UHzzmDw9NQXQhZS16b/fTD35k2S/4fGcCGaC6LT2ju1ewTJyP6ACYyp+BnvWb4GRmr+HBMK8InWmo+niiPxFo83hg9Zb6EI14C5COcwLuLhtH2v/xH1HtTzf5SQr1Mqfhiykn8eqxpEEkAcCX8GoHogi2wnBSZOeqT1+nYrndNv6KCIf4vsypAC/efzIIt5DeeIwhURvSpFA4eqdibPCh6W3FQwhUORPpqrS8aHZ8ii6b6HipU1JEpNmzAFY9nmGb3uXTuQY/7SgigM4u3UrEDohpipEHXvGAA35YRzNJ2bSvD8cNZbRmD4x/sMlR5UXitG8lqrVXpW048UMw452NPNp/0Q7zQviTJkVFiqg3/Wqyzm3PBNjME4nFhVcUsfFFot1OIwZNFlb6+YLaj7W2X5KPeDSY49I++xCdcwfNpyQZdNoe5//R2iKkUEUrlYl60l2lrkTztGcI/6hkFLNjNZ3edrHEEtjy4/5JupnLFU9cxOyw5UY1GVcWY7fAa0UyP2Dub6lB8dweb6AkfVbPSVgLJnwif8KOKmTUHc4JdtnI6i9HSSB6iu2gApAtSWMZt8HRkyXVEuxc7cfcFymku5lNu7f+9QcU1yNujxv9KaCXda6HtpLVa7YjmGdDyQAiL9/sYN8/sNdHY9ghjMVGmR0keAZHAMSlcK3qcuIApb+QraA8Q5wdFp5G3Z+cJ5STN6vHwTeSil5BF6liIKx2u1M4rs1uPRuuecfqxp42RTyncAuVQ1Lf8mHrCmWztlrhqiR96Y/6EC/SGvWIJbL5YBN7rTzfd7LBH5HjxrLVQoIOyrJWDEj/T9XSuwcePsMcREQyPHbE4vdGBX8Dkihdd285T3YrKe6zamjJ3N4NiR1RLxtO5kc/wy6STXy7AoRTbb05C09k9Ja6Hke8iYSPVDDSeSH/fTU61FkequZEKBU5o1UWW5u6WSkypR8ephibsru/HjUVZhNaOJu27GSO7GwWFdXbea+qyWX67LOugbtSzG/LVxAT7BHM5JxhsXFpdm4EXFvYRgVfeGvz0TSR6zosz4B8lZvhy7F75hZspBTD6BAw2LgflqC9taagxcJYtdK7scXTxH3IRChqtJVeCRo55DRoN3GjdTPiFjloxvttB5DMcTN6SJzjCaOrgM06Kf5NnuwGmXH7b6D7xepytG4xPtgTohyRO3YTuivbr1IKthulsoYxuiVI+7A== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230037)(1800799021)(376011)(36860700010)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 10:04:49.0238 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 793bec5a-33b7-4a90-e227-08dc8eb4ec61 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN3PEPF0000B371.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB9201 Use the ptdma_debugfs_setup function to register debugfs for AE4DMA DMA engine. Reviewed-by: Raju Rangoju Signed-off-by: Basavaraj Natikar --- drivers/dma/amd/ae4dma/Makefile | 2 +- drivers/dma/amd/ae4dma/ae4dma-dev.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/dma/amd/ae4dma/Makefile b/drivers/dma/amd/ae4dma/Makefile index 165d1c74b732..5246d4738413 100644 --- a/drivers/dma/amd/ae4dma/Makefile +++ b/drivers/dma/amd/ae4dma/Makefile @@ -5,6 +5,6 @@ obj-$(CONFIG_AMD_AE4DMA) += ae4dma.o -ae4dma-objs := ae4dma-dev.o ../ptdma/ptdma-dmaengine.o ../common/amd_dma.o +ae4dma-objs := ae4dma-dev.o ../ptdma/ptdma-dmaengine.o ../common/amd_dma.o ../ptdma/ptdma-debugfs.o ae4dma-$(CONFIG_PCI) += ae4dma-pci.o diff --git a/drivers/dma/amd/ae4dma/ae4dma-dev.c b/drivers/dma/amd/ae4dma/ae4dma-dev.c index 77c37649d8d1..d6082f14acfc 100644 --- a/drivers/dma/amd/ae4dma/ae4dma-dev.c +++ b/drivers/dma/amd/ae4dma/ae4dma-dev.c @@ -274,6 +274,8 @@ int ae4_core_init(struct ae4_device *ae4) ret = pt_dmaengine_register(pt); if (ret) ae4_destroy_work(ae4); + else + ptdma_debugfs_setup(pt); return ret; }