From patchwork Mon Jun 24 07:56:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13709122 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2070.outbound.protection.outlook.com [40.107.237.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5166A47F5F for ; Mon, 24 Jun 2024 07:56:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.70 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719215803; cv=fail; b=QyVc9EQMIcjVj08SQAiQrZzlfO75HyqLb0NlYavgCT2uIpjF1q3lJkyPeJkLRz/Sk1Y5Mko4/a+P1oGW1er86HjJLJ9l6cpuPzdQyFbN0Q+dvb6EVx/VHDkPOi2+7bAnjKA60FejcSV1s8rw7bKsVa8ow2hk7AKL//GNXx91fFk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719215803; c=relaxed/simple; bh=zJaVLIAzQ01kaelodJ2uJFpYMbNEhX2Is3TqL1cCkYA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oyQOd4S83wxWVPxiF4s5MI05b7mCv8T8EqPFQyVBb1er/aoRnbuxvmpl+CAIpXkFeIwFLzsK8lYM1a65sn0FNaqoi7PKMHYoTvBeMpCxWoMnU+5LWfHRV14hwRNpKH1x+OjbLSjptU5USYfPJCAzJ2G2KPKoe5pXfVYvtvxKaP0= 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=c1CMuNZE; arc=fail smtp.client-ip=40.107.237.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="c1CMuNZE" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RtaTzBaaYFJn7n463XMW6lDTvV7HsbyEzrawtDPc72Qi/8Fwd8D5HxOtBjBOYP24j1aMx5091IIHg2qqa889F9b4edk4ct5Kh5UC2eetrm2Cnue98k/wEqtosVa5bhMwMR8yKl7ac+bps8DHgBOu36zGrAnFebjlJE9dF3epCTBDpluY2rNrFog3srOcZ/qnh/oRM/4jrFkvebLw+ptIR2jLsw1ClP+yma5E9RwagJiYMHL6iKcqq1Wd8BGjXYV6q8bUC52RgvysehdH8fcduKj9+DFwwyboXEJZXyfLd3LRVxniuW4K2u2bRBaFGOob5Sa22Nf0op5y4vpfIlW/zg== 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=PnEZgJHUzd3DqeK2wwYYrMRXM6y3rnEf4ji14tEjgr0=; b=ZpBHEy7DKdrUmUlRR1VFGTT5qx/ZrPAXaxWP0U6aZro/WZKG7ebFhB8LxvW+vR36B/YAMbajOStD+pUGmZyK1183nKjiw/LSmNhRuLOVK7KmIMtGjM1/HmIibh7X6J5V7QdNJEFv0d1udHVs7PNbQMA5ap2I7mFg6i8tpmzJVLaGUGdttqTyJYumyHGtanOxoeCDY+lizBWazYAPP7FjoDuVzKwWBcpY21GnTUV8VPklxlXdKZJz/pIBk724YJoqp/tkVEI0V7NoBTSo5Y9yom4/5WeKGnp+deiO21oFijTG8Z3O8Zhlj8pi99nhd/khHbenvh5mKcmVDvyUvgVkew== 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=PnEZgJHUzd3DqeK2wwYYrMRXM6y3rnEf4ji14tEjgr0=; b=c1CMuNZEnqs6/bRApuXOdF2aXweTVNpJ/QYiNNneoCEJBjPZhnxuUWbWE6fMtLCp4wljho30yk2ONOW9ix85RFL46iaOWRTbJgfiCopfK/+1WmKL0MB+2P0rWXStAdCk9MqVUINsUbusy+SdE2Wmq/ItWP4+05IGtS8SYiaFy20= Received: from CH0PR04CA0080.namprd04.prod.outlook.com (2603:10b6:610:74::25) by DS7PR12MB5767.namprd12.prod.outlook.com (2603:10b6:8:76::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.29; Mon, 24 Jun 2024 07:56:33 +0000 Received: from CH1PEPF0000AD77.namprd04.prod.outlook.com (2603:10b6:610:74:cafe::bd) by CH0PR04CA0080.outlook.office365.com (2603:10b6:610:74::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.38 via Frontend Transport; Mon, 24 Jun 2024 07:56: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 CH1PEPF0000AD77.mail.protection.outlook.com (10.167.244.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Mon, 24 Jun 2024 07:56: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, 24 Jun 2024 02:56:30 -0500 From: Basavaraj Natikar To: , CC: , , , , Basavaraj Natikar Subject: [PATCH v3 1/7] dmaengine: Move AMD DMA driver to separate directory Date: Mon, 24 Jun 2024 13:26:04 +0530 Message-ID: <20240624075610.1659502-2-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240624075610.1659502-1-Basavaraj.Natikar@amd.com> References: <20240624075610.1659502-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: CH1PEPF0000AD77:EE_|DS7PR12MB5767:EE_ X-MS-Office365-Filtering-Correlation-Id: 60a1cd2b-4ecf-4c64-b1c1-08dc94232a10 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|82310400023|1800799021|36860700010|376011; X-Microsoft-Antispam-Message-Info: 0j1RSvAhrcnGkGVHMe5J6rGASVd8qGwRzgSK3WLz1itPLzOWSL6adXo+tP6Qyio7vpPMsdvzCbY8XSx00nuf+GhHdmcYrbS3apsQxTmv0yqsW+ScXkUg/AiOZFpNJvQe7Uh7dm4brzKUDBkSVmTGBVk/zfW3J7Pyb35JpTjWdgNTxauH3gLVTWJMDPjSiKY1UYVUS2L3XzpvQwkbGgwZqWjUFTARFKQfRDJOeOLbvsHXpdx9YmIX1CWqdxLiGT2raYqwfIZKgyfIO3BUq71o+7s7Fz9o9KzPEDjyl2uheomux/18x7nlCk8Xslgdtg1X4w6B4gpNP095T576pkqbu7zQuSoC8zwqQd7DrBXz+op594h4x9URFIrRQ7t7JH/fpxMpK63gp5qqTZu8h/zXXreN8U2FonM2hovQEIhHKvEQygahRNz44Fi72abQvBabLIK5zuX5akwbvT0j2nimtpA3O7H8+7KYKDGSGpAf6qI4lwAqKTqHB5R0vae9Y6vE42p6HVlEY1E3ltGsMVlBXBcAv6SCXX/O36UXLJbDJPbaq0lwgPyU75olcTwWKtX3G2dqeCBq9ywkj8LQbKGvyIDIqAMMKcJcyj4cLOIO5NlHorvu+ArWW9XH0JxjEHs/3YPlJ8PgA3PifdJ5Z/uGlrEwSOQxh2C+qqrHdHbP30c8vRP2QPWHm48eXlFPBYtmw05SQ7tz+6W7PUuPegrU8Lweviq5FkN1ci8fjeJ57vzpxN+y0R5kpWJj6zV33Bc4QT5rpVkFuGC8Y+OCzLg/8vRvDGwIrrmQhpvSl75zqpl/7auQxOkAdLXIkhIh35cUOCJeNqmrrZlKePHAN+5S4OQ+nN3YV3SlNkgP7Lt//cjbD1FMfbwBOc+xjwbRR8Hk6zqmSsZsKPsgc0NDmESgtpyEdF1Ka4L0JdWXVKrIwYSfCw9Agy1queyr5G8NHo7d8yjnBrwSrD4lfXznbW4SM4RMnyvklGEOhFMqqFVzGVeTvxcPsNVb9+H4KPzcVRLAfvKw8PeNnWrH0ck5b/winYL1FvTjSusR4CKsTh2NDH/7M4V6YftbGLeu5tEY6AZzCrGddT4lM2vrB84YuRc2Y8JwAHXI6BzAthJlJJGZs70dvpjWmki3XnotgiWkxNus9ZS3ZaMs7hc/dLY0zi/z+onq8/QLdXV20sD8YxTzCAb36ljIiu1eLX4fLUwaQsH/9p+Qracq7g3RLtXnujhjmo3Jy1uNL+4HS+Mh8lngcrvIIs07nBrFv4ucGPQ4mnqugvLmw/8so7Tkgk/f/4StUlahJ8kONJyDaTTMfCGpZXMLXLEqEeEc3YgRtT0xXpBsgBxmPFXdAFV43rSUi/JCgaSKGAtTwBhFcbvCE4gMICt5mdEdTb/Bjy0zaCQLB1EP68SUEUgVhiZ6fUEYAZMY1A== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230037)(82310400023)(1800799021)(36860700010)(376011);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2024 07:56:32.9333 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 60a1cd2b-4ecf-4c64-b1c1-08dc94232a10 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: CH1PEPF0000AD77.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5767 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 2ca8f35dfe03..537964afef55 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 Jun 24 07:56:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13709121 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2061.outbound.protection.outlook.com [40.107.220.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 7C353481AB for ; Mon, 24 Jun 2024 07:56:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719215800; cv=fail; b=lL/eVKt5Y4xZFU2XcyTLrXtRFk1/19xfScIcL7nUegJvY4owgy4rVTXxojen+rsIzeS9QFF/2MzxexYjDDDifFDJagajnAlUFWzQzBITEKWbSRHCaixLIpE0/8tPbMUFHs2WsFwFztzhiv/iUf65I+8D9isVFQD0fdkLAIE55Vg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719215800; c=relaxed/simple; bh=EsfJbWBLZktMpeqrJ0DdBLCOiliYbgZn/WcNRxsWyh4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=H6p4wZuTgpchSjxwpeIkflV0x8Mcv8+glLWplLLUOtzhGK/JtgN1+kxbX+iGcX0OzRN60gIHBQJK2Mv807zm+yAZF6d3USSJHLN/Kgkk4fszHafb3/6ydOGa23w7K/U85byhlbhSweehgHUsowVwYf/N4ZCtZlqxm4wGg2kh6WY= 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=ukGqlZuC; arc=fail smtp.client-ip=40.107.220.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="ukGqlZuC" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ezd49zBnhBQNfpcn6Wu/ffbJUQEr+uY/AdBdVfij0SaZgHklRdy2nS/gH84CWkuixoyVFt2VwnxHQgXO4qhlk0O3TYybgH3a13TDV6AkHiNglT0XVQIO0rM6FKEvfNyGQX8o1kcdtRWfiZysSDLCnEW/en5LVFPGiKKpCcoWgm1VkPvpWSveFPqDJBkuwbJ2KZLnUO/7vLcycg4t/oZ1XNQmU/+VK0yAdaGMtdezZt46mYTFnWLT2tSU5h/KdkfiKizuNMO+4rWO3uQcbKLGkH48pm0T/uMRdGsL/rrGD08tjR5n6roYW/PICfqFezBz9kP9cnyo4dMD1egihliwVA== 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=Ay8XaJUXliEFdCKahYFXHECChccOAE2XhOsSWm6Rbe0=; b=DjKfMMZUMDdFXQx/lZ9EIPxJf8rD4uaUeJKgiW5Ut0hXqzAC8hHtI+oHMczLnH1OunHMbD9cfSNHAe2TtWMRsdC85c94WTHHv/WWQKTq5NWPx69kQUksS1llAkSMPSE6bualRhVbs39DKs1jhFc7xD4fpyU53t2Y1UqXboi0bi2jnAUjHXVKIeY7nz6REbtPpEqLkv4UzQKHpk1WJZF1tjfaOwsJ6Vzaraj1vsKgwWamI3mUgt4JxGdjPKf+Li3X46gIj30bucHv76pxZ62X1A9PJF8ChdtXhVJZa7MLGvoSECV+cOc4bumrHyQq84/Zzuya9kUIM+dvG1AOci+6Lw== 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=Ay8XaJUXliEFdCKahYFXHECChccOAE2XhOsSWm6Rbe0=; b=ukGqlZuC12avYD/A+zIAQ+kbrLenHGYt4SPuQXQ1yrUjFAIUh8XYB6YXbzFr2PvObo5U7RCFJOHcAFOh7HO/Jrlp5GN2LgpZ+S478UG9TvvzSs8jTKkjABNEItwcBy1zFpZf39J32ooEY8IxaxFwA52YC7qZ0wui6xEpmmA8ihg= Received: from CH5PR03CA0009.namprd03.prod.outlook.com (2603:10b6:610:1f1::22) by SN7PR12MB7348.namprd12.prod.outlook.com (2603:10b6:806:29b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.28; Mon, 24 Jun 2024 07:56:36 +0000 Received: from CH1PEPF0000AD75.namprd04.prod.outlook.com (2603:10b6:610:1f1:cafe::8b) by CH5PR03CA0009.outlook.office365.com (2603:10b6:610:1f1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.38 via Frontend Transport; Mon, 24 Jun 2024 07:56:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CH1PEPF0000AD75.mail.protection.outlook.com (10.167.244.54) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Mon, 24 Jun 2024 07:56:35 +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, 24 Jun 2024 02:56:32 -0500 From: Basavaraj Natikar To: , CC: , , , , Basavaraj Natikar Subject: [PATCH v3 2/7] dmaengine: ae4dma: Add AMD ae4dma controller driver Date: Mon, 24 Jun 2024 13:26:05 +0530 Message-ID: <20240624075610.1659502-3-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240624075610.1659502-1-Basavaraj.Natikar@amd.com> References: <20240624075610.1659502-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: CH1PEPF0000AD75:EE_|SN7PR12MB7348:EE_ X-MS-Office365-Filtering-Correlation-Id: 5f49536b-4a79-4d1b-7aef-08dc94232bd2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|82310400023|36860700010|1800799021; X-Microsoft-Antispam-Message-Info: M+gBfO4i2lSW69ilVRWWV0/eYqKFsKp9i0fG22bcCJhvxFjOoOPz8gF/KnWl23TjPY1B31Ui9x1C7ZfL5RMyQ6lu/zk0KcIXtOt7bV26hvz+c82h4fUfAW9fc2uYFCSpUfQQipuoj+oNCGzJHH2MkKh0zjFhsdySODvbdNeFFcbKW1qeVKF4vO24V1LlmkV4XCZFHA1HHamX6ZguPdExuJSvApiWtHaJechiTjyKB8BbfCFpbLhuPs3dXJIcSdJOUrS1UknOGCOfrlYzaHnR4djjXqXAw8ZXcixXFsRp9jpHZm+ybxV0Te+S5yKt6ZDji8sns6xi7o5whOwDCPEYQ62guVzAwRvgvkh/QiC82rHFS+jMrmQx2baoLUU+L6Hx19iXNsc92Q+K8/zsXWq8x+qi2+zL7My6rZ8ccB36sC7IOWeoXsYrjQ7VzO0gvmbC+20IqiRlPhF/pNW76+Zwqewhk0qqvTBX67WoAMbbYZguRZAFxd7Vf1Gy6CMcA2kHJ5yfvjiqdJTsRJVmFU1a2DVMfEc5pvCM8uqQtGcach8C/2J84rjrjcacPh5D/385a9wLr5GwQYFagiSdCo9dqpO2011uiva2q7inoZDwoUnDcEfzncrBRCpxhPu3VQ31tB5XSS2wtwNpUOLQvZJiTx+XuuQqNf8pbbA7x6CpW1yU+tXUmN7A/9OWmBbN3M/vkSYOktczgulNM+QXRRb2EUw1KS/FNANFFc43WVjG4BG0gREyjBvYwYkXJVs1NpU7AXOR96bADdiaQ3/iW2u3V37kfOY9qiLm17JQ4wUBAP1RAGCa3T6LL8mfNP7rM//MHgTA1jolCDEYPrUU9pi24NnCfMKbhXDCImkJ1Tw5s4/C4LlBNzC4lsV5mtEsLgg2Qh/7ncxW1v0IWWcnvS3vv42DKvshiFdRg3jwXTr1mvym77MWlDvAKc2Ct59xYa8fSOJtkth6ay/t4EEkXGIlSU86Y6Uo27tSWH0Jh8EAdW1EiekgUhXUwEWPqLDndInwwzgcWxJqnaoqEhBFw65k1ERdCNY6jULvJkhpeI1+5cgxGSfedDyKxO4u3xllgVN6r8YqUPIZr9gGjTgNW+i5Ex+0KBYp76xIv3ApxEQJxtgTk0kyTtYJz50SgRrUv+WE/euZgMCFmplEklo7k6ZBrUz63MRT9lLE4HS2mEMRCnHrqjfyMdLh9Naj7eReRNwmGH6cCXY5PW2+7OzDAA7TMRt02aq0Z+c0fuF8Jh+MbKX2P6l2PbgaZsnylsowbS+L1xOcAnBxvd8w4hPUptjEape/PSDP4HkzvxNRk9MddcFNsN7iVbxWndbwguSxjttOh/ukvs8RO/nCeRdBWNNFuRKHhZuJd5XpY3owUJr9gI+nPn48j+s1lS+/IMicSOZ+SCLEpi6rZCmG31QLHplL3g== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230037)(376011)(82310400023)(36860700010)(1800799021);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2024 07:56:35.8810 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5f49536b-4a79-4d1b-7aef-08dc94232bd2 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: CH1PEPF0000AD75.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7348 Add support for AMD AE4DMA controller. It performs high-bandwidth memory to memory and IO copy operation. Device commands are managed via a circular queue of 'descriptors', each of which specifies source and destination addresses for copying a single buffer of data. Reviewed-by: Raju Rangoju Signed-off-by: Basavaraj Natikar --- MAINTAINERS | 6 + drivers/dma/amd/Kconfig | 1 + drivers/dma/amd/Makefile | 1 + drivers/dma/amd/ae4dma/Kconfig | 14 ++ drivers/dma/amd/ae4dma/Makefile | 10 ++ drivers/dma/amd/ae4dma/ae4dma-dev.c | 200 ++++++++++++++++++++++++++++ drivers/dma/amd/ae4dma/ae4dma-pci.c | 157 ++++++++++++++++++++++ drivers/dma/amd/ae4dma/ae4dma.h | 77 +++++++++++ drivers/dma/amd/common/amd_dma.h | 26 ++++ 9 files changed, 492 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 537964afef55..42436e1cf1e2 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..cb05fcb47987 --- /dev/null +++ b/drivers/dma/amd/ae4dma/ae4dma-dev.c @@ -0,0 +1,200 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * AMD AE4DMA driver + * + * Copyright (c) 2024, Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * Author: Basavaraj Natikar + */ + +#include "ae4dma.h" + +static unsigned int max_hw_q = 1; +module_param(max_hw_q, uint, 0444); +MODULE_PARM_DESC(max_hw_q, "max hw queues supported by engine (any non-zero value, default: 1)"); + +static char *ae4_error_codes[] = { + "", + "ERR 01: INVALID HEADER DW0", + "ERR 02: INVALID STATUS", + "ERR 03: INVALID LENGTH - 4 BYTE ALIGNMENT", + "ERR 04: INVALID SRC ADDR - 4 BYTE ALIGNMENT", + "ERR 05: INVALID DST ADDR - 4 BYTE ALIGNMENT", + "ERR 06: INVALID ALIGNMENT", + "ERR 07: INVALID DESCRIPTOR", +}; + +static void ae4_log_error(struct pt_device *d, int e) +{ + if (e <= 7) + dev_info(d->dev, "AE4DMA error: %s (0x%x)\n", ae4_error_codes[e], e); + else if (e > 7 && e <= 15) + dev_info(d->dev, "AE4DMA error: %s (0x%x)\n", "INVALID DESCRIPTOR", e); + else if (e > 15 && e <= 31) + dev_info(d->dev, "AE4DMA error: %s (0x%x)\n", "INVALID DESCRIPTOR", e); + else if (e > 31 && e <= 63) + dev_info(d->dev, "AE4DMA error: %s (0x%x)\n", "INVALID DESCRIPTOR", e); + else if (e > 63 && e <= 127) + dev_info(d->dev, "AE4DMA error: %s (0x%x)\n", "PTE ERROR", e); + else if (e > 127 && e <= 255) + dev_info(d->dev, "AE4DMA error: %s (0x%x)\n", "PTE ERROR", e); + else + dev_info(d->dev, "Unknown AE4DMA error"); +} + +static void ae4_check_status_error(struct ae4_cmd_queue *ae4cmd_q, int idx) +{ + struct pt_cmd_queue *cmd_q = &ae4cmd_q->cmd_q; + struct ae4dma_desc desc; + u8 status; + + memcpy(&desc, &cmd_q->qbase[idx], sizeof(struct ae4dma_desc)); + 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; + + while (true) { + wait_event_interruptible(ae4cmd_q->q_w, + ((atomic64_read(&ae4cmd_q->done_cnt)) < + atomic64_read(&ae4cmd_q->intr_cnt))); + + atomic64_inc(&ae4cmd_q->done_cnt); + + mutex_lock(&ae4cmd_q->cmd_lock); + + cridx = readl(cmd_q->reg_control + 0x0C); + + 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 + 0x14); + if (status & BIT(0)) { + status &= GENMASK(31, 1); + writel(status, cmd_q->reg_control + 0x14); + } + + return IRQ_HANDLED; +} + +void ae4_destroy_work(struct ae4_device *ae4) +{ + struct ae4_cmd_queue *ae4cmd_q; + int i; + + for (i = 0; i < ae4->cmd_q_count; i++) { + ae4cmd_q = &ae4->ae4cmd_q[i]; + + if (!ae4cmd_q->pws) + break; + + cancel_delayed_work_sync(&ae4cmd_q->p_work); + destroy_workqueue(ae4cmd_q->pws); + } +} + +int ae4_core_init(struct ae4_device *ae4) +{ + struct pt_device *pt = &ae4->pt; + struct ae4_cmd_queue *ae4cmd_q; + struct device *dev = pt->dev; + struct pt_cmd_queue *cmd_q; + int i, ret = 0; + + writel(max_hw_q, pt->io_regs); + + for (i = 0; i < max_hw_q; i++) { + ae4cmd_q = &ae4->ae4cmd_q[i]; + ae4cmd_q->id = ae4->cmd_q_count; + ae4->cmd_q_count++; + + cmd_q = &ae4cmd_q->cmd_q; + cmd_q->pt = pt; + + /* Preset some register values (Q size is 32byte (0x20)) */ + cmd_q->reg_control = pt->io_regs + ((i + 1) * 0x20); + + ret = devm_request_irq(dev, ae4->ae4_irq[i], ae4_core_irq_handler, 0, + dev_name(pt->dev), ae4cmd_q); + if (ret) + return ret; + + cmd_q->qsize = Q_SIZE(sizeof(struct ae4dma_desc)); + + cmd_q->qbase = dmam_alloc_coherent(dev, cmd_q->qsize, &cmd_q->qbase_dma, + GFP_KERNEL); + if (!cmd_q->qbase) + return -ENOMEM; + } + + for (i = 0; i < ae4->cmd_q_count; i++) { + ae4cmd_q = &ae4->ae4cmd_q[i]; + + cmd_q = &ae4cmd_q->cmd_q; + + /* Preset some register values (Q size is 32byte (0x20)) */ + cmd_q->reg_control = pt->io_regs + ((i + 1) * 0x20); + + /* Update the device registers with queue information. */ + writel(CMD_Q_LEN, cmd_q->reg_control + 0x08); + + cmd_q->qdma_tail = cmd_q->qbase_dma; + writel(lower_32_bits(cmd_q->qdma_tail), cmd_q->reg_control + 0x18); + writel(upper_32_bits(cmd_q->qdma_tail), cmd_q->reg_control + 0x1C); + + INIT_LIST_HEAD(&ae4cmd_q->cmd); + init_waitqueue_head(&ae4cmd_q->q_w); + + ae4cmd_q->pws = alloc_ordered_workqueue("ae4dma_%d", WQ_MEM_RECLAIM, ae4cmd_q->id); + if (!ae4cmd_q->pws) { + ae4_destroy_work(ae4); + return -ENOMEM; + } + INIT_DELAYED_WORK(&ae4cmd_q->p_work, ae4_pending_work); + queue_delayed_work(ae4cmd_q->pws, &ae4cmd_q->p_work, usecs_to_jiffies(100)); + + init_completion(&ae4cmd_q->cmp); + } + + return ret; +} diff --git a/drivers/dma/amd/ae4dma/ae4dma-pci.c b/drivers/dma/amd/ae4dma/ae4dma-pci.c new file mode 100644 index 000000000000..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..59a0ea3293cb --- /dev/null +++ b/drivers/dma/amd/ae4dma/ae4dma.h @@ -0,0 +1,77 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * AMD AE4DMA driver + * + * Copyright (c) 2024, Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * Author: Basavaraj Natikar + */ +#ifndef __AE4DMA_H__ +#define __AE4DMA_H__ + +#include "../common/amd_dma.h" + +#define MAX_AE4_HW_QUEUES 16 + +#define AE4_DESC_COMPLETED 0x3 + +struct ae4_msix { + int msix_count; + struct msix_entry msix_entry[MAX_AE4_HW_QUEUES]; +}; + +struct ae4_cmd_queue { + struct ae4_device *ae4; + struct pt_cmd_queue cmd_q; + struct list_head cmd; + /* protect command operations */ + struct mutex cmd_lock; + struct delayed_work p_work; + struct workqueue_struct *pws; + struct completion cmp; + wait_queue_head_t q_w; + atomic64_t intr_cnt; + atomic64_t done_cnt; + 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 Jun 24 07:56:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13709124 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2075.outbound.protection.outlook.com [40.107.96.75]) (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 7994E481C4 for ; Mon, 24 Jun 2024 07:56:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.75 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719215807; cv=fail; b=QhJw1sWhP4RkqmwbRw45qVwnehwoBOtokaHx8ev1ZW3nZ2cFq+DcLiTwMe2yJSEtriYhlHbMSJ9wNwpAD2XN73o/4pEB+GIC0bqqg5kB1oDk/Ovf7XxhHqzd8uZCYYcxR3bftoB0bpHNHYNoQ4mQ7pCnszea3+whE9Uk43RaZpw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719215807; c=relaxed/simple; bh=yD7rqa4sbFfUqRBwe41kZMwNWXA9d0POJy9n6wNQGX0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mXVlat+bNF3vSyHuay1BrADjMRMHKN+vSMlzevoB6UFE24EQH2ybBPDkmivrIhZY5IY8FyKTbvPZ7C2r4eKJsqFdmSvQe4xlUGoWVl4x31tlo3GEQgfI6fzinTOuTSxLbyRuxWCDViNXHae/W4yi9y7IE7cVF102FPKQ3+FjRRY= 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=h7AV5bEC; arc=fail smtp.client-ip=40.107.96.75 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="h7AV5bEC" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EVlUq2uHJtlaqHNV3DY9a+zGUztHmWk2jQQMhn/FbtW+Nf9jmbI+ahGMmIel8wtDOBleGQuKC/ZsurRQgHzILIMiA+/8Jn2pLIrqUtxtGbUh2G74cR67PrnAW6Ual7p6VNVR14hvhlxhfa5IHYxR5pYwuYQ94Bu61aRDoEMDigOZkHNYrjAuu3yjavYT5kJa5kRbjXRrbhWFi1rl7A6CwHGkXzjnd0gCLO1fejpMJZezvNpHPr2DfdKl6degZB/0qW34qWJZvLNJ5K5qyHlza48+8WB5XRfOInzIvPw4p5B9llW8W8o14Od+qQgYlo28lLEJ4zv2Gd9dF1N0uhDgBg== 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=edbqYjfXFmnw9Pr5WyN9OBAvDwe2JYwiGitt2fwQM5M=; b=VsFHSbcWvJqdxjqXb1Pd3s1ShIEb+2aMIhT0lwUJO4AwM1jHl/6ZSCcHM8NhN0KT1TzllyhSZax3HZ9cQoqXjIj5Dx1kTwxtPPekXHvYL+SKJL1075fkHK0gHziY9DMj2VDaHYCgo3eIXn+Tncb4Px11pLRCbfmOzi1AWvixgiSpa8RYDfxCogRVM6Z4myIoE8lnKIcSmWLnK6a4igCS233G08kg2yurPiNrBUagOMIbhVDNL5eNHB+eM8jlxDQWvkhuYoxQ5cRbPe7F2G2LVIQUPKbSeMeBEy0rVCF2TJdZ3ebu9A0XFgqJEh45DmKt+Q1L6Mkz3B/8er4Q8IWuwg== 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=edbqYjfXFmnw9Pr5WyN9OBAvDwe2JYwiGitt2fwQM5M=; b=h7AV5bECmNsRxLoH7gWa8eCpSirIQPw3qco9k1t4ZxaQ7c/5ho1J9jWtEQSg2XjYJ3HCvHEPxZiNrlUI+hz7erixT/g4v7sR49tgn4GljPdNdDtnDH/mZzXxBAyGQ6LcVN/Oi+5ASz2Ih4QPaJPeqdvlIjJua31eO9aGG3Pn+lM= Received: from CH0P223CA0006.NAMP223.PROD.OUTLOOK.COM (2603:10b6:610:116::24) by DM6PR12MB4420.namprd12.prod.outlook.com (2603:10b6:5:2a7::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.26; Mon, 24 Jun 2024 07:56:38 +0000 Received: from CH1PEPF0000AD74.namprd04.prod.outlook.com (2603:10b6:610:116:cafe::c1) by CH0P223CA0006.outlook.office365.com (2603:10b6:610:116::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.38 via Frontend Transport; Mon, 24 Jun 2024 07:56: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 CH1PEPF0000AD74.mail.protection.outlook.com (10.167.244.52) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Mon, 24 Jun 2024 07:56:37 +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, 24 Jun 2024 02:56:35 -0500 From: Basavaraj Natikar To: , CC: , , , , Basavaraj Natikar Subject: [PATCH v3 3/7] dmaengine: ptdma: Move common functions to common code Date: Mon, 24 Jun 2024 13:26:06 +0530 Message-ID: <20240624075610.1659502-4-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240624075610.1659502-1-Basavaraj.Natikar@amd.com> References: <20240624075610.1659502-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: CH1PEPF0000AD74:EE_|DM6PR12MB4420:EE_ X-MS-Office365-Filtering-Correlation-Id: 2f6c31af-89c8-4d5a-9885-08dc94232d0e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|1800799021|82310400023|36860700010; X-Microsoft-Antispam-Message-Info: qkdTsaP/poyGlZJ2TyhCFKqc9JjASfYh0Kr21iyRAz+7nEVBhNG8ngE2CCiBgwWYnxreV9m0K0/pI8fwUpkM9QE2QQ4TL5taFW9FJXId8pSifsvKsrHnf57prgyJG19cip6SpzoRmkszwuRpmmvZChUE+qjqbu8SN72UuEAG49pnArisYfiaVJtj/mFGkImiAWkNd9E6iEM8VhTt8Iad9VAfawL0L9xYbInz3k+pVyuMPIRFsuUkzaIVNbCGoEpRGS9wngxjfdBXQyyi3FFGChnTjEZLIyx3r5TSKUJDWRPYwzWdxM5KgBDUfHFdlzAtGLNUn+27BNEEwumwO3wbZB9h7HS0BDqZ3+9p8aQ9A4ZTvICGofO/BGVW+oe4xTC47702pvw9/b10p6NkzYaFIDF5v7fuhwPXpdzIKD7noWLhm8bYiVYXfaNpGeOk4hc7mOCXZdUN8YsGeW2dvVaCfqohxk/lKIgebawUYH2gE3GWb+IvkE3ezLhrtt1H9t+Su2aCOJxu617MwTOqPzumaDWEdvaokhFC1sFXX5edKDqgSbnhgCOowYL5w6tpIySxZjLL1lEE0vd2WC33H3Igqm5gBDAvhIJmR4vMypkiJrqQK0ua6RGRAriatkXtCFoa74QLVe8AOinB4ERqVdWzmlenVw9lM4lrkYOdD4rtfu/0N8NqsFsX4+LDgNqKqx1HvvoafDkuU+ODLXdrdi1nyHieAkgtPRjlXrEfQ6cDwbvuvaLihsxXEf8fBGwnoqSoTRH3si4P3UxVueBi/3tb8igyNLStJLmbWYACRfWw7Qu84RGeARrmkASXylngbu/nqHiAweBbAM4ykwVim1u/nzH8iKk62jDBcioDXJxM+FTklf5L5WG+HWsCs9OBHwg25pEh8xMFgGHmv0D4dXyia9L+ANdXHW10BndSGBTiL2idAe/R/o293ucjDJmEjjQiG/OAXn/mqouYDIV2l9VFtoxz4O0+d14SIzu4BKdbCyEuMXeW8NWk07yvtakgHP7oxlu2W7rzilDMaYd7YxyDxtXmQYUsgIL9tGQ7cLLxfsjenKaGK+o/1Oe6yrF2XlS7OfYBzQAufPMSN3O7gT8iDCJ2J5rw8pHgBlSTLejouxiGJB2jlIYMc1zKL/3PCmpYlt1/W58BB6h1wgmn9j4t8pKiPS7GZ1sC2vEws2/5QMaC8byAtH7nZ1a0oz3+3IBbLPfICJi1VrHuBL+sDjoRna4w0LK3MSjHucmdnW4E0gGCSEZsmwYsqwHPfOLu4p6UouzNp09I5w7lzh878552Xp4GKkjOoqYBxikZVugjmYKVR6H28GXBktaoEsaV2oSevYZZZLCqKaqqdNI8S0iq3wO1zzvghO97k9cVUW0FBTARbxncju2I+qQkKc/U2ENDk1rm+LAf1olaxuG9l/wqbQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230037)(376011)(1800799021)(82310400023)(36860700010);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2024 07:56:37.9527 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2f6c31af-89c8-4d5a-9885-08dc94232d0e 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: CH1PEPF0000AD74.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4420 To focus on reusability of ptdma code across modules extract common functions into reusable modules. Reviewed-by: Raju Rangoju Signed-off-by: Basavaraj Natikar --- MAINTAINERS | 1 + drivers/dma/amd/common/amd_dma.c | 23 +++++++++++++++++++++++ drivers/dma/amd/common/amd_dma.h | 3 +++ drivers/dma/amd/ptdma/Makefile | 2 +- drivers/dma/amd/ptdma/ptdma-dev.c | 14 +------------- drivers/dma/amd/ptdma/ptdma-dmaengine.c | 3 +-- drivers/dma/amd/ptdma/ptdma.h | 2 -- 7 files changed, 30 insertions(+), 18 deletions(-) create mode 100644 drivers/dma/amd/common/amd_dma.c diff --git a/MAINTAINERS b/MAINTAINERS index 42436e1cf1e2..f5c255ede973 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -952,6 +952,7 @@ M: Basavaraj Natikar L: dmaengine@vger.kernel.org S: Maintained F: drivers/dma/amd/ae4dma/ +F: drivers/dma/amd/common/ AMD AXI W1 DRIVER M: Kris Chaplin diff --git a/drivers/dma/amd/common/amd_dma.c b/drivers/dma/amd/common/amd_dma.c new file mode 100644 index 000000000000..3552d36fa8b9 --- /dev/null +++ b/drivers/dma/amd/common/amd_dma.c @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * AMD DMA Driver common + * + * Copyright (c) 2024, Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * Author: Basavaraj Natikar + */ + +#include "../common/amd_dma.h" + +void pt_start_queue(struct pt_cmd_queue *cmd_q) +{ + /* Turn on the run bit */ + iowrite32(cmd_q->qcontrol | CMD_Q_RUN, cmd_q->reg_control); +} + +void pt_stop_queue(struct pt_cmd_queue *cmd_q) +{ + /* Turn off the run bit */ + iowrite32(cmd_q->qcontrol & ~CMD_Q_RUN, cmd_q->reg_control); +} diff --git a/drivers/dma/amd/common/amd_dma.h b/drivers/dma/amd/common/amd_dma.h index f9f396cd4371..44251918f157 100644 --- a/drivers/dma/amd/common/amd_dma.h +++ b/drivers/dma/amd/common/amd_dma.h @@ -23,4 +23,7 @@ #include "../ptdma/ptdma.h" #include "../../virt-dma.h" +void pt_start_queue(struct pt_cmd_queue *cmd_q); +void pt_stop_queue(struct pt_cmd_queue *cmd_q); + #endif diff --git a/drivers/dma/amd/ptdma/Makefile b/drivers/dma/amd/ptdma/Makefile index ce5410268a9a..42606d7302e6 100644 --- a/drivers/dma/amd/ptdma/Makefile +++ b/drivers/dma/amd/ptdma/Makefile @@ -5,6 +5,6 @@ obj-$(CONFIG_AMD_PTDMA) += ptdma.o -ptdma-objs := ptdma-dev.o ptdma-dmaengine.o ptdma-debugfs.o +ptdma-objs := ptdma-dev.o ptdma-dmaengine.o ptdma-debugfs.o ../common/amd_dma.o ptdma-$(CONFIG_PCI) += ptdma-pci.o diff --git a/drivers/dma/amd/ptdma/ptdma-dev.c b/drivers/dma/amd/ptdma/ptdma-dev.c index a2bf13ff18b6..506b3dfca549 100644 --- a/drivers/dma/amd/ptdma/ptdma-dev.c +++ b/drivers/dma/amd/ptdma/ptdma-dev.c @@ -17,7 +17,7 @@ #include #include -#include "ptdma.h" +#include "../common/amd_dma.h" /* Human-readable error strings */ static char *pt_error_codes[] = { @@ -54,18 +54,6 @@ static void pt_log_error(struct pt_device *d, int e) dev_err(d->dev, "PTDMA error: %s (0x%x)\n", pt_error_codes[e], e); } -void pt_start_queue(struct pt_cmd_queue *cmd_q) -{ - /* Turn on the run bit */ - iowrite32(cmd_q->qcontrol | CMD_Q_RUN, cmd_q->reg_control); -} - -void pt_stop_queue(struct pt_cmd_queue *cmd_q) -{ - /* Turn off the run bit */ - iowrite32(cmd_q->qcontrol & ~CMD_Q_RUN, cmd_q->reg_control); -} - static int pt_core_execute_cmd(struct ptdma_desc *desc, struct pt_cmd_queue *cmd_q) { bool soc = FIELD_GET(DWORD0_SOC, desc->dw0); diff --git a/drivers/dma/amd/ptdma/ptdma-dmaengine.c b/drivers/dma/amd/ptdma/ptdma-dmaengine.c index a2e7c2cec15e..66ea10499643 100644 --- a/drivers/dma/amd/ptdma/ptdma-dmaengine.c +++ b/drivers/dma/amd/ptdma/ptdma-dmaengine.c @@ -9,8 +9,7 @@ * Author: Gary R Hook */ -#include "ptdma.h" -#include "../../dmaengine.h" +#include "../common/amd_dma.h" static inline struct pt_dma_chan *to_pt_chan(struct dma_chan *dma_chan) { diff --git a/drivers/dma/amd/ptdma/ptdma.h b/drivers/dma/amd/ptdma/ptdma.h index 2690a32fc7cb..b4f9ee83b074 100644 --- a/drivers/dma/amd/ptdma/ptdma.h +++ b/drivers/dma/amd/ptdma/ptdma.h @@ -322,8 +322,6 @@ int pt_core_perform_passthru(struct pt_cmd_queue *cmd_q, struct pt_passthru_engine *pt_engine); void pt_check_status_trans(struct pt_device *pt, struct pt_cmd_queue *cmd_q); -void pt_start_queue(struct pt_cmd_queue *cmd_q); -void pt_stop_queue(struct pt_cmd_queue *cmd_q); static inline void pt_core_disable_queue_interrupts(struct pt_device *pt) { From patchwork Mon Jun 24 07:56:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13709125 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2054.outbound.protection.outlook.com [40.107.236.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 42D47482DB for ; Mon, 24 Jun 2024 07:56:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719215808; cv=fail; b=WBijPnBWIVs2Mn7gZF5ip5H4FlWVq2WEm4PFym+JcEQZ58CqEco7sTrsCkgXDBHYFF7ac0djjjwNQsaeiVnMlzT4zJE1R/VQmIaYCSnraQI3k5IHQdi8AH8k2UdSAcpYDQna2vw3FDUCAS8WmMxucMm5i39WQtzoBhNtSC+6y9A= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719215808; c=relaxed/simple; bh=VJJpdHEl6y41byAgiYESrmHq+ZdiNLIx1dq3gvaB4nw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tzXdp+jbjCBhlz8G9tyZynwEcMC72D+bORUvxOX9gw9S8ORXgNnSV/D+bGqNH14XnwKiy1m+oEbwoCKIMyNcyHrLO1BUXuEf/EHrC6tUmAYnU9eMHvoVm9qJxQrYS5d1O6IBk7bOqTy88a2xY9HXtOBdGB+28aF+7Eo8PAyjhJc= 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=rMMq2e8N; arc=fail smtp.client-ip=40.107.236.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="rMMq2e8N" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J+lwfMtA1Htbdf3K1vD2RHqCIiikew6wVCBfgzmMWALV+m12hJk+zCfy7olI6pmtT7NmQRWMwcawyZ2Xu6fdn+83kjcIB3hvrW56uZRn8h/Dcgext2dcntX7LfsplfbkBKPfwod57odUMknQlqo+GBJByY4AxElQeVb0aY5MqW1lw8cU+rIuzKrt27xKpYQBe6/e9ulCvgfF62mPKNPBXVHqNhjXOlAoRKcK05OHyEJtKhbP+TGJlOaaVgQm2rf06SLKyTQE6ZOR8aoXN1R0/CLWkbr6sWE2B5PUAPOzgcmmus7karx26XfvnpGKjkPx4oi7H0AbnFUV4WDM1YfrMQ== 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=EASjL/NEmup4Ob9H2mzNBoJHKxGs80oH2hrlH4mi2z4=; b=Z/183dHvQIDFqYcA7QAEo3MhaIPytFGw/fYcqXQPy6WNgUmOvYYyaNAeCpP713+nEOXggoHWNdCPJZ5ozukJgBxwXLYvzPOJMWslQKTiRUZ5ean5L2qm1crde9Jh1ud9tELeN/JiJmTJsNBGptQEHLj4U8OW9iFlJtwIKtdN4BUJ+HO3FrgZDgFRFfzoVtRzfqSwgM0TSHVmS4yvvo8mLXkXnIPkhIXx8pErZvig/wsA6B/KGK2h58ORGGcQX8YBQvJoUHDds+I0NdtM+V15ddPDJx6XEuZ8z7CktNwLfUuIX4uFMyeY7cx6JZzSo890owxbPRJo3ry4ds3rkM8nTw== 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=EASjL/NEmup4Ob9H2mzNBoJHKxGs80oH2hrlH4mi2z4=; b=rMMq2e8N4rqm/tfGKyj9i0j/BRYX+DzHFft0Mq0Gft5lWhYxpcCtrNgXhwuFj1WrKdhB41r6OGkvf/Yza5GjhY36fICFPBqnAyGJb6sq3DIjDTHQxVEEUDqabA6mw2psTdnFgroWOok9mAg+AqTzjzXGIxcdzccZuY777EvvVYA= Received: from CH0PR04CA0074.namprd04.prod.outlook.com (2603:10b6:610:74::19) by SA0PR12MB4415.namprd12.prod.outlook.com (2603:10b6:806:70::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.26; Mon, 24 Jun 2024 07:56:40 +0000 Received: from CH1PEPF0000AD77.namprd04.prod.outlook.com (2603:10b6:610:74:cafe::9) by CH0PR04CA0074.outlook.office365.com (2603:10b6:610:74::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.38 via Frontend Transport; Mon, 24 Jun 2024 07:56:40 +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 CH1PEPF0000AD77.mail.protection.outlook.com (10.167.244.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Mon, 24 Jun 2024 07:56:40 +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, 24 Jun 2024 02:56:37 -0500 From: Basavaraj Natikar To: , CC: , , , , Basavaraj Natikar Subject: [PATCH v3 4/7] dmaengine: ptdma: Extend ptdma to support multi-channel and version Date: Mon, 24 Jun 2024 13:26:07 +0530 Message-ID: <20240624075610.1659502-5-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240624075610.1659502-1-Basavaraj.Natikar@amd.com> References: <20240624075610.1659502-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: CH1PEPF0000AD77:EE_|SA0PR12MB4415:EE_ X-MS-Office365-Filtering-Correlation-Id: 7ba76b4a-c38a-4435-f4ee-08dc94232e81 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|1800799021|82310400023|36860700010; X-Microsoft-Antispam-Message-Info: Rla5SG0fKs3TP6UogPpSIctMLg6OHNaaVeprnmjFuTlxb4+hczI9hm/StsFYFgm6CFG7imTQ7H16kwSoz2DicMh+0c13xJi8rZOV8rmKOLFZxlJVSA7e8Jf9cs7hIzHhqIG+jWTycQT58Po9BUFEiavIAsVaKYttLV1nnf1kKhUx2J7GQ441iQ6juyK2MdUoOAMCfXkI6LpviRyf0vFThn6+ahp0+tQ56EP8gwkB3efEGGD8zZhtHtPDFmJ7J4sMz/8akUSU8Vurvh0Z82/KSxaSjXS/YjGpr+CBEBkew2Mv1BlwTLbK3QEJ95CXLBFB7qA/JM2Q68n/o3Kv24JGO1Bov7i4+a4ljNsf6HOLy8t+g+cv5KXgck9QGF4TJ9yDT+gGpb/ou6D92CWzAupEKRApGqCeww0m837VKx/Nc1em8ooFvO9n/qjMDa4ON15z/+cv5vsP/DHlM6wayVyBK9/Kvf+IuWkHAGQvXj20cqvvWQvlWbuj+u3BFl6qk9OgmLE9Ca7BbVBFE/zd8Snm3bpbB1mV3tNZBZiVBxgs+Z/VltvMcjckIrRlOdhfqRdhhI5ceHuZL1liIeN9IgcnZhSG9+pXK/s93pXl4xNYbSdto/zd7yDCigweGc3mEkHNQ+8WyQoo7d1wq2wm0uB+TTVF81ZuAhqnvZu8PATdcOAo57tY+gewm/4xeJnkqj/ZvvfMIwG80elRb6Wp+3yoWSgP0HpVWxVbDfIh5XwvHXesp6YCRey8UrbJAJFkUk816qNqg4JasNEq9aWkkx63t3ayob+0UuqcP6uDf/lMPjpJK93mUfSH7WKJA2JYE7c2ZywDiFA9cVQa2FfRcTWckg3E/k9N166sALncHAmjlVMwpqE/DUK8zidjyput5ZHjlFsc1pLAPERlDm1dXmczoHGZCxrwGuP/6oZM2QN6X9325XFU7GC/tvWqsG6aZQUtoXU+wHA/d/1aS+vjAmq4ODjJpNFFpPjejE2M+P6dD4K6gMpMd6qSHX1EElcfKBsFdvAMD4E+cxyj6vMJRnkyUsJEUQtPPaodgldV6LyoIBKBcOdqqKx7hakkWk+juUDuoWa4Yo7RZ9IkhIPECNhypIQphxvjhTNrjl/OEYYiFH2OfYlVc0grmC5I74Z3ou1aDFO7bdRfx+6r6+7Sv+c7coH+GxoRYdJOCyVTY0OrmiKrpadEDGX/4wMRFb5rXZiNdkp8y6MhgmTpqLk1CjYs0xwB4AiVi+qY95kA6RAkLIYQcD+Ykn7A6McsXMZu0W2gjTpXsEYxNs0hTEuCXzKNszsXQWJFtBKD9MESC+hbU+Azy1XaIKK++DEQihEfW1hUHIwLKZFOR5I2Qc4oRe187aQgZiQgSqzKvWku7J785I0wIA5V+wwew3qSgREA6O9CtClYXyesRQIySnR5i29lEA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230037)(376011)(1800799021)(82310400023)(36860700010);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2024 07:56:40.3865 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7ba76b4a-c38a-4435-f4ee-08dc94232e81 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: CH1PEPF0000AD77.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4415 To support multi-channel functionality with AE4DMA engine, extend the PTDMA code with reusable components. Reviewed-by: Raju Rangoju Signed-off-by: Basavaraj Natikar --- drivers/dma/amd/ae4dma/ae4dma.h | 1 + drivers/dma/amd/common/amd_dma.h | 1 + drivers/dma/amd/ptdma/ptdma-dmaengine.c | 105 +++++++++++++++++++----- drivers/dma/amd/ptdma/ptdma.h | 2 + 4 files changed, 89 insertions(+), 20 deletions(-) diff --git a/drivers/dma/amd/ae4dma/ae4dma.h b/drivers/dma/amd/ae4dma/ae4dma.h index 59a0ea3293cb..850ad1e49b51 100644 --- a/drivers/dma/amd/ae4dma/ae4dma.h +++ b/drivers/dma/amd/ae4dma/ae4dma.h @@ -15,6 +15,7 @@ #define MAX_AE4_HW_QUEUES 16 #define AE4_DESC_COMPLETED 0x3 +#define AE4_DMA_VERSION 4 struct ae4_msix { int msix_count; diff --git a/drivers/dma/amd/common/amd_dma.h b/drivers/dma/amd/common/amd_dma.h index 44251918f157..40f18fc912ae 100644 --- a/drivers/dma/amd/common/amd_dma.h +++ b/drivers/dma/amd/common/amd_dma.h @@ -21,6 +21,7 @@ #include #include "../ptdma/ptdma.h" +#include "../ae4dma/ae4dma.h" #include "../../virt-dma.h" void pt_start_queue(struct pt_cmd_queue *cmd_q); diff --git a/drivers/dma/amd/ptdma/ptdma-dmaengine.c b/drivers/dma/amd/ptdma/ptdma-dmaengine.c index 66ea10499643..90ca02fd5f8f 100644 --- a/drivers/dma/amd/ptdma/ptdma-dmaengine.c +++ b/drivers/dma/amd/ptdma/ptdma-dmaengine.c @@ -43,7 +43,24 @@ static void pt_do_cleanup(struct virt_dma_desc *vd) kmem_cache_free(pt->dma_desc_cache, desc); } -static int pt_dma_start_desc(struct pt_dma_desc *desc) +static struct pt_cmd_queue *pt_get_cmd_queue(struct pt_device *pt, struct pt_dma_chan *chan) +{ + struct ae4_cmd_queue *ae4cmd_q; + struct pt_cmd_queue *cmd_q; + struct ae4_device *ae4; + + if (pt->ver == AE4_DMA_VERSION) { + ae4 = container_of(pt, struct ae4_device, pt); + ae4cmd_q = &ae4->ae4cmd_q[chan->id]; + cmd_q = &ae4cmd_q->cmd_q; + } else { + cmd_q = &pt->cmd_q; + } + + return cmd_q; +} + +static int pt_dma_start_desc(struct pt_dma_desc *desc, struct pt_dma_chan *chan) { struct pt_passthru_engine *pt_engine; struct pt_device *pt; @@ -54,7 +71,9 @@ static int pt_dma_start_desc(struct pt_dma_desc *desc) pt_cmd = &desc->pt_cmd; pt = pt_cmd->pt; - cmd_q = &pt->cmd_q; + + cmd_q = pt_get_cmd_queue(pt, chan); + pt_engine = &pt_cmd->passthru; pt->tdata.cmd = pt_cmd; @@ -149,7 +168,7 @@ static void pt_cmd_callback(void *data, int err) if (!desc) break; - ret = pt_dma_start_desc(desc); + ret = pt_dma_start_desc(desc, chan); if (!ret) break; @@ -184,7 +203,10 @@ static struct pt_dma_desc *pt_create_desc(struct dma_chan *dma_chan, { struct pt_dma_chan *chan = to_pt_chan(dma_chan); struct pt_passthru_engine *pt_engine; + struct pt_device *pt = chan->pt; + struct ae4_cmd_queue *ae4cmd_q; struct pt_dma_desc *desc; + struct ae4_device *ae4; struct pt_cmd *pt_cmd; desc = pt_alloc_dma_desc(chan, flags); @@ -192,7 +214,7 @@ static struct pt_dma_desc *pt_create_desc(struct dma_chan *dma_chan, return NULL; pt_cmd = &desc->pt_cmd; - pt_cmd->pt = chan->pt; + pt_cmd->pt = pt; pt_engine = &pt_cmd->passthru; pt_cmd->engine = PT_ENGINE_PASSTHRU; pt_engine->src_dma = src; @@ -203,6 +225,14 @@ static struct pt_dma_desc *pt_create_desc(struct dma_chan *dma_chan, desc->len = len; + if (pt->ver == AE4_DMA_VERSION) { + ae4 = container_of(pt, struct ae4_device, pt); + ae4cmd_q = &ae4->ae4cmd_q[chan->id]; + mutex_lock(&ae4cmd_q->cmd_lock); + list_add_tail(&pt_cmd->entry, &ae4cmd_q->cmd); + mutex_unlock(&ae4cmd_q->cmd_lock); + } + return desc; } @@ -260,8 +290,11 @@ static enum dma_status pt_tx_status(struct dma_chan *c, dma_cookie_t cookie, struct dma_tx_state *txstate) { - struct pt_device *pt = to_pt_chan(c)->pt; - struct pt_cmd_queue *cmd_q = &pt->cmd_q; + struct pt_dma_chan *chan = to_pt_chan(c); + struct pt_device *pt = chan->pt; + struct pt_cmd_queue *cmd_q; + + cmd_q = pt_get_cmd_queue(pt, chan); pt_check_status_trans(pt, cmd_q); return dma_cookie_status(c, cookie, txstate); @@ -270,10 +303,13 @@ pt_tx_status(struct dma_chan *c, dma_cookie_t cookie, static int pt_pause(struct dma_chan *dma_chan) { struct pt_dma_chan *chan = to_pt_chan(dma_chan); + struct pt_device *pt = chan->pt; + struct pt_cmd_queue *cmd_q; unsigned long flags; spin_lock_irqsave(&chan->vc.lock, flags); - pt_stop_queue(&chan->pt->cmd_q); + cmd_q = pt_get_cmd_queue(pt, chan); + pt_stop_queue(cmd_q); spin_unlock_irqrestore(&chan->vc.lock, flags); return 0; @@ -283,10 +319,13 @@ static int pt_resume(struct dma_chan *dma_chan) { struct pt_dma_chan *chan = to_pt_chan(dma_chan); struct pt_dma_desc *desc = NULL; + struct pt_device *pt = chan->pt; + struct pt_cmd_queue *cmd_q; unsigned long flags; spin_lock_irqsave(&chan->vc.lock, flags); - pt_start_queue(&chan->pt->cmd_q); + cmd_q = pt_get_cmd_queue(pt, chan); + pt_start_queue(cmd_q); desc = pt_next_dma_desc(chan); spin_unlock_irqrestore(&chan->vc.lock, flags); @@ -300,11 +339,17 @@ static int pt_resume(struct dma_chan *dma_chan) static int pt_terminate_all(struct dma_chan *dma_chan) { struct pt_dma_chan *chan = to_pt_chan(dma_chan); + struct pt_device *pt = chan->pt; + struct pt_cmd_queue *cmd_q; unsigned long flags; - struct pt_cmd_queue *cmd_q = &chan->pt->cmd_q; LIST_HEAD(head); - iowrite32(SUPPORTED_INTERRUPTS, cmd_q->reg_control + 0x0010); + cmd_q = pt_get_cmd_queue(pt, chan); + if (pt->ver == AE4_DMA_VERSION) + pt_stop_queue(cmd_q); + else + iowrite32(SUPPORTED_INTERRUPTS, cmd_q->reg_control + 0x0010); + spin_lock_irqsave(&chan->vc.lock, flags); vchan_get_all_descriptors(&chan->vc, &head); spin_unlock_irqrestore(&chan->vc.lock, flags); @@ -317,14 +362,24 @@ static int pt_terminate_all(struct dma_chan *dma_chan) int pt_dmaengine_register(struct pt_device *pt) { - struct pt_dma_chan *chan; struct dma_device *dma_dev = &pt->dma_dev; - char *cmd_cache_name; + struct ae4_cmd_queue *ae4cmd_q = NULL; + struct ae4_device *ae4 = NULL; + struct pt_dma_chan *chan; char *desc_cache_name; - int ret; + char *cmd_cache_name; + int ret, i; + + if (pt->ver == AE4_DMA_VERSION) + ae4 = container_of(pt, struct ae4_device, pt); + + if (ae4) + pt->pt_dma_chan = devm_kcalloc(pt->dev, ae4->cmd_q_count, + sizeof(*pt->pt_dma_chan), GFP_KERNEL); + else + pt->pt_dma_chan = devm_kzalloc(pt->dev, sizeof(*pt->pt_dma_chan), + GFP_KERNEL); - pt->pt_dma_chan = devm_kzalloc(pt->dev, sizeof(*pt->pt_dma_chan), - GFP_KERNEL); if (!pt->pt_dma_chan) return -ENOMEM; @@ -366,9 +421,6 @@ int pt_dmaengine_register(struct pt_device *pt) INIT_LIST_HEAD(&dma_dev->channels); - chan = pt->pt_dma_chan; - chan->pt = pt; - /* Set base and prep routines */ dma_dev->device_free_chan_resources = pt_free_chan_resources; dma_dev->device_prep_dma_memcpy = pt_prep_dma_memcpy; @@ -380,8 +432,21 @@ int pt_dmaengine_register(struct pt_device *pt) dma_dev->device_terminate_all = pt_terminate_all; dma_dev->device_synchronize = pt_synchronize; - chan->vc.desc_free = pt_do_cleanup; - vchan_init(&chan->vc, dma_dev); + if (ae4) { + for (i = 0; i < ae4->cmd_q_count; i++) { + chan = pt->pt_dma_chan + i; + ae4cmd_q = &ae4->ae4cmd_q[i]; + chan->id = ae4cmd_q->id; + chan->pt = pt; + chan->vc.desc_free = pt_do_cleanup; + vchan_init(&chan->vc, dma_dev); + } + } else { + chan = pt->pt_dma_chan; + chan->pt = pt; + chan->vc.desc_free = pt_do_cleanup; + vchan_init(&chan->vc, dma_dev); + } ret = dma_async_device_register(dma_dev); if (ret) diff --git a/drivers/dma/amd/ptdma/ptdma.h b/drivers/dma/amd/ptdma/ptdma.h index b4f9ee83b074..d9e4ff942901 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 Jun 24 07:56:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13709123 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2084.outbound.protection.outlook.com [40.107.93.84]) (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 31A1647F5F for ; Mon, 24 Jun 2024 07:56:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.84 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719215807; cv=fail; b=obRtkZzzTXGI9+Yxd8+Hjwve3f0QXKWFhb3MUSUNxC7pQa/qZLk/97KV0tmq/dcoahOa2HcU92oErfCl6E+ZGCIPfFKIZbAmDim4T4cYXEnGDP/zC5hRLWiF46Tv67mTV+8wgofqPhvzg0hVTa/N+nRfN+oELyxXVkdoHQbSkY4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719215807; c=relaxed/simple; bh=Z+ofXQLQ2DGHIXi/pYp1eNTMEx0E3RbLKEhjgK0e3Ts=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qjOPBdSzQdc/+j+CL2YWbkFTct7aQXo/g6J/A1eRx0KMmBfr4RSgCzSWmv2Z40yKK+Y2V4mCHta9BSITtZG/hOFE49jrRXNQ//VI+N+NMLWcQahviDt8EmEjIOK8zMtWTB/2Yc7Ck4Clo1AilaU3btHdt/X2LHOykbgymN6ZSyQ= 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=byzFc2p2; arc=fail smtp.client-ip=40.107.93.84 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="byzFc2p2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K1G7rMiqMX43CMWpUM5UH3lTCV2sYn2SwrffJX386aRERadvrdCkyIN+QQa3lxeKjKCVjdx9vzzu/GOzmVn7ltNO14GAn1cxQiHCSK865WskDKucPZUU7YNj8YD8dns9jpUfzJY19i7rueOFKSzV1Vjw5WB5K3Wui/H5tPp9UxxC88fz4dhAXo58maDvh4f2zuqmVyV1hxLMb26nhEQdwGcrSBUgNhktXV4fRtuHDEMGOJMCRvwSlErNbcj2eSnjhIV9cV10BA48qjQmlUlbDJ1wCsY9xZzQhzjcd6nIloiSPt1Bhe5aQcDjkrxRFiPTsdreUPNQ2rC45Z+uCrHuZA== 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=6iP44LH3NfVMgBdisr6/PTi9GPUcm6Z9TjBSwgtxOxE=; b=f061gVWikbaPWmpiGh0mn3Gn9DLSh/IrfZhAXEscZLyeitG5K4TrIa7HDP9Fw8ckGk6MTxVy3ZzEAxzrMwgR/xg4Xz8sNvPx1/myudk0PomsPdFOz0ij+1KsEhCiIXr5mjJGjPIO6gr4G3+OJu05zyV8ZTO756IbrHSHmJYrg/4H26HMd6l2vLGLBAM9vvj+zwgQmtkGgxcq071ohZkdA0KpWAIjeqObWzXe7/RHQ1aIhAaS1mmveaS67T+TNbev6tuSOonJbOgK6BiK6QrvrFcc2cXeCdKta1eF298lbWIf5KRIRrBLI4tmo9YoOMolU3QvabVZeFh0V2FBjafiJQ== 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=6iP44LH3NfVMgBdisr6/PTi9GPUcm6Z9TjBSwgtxOxE=; b=byzFc2p2srNM//BJg0IRGfsjGkptzKl6i7CUcqqpuKy3dY3FkhNjqRNjhBpN4+n+gukJG81bYqTsSASndK2eSZF3GPxHaNc6k/F8nfRYZ8iMclSF/LKj5ueI1c6dL3aXU86Tf5O7JjmlmtoJsun6yPEJTz5wF2hRbO2S97KFwqI= Received: from CH5PR03CA0022.namprd03.prod.outlook.com (2603:10b6:610:1f1::8) by BL3PR12MB6450.namprd12.prod.outlook.com (2603:10b6:208:3b9::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.19; Mon, 24 Jun 2024 07:56:42 +0000 Received: from CH1PEPF0000AD75.namprd04.prod.outlook.com (2603:10b6:610:1f1:cafe::bb) by CH5PR03CA0022.outlook.office365.com (2603:10b6:610:1f1::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.38 via Frontend Transport; Mon, 24 Jun 2024 07:56:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CH1PEPF0000AD75.mail.protection.outlook.com (10.167.244.54) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Mon, 24 Jun 2024 07:56:42 +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, 24 Jun 2024 02:56:40 -0500 From: Basavaraj Natikar To: , CC: , , , , Basavaraj Natikar Subject: [PATCH v3 5/7] dmaengine: ae4dma: Register AE4DMA using pt_dmaengine_register Date: Mon, 24 Jun 2024 13:26:08 +0530 Message-ID: <20240624075610.1659502-6-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240624075610.1659502-1-Basavaraj.Natikar@amd.com> References: <20240624075610.1659502-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: CH1PEPF0000AD75:EE_|BL3PR12MB6450:EE_ X-MS-Office365-Filtering-Correlation-Id: 861a3c19-26a3-4422-2271-08dc94232fe9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|1800799021|82310400023|376011|36860700010; X-Microsoft-Antispam-Message-Info: YY4kbVwv24U+l+ZOabJlpzQvC9bmx77ZRB0zMNCklRAxCKM2QKU1Wt4rbvwi+Wre5M4UbbyaLKoDMoGFg07Gm7AItvDuy3fKvPnHH2jc4dxcuT+mJg7J8hb53dAhPEyS+8Ilv5C6EqEgqAI74HZP2x1EhhDPE2hPZGbiNznUUzvkcLXRfvLDFV978siQRoMdvAiwwBkEAKzIW5yDvzH3r1T8JD2cBYaxYLvclZonVNetRycLnLruaTh1zVJtYt11hYEFkvJfMBmpHlzFU9hPW6g0DzREIXOzu8liTqt0HHv5dfPFsrbGBhUE+j9rzOScGD5xr1w/kpQe/CiOIG8RNCiuD1IJGgp0A8P9AQBOCNjyJnO7afVt7myniXCSH4aWN9ZjQg8m+sp3aH0PGdDwdhZivZBCE1t6oE1CR/YEsGI4ex66fsQRPP6q83HA8qa44UpspwzGWHoIwpLPLSomOs1czsWVY18JThwtPRRK3X6a1m3/nynR5bYP8rFQXlnmeAchBT1ES0i2B6I8q1UW9FRviuS+NfSsxtMMJ869UNnbtxuSAj/PLf+sxKvPIpDJ+LodlgKWI44OsOud06ATCYKyqOAuNjdE1kKizkLgU8MLtxZlHsXwELFZLio5IjEvDMZaN2kLIypIH8cHnvv4fIwxbwc1nxfdVaxH8Yg5tIWkigOBrljtgHSTivkzqWAVPfkC+boZQWIHsGfKz4fFMbaTi+kRL68UFOgQwuPdyjB0HEzf0fKSzasYIl7FjGee9iPlxfwoFp+TV1gDyJAYB6l/BS0XX6D0pJ5V1t4l+6CoEtDaZZhiXy33WPdlWwPbj8AmuVpM3sRdBP7JTXymPJJN2f72cgROLiytMJj+VcssEjtQu6z24JAHDJii77OvUvikH1+kxxtiqn1cZjSucwcbdytMbwhnbmPOgIh70q/azlzzYiwsS3mmjxrNohHhIdxf3toGvzb8Roo4phF3bdBsepzrRX5aH3rOxZVJ32pyyS4nRtl1n9JOab9I56Iz60xNl5wgDEJxhH6IBAMTWmRhTuxE19B+1oo4IXIVvspe22C7cZEfuvmk5CNREYE5vM//thwm5qIPkzVadQG872ZYDE0tJ0sNvGZFTnNOvu7P9HvHP8WHBkKnqzzfGfgncd4TIt0BwPgtlJtrydAABLloANrxas4rzdG5HSUKwxAzYnIgdzw+n4PVPazNHuLz6FbD/+a0oXqPTbqbN3A+J5vDIkzxyOM1vn92ynH66AcGVca32f84oFCUkO82ixIcwdpeacLqKDFFExiQuqCpnb//CvKGM4PRYh+zWkslTbgDvylvuWqbmGNZWckPYbLeiWfKM7CTVA52z++JhiUXdxWUPKvAbrQHU6vNfYsbuiKA5PV5+Jkri2IjmdESld6z X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230037)(1800799021)(82310400023)(376011)(36860700010);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2024 07:56:42.7560 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 861a3c19-26a3-4422-2271-08dc94232fe9 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: CH1PEPF0000AD75.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6450 Use the pt_dmaengine_register function to register a AE4DMA DMA engine. Reviewed-by: Raju Rangoju Signed-off-by: Basavaraj Natikar --- drivers/dma/amd/ae4dma/ae4dma-dev.c | 65 +++++++++++++++++++++++++ drivers/dma/amd/ae4dma/ae4dma-pci.c | 1 + drivers/dma/amd/ae4dma/ae4dma.h | 2 + drivers/dma/amd/ptdma/ptdma-dmaengine.c | 1 + 4 files changed, 69 insertions(+) diff --git a/drivers/dma/amd/ae4dma/ae4dma-dev.c b/drivers/dma/amd/ae4dma/ae4dma-dev.c index cb05fcb47987..9ab74fc227cb 100644 --- a/drivers/dma/amd/ae4dma/ae4dma-dev.c +++ b/drivers/dma/amd/ae4dma/ae4dma-dev.c @@ -58,6 +58,15 @@ static void ae4_check_status_error(struct ae4_cmd_queue *ae4cmd_q, int idx) } } +void pt_check_status_trans(struct pt_device *pt, struct pt_cmd_queue *cmd_q) +{ + struct ae4_cmd_queue *ae4cmd_q = container_of(cmd_q, struct ae4_cmd_queue, cmd_q); + int i; + + for (i = 0; i < CMD_Q_LEN; i++) + ae4_check_status_error(ae4cmd_q, i); +} + static void ae4_pending_work(struct work_struct *work) { struct ae4_cmd_queue *ae4cmd_q = container_of(work, struct ae4_cmd_queue, p_work.work); @@ -117,6 +126,58 @@ 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 + 0x10); + + mutex_unlock(&ae4cmd_q->cmd_lock); + + wake_up(&ae4cmd_q->q_w); + + return 0; +} + +int pt_core_perform_passthru(struct pt_cmd_queue *cmd_q, + struct pt_passthru_engine *pt_engine) +{ + struct ae4_cmd_queue *ae4cmd_q = container_of(cmd_q, struct ae4_cmd_queue, cmd_q); + struct ae4dma_desc desc; + + cmd_q->cmd_error = 0; + cmd_q->total_pt_ops++; + memset(&desc, 0, sizeof(desc)); + desc.dwouv.dws.byte0 = CMD_AE4_DESC_DW0_VAL; + + desc.dw1.status = 0; + desc.dw1.err_code = 0; + desc.dw1.desc_id = 0; + + desc.length = pt_engine->src_len; + + desc.src_lo = upper_32_bits(pt_engine->src_dma); + desc.src_hi = lower_32_bits(pt_engine->src_dma); + desc.dst_lo = upper_32_bits(pt_engine->dst_dma); + desc.dst_hi = lower_32_bits(pt_engine->dst_dma); + + return ae4_core_execute_cmd(&desc, ae4cmd_q); +} + void ae4_destroy_work(struct ae4_device *ae4) { struct ae4_cmd_queue *ae4cmd_q; @@ -196,5 +257,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 850ad1e49b51..668fad780314 100644 --- a/drivers/dma/amd/ae4dma/ae4dma.h +++ b/drivers/dma/amd/ae4dma/ae4dma.h @@ -16,6 +16,7 @@ #define AE4_DESC_COMPLETED 0x3 #define AE4_DMA_VERSION 4 +#define CMD_AE4_DESC_DW0_VAL 2 struct ae4_msix { int msix_count; @@ -36,6 +37,7 @@ struct ae4_cmd_queue { atomic64_t done_cnt; u64 q_cmd_count; u32 dridx; + u32 tail_wi; u32 id; }; diff --git a/drivers/dma/amd/ptdma/ptdma-dmaengine.c b/drivers/dma/amd/ptdma/ptdma-dmaengine.c index 90ca02fd5f8f..1f020f90d886 100644 --- a/drivers/dma/amd/ptdma/ptdma-dmaengine.c +++ b/drivers/dma/amd/ptdma/ptdma-dmaengine.c @@ -462,6 +462,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 Jun 24 07:56:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13709126 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2046.outbound.protection.outlook.com [40.107.92.46]) (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 CF834487B3 for ; Mon, 24 Jun 2024 07:56:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.46 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719215809; cv=fail; b=ky8XNZYRo3SxM7g5ZuDaZaNsaGKm4iW7qM4qTkYbKkQ/ANkGynujpRDKjGJ8Ps3qoGQpX1A8eHZ52y3TXLlufAok7PZCm5gRpZITvQTXx42OkxwR09dZ1cYlbH6PaMseUTssyeHqui3ms8ZdM81spB4wyHUoiP6Ne71FawCC2Ig= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719215809; c=relaxed/simple; bh=b0aowZT5jOnuAEJvm1jtpE5bCOc6J1cqlzYDaL7Savc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cZjpnydlU0MkQo+7+xhWtsaBfM39P2EzefN4uPWArqkPFxp6V4Hk8lnGRTODT5u8MUWfBNAK0wA1QmZt5xro0GER10PHsgKxL4xdv9n/Bk6ld527VXTYWi+1EbxU2YN/vh1uUT7tl90BEgkiWXX9qGiP6piBXHfNsD7INTR5X5A= 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=VWa1cNAy; arc=fail smtp.client-ip=40.107.92.46 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="VWa1cNAy" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PEdy74wtM3FXvX+bwb/Ugs4PEW9X1IEwXODKR4JnPOoe87tWfRrPbCS1f/5YhHglP5x17bUdX4FT9y6J+ncTDMiWgvKbhvOkL8rtFOMWm5y6lyzxydntAqpcZaMsqv7GP0NZgSyziX/xyIn651npV3FXQWsEtMPeCfaEbBG3SN0anA+QLqsq68OSFVjQ+UoHDIHc98RNwtQ62pabHavYIOmpXFu0kR6lYAxsMyg/5fD5BtDBh+3d6y+i19Y1zSMubVlivfaZCiR0I6yzef2gvcU2mw3fJjKsag+Pr//6P3M3JHSKeViU1YhMHa1wAEV/6HX4Caxl1cEt0yrW5niTBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AfVuBQfuvb3Z3ecPjWRpAmSCUYkcHH5s6Ftzphrc9fM=; b=mFLIt5Ej6enjB/PQEO4MKKvdtd9uAEVqtI17gajs1Qvcrmg+xW1BoxJ3I5woV2jynuYpocaNVztxVrYmxNamnCDsvbDhrcYYmFDDfC69FoRVuLW3QAnuXlKP28sOlZigRyUYAwc87cW/7iQ0YRr3/eetm2XNG5e0/t1i4MgbEFgGENq2kq5OJMdxn98rWfJPGsOntPLyFQn7jjzmwKdN+s68dR7+VGE9V998W06pc74eC6qDJwOIFFOfTagLaf+rHC7a4J3okjwErEd4CKIlUwMoUtl1sk6NQ03x0lvm+iJATvuyAFpNqmEUMnhDnRC365JlcOosFzYj/UB0etHdzg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AfVuBQfuvb3Z3ecPjWRpAmSCUYkcHH5s6Ftzphrc9fM=; b=VWa1cNAy/Xool/gM3zlUTvTlKcozxRDdcC2WMIq6C/FPcSr8/54ofTWhduuKz4xtsKYLeRoBZBCYGGn28LOJCgHXXOvUvmrYdpkdJALtCMNaAYcKSZtBsuiKu+bCr+bu2qxTM6I4+SvimyYfu57f78ulTpCKcsdEUIfXZuga7uQ= Received: from CH0PR04CA0081.namprd04.prod.outlook.com (2603:10b6:610:74::26) by DM4PR12MB6376.namprd12.prod.outlook.com (2603:10b6:8:a0::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 24 Jun 2024 07:56:45 +0000 Received: from CH1PEPF0000AD77.namprd04.prod.outlook.com (2603:10b6:610:74:cafe::13) by CH0PR04CA0081.outlook.office365.com (2603:10b6:610:74::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.38 via Frontend Transport; Mon, 24 Jun 2024 07:56:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CH1PEPF0000AD77.mail.protection.outlook.com (10.167.244.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Mon, 24 Jun 2024 07:56:45 +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, 24 Jun 2024 02:56:42 -0500 From: Basavaraj Natikar To: , CC: , , , , Basavaraj Natikar Subject: [PATCH v3 6/7] dmaengine: ptdma: Extend ptdma-debugfs to support multi-queue Date: Mon, 24 Jun 2024 13:26:09 +0530 Message-ID: <20240624075610.1659502-7-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240624075610.1659502-1-Basavaraj.Natikar@amd.com> References: <20240624075610.1659502-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: CH1PEPF0000AD77:EE_|DM4PR12MB6376:EE_ X-MS-Office365-Filtering-Correlation-Id: 2ba12e48-6e7b-416f-22fc-08dc94233159 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|36860700010|1800799021|82310400023; X-Microsoft-Antispam-Message-Info: wVsJr2cKR+7X6f2Sb8CFO2GrnPryiIsP7s01Mo9C37NQ7Qra4m5IA4bO4COIVtOeCGMyo1aTpSU+LK/b4F65UiTx1TAmXs+k6/uOovXlw0/rQvXw/AA+ofu3ejCMrwpEDb7rKky7vifl5lI4JwZWrxiuKaUi0s8mJFi8H12Aupv4DMjUHw21eT9lZ2r0vCLzq7SmlLfyykq+jt4Y3KZo9fVj+uJllRcfcvdHXsDWI/o8g9RcXrWKRAgmw8iBE+CZmhhOzxBZjvTSupTcuvg/69AE88Iw8GrL4HQrhkCX5/UVq67//u45LB7T1qSj+17Fzbx1gV5bX6aEQfs0p2sr4Aune4wlusNrYXlC6cjCeqk17P2cmGx+VnwbHo0dOYoluBEQX9PnK62p0+jHWwy8x1P7CpuWCmFQZ7n2zKjh5NW42CUKRBkDP/J2vqrty1TLRze9WnFfpNIBC1zUMp9ITnj3G1GaZ+5ay7Vtsc5uxukhl0dqr5c2nnUqiTZF1FNsB2QUVg5pBhfGTVfA6Vd2vexiB+X2FzgJXa7yiRMBVAIJdNdDfOXC0e9WkA3CTM/srQfX1cUlIMQiFvzdc4X5sTEzCJyeJ9rHHdARdJzUI3g4IMKqPySQMFep/3C8fApEvsFYM8LPVHNavpfgfRSGNMCUPjQNSvx71HH6a1tCYMxxJmClNnRVACyriEP6K0joKmOUxvC/gUKosALZCgDxGVD6ZN1rAZ0CLpSOOuPWviDPBlvzbOja20cSaUjxKqty1Xgjh9/6pFwF5rbKIwSMW8OUqwDxTa7ZRwh1fikpkcjrI+340aluU6JZjMuqkzM5tJwXGvZXsasAeohkbvJh5nuShn6Xm1oXAMaC1kcox+GeD17u6r+gFhvxLA7OfhaXrRsW+o/DSng2HmxpK+2pW4Qb6Xu3wRIPYs2AFa26PEyxAvgixn4CF3jiA+NWzL7IBaUVLIIgDV/1Ql0Y7y3pODrEAE/qAVJ2LAg/y5SQbM3h96752eYgX/piA4AaCjHvwxri7OD7ni4hevcYYas1DZVVTkoxguXxwNE8o0FcToBVhygACwjpenjS9gFWZMl2kZAp/aiceFrmzeHzW6gUYuDFM93lv/EUw47kSbkIIVa+3t4ez2NV8MpQOglchZnyf1ykfVcFmE3zB2bVSDfhtkSHAeiBXX4p6kSW/OVOnRsLA49tqkhsdBxOyy+p2NNhIwQh1/r+G3/OYuE/NIKeu4Iu3tWF1Ws3t4vUSik4SNjJ7TkYqJQs25AxyoeHDGI6OxcSNroVN91z8yfHN4BAnjUdTraBOLTpgTAMfQOv+EUlCO1nWGasIF9uAvG0fVl1JIr7lP4ly94I5Mop7DqB7iCq6xes9Jey1zGmlXTf8+63pvtJeyqUpAWytuEcUoSK/TxYgPcY9XOBgwvMmyV4FQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230037)(376011)(36860700010)(1800799021)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2024 07:56:45.1678 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2ba12e48-6e7b-416f-22fc-08dc94233159 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: CH1PEPF0000AD77.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6376 To support multi-channel functionality with AE4DMA engine, extend the ptdma-debugfs with reusable components. Reviewed-by: Raju Rangoju Signed-off-by: Basavaraj Natikar --- drivers/dma/amd/ptdma/ptdma-debugfs.c | 76 +++++++++++++++++++-------- 1 file changed, 55 insertions(+), 21 deletions(-) diff --git a/drivers/dma/amd/ptdma/ptdma-debugfs.c b/drivers/dma/amd/ptdma/ptdma-debugfs.c index c8307d3044a3..9aa7a49ae5be 100644 --- a/drivers/dma/amd/ptdma/ptdma-debugfs.c +++ b/drivers/dma/amd/ptdma/ptdma-debugfs.c @@ -12,7 +12,7 @@ #include #include -#include "ptdma.h" +#include "../common/amd_dma.h" /* DebugFS helpers */ #define RI_VERSION_NUM 0x0000003F @@ -23,11 +23,19 @@ static int pt_debugfs_info_show(struct seq_file *s, void *p) { struct pt_device *pt = s->private; + struct ae4_device *ae4; unsigned int regval; seq_printf(s, "Device name: %s\n", dev_name(pt->dev)); - seq_printf(s, " # Queues: %d\n", 1); - seq_printf(s, " # Cmds: %d\n", pt->cmd_count); + + if (pt->ver == AE4_DMA_VERSION) { + ae4 = container_of(pt, struct ae4_device, pt); + seq_printf(s, " # Queues: %d\n", ae4->cmd_q_count); + seq_printf(s, " # Cmds per queue: %d\n", CMD_Q_LEN); + } else { + seq_printf(s, " # Queues: %d\n", 1); + seq_printf(s, " # Cmds: %d\n", pt->cmd_count); + } regval = ioread32(pt->io_regs + CMD_PT_VERSION); @@ -55,6 +63,7 @@ static int pt_debugfs_stats_show(struct seq_file *s, void *p) static int pt_debugfs_queue_show(struct seq_file *s, void *p) { struct pt_cmd_queue *cmd_q = s->private; + struct pt_device *pt; unsigned int regval; if (!cmd_q) @@ -62,18 +71,24 @@ static int pt_debugfs_queue_show(struct seq_file *s, void *p) seq_printf(s, " Pass-Thru: %ld\n", cmd_q->total_pt_ops); - regval = ioread32(cmd_q->reg_control + 0x000C); - - seq_puts(s, " Enabled Interrupts:"); - if (regval & INT_EMPTY_QUEUE) - seq_puts(s, " EMPTY"); - if (regval & INT_QUEUE_STOPPED) - seq_puts(s, " STOPPED"); - if (regval & INT_ERROR) - seq_puts(s, " ERROR"); - if (regval & INT_COMPLETION) - seq_puts(s, " COMPLETION"); - seq_puts(s, "\n"); + pt = cmd_q->pt; + if (pt->ver == AE4_DMA_VERSION) { + regval = readl(cmd_q->reg_control + 0x4); + seq_printf(s, " Enabled Interrupts:: status 0x%x\n", regval); + } else { + regval = ioread32(cmd_q->reg_control + 0x000C); + + seq_puts(s, " Enabled Interrupts:"); + if (regval & INT_EMPTY_QUEUE) + seq_puts(s, " EMPTY"); + if (regval & INT_QUEUE_STOPPED) + seq_puts(s, " STOPPED"); + if (regval & INT_ERROR) + seq_puts(s, " ERROR"); + if (regval & INT_COMPLETION) + seq_puts(s, " COMPLETION"); + seq_puts(s, "\n"); + } return 0; } @@ -84,8 +99,12 @@ DEFINE_SHOW_ATTRIBUTE(pt_debugfs_stats); void ptdma_debugfs_setup(struct pt_device *pt) { - struct pt_cmd_queue *cmd_q; struct dentry *debugfs_q_instance; + struct ae4_cmd_queue *ae4cmd_q; + struct pt_cmd_queue *cmd_q; + struct ae4_device *ae4; + char name[30]; + int i; if (!debugfs_initialized()) return; @@ -96,11 +115,26 @@ void ptdma_debugfs_setup(struct pt_device *pt) debugfs_create_file("stats", 0400, pt->dma_dev.dbg_dev_root, pt, &pt_debugfs_stats_fops); - cmd_q = &pt->cmd_q; - debugfs_q_instance = - debugfs_create_dir("q", pt->dma_dev.dbg_dev_root); + if (pt->ver == AE4_DMA_VERSION) { + ae4 = container_of(pt, struct ae4_device, pt); + for (i = 0; i < ae4->cmd_q_count; i++) { + ae4cmd_q = &ae4->ae4cmd_q[i]; + cmd_q = &ae4cmd_q->cmd_q; + + snprintf(name, 29, "q%d", ae4cmd_q->id); + + debugfs_q_instance = + debugfs_create_dir(name, pt->dma_dev.dbg_dev_root); - debugfs_create_file("stats", 0400, debugfs_q_instance, cmd_q, - &pt_debugfs_queue_fops); + debugfs_create_file("stats", 0400, debugfs_q_instance, cmd_q, + &pt_debugfs_queue_fops); + } + } else { + debugfs_q_instance = + debugfs_create_dir("q", pt->dma_dev.dbg_dev_root); + cmd_q = &pt->cmd_q; + debugfs_create_file("stats", 0400, debugfs_q_instance, cmd_q, + &pt_debugfs_queue_fops); + } } From patchwork Mon Jun 24 07:56:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13709127 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2045.outbound.protection.outlook.com [40.107.94.45]) (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 A2F94482DB for ; Mon, 24 Jun 2024 07:56:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719215811; cv=fail; b=pAJnWkgAzpN8uTYwAqkAhwgR++JFnt5hUsfnQJcbThihBJnSL90Ue6spTfANXRjkYQtygj4ElTdm4WSK0qQy9kEGtefaXMitYJ/si36T3fkYD8Cjbt8+44WkYLThF1PtZAFdXfmskGGU9VR/N1gc2D9z2qwWsynKjDi7mU9P/JY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719215811; c=relaxed/simple; bh=U+ZOHGEr/dbT6R7ZOSlgDEccaqkXdvxfjgvw/iD2I1E=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ijSPfffCoiTdoLeRXB4DyaiPb07yshuz9PGm1/7MiSuIvjRCWglzQEYVjB6HUsJSFilldj2IxE43Q4jUhHO7KSOrQImSqoz8ID8FXaBhuq888w/qkjS1Irw4XOmYYr6wZmJdl1BfUkPgGsJMnglbL2J69DUkSZ7yk44+KeE1V1c= 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=1htiDrMp; arc=fail smtp.client-ip=40.107.94.45 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="1htiDrMp" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J+vrW7TY103xghrY5i6ubpgjfJUd8TgVwby6VGjLILfzZLLy9ycVbr7xLTJbbfdSfD7x59UU0vxs+2EVWwvLbTGxaoOOcz0I0twZYtBnWK0YsAL/JHUMQn/MFJwure5T6eW96nd9DlOUTkd96t2Io3ZRv8HClxTZDuHGYUzGCTXDQgER7FOA7lDj4SC2U9kD57Zvhfs17cb04vf5cR1SWxius1FkTPCtHPFl6fybYfiNaHsflLc5vLKo6YhELxRkIc3V4xd1PkvBSBG1xcpq1DgXNELQb7y1O/HJA6l8N4w7+n7Ipj+jpcRpw6YbFbVfgCMQ61CMMQ0RajLhkgVcPg== 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=9a4ZmAWe0FAIZvy8V82gK3+uDeoTLA2HT40oz4xzMHg=; b=ESMyStpotVT+SPYaKSaUFZcbFcjnzRQAL/vzxDPxVfPCsZEZiUNeYHDIo6FJA/vYxasHQyIwUkGc9GgpnUfcuEV5nJmiKeAm7Qao8H1lLvKu0BqZAn1tGnI1Gb/EJeTw+laM9OPCIZi48rqeLAt+xrflZKkCuP3t6M5Lasrxbafph416MkZdo/o6izuA8hRwI/Yr19AcZGUnVVzEqB5v23x1JKQsyU+YaytqDFBgAF/PuPnM3lL1t5e5RqalOJZXfdMWxOG83XuG6gzmQS4ojuN+rwo3AOUqcQWFfYO7ZhJ3BddJDa3ax1WotaPlVIJlzpNs9b+TY0ORemNvoRlSXA== 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=9a4ZmAWe0FAIZvy8V82gK3+uDeoTLA2HT40oz4xzMHg=; b=1htiDrMptfExGvluIc/fjqDQpjyjqcbb5ptVR/cWkUtmadyjlut8i19bodDvS3e3hkkwBj/PNbHhpENTIuohwCYaNsFD12cTZXmmrKPgyfKU6RBfsgauWE35c+4tzzoqqQJdy+1UexziAMpkvn5twsTTm/fWUBiAOKqMuOlYqQI= Received: from CH0PR03CA0373.namprd03.prod.outlook.com (2603:10b6:610:119::7) by MN6PR12MB8542.namprd12.prod.outlook.com (2603:10b6:208:477::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.28; Mon, 24 Jun 2024 07:56:47 +0000 Received: from CH1PEPF0000AD76.namprd04.prod.outlook.com (2603:10b6:610:119:cafe::50) by CH0PR03CA0373.outlook.office365.com (2603:10b6:610:119::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.38 via Frontend Transport; Mon, 24 Jun 2024 07:56:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CH1PEPF0000AD76.mail.protection.outlook.com (10.167.244.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Mon, 24 Jun 2024 07:56:47 +0000 Received: from jatayu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 24 Jun 2024 02:56:44 -0500 From: Basavaraj Natikar To: , CC: , , , , Basavaraj Natikar Subject: [PATCH v3 7/7] dmaengine: ae4dma: Register debugfs using ptdma_debugfs_setup Date: Mon, 24 Jun 2024 13:26:10 +0530 Message-ID: <20240624075610.1659502-8-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240624075610.1659502-1-Basavaraj.Natikar@amd.com> References: <20240624075610.1659502-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: CH1PEPF0000AD76:EE_|MN6PR12MB8542:EE_ X-MS-Office365-Filtering-Correlation-Id: a125aa63-9f4d-4f47-8058-08dc942332c6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|82310400023|36860700010|1800799021; X-Microsoft-Antispam-Message-Info: LKXPtblgtrs3IWuleJ5mqZrz09d5lxI1caEurgK45GjZkLVmYWFeHQzYzl27dYNIopdrCZlYjkscbJyjcDOZ1frjw3gBcRbmfhLCIJD48s5O0VEiYKFpJXinbz0C6/FNQArWzjd2osuevlbF62zNi9HWLhZ2+5X5FGykdsevaW/LCiRRvadVmwX6BqY5Wv5NWqmpD4Z5JQmQHOCp+Wv6I3sbS24fNhTw78mzv2YOIy+GJCCi4KW8LUYKedR799pQ99RFR933n3HZQwNhNmfEsZdeAmFrbiwz55zvZlQBSXNEP1cQmxQNTdQ2ao2rHM0jcK4Eq6x57Pzat9F+LUh3uOoWISbNU0r8UziVteAxlP60X+ZSgri656PBWycNbh8Qy1H0r1h9pOzA0h52ZEvBRHRT5ciYDwP1Lq9DKBmNlOxoSWxwQJGp2NqdCYiIvS7qR2DncO/FRAxf5Ru8SuUHfrm8FUiJ41YQ5l8l9KeCItbn2NqaXbrWHkmpLRbUU87dFTmZ9VCplgKVM5WfsfiSFFgwEPvuvyj15INUQYLeFmIfvXy2TH5ptMxraYDrawmUqoYMz/C3+j4dGa3xXXW38CFcdVeZW4OTbvGkRD/b5GX0nyQo3Lyo2K3nUEmj4N8SP89hJQj+U7IDp/cAlcvru6pSV5JoN1NRehEQ0C+VZXenoQiqyb4+7oUoeEJQCPNPN5CIjZEwk9GiYVG9sHc4yOyOiYnhAcNsVBvPv97g9FXQbl3vJzw7dyTAcKLl9iNpc4ELie85+xbeOaNczA5U3nB3Ame0hYlQsN50yOlKpzB+hXr/BP5EkSfmC62dPGl1EezIGXB6+fIw2E+537OUNUWq5TAN3emY0wP3FW2Ex1sbYiWOJujGmQx5Yd5hWBxwKoP+FGe8t97NlkGaLXdwV+Zk67SDEtqSlRb9lRZr3g29i4J5UqrNe9naEsiK3/i4Qr64cR9MQfnvIkZTZGBuFtj9MkRK84hM04gV/q807K5jUmvj/n9r6Qh0p/HndAq1Ykmx3bJyUvzPk2zg9fLzNG38LOIFJFomzCJnxBwLkQN8t0NUNA0fCCIF9hBs69UI9K4SqoqQIp61gdebnyItKd2pgfAgtQrYz+mvZW8hkEITHTOK6XKVHAg8oqIDBLgf5vlw8TrL8M5m05njjc7gmg2RCOAPv02Cm44jGJas4VU1y51BX12ifR6p16j69lOy8kjg1vpLeHPsxaZ4ta3H1I31i5RbQYsosMeCmSh81PuP4W3Rkh724gjkTl10MC28IuSitcPvC6nb9jy9BNJgftqCeHgGXWczqON+KuImYjk8sUzcvyLkHCRoN6MOMHUaFjqBBTmMOOUTB50mO0Ex5FaKBy4WvJpP6Gm05zLpqsSayWC08YRJXyPgZvcbwSSn+gPwfH5jjPZiDx97qZTvSw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230037)(376011)(82310400023)(36860700010)(1800799021);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2024 07:56:47.5622 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a125aa63-9f4d-4f47-8058-08dc942332c6 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: CH1PEPF0000AD76.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN6PR12MB8542 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 9ab74fc227cb..e472bd99e970 100644 --- a/drivers/dma/amd/ae4dma/ae4dma-dev.c +++ b/drivers/dma/amd/ae4dma/ae4dma-dev.c @@ -260,6 +260,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 9aa7a49ae5be..f2973761cca4 100644 --- a/drivers/dma/amd/ptdma/ptdma-debugfs.c +++ b/drivers/dma/amd/ptdma/ptdma-debugfs.c @@ -138,3 +138,4 @@ void ptdma_debugfs_setup(struct pt_device *pt) &pt_debugfs_queue_fops); } } +EXPORT_SYMBOL_GPL(ptdma_debugfs_setup);