From patchwork Mon Jul 8 14:44: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: 13726687 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2054.outbound.protection.outlook.com [40.107.237.54]) (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 0D86E15A5 for ; Mon, 8 Jul 2024 14:45:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720449930; cv=fail; b=hhncpaMiI0Ow/bTBPujLrPLrb85NAjiqPEMXDt7XHtUdOH3EVHISYAIqKyo9Ca52ORDhICH8xebp1ftapPYawXeThCo3Di+6nbeswdixg4P1AWjopMBl8hFBPFXYpKtMn5Z4VvJiuRSks0oawvwiU16xbKaPd+b7WYdmGBly8Ak= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720449930; c=relaxed/simple; bh=fwRddPg505G3YDdAa0GEwhgVH59sJl2GqzEqdl3sP8w=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=twtsnRfihAqQjEU+VZxXrN0PtT35JMb8QaxIHuGKuGii+JLGzumzxvrkfQPdsEdDIthC9PQ6tMu36AICVEOvMi53dbC8UW6zfs8rAFBrhABvBRUQGjGKhMqE5D+Pnl4WLzl9TfRbu5sbK/lij7NKbWfsmDmh7wCsHaVCQiyaNVU= 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=RQwrQbeG; arc=fail smtp.client-ip=40.107.237.54 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="RQwrQbeG" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gPu/TN7D/HxxgqaYCgqNasb/wb1UgE2K1XssTwQGmVeN9V7woz2GMb0PfZ9HQUJ2la9vvn3AGnd1MbnKVMghI0bu92D44H7O1zgDnGYIXfVoVv0jMyVZ9ThXktlxZvSj6VWQXtS23hotkJoPVIwBFhkVecadQ1vkBAewjz90xJEpg7sPKhzBmPrAMbnbpmLOREQltmUYp9TvSYeHZssEMh2upkx+s/mtuEPnp6iQZVK1evnRtXLPEvlWax/jMqKqFj/xTQSMlZZsCZk4e/UdKp40rHgXkTXPP8VAq2WxxAV9mR2LJI6dvVOXPY8g5URdTp333624R1d42ewVDZba3Q== 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=AzD2wiAwElfAXESdCMCnYjQZGU/3uP0KPVrOyeE0Mnc=; b=Nph4R1AeYPjhSu8hcvNOHuGULrhvaJJdnHJpETLJd0UWYltPosoMga3QupnCpO65VcLx/4+Hz2lM1WEA5YRjdE3mLFa5gyqncq5sThuY0yTPmUZ6IIMpReTD+hU9qSIj3bTZVoxBBM2JSOacxGfB2g9eBbECPngbVkuUGhfr5LxN7y1Z++MW0TSemXPmOATKjrDkBB1KesQrFq94qoRifkFdaU42Sl54ULzPucEDuvo8ttMdVvYN2V7jUcIj5VzPNobWFSz+shC76FxYlU9t4MKtgGMc+NwaKnyHhKeYezBK+WZi0cPLL33vGsh3gX9r81YJoNkhWWdapRs0NpNmGw== 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=AzD2wiAwElfAXESdCMCnYjQZGU/3uP0KPVrOyeE0Mnc=; b=RQwrQbeG2L0iqfdEFikoSHBAlPYNpkTjc4larTHX0MViciDYfcp260Ux3z9hjr60+lzeNRPbztUA+/TI5B1Ng1VihCYL3gva5wbAGLdchugO88blJ3J8UBmwjAF1gCXO/Ppo4spAEUIGUNHobxGXdHJ0iL6/Gm2eOIX7UeOSVNI= Received: from BN8PR03CA0003.namprd03.prod.outlook.com (2603:10b6:408:94::16) by PH8PR12MB8608.namprd12.prod.outlook.com (2603:10b6:510:1bc::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.34; Mon, 8 Jul 2024 14:45:23 +0000 Received: from BN1PEPF00006000.namprd05.prod.outlook.com (2603:10b6:408:94:cafe::d6) by BN8PR03CA0003.outlook.office365.com (2603:10b6:408:94::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36 via Frontend Transport; Mon, 8 Jul 2024 14:45:23 +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 BN1PEPF00006000.mail.protection.outlook.com (10.167.243.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 14:45:22 +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, 8 Jul 2024 09:45:18 -0500 From: Basavaraj Natikar To: , CC: , , , , Basavaraj Natikar Subject: [PATCH v5 1/7] dmaengine: Move AMD DMA driver to separate directory Date: Mon, 8 Jul 2024 20:14:54 +0530 Message-ID: <20240708144500.1523651-2-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240708144500.1523651-1-Basavaraj.Natikar@amd.com> References: <20240708144500.1523651-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00006000:EE_|PH8PR12MB8608:EE_ X-MS-Office365-Filtering-Correlation-Id: 69dfa9f0-a920-4ddf-a330-08dc9f5c98f5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|376014|36860700013; X-Microsoft-Antispam-Message-Info: Uxj2uuCAUZNEmCJUdzfTLa9ql9pNnnPmP0vNCztiZ2TQYWQqvko7rNb9nNfAgYIeL/4J6Q5ArbADPKGA/OjH7Bo+CCh9T9FiWWsYPEZLF/plO1IeigtETY7aQpixPbirn0pYtLr8YjGd34NiNxPSB1KcM6XEI9bYzFC9Pxwp4tD3JMty8qsOwMi6sVSYfQ4okq/ODmw3Z5RJZE9k2vV0t23iYhOddsXBfPnPdhBE6sGumkh4mOYYYss58kj3gXNF7xI4j6kAdcCdaRQiNcMC9P4yzuRm8XAJxC8tfL8mPrXYe49bXYmYc+mwegQ9v9wwhItUmSyzkRWi3kEjBb2lX5E+unvY8fDUYBZyLCAAc/70qi8n6BtABqUP82SebIkilEPdbltxMSwGKouYSTlQ4Md238mln6SRS9HrWXaSFlaoVCO02qthaMBg1pcRmy92RZLsZ+FrhFCTCOybsav+8ijCiO67AeY5NkWpuaDG1NQW+B209gzKAhvxu3ibK7bqKUUqEp5Vp8G/XI5VoDiYtRBy+4012OajexN8TkOY0KqpeeoARt/fpvsRVW9rvYaQcws8k+43jZQBWz4y9cyjIzSEgro5qxbEnZ1INLpiy0M/aSdP29q8/bhQZ8bTdWYa82pvfC+4ZarqMssap12vfDw4Elk5AhCDXPcyxR5Skb6W40+gYq0Z+h/uaclN/311SxFwIU7aHDYq+N7FxAY6jO41Q8KDmFQ5Q8hGncqq+JCEGme4Oc8KaATGecdnJq09KnXv2nH3Jmhz/U2LMi9c4ayRBqPnsGhYjkPDffubPaxS/tKkm6femU9SGCLiJzL1nYniHDj2i0OEGJh+lTkeZyZSPGq3Jel89/UgorHcTG1KowFtgP85d1DCf4gAxltqOWEamWcMUUjeQP+GvZB9WcnXu1uuQfWVETYON2repnKH1LSq9BLBjsSeT9z/oeVUoH6DHLEq0duCBMvzDpZ3cSpaN+mS2e6BO/sHvSW/cyiBTWzG+yjI5xj4Nyc3/sd1dGe31wBPUI0f3WmwqlOZc8ksBJZtgs2TMyr+QKoQ0SgscsmuCZ6WqsGIJXRdgUwVLdRftBBirEsUmXYYWBUZbiQexvPJoJzTp+xFD28IsgfyW0k84B6AWHF1TaV+Puz+kmqbe3RdvBafg0LmjkzKYNnJyEVdKci/k590ChPKIZO2hsyepYabJVWvZt2x0zkpqZ+bNSUIm97Q0eF6lPE4lAXk8skdoSrNLWuTsvXNVmqoz8hPcLWoYZRlCFaMADcOq6W4It3yW/jnO+Sf0U1I3V0fly9gU0Hf9zhj6VkaLuQRpp6XgPM+sgn13J0TisxGsaxOMop+H+nn7DyAVIl+qUKXk3dnbSccX5CIrjpPeChpWNyYbJc2LhA3xTkFm9fNHcgHl9pfzsA/u8Sfpm2P2GEjKEPkWKg8BOfx/GyQlxQ1OYQrJrFK6PwmXVU03t3s 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:(13230040)(1800799024)(82310400026)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 14:45:22.9622 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 69dfa9f0-a920-4ddf-a330-08dc9f5c98f5 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: BN1PEPF00006000.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB8608 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 da5352dbd4f3..33a1049fd38b 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 9fc99cfbef08..e4e424ebdac4 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 Jul 8 14:44: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: 13726688 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2058.outbound.protection.outlook.com [40.107.223.58]) (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 8BB7213C674 for ; Mon, 8 Jul 2024 14:45:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720449931; cv=fail; b=MfcDIVIxDdH6tbX1hiTKbTJiPt2Tcw83/10f1olgpZCR6Qq0mWsKPK1qmGgxNZJbDhFTgpY5gYuwQwxSzTgi4d4H0XOY9UADTffiQTYfr6R0w7dilVyY8yTE32pGPX57VVoWHt2Saq4lXXNxyIr62va9WBkT/QqGn8Hft8jmBOs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720449931; c=relaxed/simple; bh=ylJ1aLl0PsADFRh/hQmBeKlWlZTWjZ1hafcKpHukRF0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=C5vjQgjH+wekBtVpe8qXO0sLS3GmU7NiVB2LuL+evX87tPBwqeIVUgqLSsWVmNGjwBHT8uM++JUV4vsxZCpmwsV2OE1cGkgmKriSnlu7wGcUnrtvYxO/ICaj600/461ekYEGjmHITRxfloPDaRxo2GsHZk0g1+V83cuI7uPrKdk= 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=edaEbF3y; arc=fail smtp.client-ip=40.107.223.58 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="edaEbF3y" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E87m8iWv9rZPHjVHtk8OXZPuZ39nwCwooSvnv/m8JmaiDM1jAU4e/8x39/sQRxFuMReb0Xyexqrt3dzKT6+wfQbKUA93ATxDq8DZFnxtFOmAwyUcyymF7aiVATWW+Sowf+r80r+3Y6n6NJhfGWIKkzdI4ykIsRkYntQX7hpelBALERpCA6O/bXRBp2dKfwj6qjzYUEGPOUUvcKLlSQdNZ1IGSdx8OjgUaMzl6zaDOEz1B3OYPF9YGYjupfA/ZOPKoh3EMafCCAfPtxUb6r2Y9kBy6Ewn69OFkHAdMfNBWevA/RaQhLre54z3iB2Px0op7ahXK+9MmrfYDNsq8Zx6mg== 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=oTuh9YVo2leMT/3gkDs5eMS3d9DrTV86ARtU5mMClZw=; b=P8Nzng93Y+NMyHT/PL+Tpx8I5brHqEEH9Pro9ONmhA1GBVKmuViW5o5JkSRnarx4a/ogmgkbK4D7phyNpzzJcMNR+AZu2ouooeOaORbSuhDKHtpAH7AH0TyhJq22/ymYCz2/+teh/HPa3hqchRqmLXIlHDVV7bnDkw4/I5Yg0Es4b5ycm7cHp90b8rvoEC4/oTM/K9dO/4n/miewO5xV2RuDPh/DJMBfMWnnNt0gK7LEMNM1PDo1NVz53KM9p+R1/Y8OdpDFn8gw9fsZUN/yY+6Tc3BPyiZnJBMCwHgbc4HoXA9cGV/9OdJoy0oPkXu/V1HhMTYF7AnUk/R3bSGgzw== 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=oTuh9YVo2leMT/3gkDs5eMS3d9DrTV86ARtU5mMClZw=; b=edaEbF3y8kj+GtZXyUZ/kTMO1IxIAEeyC82yAg6HXnPAP+HXGnWGKndjqFaiam5FD0lReoClqpUWBkHurxTGt6xW/DzJHAnSV+3/SDmNjZO6sueKPv58lXF34LxFS0RaXORNdl25m8kZsWzM3DP+nGyN4yD+Ov3tb5Ag6aEA6CA= Received: from BN8PR03CA0028.namprd03.prod.outlook.com (2603:10b6:408:94::41) by SA1PR12MB7272.namprd12.prod.outlook.com (2603:10b6:806:2b6::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Mon, 8 Jul 2024 14:45:26 +0000 Received: from BN1PEPF00006000.namprd05.prod.outlook.com (2603:10b6:408:94:cafe::4e) by BN8PR03CA0028.outlook.office365.com (2603:10b6:408:94::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36 via Frontend Transport; Mon, 8 Jul 2024 14:45:25 +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 BN1PEPF00006000.mail.protection.outlook.com (10.167.243.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 14:45:25 +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, 8 Jul 2024 09:45:21 -0500 From: Basavaraj Natikar To: , CC: , , , , Basavaraj Natikar Subject: [PATCH v5 2/7] dmaengine: ae4dma: Add AMD ae4dma controller driver Date: Mon, 8 Jul 2024 20:14:55 +0530 Message-ID: <20240708144500.1523651-3-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240708144500.1523651-1-Basavaraj.Natikar@amd.com> References: <20240708144500.1523651-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00006000:EE_|SA1PR12MB7272:EE_ X-MS-Office365-Filtering-Correlation-Id: a7d342c2-0b55-4dbb-a59b-08dc9f5c9a7c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|1800799024|376014; X-Microsoft-Antispam-Message-Info: dbIWFpgj6aed8gvQ7EObSlc4rJH0c+hg739kgnSmqD6uLSnovkUv6XNCs+KMJ+0b8X2AJzgDg/EW/us9HpLhJNj3aNKDeK8UczFxEe+0p+tlSMQEL6cN9WbOv6+Jc6+1G46Ike6qln3ybhlwJIZDevKomEFRCTTSMWgdY7LQeM96it9tQM2orhiMiQD1CdcBw8BFl4sUM/B1CteMFBOxAUeYP3n2Tk5IokavNtlIBtrSFdaUtQfVRX/HhrZBhj/HaislVxZ69j52RZjvos5kMTCaEcx67yX5GzhWkShTxfmKfpmEJ4n8v0HmpzjxCOuCaAyMGH8wRWgrynqUkG8szaedSS/pG5uPzn6IhORr7+kafwd2LF50Alpekt9qsq8gcwBu+2pEZ7kwu4KjY40+gd0IjJ3yHD/Bs1DYLmEEdWzC/hYK6lGIlua4r8Q/GTukQLy3V2hEfV7IxKBSsVr3ZFtlNeRkj2/gae9fuGQzDibI6EZ7TvH6HOFIDCb7BXApSyy2ZnGOGaIcQXLrQjv/YSB8sqjNB9EE8IMIlviF1omjuxupdMCY9SUGCdhjwrOfEhcfHz2KPXeDiuMzhwK1iUViygbZqQVjJ36t1MD2e8Vh3hm5yeA7FveIN0Kh+hixsoCiLHDRAUtrQ5ThuRsnFQHY9ShFB2hawL8t2M6JFRADdgrsUkXgVQGX10xl3BlKIfTwpMWju3nmD6fHWhwJ97xuK1j6tlm7SYiyqQkBj4EVC544vTFZJY19Qq5o4v/PdK3OISs1GRHlffG4h0KV5lgwiR5SwWwWM+cQA/JXb9/lezwHcv3WliUZAuLXpVhFs2sbbL3neAPLTp9pAaoHe5aMYRPUVjCQu2xFdTQq//jWH6lS8UabQqVXNJb+XxEy829lo/oMDiT7ZYXKG+IcjLiZ6etyR2Vc9vfAJnNRtbdmUU9B9uVfI36HqOHguNNPxC/JFkYNq4XlqGUmnuj2h+0sahlMnlWwAZ+ZlvG4a59SVf9ry+8BgD2lOeG0e80nw88/m3ACzGVG76SmfCrWhQvSUaMrJU9Gggq1pCYVFBksEBCqazVxtpfFN5lNRk7hGxdX3OjQuaJohXnl8JI0rmFv1m3qAIyluaVRLTvX9jSuklhhigwMLNV38LO4kXBzvUhXYCc1Whouu4Be4V5YLI07Q/VT0UgGMQjEtnhAB0Tu+vSv/zUQ5mpSzjp2wjgaacfHT3xmwyDGd/axdyou1dUEBlM7bqMVJVQLGWM0pL1uo1HyrSLJtr+AV/8Br4sywzbmXvycoXqrLD10gspSjJ/BF+/iZN3gu0PSrMcb/Yt6Wr3BaeyLtNfOB9PZ5KVcvG3gIy+3nKz5OLb/YjQdrANS1qG9OnoF1Bf1HS+qyyRSxz4GVdC4zjgamLKa01uu72Eb0Q8h9/sDNKKNDFtblVjZ+wveBIeLPXMxsNSeYcTfF+XQiPtogQIx20k+4MfG 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:(13230040)(82310400026)(36860700013)(1800799024)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 14:45:25.5091 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a7d342c2-0b55-4dbb-a59b-08dc9f5c9a7c 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: BN1PEPF00006000.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7272 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 Reviewed-by: Philipp Stanner Signed-off-by: Basavaraj Natikar --- MAINTAINERS | 6 + drivers/dma/amd/Kconfig | 1 + drivers/dma/amd/Makefile | 1 + drivers/dma/amd/ae4dma/Kconfig | 14 ++ drivers/dma/amd/ae4dma/Makefile | 10 ++ drivers/dma/amd/ae4dma/ae4dma-dev.c | 198 ++++++++++++++++++++++++++++ drivers/dma/amd/ae4dma/ae4dma-pci.c | 157 ++++++++++++++++++++++ drivers/dma/amd/ae4dma/ae4dma.h | 85 ++++++++++++ drivers/dma/amd/common/amd_dma.h | 26 ++++ 9 files changed, 498 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 33a1049fd38b..539bf52410de 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..ea8a7fe68df5 --- /dev/null +++ b/drivers/dma/amd/ae4dma/Kconfig @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: GPL-2.0 +config AMD_AE4DMA + tristate "AMD AE4DMA Engine" + depends on (X86_64 || COMPILE_TEST) && PCI + depends on AMD_PTDMA + 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..c38464b96fc6 --- /dev/null +++ b/drivers/dma/amd/ae4dma/ae4dma-dev.c @@ -0,0 +1,198 @@ +// 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) +{ + /* ERR 01 - 07 represents Invalid AE4 errors */ + if (e <= 7) + dev_info(d->dev, "AE4DMA error: %s (0x%x)\n", ae4_error_codes[e], e); + /* ERR 08 - 15 represents Invalid Descriptor errors */ + else if (e > 7 && e <= 15) + dev_info(d->dev, "AE4DMA error: %s (0x%x)\n", "INVALID DESCRIPTOR", e); + /* ERR 16 - 31 represents Firmware errors */ + else if (e > 15 && e <= 31) + dev_info(d->dev, "AE4DMA error: %s (0x%x)\n", "FIRMWARE ERROR", e); + /* ERR 32 - 63 represents Fatal errors */ + else if (e > 31 && e <= 63) + dev_info(d->dev, "AE4DMA error: %s (0x%x)\n", "FATAL ERROR", e); + /* ERR 64 - 255 represents PTE errors */ + else if (e > 63 && 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)); + 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; + + for (;;) { + 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 + AE4_RD_IDX_OFF); + while ((ae4cmd_q->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, ae4cmd_q->dridx); + cmd->pt_cmd_callback(cmd->data, cmd->ret); + + ae4cmd_q->q_cmd_count--; + ae4cmd_q->dridx = (ae4cmd_q->dridx + 1) % CMD_Q_LEN; + + 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 + AE4_INTR_STS_OFF); + if (status & BIT(0)) { + status &= GENMASK(31, 1); + writel(status, cmd_q->reg_control + AE4_INTR_STS_OFF); + } + + 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; + + cmd_q->reg_control = pt->io_regs + ((i + 1) * AE4_Q_SZ); + + 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; + + cmd_q->reg_control = pt->io_regs + ((i + 1) * AE4_Q_SZ); + + /* Update the device registers with queue information. */ + writel(CMD_Q_LEN, cmd_q->reg_control + AE4_MAX_IDX_OFF); + + cmd_q->qdma_tail = cmd_q->qbase_dma; + writel(lower_32_bits(cmd_q->qdma_tail), cmd_q->reg_control + AE4_Q_BASE_L_OFF); + writel(upper_32_bits(cmd_q->qdma_tail), cmd_q->reg_control + AE4_Q_BASE_H_OFF); + + 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..43d36e9d1efb --- /dev/null +++ b/drivers/dma/amd/ae4dma/ae4dma-pci.c @@ -0,0 +1,157 @@ +// 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_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 i, v, 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_alloc_irq_vectors(pdev, v, v, PCI_IRQ_MSIX); + if (ret != v) { + if (ret > 0) + pci_free_irq_vectors(pdev); + + dev_err(dev, "could not enable MSI-X (%d), trying MSI\n", ret); + ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSI); + if (ret < 0) { + dev_err(dev, "could not enable MSI (%d)\n", ret); + return ret; + } + + ret = pci_irq_vector(pdev, 0); + if (ret < 0) { + pci_free_irq_vectors(pdev); + return ret; + } + + for (i = 0; i < MAX_AE4_HW_QUEUES; i++) + ae4->ae4_irq[i] = ret; + + } else { + 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 ret; +} + +static void ae4_free_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; + + pdev = to_pci_dev(dev); + + if (ae4_msix && (ae4_msix->msix_count || ae4->ae4_irq[MAX_AE4_HW_QUEUES - 1])) + pci_free_irq_vectors(pdev); +} + +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 < 0) + 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..a63525792080 --- /dev/null +++ b/drivers/dma/amd/ae4dma/ae4dma.h @@ -0,0 +1,85 @@ +/* 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 0x03 + +#define AE4_MAX_IDX_OFF 0x08 +#define AE4_RD_IDX_OFF 0x0C +#define AE4_WR_IDX_OFF 0x10 +#define AE4_INTR_STS_OFF 0x14 +#define AE4_Q_BASE_L_OFF 0x18 +#define AE4_Q_BASE_H_OFF 0x1C +#define AE4_Q_SZ 0x20 + +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; + u64 q_cmd_count; + u32 dridx; + u32 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 Jul 8 14:44: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: 13726689 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2061.outbound.protection.outlook.com [40.107.94.61]) (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 F359113D275 for ; Mon, 8 Jul 2024 14:45:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720449932; cv=fail; b=YFRHfYCaRBLjFb+M2+c38Z8LTbrBFSMf6CkeBdUrqX3SgUNFIFRtDZVzgLy5eBagXZICJg4cf3zCX55ogsVYTX6vXDXECr1Nb3yXWa6aGESFyzZDEZqQE4oQV/Msp1MFSbH+9fpHgNf9PsXmLqH8o0nnU8PdobYheELwoXhjUvw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720449932; c=relaxed/simple; bh=J544fe2Yj11p6iDUipsNP5NkWV0yxcVT9mqD/LsxQ1o=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gq/2KWPYePvAaCKv3SmOI/0piZ1FeJmoYUrMfSMmlvPmcKYmIHcxR2MYX0ve6g2TRK+9OjVcs27+8RwcerHY4Yw2PxWwwV3YM/cJntA6laf+6E1/f/WzZQbEhzU48XLFhfJETdddq2xKuLOaM285h11+RQuTnoN1k02Trd5kuck= 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=uEeQqZu0; arc=fail smtp.client-ip=40.107.94.61 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="uEeQqZu0" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z8vaC0B68dH9FvGN2ubY1nbLkd27qnprRi+USDxfgtcsaJ1MVIkqAaeEikmpqJRNhcFzi/ivlupJ0ZGAjR/C3FMl4/lOTvhTqvchpsGxsAQOk/2nvtzQuv7M8eTZmoF9/HCr3kggXLHzwk5AcV9tpbDZ+DWikX86l+tGJa9mvFGFPGBtWc0FodgSGLAH/5Z7Qm9wdMe1cIyiA69Jz4qmY73VOcWuEjrrhw2KitPIGP146oA1s6uVr6S9+k1jLjUcRQ4L/pp6YAovVPkV4ikgvIRrr5CqDMCROG1mQSfM7Nc7UjJHPLtjT3aBHe633x2cYRHTneF+NFqFoDLo/JUQvQ== 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=SuwWx2KCbNJ/yLgXyUs01UNRIKJdiWaX/FYMeYt269A=; b=b52GyW8j8FIfPh3uNK+jxfTHqJyIRwQOMPX77gJGOiKYy0Z9jX4tlDmuNl/KjPbOIrkz1YaAlJ55M0QltHsQE5NLKTYChlIwHLVetugHeZi4DFd33Dm8mTJqvLBb+j+0so5YHjC3FklIveiODFBXBnvfySvXGa6Pbxlmfthg1EjEWkz2pfscK2DgdoSuGav+b5qxoCKNotKkcBYGmWOs5eqYZMz9NrGk/xunicFuB9kIb236b8NTiZCoB+vAb1yTp7zwytG5MoyVNhbxZHa2lBY0wXJ1mxTZGpzCBpFQIv7q3z2MdYQ47F+xB6aSSpajNvbzF5Oo+Dozk4A7zuQyLw== 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=SuwWx2KCbNJ/yLgXyUs01UNRIKJdiWaX/FYMeYt269A=; b=uEeQqZu0dGE7OWJp13HXF310moWvEIILei/oOum3ktqniq2GJ9S7aYUacy8x6Dd5lKzTZvckjM8tbhK02mLQLb1f03YE8DjBsoPrMnr7fYfeHRvZHIP0eXgk+PMYfspkPWSVcPtZNDilx36m6tye0iFC3EVTrSyJ/8vzZNSWEsA= Received: from BN8PR03CA0027.namprd03.prod.outlook.com (2603:10b6:408:94::40) by PH8PR12MB6747.namprd12.prod.outlook.com (2603:10b6:510:1c3::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.34; Mon, 8 Jul 2024 14:45:26 +0000 Received: from BN1PEPF00006000.namprd05.prod.outlook.com (2603:10b6:408:94:cafe::f0) by BN8PR03CA0027.outlook.office365.com (2603:10b6:408:94::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36 via Frontend Transport; Mon, 8 Jul 2024 14:45:26 +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 BN1PEPF00006000.mail.protection.outlook.com (10.167.243.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 14:45:26 +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, 8 Jul 2024 09:45:23 -0500 From: Basavaraj Natikar To: , CC: , , , , Basavaraj Natikar Subject: [PATCH v5 3/7] dmaengine: ptdma: Move common functions to common code Date: Mon, 8 Jul 2024 20:14:56 +0530 Message-ID: <20240708144500.1523651-4-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240708144500.1523651-1-Basavaraj.Natikar@amd.com> References: <20240708144500.1523651-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00006000:EE_|PH8PR12MB6747:EE_ X-MS-Office365-Filtering-Correlation-Id: 46fdcfe7-d814-40ed-da03-08dc9f5c9b12 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|36860700013|376014; X-Microsoft-Antispam-Message-Info: yS7fzWSnsS33WfRce3lHqMrpc4xhV7EWsg1jwuQlUGWk+f/8EfT1RwcthwHvrhP0NUn19L9r9HMB3mK7frzjs2WCrvkpDtiZ5bavbm1sC9kNclqyGeju6WcWQfwkXVIkwDzp1bxyD2ns0vZwQP6dXPcYEhFNezM+vERGxmK39kKqtVgAzq9Eto2K4MW1ll5WREPD4VtXdXVRExNoecRYKuj7S+7XGnvMjHv1hEQxCFopFDaIxXt611MahHAzROD3Ia1YtN7NwU7oxlLSgYxX4LQ0JZXatccBnSeuytVK88Kn7fMcmVhqbuebvylDSH7k4JzNMvUq5CL2s0ngRW0a6x7y5ymKQe+W5d1Up2hvzCb/+qu229U0u4LSRrO8I9Oy+VMbzRrtZJvNjBuUuC9HXgTEym3QE07qExBZf0HVLnRYXjWnZS0k8xd0Pf2Fxc6UwDgSyTZ24Ba8yEU0/g9xSNE9tb1FAboNEsDr+thVDLViwu2Ynp9A7x6o3FuFetakobUWcOutspidnsAnoVOtCKR7krcmuy4ifFlt2pGIjX7H5pcX6Wwxqh1OUMUBKQOGJmTszf9VFI7wTOTQlj+oFbwj4QI7S2XxPf9tqsSwDMPuvf4Pa6evEJmpiW39wWNHuLVJx5l5CAXPY89qsSWyXV1aGgsLqcA5eqtM5QJrF3Ielf4ycg8hqRjG19kXZyccymmchHWu9jn6oDgsYkaqy3RmmvnTx16LOJi4VpWxm4cUnODmeyGjOFHZRsgLdKauUaCqWx+zyeGSmWpuFHkBGMvgC6XSxlzCVHcUWIqrvsT3UDkOvWs8169KDWkRYofrl2++UWK94Ua+r5H1c7RNWXYAXymapJK3xI/bk0p3cdPyhaTlXPa69OYixlgaKDp1srXMg+Z48gQPzk295VIeCzuDjcOcHW8uVezbqtvC8mrXaAO6/bnEgIl6xsfQoJwvqAbR6NPzrUFMdc+xdmse5CJYlpJ+axD1v4atsmpaxnn3r7tQrMqdCM7bBp5DX0ZWpZ80HiKBqWjk5866Zi5or3CTRXhVzdUr9vidTRDvFEAxJCpsGFjsvpzD7VYChaP/SFatzcMM78TtyWXpUlzUriZfnq6hlmjDC1NKR3FX0I+tPWGIGmSrEQIVyUVsoBeLSh4Z6ubricSmT4P+MWbSwtU+iUAcOUd2nfli2PnHg0w6Er8OOvmD0yidIuVCkViN0sXA5/JxBcJCaAQvmjV+xzOHNiet1GwMkQ0j0PHLhx0ebOlOpneN/Dy0BWe4Sa54jiSsKSnfRu2HYDoHRIQyKXcj4MFGeDIFQwaVVVc29omLt5GaYr58TLo9Ke0TFcWoV70gFgm33mXrF0ItxxXm7DUEc6OTpjs1kAoMomJCkb2k4AnSAvrpH6tyLy74VzdjHqUMecyqs0Ts+er3H/J4rHIx7SDxmYErNgUYHoZXOzuWBBAA1TzGL56kfqEL/q37 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:(13230040)(82310400026)(1800799024)(36860700013)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 14:45:26.4779 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 46fdcfe7-d814-40ed-da03-08dc9f5c9b12 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: BN1PEPF00006000.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6747 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/ptdma/ptdma-dev.c | 2 +- drivers/dma/amd/ptdma/ptdma-dmaengine.c | 3 +-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 539bf52410de..97d97ddf26f5 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/ptdma/ptdma-dev.c b/drivers/dma/amd/ptdma/ptdma-dev.c index a2bf13ff18b6..2bdf418fe556 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[] = { 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) { From patchwork Mon Jul 8 14:44: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: 13726690 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2067.outbound.protection.outlook.com [40.107.100.67]) (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 154FD13C674 for ; Mon, 8 Jul 2024 14:45:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.67 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720449936; cv=fail; b=R88Xv6zz2K6RS5Tfk1xpHH7j0TIkWmORK829fJhp8vg1CFnRAKRJDUe5CxOLUbi73DuUpLD9kSxleGevoFmqc99TiwRFxqcwEkCLS9JSWNfHA9D41tIIIPn0f1JXaV2wf9BRJlTMeFYSY7qNyoJ30nCHbj4pjEZqbwOoA5Pv07g= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720449936; c=relaxed/simple; bh=3Yiys6c6UTRKJ6Qn0UYlOh1GK25pBSEoMkz6CYfNXCQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dd2xXZtPPWnh2vd074GjB0fKW6TZ0kIg0n6hEw59xPSyehQcjFhFSu8qB6+d8Jr2Z6alI93DMF+9CHw1q3CTtRCRu6YveGWmk9hIxBxAFGJ1K+rCdk0G/m2rAjVL5TOnja6yezekMFDr0j3glZpJ3/9YQhFsagZRGqf2j2Aqits= 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=gimn0Vvz; arc=fail smtp.client-ip=40.107.100.67 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="gimn0Vvz" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gYKbuJXWxTIVhMbkkR6IWVoSnKW6QrCoESe97quEfLS9ngNm9yLjc3wunTIknnUkdAyUhTbNlMDh3PWoPZttJMkhUwdX6vQQy29tLHhKKHStCAetEOTrm3HXal3ynEVHsfPTw9CgjphGR28ThfWhEi9W/o64Rv/lMMbE9OlU4pmdj9JvnZ/ojs8V4xUGJwn3tKdWs8iapLXjPPU5qdbGY0crE2tJz8oq+F8zchcvcg4kz6ZeZ8C0TlBqMlGTKIuyUFHmd6yqf/jVk/aOR1xAWPMs9peRMl1aJepiI55DTP84328MG0wzbUpPTwlGj98QGk2Ezmgx/I3o+ijhcat69A== 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=7fQcifImxxKNsH2AznDmTVwomeKfKNo3yo9Pev1GlQo=; b=jygCBQnXwpuHoOj93LX7RyxNp1HW8LXXSgGnb0ZpcgstopwdCyuxOKHuK74KMMO1wJ9BLMwNODEqj6gDSIzCihDUq1W4DYwPVq9TDG/vliKzXlpIHVzItSXE3eG5zWF2rfCJuJp98JgZ6pGukAeR/KhwgA6Wmlqg/J+eGW/tF+r1GzMr8VqJVdEJHGkLAnF4bD/BSKUme4wLXJ9FPPcl/aaj7SB/CFplpQjypv6SrzxIufH0x1i41czPdlr+DayPHHzKQTn0KSP5il2qEhOqDKqkm41kJrPNhtqjhzsibLENUpPMfjChzxpgljqQh8XXfsmXWxZI5FcH+UrBkqPRtw== 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=7fQcifImxxKNsH2AznDmTVwomeKfKNo3yo9Pev1GlQo=; b=gimn0VvzzM6CFS6W63X1sKSlZsapNIMLwNbiKo0aNHvstQUYAGiq4qzNwgotjBCFhTN6XEuSRUlHJXB1ermQT20/yNHSGs2Z7K4VS99NSeMUvdgmLfpfQ2k5lJ7uWSlz0944PHpiKuvBbSi1dgv8i7iAi39/EODnCVQzvf9yxvU= Received: from BLAPR03CA0147.namprd03.prod.outlook.com (2603:10b6:208:32e::32) by SA1PR12MB6945.namprd12.prod.outlook.com (2603:10b6:806:24c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Mon, 8 Jul 2024 14:45:29 +0000 Received: from BL6PEPF0001AB4A.namprd04.prod.outlook.com (2603:10b6:208:32e:cafe::36) by BLAPR03CA0147.outlook.office365.com (2603:10b6:208:32e::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36 via Frontend Transport; Mon, 8 Jul 2024 14:45:29 +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 BL6PEPF0001AB4A.mail.protection.outlook.com (10.167.242.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 14:45:29 +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, 8 Jul 2024 09:45:26 -0500 From: Basavaraj Natikar To: , CC: , , , , Basavaraj Natikar Subject: [PATCH v5 4/7] dmaengine: ptdma: Extend ptdma to support multi-channel and version Date: Mon, 8 Jul 2024 20:14:57 +0530 Message-ID: <20240708144500.1523651-5-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240708144500.1523651-1-Basavaraj.Natikar@amd.com> References: <20240708144500.1523651-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB4A:EE_|SA1PR12MB6945:EE_ X-MS-Office365-Filtering-Correlation-Id: cd532798-5896-4c98-974a-08dc9f5c9cec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: xqarb4E+tC1YyiBS8f82mOAIAYgmnGLJEeu0um2YpKuxuHivRTKgkr7R4quyuApBuZo9zusQ5LVQSvWj9XRlCNtQT1fOfKePS4hXZzRC9spqohJm7jAVI4STTwHtVL7hTtpJNIvh2/wE2KTDhSG4YjHrQpfbnidPGuwidct14K20tySp0zgw4HWDC4czZAFumVpBNhZ8x8qohdNwa13fvXBCFe5dLZAd0gDSTl1+AmIi7LSpW0lgVGkYSupBFY5CSRueJKeCkhKQELkA82zmNB5NmmhDY2DE0Xth6DaS/oPbgeL4760Ed9dv9ccwX3myumutR5opqz+tofrRAbqhAGui7QE7SP5u2KkUUYs9IAFy+6hNKgYF9S2t9ZMrgGvJm23sl7sOFlr7iQ5fecApR2eNluo2S2lxwnR8bmOg9W1HFUqhyZJylbeDAFi9q3/8MdS0adMp5kywaDEsxL0UAsgy0XZVq8IhSamtghb8Sgcj0HYyDolLlvwVrBsc1Z/K9PPbxpNptvX7fQ7EYCOLmF+SUApLZa0NLPJV+g0NaN2OwbNUQ/B8N4Lk6DZ9zRJZ0aWA/GrZX31gOMMbXMkwBfRTNe4F0bO8Fngp8Fg1mu6iOBg7GfDTWnxx2zC9ljrpIv5nDCOaQpgsX4jsLA7BxPkJLnpuFRW6Uy5seZ/bwH5OkpHGdqw5cQwS0A2yxWQgaLqiThVIlROOQzg0NIlJVTxZgGK89h5ZVBGFDRCrUOXRGkjCaW6ZdTeimND1urdn8Sv3XpdQCrsMm7Ih97HfXgzsg53cjRFfY3gbyPxHcTepvZQRKTXB0y5r31NLdR3oA6dCZUTBvmW5gyuEEnOZDZF8P1Sud8KH3UA8rE1p+f5emKnO/2eMD/cbcr6QZD1Lr1juORMiw5sMejno+6lg2n3JkHZ819L70R8UGRDbhBXF3oZmbbWvAlufBj/r8OxINPtlsorrIgSEXPz4xh/xoFJxCBqtAaw7UZtq4QLG31iNGz+SZDPWM49EUmdFGo8Cz5m0CD7qs7vR36NwL+1cBNUe41d1Xi2rUQnSwvn4FBcZyqj6zd5diXAb7pzJfetVBE3LYJpxl9hBc9hbcjQFFyyWY1i1JkJlDXbn6zhFyA0jxyriI9xy74GlKlX7bqER220EqklBiPWvmuHyJLG14G5cqt+ATxiE0wEkAIt/3bbdZAfHrEtzGSHX8Ppl1iuzz719bItM7/AJFUL9m/AdSPSsW3OIeOQN8EkL4YIY3ZpZ7Xi0uRfzmNlAY5QczvNETyzTlusliwUEntZ8SOPU8j4M76P7Vcnc7xTgYaEAwBw9+aaikiAEn3iv543qguDPi2m7cWOPvKoKoG6kFIyKRC3F7mb25J7DCgA3ws5nK1ZA0dmvP+G9VHqgcGkP/Wot7GzYpDVFLLL1OFcmCYC8nExOjnxABJTyNsMq3QeYQac= 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:(13230040)(376014)(36860700013)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 14:45:29.6451 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cd532798-5896-4c98-974a-08dc9f5c9cec 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: BL6PEPF0001AB4A.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6945 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 | 2 + 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, 90 insertions(+), 20 deletions(-) diff --git a/drivers/dma/amd/ae4dma/ae4dma.h b/drivers/dma/amd/ae4dma/ae4dma.h index a63525792080..5f9dab5f05f4 100644 --- a/drivers/dma/amd/ae4dma/ae4dma.h +++ b/drivers/dma/amd/ae4dma/ae4dma.h @@ -24,6 +24,8 @@ #define AE4_Q_BASE_H_OFF 0x1C #define AE4_Q_SZ 0x20 +#define AE4_DMA_VERSION 4 + struct ae4_msix { int msix_count; struct msix_entry msix_entry[MAX_AE4_HW_QUEUES]; diff --git a/drivers/dma/amd/common/amd_dma.h b/drivers/dma/amd/common/amd_dma.h index f9f396cd4371..396667e81e1a 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" #endif 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 2690a32fc7cb..a6990021fe2b 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; + u32 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 Jul 8 14:44: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: 13726691 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2057.outbound.protection.outlook.com [40.107.102.57]) (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 76DB513C674 for ; Mon, 8 Jul 2024 14:45:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720449938; cv=fail; b=m8CwGd4Q7oQA+dkc/xOkzNYLczG/ctErtjClCq2xZJuIHYPeFy3rUbnm5xr8IAN0wja3jg8QieY/xgZPMTc5SUMwomDKRo9B9JZqKqOOwSjAVjMsOKAB2dYJr8wdXzb9x4LWWUoE5l8I1TKQUD35DkS1Lo1p71JTDwtizbItCKE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720449938; c=relaxed/simple; bh=W0ULvef8FSiC/F3nCYmtiuEhEg3mK/ThQvmb2pZXmJA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FfHWOfSAEQL8wLHy2fULYlTXKF7ETyGj2662QA1wqAWaFUBCUQOw/c05c1AfwHyatjr0TL3KghtJJJUcgyTROm0BstDQYtDLExwkRhQtRenHNjFYwRbTAzqXNXv/r16fc8LnMVtmKW9nbRA48L7VIgQ81EVHVGZadywZ701L6m4= 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=agffXYYJ; arc=fail smtp.client-ip=40.107.102.57 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="agffXYYJ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bLCpVrD9cLkNmY3/n/dP3xu+qkvf+yjV55QMiJRyg0VvZpl57U6DBsIV4UywoVSpzUyumW2HYb+ydJ9+XJ0qwKg+NlLJdq5por0t+F40qbKhBh24EKIeqh4+0WR775A1UaVyzjsNbnjY1hbJljUyyKImSR9w0YQkfCwyoJqJ44gsSm84EJrfIEeB2aCyWE0N6ILlAcRAJcTZkNhYrqJJ5B2u1X809eCZ+vZ7qNS8H2sNe59Qrh8OCD9mB7xCsSdDQ0jOfT7VWUwvoxZBC+2H7xaESnL16mJ7oZ2nwyJ27WvTgSG5SE6ls+hia/6ODLetbmaNN4ErIRMmamgdFKO92A== 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=E7q/qZRkOmijskuNe30az9i7ajyG2j288qezL+VTGu8=; b=L3DThXYl/2Bp3FlAsmsYSg+U32KLQLQ05v0Lc1DFWz1lgNLlEgg/5lOfHb2OLsYxTRuhuYiVrn7EuMuoEeh64BvM1kgDosfgHY5GC5TdSMcMeb7Te6wANSS9uLxEn4IPKthZlLLBBeDjDWNY7NePjg5P+GrcR/FaB1vRf90CVAFAA2fUa+9hNmviDOKOEo251Ny4ikfymAuckBwGHOnbuh+x1x/0Iy/KEjN7XHhCHESfA6ca7hPWQqfNW9ViQQZcw36+LDNPltwb7/tyK1/i9k4CV+HUELRJyxS6vDdd1n6GD7g682RTrrRQ296+vjSH74fMNithWCL8VOp8So03Cg== 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=E7q/qZRkOmijskuNe30az9i7ajyG2j288qezL+VTGu8=; b=agffXYYJNKZRsV3BMWyMSrviyAClmP+MZ4vBMdpO6TT4dnPhzOtqkz2k8l1E+3i9jF/cI+ctkHv5/6+q6pDewlj9BFXe5VT3HC67X6g++K3STIlSGSs/Xwdi2oy0MKBy5rQmFvKsXM9IpwsF+z7LSchT2g7CheSdUrBOf5CkD6w= Received: from BLAPR03CA0135.namprd03.prod.outlook.com (2603:10b6:208:32e::20) by SA1PR12MB7152.namprd12.prod.outlook.com (2603:10b6:806:2b2::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Mon, 8 Jul 2024 14:45:33 +0000 Received: from BL6PEPF0001AB4A.namprd04.prod.outlook.com (2603:10b6:208:32e:cafe::a4) by BLAPR03CA0135.outlook.office365.com (2603:10b6:208:32e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35 via Frontend Transport; Mon, 8 Jul 2024 14:45:33 +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 BL6PEPF0001AB4A.mail.protection.outlook.com (10.167.242.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 14:45:32 +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, 8 Jul 2024 09:45:28 -0500 From: Basavaraj Natikar To: , CC: , , , , Basavaraj Natikar Subject: [PATCH v5 5/7] dmaengine: ae4dma: Register AE4DMA using pt_dmaengine_register Date: Mon, 8 Jul 2024 20:14:58 +0530 Message-ID: <20240708144500.1523651-6-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240708144500.1523651-1-Basavaraj.Natikar@amd.com> References: <20240708144500.1523651-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB4A:EE_|SA1PR12MB7152:EE_ X-MS-Office365-Filtering-Correlation-Id: 576ca7a3-3df9-4c2c-a87b-08dc9f5c9ee3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|376014|36860700013; X-Microsoft-Antispam-Message-Info: k689zX4SHQvqykB8BXSER72DjVZxBKOseqIHmOkwPnSOzJymJCQtwiTgKYGtONSrFvMBk0dX0VuwaZa3wdeENjzuCFaT6cfPSVVkPL0wdTjTCzKoznS4Pc99AubzrIvEjkV80AmqyXS4xYL+lLrOKhwBOnB/1hurKEuzy2oC13p7COK4YvDaSSOzLrL8NDTc86p6bjkStLaoS8SXq3S2fz6UyxKqQyNe9rjx7vfhB6TlJXlfHdCg0FBs0XhniApc1cyytGMrf1VSN5w+kCwLUZ0prjadlK5QdgAjSDldIakT4ZPTaRdijZwhooAXS0crl38w/03yb6le8QS0BTLGZA0/pcZUd02i7Zcd6Piz554sEU9HHGhrvJ47NghXhlzLhmSREmranhgBHyrePbz/3IKE5ZYG7Uvgg34Tg46gfrkFYReSqkpw98ZJJefYqjgsLjeRpvL+lCVWM8L0qkLD7ONOdLwQEBsO3KRiNSbUW8YciInMRcsMgxfD0/vPNKG1hGtwBwTf9z8XL4gSzhhwGnTrfqgA+Y2zdGthEseDcW8OACAz5IUjqZrq9Jyl/CMTEpvfS7e7fmzRd01y4Xy5RmnqsZ43R4X6U5zzPBuLp4dei4IN6ApumrVcYJxY9IrIOTRxN1AqjvjY2tlRPMK4KSHHUsDgnj8pMr89zwTuv/ezENZiO3hmcAbEe8tb2db3qVzIlFFdWRrNgY2tQuvMYPmIpy61t1Zw5DQROK/H6zvH9I9HObjGNA233MtKeUfbEiS1ETL7G8WUVg7Kc4dXMmwljPivRQP9dzDF1HZqSPUHnt7zImUDdXuhvBeYwAUk9/oJBb5yzMdx9n2i7IqXuTVhMqN2I9RnjcQ9BwLf20aE3+HP1zveazrjHRK3PmaCuq4wJfQkwkqdCr+5x692aUU/kEXm9NuelQaYySpuhBGNnuZXO8HE+fhRdLwNYdSelYMmTpKRWuQqKEXVGrVNg1mZMhIr+UIaYpQ31tJ3WdSFk2nJ4kkOpvdi6HjWAPdSPxyCceChau+mNHVfq1Y+vPXb5WhD82/fZqNaP/nerWIZnS4XT066oPEKKghDOmF4TGEUc0BMN7ZSqU9OjINDy92fz/pSIW8WqjBvGjfh16Kr6S0LUzhLrLZ6GUK3Y1wC0d8BbCqyp59C//oGh3FkkjoeLdjfal5KeUJiQSNdKaCXf/tVSCpjl9kHu24NQoV54C5jve5pJYMHzlbFhXryuiQsn+Vryw3pVO7qwZknPROLo+TLV7/9o7Uw1/oXeR3BgVpmbGayu6UozXQ+wleEzBpM/GbDH3UL8lT5OENRMZK5m/gEQP5GvpiJyLuSVPnWZrCJEJjiHfVGFH2r5IjbCrjoom90wVkox8myRMce7Pp7KNvXnirwZEQE2Ut8x1r0604br+w1kQw5KU1U806SKStwccFAZXnHgi7L+Lq+4qs= 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:(13230040)(1800799024)(82310400026)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 14:45:32.8951 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 576ca7a3-3df9-4c2c-a87b-08dc9f5c9ee3 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: BL6PEPF0001AB4A.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7152 Use the pt_dmaengine_register function to register a AE4DMA DMA engine. Reviewed-by: Raju Rangoju Reviewed-by: Philipp Stanner Signed-off-by: Basavaraj Natikar --- drivers/dma/amd/ae4dma/ae4dma-dev.c | 61 +++++++++++++++++++++++++ drivers/dma/amd/ae4dma/ae4dma-pci.c | 1 + drivers/dma/amd/ae4dma/ae4dma.h | 2 + drivers/dma/amd/common/amd_dma.h | 3 ++ drivers/dma/amd/ptdma/ptdma-dmaengine.c | 11 ++++- 5 files changed, 76 insertions(+), 2 deletions(-) diff --git a/drivers/dma/amd/ae4dma/ae4dma-dev.c b/drivers/dma/amd/ae4dma/ae4dma-dev.c index c38464b96fc6..248abf794aff 100644 --- a/drivers/dma/amd/ae4dma/ae4dma-dev.c +++ b/drivers/dma/amd/ae4dma/ae4dma-dev.c @@ -61,6 +61,16 @@ static void ae4_check_status_error(struct ae4_cmd_queue *ae4cmd_q, int idx) } } +void pt_check_status_trans_ae4(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); +} +EXPORT_SYMBOL_GPL(pt_check_status_trans_ae4); + 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); @@ -117,6 +127,53 @@ 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; + + if (soc) { + desc->dwouv.dw0 |= FIELD_PREP(DWORD0_IOC, desc->dwouv.dw0); + desc->dwouv.dw0 &= ~DWORD0_SOC; + } + + mutex_lock(&ae4cmd_q->cmd_lock); + memcpy(&cmd_q->qbase[ae4cmd_q->tail_wi], desc, sizeof(struct ae4dma_desc)); + ae4cmd_q->q_cmd_count++; + ae4cmd_q->tail_wi = (ae4cmd_q->tail_wi + 1) % CMD_Q_LEN; + writel(ae4cmd_q->tail_wi, cmd_q->reg_control + AE4_WR_IDX_OFF); + mutex_unlock(&ae4cmd_q->cmd_lock); + + wake_up(&ae4cmd_q->q_w); + + return 0; +} + +int pt_core_perform_passthru_ae4(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); +} +EXPORT_SYMBOL_GPL(pt_core_perform_passthru_ae4); + void ae4_destroy_work(struct ae4_device *ae4) { struct ae4_cmd_queue *ae4cmd_q; @@ -194,5 +251,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 43d36e9d1efb..aad0dc4294a3 100644 --- a/drivers/dma/amd/ae4dma/ae4dma-pci.c +++ b/drivers/dma/amd/ae4dma/ae4dma-pci.c @@ -98,6 +98,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 5f9dab5f05f4..1bc8abcd1d44 100644 --- a/drivers/dma/amd/ae4dma/ae4dma.h +++ b/drivers/dma/amd/ae4dma/ae4dma.h @@ -25,6 +25,7 @@ #define AE4_Q_SZ 0x20 #define AE4_DMA_VERSION 4 +#define CMD_AE4_DESC_DW0_VAL 2 struct ae4_msix { int msix_count; @@ -45,6 +46,7 @@ struct ae4_cmd_queue { atomic64_t done_cnt; u64 q_cmd_count; u32 dridx; + u32 tail_wi; u32 id; }; diff --git a/drivers/dma/amd/common/amd_dma.h b/drivers/dma/amd/common/amd_dma.h index 396667e81e1a..896318ed2495 100644 --- a/drivers/dma/amd/common/amd_dma.h +++ b/drivers/dma/amd/common/amd_dma.h @@ -24,4 +24,7 @@ #include "../ae4dma/ae4dma.h" #include "../../virt-dma.h" +void pt_check_status_trans_ae4(struct pt_device *pt, struct pt_cmd_queue *cmd_q); +int pt_core_perform_passthru_ae4(struct pt_cmd_queue *cmd_q, struct pt_passthru_engine *pt_engine); + #endif diff --git a/drivers/dma/amd/ptdma/ptdma-dmaengine.c b/drivers/dma/amd/ptdma/ptdma-dmaengine.c index 90ca02fd5f8f..412b40903e57 100644 --- a/drivers/dma/amd/ptdma/ptdma-dmaengine.c +++ b/drivers/dma/amd/ptdma/ptdma-dmaengine.c @@ -79,7 +79,10 @@ static int pt_dma_start_desc(struct pt_dma_desc *desc, struct pt_dma_chan *chan) pt->tdata.cmd = pt_cmd; /* Execute the command */ - pt_cmd->ret = pt_core_perform_passthru(cmd_q, pt_engine); + if (pt->ver == AE4_DMA_VERSION) + pt_cmd->ret = pt_core_perform_passthru_ae4(cmd_q, pt_engine); + else + pt_cmd->ret = pt_core_perform_passthru(cmd_q, pt_engine); return 0; } @@ -296,7 +299,10 @@ pt_tx_status(struct dma_chan *c, dma_cookie_t cookie, cmd_q = pt_get_cmd_queue(pt, chan); - pt_check_status_trans(pt, cmd_q); + if (pt->ver == AE4_DMA_VERSION) + pt_check_status_trans_ae4(pt, cmd_q); + else + pt_check_status_trans(pt, cmd_q); return dma_cookie_status(c, cookie, txstate); } @@ -462,6 +468,7 @@ int pt_dmaengine_register(struct pt_device *pt) return ret; } +EXPORT_SYMBOL_GPL(pt_dmaengine_register); void pt_dmaengine_unregister(struct pt_device *pt) { From patchwork Mon Jul 8 14:44: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: 13726692 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2088.outbound.protection.outlook.com [40.107.220.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 19B6213F016 for ; Mon, 8 Jul 2024 14:45:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.88 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720449939; cv=fail; b=Apy8ZYS1nfzSSiUkiBjY16szKTLG2en/hstWqSHiNOuqgjAGz/KCuMv1HSx5R//d1D4Hqm+kmiFKOGPl5jXA5QcBf/pwwtyBysT7n5k6Wq/AQLH1PaNxZEpeHTIC80TR+wBbXACxdre+8iBCY3Weii3O0fXGOITw1irHJ8ATxfU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720449939; c=relaxed/simple; bh=9OEB5+8kKPVowdTn1Q92kP3B2AFMNreyu3XBze81R0g=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=S9tSvYsvvAKM4OqMP79JrnehyKbsDKPOgEDouitdZgG+eMGVFCpxfud5vx/EXhMg5HtvEPrCYVtuXTKTV0vv1Ybq1ZfRQjcxIm+uxrJIL46MrOU9ni8By1Nj93uVDDX+U1YTtXQpgwFOhH9l+rra3G+3O0fZeO/ijxp7nbxF83A= 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=Vck/bAwM; arc=fail smtp.client-ip=40.107.220.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="Vck/bAwM" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PAT7pfJrduhy9waUJV18j0JjRjTDNUus8J5iLmo1A9bASY8ihlq3JmlG5LV4zknoBWob9Nxu4eQCyaL/gtWTr+x9zq+33BqMF8z+J95faMD2W+yGGiE/XlW9mJfK6Uzkhm6RquVOBw4hGp6zxbbuIfSIyjKC/G0iTmr/hnvySBiJhr80g07cAZFgYLiGoG/qHrlVHB2Of3CMi3VjZNr91HlC7lwy7fF4nPSqOFFZGL09JIfzGtPhYHDBiihXhC1GH48KgPKN73ZmdfcC/uC0nf/GkltQz9EedsfvMahh1jimRgU62EurHE/1K0ujWv+vX91eyhpzZx+fNK8Az3kAvw== 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=rDi7zs2g5k7SXLCIBrzVN/WI+geBfUtsW28xJzadxps=; b=J2mc7x4KBiA+uzXJXvYcCs8vn09lLNGRg1VkmyH5yaxP4+cHQ3mpeSgaHQuEH07ZHYm2lUMjFEMJYSL7UulUcYOt9PUgmSS+s7jXnjFodQgCrcMd865u/Q9S2Og2o+gNsQNsndKrwGF+p3TUHL5c6+d5AFZ8Yz/ZHMxqv9LTqwMqyIAWpMaM5kP93NwtslVBSt7bCssvzTXnc0xVkLyDJ96vI+s/LEqIWM824OaZZ3lHwAxHdbVo8sUgOoBX7V7RVn0cxCYQ0XJgIJIfkthk82+zVq7oM7ngfrLQhyXwq4oA4vU+ezM2GouW5d3E4ZUOZoidq09enapFcX7oVF3AHA== 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=rDi7zs2g5k7SXLCIBrzVN/WI+geBfUtsW28xJzadxps=; b=Vck/bAwM/79DVYBTIBkazQLpSnd5WGB/B/Bvc+unNudzq+lyD5lJ/U4NY+aRFWvIHFdvbQXgM7lDUYhbpkkOoRdtep3i+YRArd/CPB789LjR4avxyAYJSwJWfEzGrPAANPlCSOhhsjhhClulgyyVQX8qSn81K4aNqQLuSy2eFwA= Received: from BLAPR03CA0138.namprd03.prod.outlook.com (2603:10b6:208:32e::23) by CY5PR12MB6203.namprd12.prod.outlook.com (2603:10b6:930:24::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Mon, 8 Jul 2024 14:45:34 +0000 Received: from BL6PEPF0001AB4A.namprd04.prod.outlook.com (2603:10b6:208:32e:cafe::61) by BLAPR03CA0138.outlook.office365.com (2603:10b6:208:32e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35 via Frontend Transport; Mon, 8 Jul 2024 14:45:34 +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 BL6PEPF0001AB4A.mail.protection.outlook.com (10.167.242.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 14:45:34 +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, 8 Jul 2024 09:45:31 -0500 From: Basavaraj Natikar To: , CC: , , , , Basavaraj Natikar Subject: [PATCH v5 6/7] dmaengine: ptdma: Extend ptdma-debugfs to support multi-queue Date: Mon, 8 Jul 2024 20:14:59 +0530 Message-ID: <20240708144500.1523651-7-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240708144500.1523651-1-Basavaraj.Natikar@amd.com> References: <20240708144500.1523651-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB4A:EE_|CY5PR12MB6203:EE_ X-MS-Office365-Filtering-Correlation-Id: b0169db2-96c0-4649-29d2-08dc9f5c9fa7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|1800799024|376014; X-Microsoft-Antispam-Message-Info: 1eE1TfK216tr7Mb1MITcsnQlIFKxUoCEJHyLcPXy9GxGsZgRZcr1z/zRiiUA+OzstIJrzEm3bjQUtDcRmDnY71/VVyWs9StOgjrVYTo6XDWukNroW1Z1+3guZmF4o9ELDYkXKGEJ5OPWFLjysnFMzy3diig4QCkoC9PA7QWj9c/aZ0ETQg23QiM/phsTVGaLb8eu5fQm0fWocvOm1pHqdba3RqNjVQPyHENU4slV6ePMSp04VXs4obHRur0lhbDurj1zvhQ2o3qQyVusN77RrECcJMk0kfn1jBjtINSy/xArs4LKWin30pjvOJ6HtrwVGIg4/swAdFzxYjyyjhJzWCth1bbZ+IhMxWlrnw2IJwsB2RRwBpW7yByWQk4NBdp7eYF3q5K7qrXZCi77STsF6JDuMfMTBJV8fGJbHH/hU6FrprRekZGdhmPhJkPpX9jkLmdkMzGNDL53ev/T5ebmiA0eq8XguFL9+UB02IKUVwibqinN3eQlm3qH+ADh3QE0IBBuQ9b4dIp4I96pRwYdWNhmd7kALP4ArRmoaM2ElcQIw/Wio/mPSJGuZr46f87k+sFsOZXFuLjClTM8FYma0W+/qmezqZ0Zia8JIYxWc9WQy6e4gZ4JgF0NVXUfTjHCTA+UjceNd186Mk0ktwwsj+dXXAOe+UObNp216TObtjAyZ1yIVNODpAEwrNEMSM1FJFEngCvzlN6Rzj4tAKVZUoh/kQSZ0Z7T5T5DzLQakfYisNXuUgzx1lyb6JEJGFu459mF0DsM2j+Bk/j7PeZSzzvQY376J8c+SVhZPOiFCRDeFaFH/aZZcSC2V+6T1tNqqgMxZVFdIrqmb/e2Hr29mHLV7+D8s+ivo67tnr8vpwTYbjjQv++VUDaUvwU5XCAefSirFSnn3+Z5kfJ2DzOCoAmdTOKspyMFpErI+ux+hvzun0IHbRTshNOy/8S0bCud8K3BJ/j6kVyzNJYpSdGiilPUXJ3tETE95VdaOCi1gydNdlJRAK8+cxrhlYWjgHQEoIM5aqi1EcNoAry7XCYYJ+IgWg62JHSxUtqHwIq3XVJYG9DwIJGQ3DdzuzeK1pantnr2vTvirHdwrLW+CkxnTSIgRwS3rq/e7/a1tzD0a8Cgy3tLawhGnrpmknEJEmirmYnq9kD0hE5i5m2A/2KqPDCMz2ScFjre9hPRnL7VSUJ/Y796jYA+N8KMp5Y8VirPmGnPBW68VkVBCx/CQMK646Qpxh1dm9ZT0Uy/VBOEV0ws8ywczCf76SqRJucszX8YwAuhaT8ENwT7aA/vdsffWJfauiND1WHnddLMZ7H3pHPCqVQAuwlWTzeMATZ4gh/qYFDe3ySYO3qqQYXlxu3YKG2Lu9MFFn3/5EjidM5qfyQAI45KHegCcfgjZz7CY1X8OQy5vc8YQSaT+LTc3WchK3L8IyFEP2pZ1x8/iMgVAiMK4oNvIRnfQy8IMYyx9qr9 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:(13230040)(82310400026)(36860700013)(1800799024)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 14:45:34.2232 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b0169db2-96c0-4649-29d2-08dc9f5c9fa7 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: BL6PEPF0001AB4A.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6203 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 | 79 +++++++++++++++++++-------- 1 file changed, 57 insertions(+), 22 deletions(-) diff --git a/drivers/dma/amd/ptdma/ptdma-debugfs.c b/drivers/dma/amd/ptdma/ptdma-debugfs.c index c8307d3044a3..25654799077b 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,27 @@ 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); - debugfs_create_file("stats", 0400, debugfs_q_instance, cmd_q, - &pt_debugfs_queue_fops); + 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; + + memset(name, 0, sizeof(name)); + 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); + } + } 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 Jul 8 14:45:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13726693 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2062.outbound.protection.outlook.com [40.107.237.62]) (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 85A2913D275 for ; Mon, 8 Jul 2024 14:45:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720449942; cv=fail; b=lA0Jn+JOIlqjJieR94Uwe7iU5etXDf4l2S+9FDb3t0XFevYjpYrwWX/mQJsGpdUznaf6fhIR6ALPO5s1GOgoprVnbkkx63zKaeMMwXq4b0g1WxKcpwPBoYIgUmbSsVzDEcKLn63u/VOz0rBKOO+QRCYeT9XTPGS7Q8YUMr4tQKw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720449942; c=relaxed/simple; bh=Y5L7iTAK/bHUrXmnkRJNzkgeMZQO4S6z6R763cHvj58=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=n6E/12wI3m8iVEARnTZayDJjDPRvGPqF0Y+Wi7UVVRG7gr5zrYlqhDLyJRzdi4xIVuUi83aGy8Znp33G3+xEEe1HLUipQYcM/lqFG8juDm0TJoIr0s/IvsvRgp9EWqt0hXwq2jwZEmGkCJnwT0cHw75L13qogt7zvTgQHDskuxI= 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=JrK2IkYe; arc=fail smtp.client-ip=40.107.237.62 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="JrK2IkYe" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WcurZCkDQ10lhUAN48t5oEvSNhw2vClCSsLJXpYKtAnwRqGmQtIqJzJ6Sz5fknE3Eb+VT2w+RU2gMDzYFVLSzLcus1LhqWCggURZc4Izp4UTdP1qKdU/nj/k570+nr2xm9RZ2K6WrLMyca7xs78ti1DYhH/O1sIl13AsUixHm1IrMpQk55FToTtBn5AvIYFqfM0Rli7AsOu00qaSfK5xtE6AXrMQ+ald9sVGHiQ1TwIrBtRBbix2ToGYmXBGZas0e+HJJaXvKZzdCvId7A+Xl0cXujBkWKbCLQcVQE9N8nzYadghswsG9G6BuwL21lKftukSZ7aVX9NhMlpRQLq5aA== 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=HiaPAa+mHtfxPRpTS9zx/psseinDRhITf1KuqbQv5yg=; b=hsBHzCd/cB2vFKGv1t38piP8baEb1K0SJ1lKrfwYKeiZLP/wKG0uciJuG7XTsvF93mq5Mzl+f7LUtJGZYdr2pMRJNdP828f3S6q676JKvRxSUQ4kZQ6awHC0VgjdIoIimyoNNBBe6FK6ZvrZN7Jk2I+sqli1e8SOM6DK8SXSUxTW26NUHvYcoUFjzz7TuhxFfVGE0npSU/6LWE8eGjJoRnF2MZiH0nras6+9oIjGWtQPXjzRdIyvix8EOs8z01Ej1XRlZZH7n6vB2QZ13TR6z+NrESEG2QmtUVv79QNVxQhXYF1dJbBO67Et7OJa9STJyTtjU1xeOkjSYWtRZzf4EA== 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=HiaPAa+mHtfxPRpTS9zx/psseinDRhITf1KuqbQv5yg=; b=JrK2IkYesulkWZbRYrCLByyPaLFnz/J59tQ51/wza7k+8wk5luB18/E0XxrZ3raMY6r8SO5xoJE7sOh4oUnREK89hR4GCIf64WBqALzPWGusKop/fhMHxLeik0tS5EZTqv7WybYTLpOX0oPL23ZyAWyKCLIkgZD05zqyqzocuvY= Received: from BLAPR03CA0138.namprd03.prod.outlook.com (2603:10b6:208:32e::23) by BL1PR12MB5828.namprd12.prod.outlook.com (2603:10b6:208:397::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36; Mon, 8 Jul 2024 14:45:38 +0000 Received: from BL6PEPF0001AB4A.namprd04.prod.outlook.com (2603:10b6:208:32e:cafe::d) by BLAPR03CA0138.outlook.office365.com (2603:10b6:208:32e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35 via Frontend Transport; Mon, 8 Jul 2024 14:45:38 +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 BL6PEPF0001AB4A.mail.protection.outlook.com (10.167.242.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 14:45:38 +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, 8 Jul 2024 09:45:33 -0500 From: Basavaraj Natikar To: , CC: , , , , Basavaraj Natikar Subject: [PATCH v5 7/7] dmaengine: ae4dma: Register debugfs using ptdma_debugfs_setup Date: Mon, 8 Jul 2024 20:15:00 +0530 Message-ID: <20240708144500.1523651-8-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240708144500.1523651-1-Basavaraj.Natikar@amd.com> References: <20240708144500.1523651-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB4A:EE_|BL1PR12MB5828:EE_ X-MS-Office365-Filtering-Correlation-Id: 604f53a6-3e04-4d07-8526-08dc9f5ca209 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: 1Il2iBfMRr8gqjrYEynnp6RuX3Rq23cIkjvrEBITeOwKUso7p6jOBfQ80TIoVLY9biCudjdTq+JvBzrVFaS9hddk3uqlKrunzgtgRD5NkMholXFf11qm3aS6Zj43zzD3aNeDMmafQT7smMNp2VmGGI86K4g1zZrh3MtsixvMrwkymXHkGn36UVB/U0QGSedF9u4qJuRMqmPUc/4dQr5uCB9sQ9d0G+LWYBIfaZSymfSmU9nTdoxvjo0kVNrAr4caIqq48FED0lKV0hpYQcfHffizpY2/s7LVIN2lZ7SEZCNt9aWJwBMdQvwm+/P6EmpbAewFa08Pjy6Uci2wFJBnZ4Vc/MhsZDzW93L+9PrfXuxnzA/UeiJo9iBCC0CaHtDqkY1pBWqNqMfFa/OOTd6ZtHjcPeSzZR1hV6v9wDz0jn2n5z32BCyLD2JdTok2nbeekVFn94QOdks9H65TckuMtNGzNhSgsiNc9CfTfufSXH2ar1NQ/Kv3C52ydGWEJSI/tV7kLET1PBghfvT7D5ngkaortMWvwAqPq63YFwUEPeyrUxnnc7UcieaF04jZLgMUoBsiZZhpnmukvKJ7ci4q6VkXOBv9DFvk7tqiaTWCeZPGF8wVPErRpT7oiA4q0nNqZ5F1+Kdsw3Fqmt+onItVoIaOtPwYFB0cZG+jLjuAFjO/3KkK9WNtDdy5uC+F9/AMOjgsK9YS8TKaeHrLo2VGOREnmytTDJpjXqTvowXPibdDSqk7bZQvsvLvXOZ/SnpscgW4ysoMCdRYw+bMZOkSeU2au4QGugyPAoMhEgGqnsCU3iHpV1bi74zWqu7Hr13md8e/Z/ka3lRCQZKxyGl9lb/tijwm33PLOtDMg57VOdl83gNrc/s2kKNc8uckiA+AHiX79wEDKJpMUV2axyt8ugssXuTAaSDuKjHgo3BhvYWFUj8coT7uX8ubuos049hIOYBCbjJo8Za2ltBmcqKyXSMhOEnjt7PTAum8YKNEzbhP0ONtZXo+czh+cT8AzN9gD18l8DYsad44zkhUpEDfnWoc2Dz32+UItwj62B54n+sKIRzAU0bB/DQWyDvwbjyreuW6KKE2rrdCBzKdZieCp8azumN8BuzywJnVxul2aN1Nt1ydHBQZPQXUscuRJs2x+EOffSJioEVdhjskesyriezCGqLPhevjcHh2fFhmjp4sFWyt1uXnCz9LcdmvqLd5rczBsKzgDzxdZ1LzNCu3UHELctFUIMqinEoemGaGe/cWKwPYaYH05WbNj5NUYByGEfPzHGb76y0bwAUZJ2ZHWi8EwZ8qyff1bGBMsAHh5LtGElDQ8mCiPCwSJWfDVgdmhfWehivrBa52fCYmaAodYrsNIpEeYI/4YqRuUgQbrs3FatjHkaPHv70sih6C8Gpk01P+DW8lo3MQpe2ZTEc35S+nXL6i6BP3D1c7d9atKBsW80oT889/uiEcSEk7bmg9 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:(13230040)(376014)(1800799024)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 14:45:38.1764 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 604f53a6-3e04-4d07-8526-08dc9f5ca209 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: BL6PEPF0001AB4A.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5828 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/ae4dma-dev.c | 2 ++ drivers/dma/amd/ptdma/ptdma-debugfs.c | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/dma/amd/ae4dma/ae4dma-dev.c b/drivers/dma/amd/ae4dma/ae4dma-dev.c index 248abf794aff..3ff3573fd2b7 100644 --- a/drivers/dma/amd/ae4dma/ae4dma-dev.c +++ b/drivers/dma/amd/ae4dma/ae4dma-dev.c @@ -254,6 +254,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; } diff --git a/drivers/dma/amd/ptdma/ptdma-debugfs.c b/drivers/dma/amd/ptdma/ptdma-debugfs.c index 25654799077b..0d1133ec1919 100644 --- a/drivers/dma/amd/ptdma/ptdma-debugfs.c +++ b/drivers/dma/amd/ptdma/ptdma-debugfs.c @@ -139,3 +139,4 @@ void ptdma_debugfs_setup(struct pt_device *pt) &pt_debugfs_queue_fops); } } +EXPORT_SYMBOL_GPL(ptdma_debugfs_setup);