From patchwork Mon Jul 1 16:42:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13718377 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2073.outbound.protection.outlook.com [40.107.92.73]) (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 0800016DC35 for ; Mon, 1 Jul 2024 16:43:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719852182; cv=fail; b=EDU8Dmqp2ACEH8RtdGdl+Ke3cKkPd4MwzObk9C7jfi4AAP2qoS341lPref93/8HolxWsM8EysP/bhYFhRGOCXpL0T7N2C6dM68uJeBRBv3IdGRgLqVnh77/6433CCupA/bNPVfxA5zEt0b0CLSEoIG2AeUDUL05OeNz+sZ5SKqA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719852182; c=relaxed/simple; bh=5025hjnXenPw7l2P2fk/phiAiOvx1EEWjkpH4kPaoZM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=upST0QfmLrihzJ4j4bYimcf8vSYtPiuK6hIxH9GfgVjzcRlsYkpjUfhAllljEei/h4OJAtpqyjeu09PmEiU1kEZ1lkEImdzZyRv4KvODOguBMBICwt/B45EHLxLVLdo8dcPi+WZlZS/HQklhjPcfCWWi4i82bxRo5uNUed9SHb0= 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=lkTQ6bNc; arc=fail smtp.client-ip=40.107.92.73 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="lkTQ6bNc" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BKuXXWJmvxIXyEqQiaMypa0xqgmQzrPymq5Rq7LoYANg/DXrBPDxiwv1i53Uf6NtUi9DNeLZbVnWixP/GyK1zXfocsqtJSLBIitHY8aQLcUtmtOBukpf8Cen0zMSMMpZfTzsP7+OBULj1qFvqPH6a5ButH9pWzybKkJafhi57e72SDWjNQAKijCZ9e9qbsMmsichVG7qvG0sMfY80eVUBD7bhFmhIi591NAr/LSL6Y2Qip2LPnLmOLRYExItyKDjPbTknHpS/twtTaVeZWYwkJhMPtufxKaIlpTOsANK2RDbXgSZlzYDr70nJ5a6ebsJ5RJ5afaBhf4pfd95SHAjzQ== 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=LOUE3h+2rIK5NUQFW8GSRGnqVITrHEKzR776mRW7q4s=; b=WLcXpZFYhcCPZs5FcFp1nob5aHmRnFwB2VJ7raTnyRQs4lwOQBu3YZF5GHQINDDplESOEGwexqfKLUNjV3p6jOSLfWqkltPVIPGBqkIyXxf36a+HjoLutBibS6HEEK7QWEIF7JuPRvV9ANQZ9XTVyv0VrvRY8paUMxFC9HNiSlm6qBDaq+3vtqLhWBRuG3SZ6yj2HAfiWAc7SkYTwQjLH2+W/acD0lq2bwrLpxGMz9Q3eHhqIDDBVS0agEfpPBX/Z1pi+jb8UJnKvuE63eNtbVMaTJAJLS3+pPj9qSvkJRhwlaj9tVU0qz8fjNMKv93cKINFUsv2vvuWBRJ+BBztcg== 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=LOUE3h+2rIK5NUQFW8GSRGnqVITrHEKzR776mRW7q4s=; b=lkTQ6bNcxXv38pnSqh2BzpJLQphlhppANjUlFgsq0p40qF0qNiEUOKfQ3RxtNsNkGwc/dxISHo2Y6JvixRWQDMaf0w/qPZd6gZjogTDjN7VgcRXPJyHEQfhUcBu6h55Z7GtI8tucffI89ch3CB9pVYmI9Nt1FgbIz3+3MxRKXY8= Received: from SJ0PR03CA0033.namprd03.prod.outlook.com (2603:10b6:a03:33e::8) by IA1PR12MB6138.namprd12.prod.outlook.com (2603:10b6:208:3ea::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.32; Mon, 1 Jul 2024 16:42:57 +0000 Received: from SJ5PEPF000001D5.namprd05.prod.outlook.com (2603:10b6:a03:33e:cafe::d9) by SJ0PR03CA0033.outlook.office365.com (2603:10b6:a03:33e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.32 via Frontend Transport; Mon, 1 Jul 2024 16:42:57 +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 SJ5PEPF000001D5.mail.protection.outlook.com (10.167.242.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7741.18 via Frontend Transport; Mon, 1 Jul 2024 16:42:57 +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, 1 Jul 2024 11:42:54 -0500 From: Basavaraj Natikar To: , CC: , , , , Basavaraj Natikar Subject: [PATCH v4 1/7] dmaengine: Move AMD DMA driver to separate directory Date: Mon, 1 Jul 2024 22:12:27 +0530 Message-ID: <20240701164233.2563221-2-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240701164233.2563221-1-Basavaraj.Natikar@amd.com> References: <20240701164233.2563221-1-Basavaraj.Natikar@amd.com> Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D5:EE_|IA1PR12MB6138:EE_ X-MS-Office365-Filtering-Correlation-Id: 5ed600bc-f178-4dd2-944e-08dc99ecdcea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: PdNPoCbpXu45VX6HUBKsyIulzoBXLWDSyPg1SjgrI8poW7cKCtrTbQ8V+G33KpNV09C47PV5kadwBCenJXQ9oA04G73/v8qMvTSPW5IwB7Z56ILIMdPKROS7DOWq9TNUKbs/w5j/LeoCufZhi/lQYW2YXXLT1XofgFQj17tdpkTGGXv/KBIsSnYA+5iCpxqqK30nD9jfRnF5+w5XXOhC+5cNQeIYIIeFzKrr6d7iWwscCsqzW/xd9P8JSR+LIJmNgf+4mrcBoafQVDWv/mW9IIRhflhWppZM2AktrU3vngqYJ/O7W5w7vsjexy71NsApWQLNZ3GyFMBbtF9EuU2O8qZixGESXq/wAMj40rb3usnDK0Z50I77Y3AtOWpd/t4hhORYNaeSzRIhuyN/tha+1/OwoVkCvyFmhCDQwcsVe6KJk9dOnARDgk6onxR4qzue4w7q3tza2O0QBSDob2T3vY2YXk+jl7bEIXwPrTJHlKDUvAA/NqOHhAqzlqImITBgkv59IlCg2xhs6sHMVGfbXRfPEbVuSvH21RcYwgW7zmt9gMyiZAMrvDr3lPBrKZG8iB/yoNSoRsI50QZuRPwFx6hNfIKSYD6StHjR9x3O+z9566rByopbYP4Um7iXs2Uxo/D29ByZ8/SGzqRwssqFZYughBhzGYM9yFujW/rj5hFmQio/cXfzMJuOEouJW4v9vOa7ebD/MemMPKSdS/3tONLAAamqmYTN0k/shqYAe+DIbWcLhyh+KkzSnlWzhSNFYHakfqZvOHZ+Zwc8FDQ1jDO8WhfLKsjFNnjk5bgF0CtRsLaoeDwALPk+i5rASFe7Ri27lnvYe/8+OtY0GKiHXg8WqRv3T4OFa1L7ykc5nSdeBGMUZ68mpt2mCfUkQuhLtgAL2aI3rPcZVkbaZXWPij6nTrn5yFwikb2C82OopcFxDlQGFXublH6okaXT20V4oMAr781MiYqFHnlx6rvrrE6N/5EiHZTvI1jvpsqlfEWH4lh9wI1KNUZfZbTK6SLhTvGLuiAD6AJ37looaLBL2pCUubWGWWQv/oef//VRrEfnJjGmKi3Uvl8V+N5Fquud9QxFqFi9Rf/ji4dYWXjmSqh1TR6OYz7zGet/QNnHimhmoCCInduxQ8s81iZoWF9/tFXfYtzaZogS68h58jICC9gAaAK+VIukC8T6oK6QpLFQ0vKSn6k1Wi5dBk25L22sn9MOaIhKl+MxEdLmw7OpPpDmZxt5fB3GoRqTRaL74iqbLsKk4sA+ZUGYgyYwvBnCywv/YTXy7OWUbijEgTfRZ7hLQc4tYldUQF+n1aiENtaN5bnSVDtlWcOIQkPEvrcs570HR+fjV8hSwuNWkdAS40Vsyup5oqUBQ8pHAAWxVH44o7ErEk0CGszVavPItgvUOOlbR5/UvouDOa4UL4UJ4l+hsEb+u3WVjs2VHN0hUFuRKtdYpcHN7WEVJt/X47Y2 X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(82310400026)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2024 16:42:57.6054 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5ed600bc-f178-4dd2-944e-08dc99ecdcea 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: SJ5PEPF000001D5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6138 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 3c4fdf74a3f9..c00558c0150d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1113,7 +1113,7 @@ AMD PTDMA DRIVER M: Basavaraj Natikar L: dmaengine@vger.kernel.org S: Maintained -F: drivers/dma/ptdma/ +F: drivers/dma/amd/ptdma/ AMD SEATTLE DEVICE TREE SUPPORT M: Suravee Suthikulpanit diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index 9fc99cfbef08..e4e424ebdac4 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig @@ -752,8 +752,6 @@ source "drivers/dma/bestcomm/Kconfig" source "drivers/dma/mediatek/Kconfig" -source "drivers/dma/ptdma/Kconfig" - source "drivers/dma/qcom/Kconfig" source "drivers/dma/dw/Kconfig" @@ -772,6 +770,8 @@ source "drivers/dma/fsl-dpaa2-qdma/Kconfig" source "drivers/dma/lgm/Kconfig" +source "drivers/dma/amd/Kconfig" + # clients comment "DMA Clients" depends on DMA_ENGINE diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile index 802ca916f05f..c59948a0dc7c 100644 --- a/drivers/dma/Makefile +++ b/drivers/dma/Makefile @@ -16,7 +16,7 @@ obj-$(CONFIG_DMATEST) += dmatest.o obj-$(CONFIG_ALTERA_MSGDMA) += altera-msgdma.o obj-$(CONFIG_AMBA_PL08X) += amba-pl08x.o obj-$(CONFIG_AMCC_PPC440SPE_ADMA) += ppc4xx/ -obj-$(CONFIG_AMD_PTDMA) += ptdma/ +obj-y += amd/ obj-$(CONFIG_APPLE_ADMAC) += apple-admac.o obj-$(CONFIG_AT_HDMAC) += at_hdmac.o obj-$(CONFIG_AT_XDMAC) += at_xdmac.o diff --git a/drivers/dma/amd/Kconfig b/drivers/dma/amd/Kconfig new file mode 100644 index 000000000000..8246b463bcf7 --- /dev/null +++ b/drivers/dma/amd/Kconfig @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# AMD DMA Drivers + +source "drivers/dma/amd/ptdma/Kconfig" diff --git a/drivers/dma/amd/Makefile b/drivers/dma/amd/Makefile new file mode 100644 index 000000000000..dd7257ba7e06 --- /dev/null +++ b/drivers/dma/amd/Makefile @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# AMD DMA drivers +# + +obj-$(CONFIG_AMD_PTDMA) += ptdma/ diff --git a/drivers/dma/ptdma/Kconfig b/drivers/dma/amd/ptdma/Kconfig similarity index 100% rename from drivers/dma/ptdma/Kconfig rename to drivers/dma/amd/ptdma/Kconfig diff --git a/drivers/dma/ptdma/Makefile b/drivers/dma/amd/ptdma/Makefile similarity index 100% rename from drivers/dma/ptdma/Makefile rename to drivers/dma/amd/ptdma/Makefile diff --git a/drivers/dma/ptdma/ptdma-debugfs.c b/drivers/dma/amd/ptdma/ptdma-debugfs.c similarity index 100% rename from drivers/dma/ptdma/ptdma-debugfs.c rename to drivers/dma/amd/ptdma/ptdma-debugfs.c diff --git a/drivers/dma/ptdma/ptdma-dev.c b/drivers/dma/amd/ptdma/ptdma-dev.c similarity index 100% rename from drivers/dma/ptdma/ptdma-dev.c rename to drivers/dma/amd/ptdma/ptdma-dev.c diff --git a/drivers/dma/ptdma/ptdma-dmaengine.c b/drivers/dma/amd/ptdma/ptdma-dmaengine.c similarity index 99% rename from drivers/dma/ptdma/ptdma-dmaengine.c rename to drivers/dma/amd/ptdma/ptdma-dmaengine.c index f79240734807..a2e7c2cec15e 100644 --- a/drivers/dma/ptdma/ptdma-dmaengine.c +++ b/drivers/dma/amd/ptdma/ptdma-dmaengine.c @@ -10,8 +10,7 @@ */ #include "ptdma.h" -#include "../dmaengine.h" -#include "../virt-dma.h" +#include "../../dmaengine.h" static inline struct pt_dma_chan *to_pt_chan(struct dma_chan *dma_chan) { diff --git a/drivers/dma/ptdma/ptdma-pci.c b/drivers/dma/amd/ptdma/ptdma-pci.c similarity index 100% rename from drivers/dma/ptdma/ptdma-pci.c rename to drivers/dma/amd/ptdma/ptdma-pci.c diff --git a/drivers/dma/ptdma/ptdma.h b/drivers/dma/amd/ptdma/ptdma.h similarity index 99% rename from drivers/dma/ptdma/ptdma.h rename to drivers/dma/amd/ptdma/ptdma.h index 21b4bf895200..2690a32fc7cb 100644 --- a/drivers/dma/ptdma/ptdma.h +++ b/drivers/dma/amd/ptdma/ptdma.h @@ -22,7 +22,7 @@ #include #include -#include "../virt-dma.h" +#include "../../virt-dma.h" #define MAX_PT_NAME_LEN 16 #define MAX_DMAPOOL_NAME_LEN 32 From patchwork Mon Jul 1 16:42:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13718378 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2059.outbound.protection.outlook.com [40.107.237.59]) (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 2745916DC24 for ; Mon, 1 Jul 2024 16:43:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719852188; cv=fail; b=GeS1xsTi83DHW9nx649TbgOiGxhZvFsRaNTt4ENTRr9MMSnxK42+jfx16QW0WMEb3BEzrLfwYmvYRDAqLTttNhuf9inVSnnQmv8TatipTa9+8yUOr5+jQUEdPQbK4VR+z/rAZVhxIHACFdLruQcV/iY+LTTCNHVHct1epnwBhBo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719852188; c=relaxed/simple; bh=nbJmMnNli3xPKDCu2r9Q6VUrCUOp6KAaOEWzIM3j7/E=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qZMbpijS4+jTZk8sIRplfk0DwwKiNieDbgmbZlQqo6Oj0MZX42bYyt1OTZlnbin4lrq/UZQf3TBn0BkvLIt0WWN7fqtJG15CKi6Ol/FpXxMte3fYem1GHmpg423/qiQk1bXTMM1z5lrPe0jluGouA84YdgDhfTimod7UT5+y3D8= 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=tN3GqtMF; arc=fail smtp.client-ip=40.107.237.59 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="tN3GqtMF" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SdlVXZvDIrjEpwa34magakM5b2soGOIRWiV8wY7/AJWe0RJBPJUCLnAgRuiOPdv4eKs08IIao+PmoKnoj2q/qHyzebN1Ifk2ajf8YvSrAv2HGvgMd07NetgktWb9DCmmrV3xjLGch2tMpwLem83uRRR+iacWy8i/pV9T8hosa/XGk1kkZqxHle+0ndBBnGrShYVKxNypYrJgTxE3KPU6c1QqV71G/sZFypDwbVF9m1kEvPbxm0uYqZtJSygmZClMUK0e0D6imNq/NO2WCozNmZKM9oSkDEYnLCdaUjdqQRZGr79XzHSFbt+WvkYmbHJX1Ctw75jd15zwJjq3UHikRQ== 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=nRHqh1BaWzlcBRUOL07oa6otrlUXh15GoarxE7TtQiA=; b=hy3NMSzBapn4rcMMPI8DCTWAouYuTEoYADQFWRkKdegcVcg6OfoBf+FWp/fhLIWIwny+BoTfhhfFNEj6V+iBhsbAWQZXc5/jnj2SflFG6o42cB+BCMO4porhNSJwvS5Z+Vm96rVDSYQZx4Uu8m13rL9M+TkKuPGAKE8kc8epEUhcvUJMHI9gZ6Yd0+r3kuZTAslLpNZ5EIJgbkvMUxZX1Vn/Z1HR+Ge5AyTHiiJVj37GfxdQ7jVVPvw/Osi7h5RhG7knewVaKHx2GMylo1DL5T5I3onmKJXP3OS+WVgE4DBFmK00VYE1461N9Ttbi4m2vLnlynlklK+IIheg+nRopQ== 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=nRHqh1BaWzlcBRUOL07oa6otrlUXh15GoarxE7TtQiA=; b=tN3GqtMFUP6JXzqJ7dxEYixjGqxUaMbMRr0OxqgEXDFppuBiwkN4G03UGQm4fTpfyMv3Fd1Yru3v7fMWXYJbRMXFNDv2M6zFljZzlmORqv+dvpUyXfpeIy3x/B218Dus9gDy2chsF4GgGVTgYXklv/Nj8ce6WTWq7v3njvN4UN4= Received: from SJ0PR03CA0035.namprd03.prod.outlook.com (2603:10b6:a03:33e::10) by SA1PR12MB6704.namprd12.prod.outlook.com (2603:10b6:806:254::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.32; Mon, 1 Jul 2024 16:43:00 +0000 Received: from SJ5PEPF000001D5.namprd05.prod.outlook.com (2603:10b6:a03:33e:cafe::b4) by SJ0PR03CA0035.outlook.office365.com (2603:10b6:a03:33e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.29 via Frontend Transport; Mon, 1 Jul 2024 16:43:00 +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 SJ5PEPF000001D5.mail.protection.outlook.com (10.167.242.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7741.18 via Frontend Transport; Mon, 1 Jul 2024 16:43:00 +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, 1 Jul 2024 11:42:57 -0500 From: Basavaraj Natikar To: , CC: , , , , Basavaraj Natikar Subject: [PATCH v4 2/7] dmaengine: ae4dma: Add AMD ae4dma controller driver Date: Mon, 1 Jul 2024 22:12:28 +0530 Message-ID: <20240701164233.2563221-3-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240701164233.2563221-1-Basavaraj.Natikar@amd.com> References: <20240701164233.2563221-1-Basavaraj.Natikar@amd.com> Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D5:EE_|SA1PR12MB6704:EE_ X-MS-Office365-Filtering-Correlation-Id: 581e9361-39b0-4a6f-6c95-08dc99ecde89 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|82310400026|376014; X-Microsoft-Antispam-Message-Info: dCHZUl+rjTVTPSvMLuBQPkG1XL7IT9AP5BHUZD3hTX3sCHe9s9bxikmUtQDHlh41W9Tv2ewms+MVTUBZetYNiVFrOmvCsE9NnIjm8X5ucQ6jzkGZOwySvKe/h/2zkIOtWWXMM54euqVesq+ablhVq14X86CK4h01b8ivqxnBv9xUpif1X66qwpugGlq7VYzNsFUtR2TiErsOph4m+B50m1a4vSJPlINQEfSE9/YN8ftYHvtela6EHtstT9x4Tax7iOOVjgZoIi+uXxQymYqVeX0xxEDA7YTzPTb99IAl/sBoKFvNbpnW09jt1U07uneXdkBxzI3XKswPb9dbZCDQYavbg6N79JVOqEKhYGZmhzpNm7GQ9H7eHo+TZP5WE+7DR9Z1esK/XMGX7bzlXxwHTdkqOB31KomD90r4D/7VptOMGOZTTGkDidnq8L8R33LVrfkGyfppQc47/11Q9jaS845Iz8HkxBjn4tmE3Ul1BEjqF0ghoVy+TmxJS2b24xw+3Sf2HIkoHfHCv3Fp9objRCWgytrKwlBbH4efRWaNeMJC4nVQ5X75ki3gdTWMgsSLkQgG29Q4jDsxG0DqyLkdy1ty3mbBm0JLj3uNCNBtvmo05whvGeHqh3mS6rUJ561MZc6uUKM1NP19/5fYVL13WUeAac7w5bcepPZ60d19S0Vi2pOn1j6GpEvnvzSPrauriTIXfrFEB4aIEE5a1a87u524vKeRzAWiN2E+cpwZ8u9JXrXnbjgEV5GCWlSK3GMiMCOgVxhn0Hkfh/rmdcPFTNKMgxUwkDl1ovL0QY3VRfVMedWyjFQDpfJULLpHdiZtOwl/pjM/DaZNTBWcviRc+MBLaagFqZYyJhZSAZGD3l8bBYw76n8nTywuHhzTYqdpK0nwsJtnZvkbiZt39lI5wGXwI0nxnBhup/v9xZV7CRbK8k6mGy8Uzy65pVSEqNG/g9j2T91X2Fh0iK6Np3aUGUp/XRdIUWG2FX0oqRR7J2aNwnlRVo8/MHRXTjS1d79YkJe3QumbAk468Ls9vJqWHZlHiiOTABm4brEjQ0yHFWwz1j+Od/GI+ZbOaREuAtm3ceNBaYidOgptka3E+V/UM07SpgqfEE+B7FD9fcTvlkkVA5P9NY+U+jdD20O2OCFW4InY9uWHWXB0Ru3FsM9IKesg1+Yj9YWvXUHzKEEiQVLQdOzobujswnrBacCb7CaW9Vus8yhAsrStVsNnUVUZJa1HZ2nfaYZOkchGXyTVLPNUwABzG/mHui/6zuDHgMp90YTdEPpT1CUNvc20Y6DY7ceB/jOTx+bjT2YeQeBYAojPR1TKIc6dhGzuiBIDMOze4MNNk0i01qWXMFvYFz0LV0uaTKEUMncP2v+SdyV4CU/eHp5BaEe1OHgpApB5IsMegffRpKNxWI61sUPAj1rKyWxs+JoqYtnwhwiJKi8zfJ9TFDt9EwkpGe8ZdDf//Ci2 X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(82310400026)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2024 16:43:00.3241 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 581e9361-39b0-4a6f-6c95-08dc99ecde89 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: SJ5PEPF000001D5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6704 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 Reviewed-by: Philipp Stanner --- MAINTAINERS | 6 + drivers/dma/amd/Kconfig | 1 + drivers/dma/amd/Makefile | 1 + drivers/dma/amd/ae4dma/Kconfig | 14 ++ drivers/dma/amd/ae4dma/Makefile | 10 ++ drivers/dma/amd/ae4dma/ae4dma-dev.c | 198 ++++++++++++++++++++++++++++ drivers/dma/amd/ae4dma/ae4dma-pci.c | 157 ++++++++++++++++++++++ drivers/dma/amd/ae4dma/ae4dma.h | 85 ++++++++++++ drivers/dma/amd/common/amd_dma.h | 26 ++++ 9 files changed, 498 insertions(+) create mode 100644 drivers/dma/amd/ae4dma/Kconfig create mode 100644 drivers/dma/amd/ae4dma/Makefile create mode 100644 drivers/dma/amd/ae4dma/ae4dma-dev.c create mode 100644 drivers/dma/amd/ae4dma/ae4dma-pci.c create mode 100644 drivers/dma/amd/ae4dma/ae4dma.h create mode 100644 drivers/dma/amd/common/amd_dma.h diff --git a/MAINTAINERS b/MAINTAINERS index c00558c0150d..3d4c2c21a503 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -947,6 +947,12 @@ L: linux-edac@vger.kernel.org S: Supported F: drivers/ras/amd/atl/* +AMD AE4DMA DRIVER +M: Basavaraj Natikar +L: dmaengine@vger.kernel.org +S: Maintained +F: drivers/dma/amd/ae4dma/ + AMD AXI W1 DRIVER M: Kris Chaplin R: Thomas Delev diff --git a/drivers/dma/amd/Kconfig b/drivers/dma/amd/Kconfig index 8246b463bcf7..8c25a3ed6b94 100644 --- a/drivers/dma/amd/Kconfig +++ b/drivers/dma/amd/Kconfig @@ -3,3 +3,4 @@ # AMD DMA Drivers source "drivers/dma/amd/ptdma/Kconfig" +source "drivers/dma/amd/ae4dma/Kconfig" diff --git a/drivers/dma/amd/Makefile b/drivers/dma/amd/Makefile index dd7257ba7e06..8049b06a9ff5 100644 --- a/drivers/dma/amd/Makefile +++ b/drivers/dma/amd/Makefile @@ -4,3 +4,4 @@ # obj-$(CONFIG_AMD_PTDMA) += ptdma/ +obj-$(CONFIG_AMD_AE4DMA) += ae4dma/ diff --git a/drivers/dma/amd/ae4dma/Kconfig b/drivers/dma/amd/ae4dma/Kconfig new file mode 100644 index 000000000000..ea8a7fe68df5 --- /dev/null +++ b/drivers/dma/amd/ae4dma/Kconfig @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: GPL-2.0 +config AMD_AE4DMA + tristate "AMD AE4DMA Engine" + depends on (X86_64 || COMPILE_TEST) && PCI + depends on AMD_PTDMA + select DMA_ENGINE + select DMA_VIRTUAL_CHANNELS + help + Enable support for the AMD AE4DMA controller. This controller + provides DMA capabilities to perform high bandwidth memory to + memory and IO copy operations. It performs DMA transfer through + queue-based descriptor management. This DMA controller is intended + to be used with AMD Non-Transparent Bridge devices and not for + general purpose peripheral DMA. diff --git a/drivers/dma/amd/ae4dma/Makefile b/drivers/dma/amd/ae4dma/Makefile new file mode 100644 index 000000000000..e918f85a80ec --- /dev/null +++ b/drivers/dma/amd/ae4dma/Makefile @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# AMD AE4DMA driver +# + +obj-$(CONFIG_AMD_AE4DMA) += ae4dma.o + +ae4dma-objs := ae4dma-dev.o + +ae4dma-$(CONFIG_PCI) += ae4dma-pci.o diff --git a/drivers/dma/amd/ae4dma/ae4dma-dev.c b/drivers/dma/amd/ae4dma/ae4dma-dev.c new file mode 100644 index 000000000000..c38464b96fc6 --- /dev/null +++ b/drivers/dma/amd/ae4dma/ae4dma-dev.c @@ -0,0 +1,198 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * AMD AE4DMA driver + * + * Copyright (c) 2024, Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * Author: Basavaraj Natikar + */ + +#include "ae4dma.h" + +static unsigned int max_hw_q = 1; +module_param(max_hw_q, uint, 0444); +MODULE_PARM_DESC(max_hw_q, "max hw queues supported by engine (any non-zero value, default: 1)"); + +static char *ae4_error_codes[] = { + "", + "ERR 01: INVALID HEADER DW0", + "ERR 02: INVALID STATUS", + "ERR 03: INVALID LENGTH - 4 BYTE ALIGNMENT", + "ERR 04: INVALID SRC ADDR - 4 BYTE ALIGNMENT", + "ERR 05: INVALID DST ADDR - 4 BYTE ALIGNMENT", + "ERR 06: INVALID ALIGNMENT", + "ERR 07: INVALID DESCRIPTOR", +}; + +static void ae4_log_error(struct pt_device *d, int e) +{ + /* ERR 01 - 07 represents Invalid AE4 errors */ + if (e <= 7) + dev_info(d->dev, "AE4DMA error: %s (0x%x)\n", ae4_error_codes[e], e); + /* ERR 08 - 15 represents Invalid Descriptor errors */ + else if (e > 7 && e <= 15) + dev_info(d->dev, "AE4DMA error: %s (0x%x)\n", "INVALID DESCRIPTOR", e); + /* ERR 16 - 31 represents Firmware errors */ + else if (e > 15 && e <= 31) + dev_info(d->dev, "AE4DMA error: %s (0x%x)\n", "FIRMWARE ERROR", e); + /* ERR 32 - 63 represents Fatal errors */ + else if (e > 31 && e <= 63) + dev_info(d->dev, "AE4DMA error: %s (0x%x)\n", "FATAL ERROR", e); + /* ERR 64 - 255 represents PTE errors */ + else if (e > 63 && e <= 255) + dev_info(d->dev, "AE4DMA error: %s (0x%x)\n", "PTE ERROR", e); + else + dev_info(d->dev, "Unknown AE4DMA error"); +} + +static void ae4_check_status_error(struct ae4_cmd_queue *ae4cmd_q, int idx) +{ + struct pt_cmd_queue *cmd_q = &ae4cmd_q->cmd_q; + struct ae4dma_desc desc; + u8 status; + + memcpy(&desc, &cmd_q->qbase[idx], sizeof(struct ae4dma_desc)); + status = desc.dw1.status; + if (status && status != AE4_DESC_COMPLETED) { + cmd_q->cmd_error = desc.dw1.err_code; + if (cmd_q->cmd_error) + ae4_log_error(cmd_q->pt, cmd_q->cmd_error); + } +} + +static void ae4_pending_work(struct work_struct *work) +{ + struct ae4_cmd_queue *ae4cmd_q = container_of(work, struct ae4_cmd_queue, p_work.work); + struct pt_cmd_queue *cmd_q = &ae4cmd_q->cmd_q; + struct pt_cmd *cmd; + u32 cridx; + + for (;;) { + wait_event_interruptible(ae4cmd_q->q_w, + ((atomic64_read(&ae4cmd_q->done_cnt)) < + atomic64_read(&ae4cmd_q->intr_cnt))); + + atomic64_inc(&ae4cmd_q->done_cnt); + + mutex_lock(&ae4cmd_q->cmd_lock); + cridx = readl(cmd_q->reg_control + AE4_RD_IDX_OFF); + while ((ae4cmd_q->dridx != cridx) && !list_empty(&ae4cmd_q->cmd)) { + cmd = list_first_entry(&ae4cmd_q->cmd, struct pt_cmd, entry); + list_del(&cmd->entry); + + ae4_check_status_error(ae4cmd_q, ae4cmd_q->dridx); + cmd->pt_cmd_callback(cmd->data, cmd->ret); + + ae4cmd_q->q_cmd_count--; + ae4cmd_q->dridx = (ae4cmd_q->dridx + 1) % CMD_Q_LEN; + + complete_all(&ae4cmd_q->cmp); + } + mutex_unlock(&ae4cmd_q->cmd_lock); + } +} + +static irqreturn_t ae4_core_irq_handler(int irq, void *data) +{ + struct ae4_cmd_queue *ae4cmd_q = data; + struct pt_cmd_queue *cmd_q; + struct pt_device *pt; + u32 status; + + cmd_q = &ae4cmd_q->cmd_q; + pt = cmd_q->pt; + + pt->total_interrupts++; + atomic64_inc(&ae4cmd_q->intr_cnt); + + wake_up(&ae4cmd_q->q_w); + + status = readl(cmd_q->reg_control + AE4_INTR_STS_OFF); + if (status & BIT(0)) { + status &= GENMASK(31, 1); + writel(status, cmd_q->reg_control + AE4_INTR_STS_OFF); + } + + return IRQ_HANDLED; +} + +void ae4_destroy_work(struct ae4_device *ae4) +{ + struct ae4_cmd_queue *ae4cmd_q; + int i; + + for (i = 0; i < ae4->cmd_q_count; i++) { + ae4cmd_q = &ae4->ae4cmd_q[i]; + + if (!ae4cmd_q->pws) + break; + + cancel_delayed_work_sync(&ae4cmd_q->p_work); + destroy_workqueue(ae4cmd_q->pws); + } +} + +int ae4_core_init(struct ae4_device *ae4) +{ + struct pt_device *pt = &ae4->pt; + struct ae4_cmd_queue *ae4cmd_q; + struct device *dev = pt->dev; + struct pt_cmd_queue *cmd_q; + int i, ret = 0; + + writel(max_hw_q, pt->io_regs); + + for (i = 0; i < max_hw_q; i++) { + ae4cmd_q = &ae4->ae4cmd_q[i]; + ae4cmd_q->id = ae4->cmd_q_count; + ae4->cmd_q_count++; + + cmd_q = &ae4cmd_q->cmd_q; + cmd_q->pt = pt; + + cmd_q->reg_control = pt->io_regs + ((i + 1) * AE4_Q_SZ); + + ret = devm_request_irq(dev, ae4->ae4_irq[i], ae4_core_irq_handler, 0, + dev_name(pt->dev), ae4cmd_q); + if (ret) + return ret; + + cmd_q->qsize = Q_SIZE(sizeof(struct ae4dma_desc)); + + cmd_q->qbase = dmam_alloc_coherent(dev, cmd_q->qsize, &cmd_q->qbase_dma, + GFP_KERNEL); + if (!cmd_q->qbase) + return -ENOMEM; + } + + for (i = 0; i < ae4->cmd_q_count; i++) { + ae4cmd_q = &ae4->ae4cmd_q[i]; + + cmd_q = &ae4cmd_q->cmd_q; + + cmd_q->reg_control = pt->io_regs + ((i + 1) * AE4_Q_SZ); + + /* Update the device registers with queue information. */ + writel(CMD_Q_LEN, cmd_q->reg_control + AE4_MAX_IDX_OFF); + + cmd_q->qdma_tail = cmd_q->qbase_dma; + writel(lower_32_bits(cmd_q->qdma_tail), cmd_q->reg_control + AE4_Q_BASE_L_OFF); + writel(upper_32_bits(cmd_q->qdma_tail), cmd_q->reg_control + AE4_Q_BASE_H_OFF); + + INIT_LIST_HEAD(&ae4cmd_q->cmd); + init_waitqueue_head(&ae4cmd_q->q_w); + + ae4cmd_q->pws = alloc_ordered_workqueue("ae4dma_%d", WQ_MEM_RECLAIM, ae4cmd_q->id); + if (!ae4cmd_q->pws) { + ae4_destroy_work(ae4); + return -ENOMEM; + } + INIT_DELAYED_WORK(&ae4cmd_q->p_work, ae4_pending_work); + queue_delayed_work(ae4cmd_q->pws, &ae4cmd_q->p_work, usecs_to_jiffies(100)); + + init_completion(&ae4cmd_q->cmp); + } + + return ret; +} diff --git a/drivers/dma/amd/ae4dma/ae4dma-pci.c b/drivers/dma/amd/ae4dma/ae4dma-pci.c new file mode 100644 index 000000000000..43d36e9d1efb --- /dev/null +++ b/drivers/dma/amd/ae4dma/ae4dma-pci.c @@ -0,0 +1,157 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * AMD AE4DMA driver + * + * Copyright (c) 2024, Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * Author: Basavaraj Natikar + */ + +#include "ae4dma.h" + +static int ae4_get_irqs(struct ae4_device *ae4) +{ + struct ae4_msix *ae4_msix = ae4->ae4_msix; + struct pt_device *pt = &ae4->pt; + struct device *dev = pt->dev; + struct pci_dev *pdev; + int i, v, ret; + + pdev = to_pci_dev(dev); + + for (v = 0; v < ARRAY_SIZE(ae4_msix->msix_entry); v++) + ae4_msix->msix_entry[v].entry = v; + + ret = pci_alloc_irq_vectors(pdev, v, v, PCI_IRQ_MSIX); + if (ret != v) { + if (ret > 0) + pci_free_irq_vectors(pdev); + + dev_err(dev, "could not enable MSI-X (%d), trying MSI\n", ret); + ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSI); + if (ret < 0) { + dev_err(dev, "could not enable MSI (%d)\n", ret); + return ret; + } + + ret = pci_irq_vector(pdev, 0); + if (ret < 0) { + pci_free_irq_vectors(pdev); + return ret; + } + + for (i = 0; i < MAX_AE4_HW_QUEUES; i++) + ae4->ae4_irq[i] = ret; + + } else { + ae4_msix->msix_count = ret; + for (i = 0; i < MAX_AE4_HW_QUEUES; i++) + ae4->ae4_irq[i] = ae4_msix->msix_entry[i].vector; + } + + return ret; +} + +static void ae4_free_irqs(struct ae4_device *ae4) +{ + struct ae4_msix *ae4_msix = ae4->ae4_msix; + struct pt_device *pt = &ae4->pt; + struct device *dev = pt->dev; + struct pci_dev *pdev; + + pdev = to_pci_dev(dev); + + if (ae4_msix && (ae4_msix->msix_count || ae4->ae4_irq[MAX_AE4_HW_QUEUES - 1])) + pci_free_irq_vectors(pdev); +} + +static void ae4_deinit(struct ae4_device *ae4) +{ + ae4_free_irqs(ae4); +} + +static int ae4_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) +{ + struct device *dev = &pdev->dev; + struct ae4_device *ae4; + struct pt_device *pt; + int bar_mask; + int ret = 0; + + ae4 = devm_kzalloc(dev, sizeof(*ae4), GFP_KERNEL); + if (!ae4) + return -ENOMEM; + + ae4->ae4_msix = devm_kzalloc(dev, sizeof(struct ae4_msix), GFP_KERNEL); + if (!ae4->ae4_msix) + return -ENOMEM; + + ret = pcim_enable_device(pdev); + if (ret) + goto ae4_error; + + bar_mask = pci_select_bars(pdev, IORESOURCE_MEM); + ret = pcim_iomap_regions(pdev, bar_mask, "ae4dma"); + if (ret) + goto ae4_error; + + pt = &ae4->pt; + pt->dev = dev; + + pt->io_regs = pcim_iomap_table(pdev)[0]; + if (!pt->io_regs) { + ret = -ENOMEM; + goto ae4_error; + } + + ret = ae4_get_irqs(ae4); + if (ret < 0) + goto ae4_error; + + pci_set_master(pdev); + + dma_set_mask_and_coherent(dev, DMA_BIT_MASK(48)); + + dev_set_drvdata(dev, ae4); + + ret = ae4_core_init(ae4); + if (ret) + goto ae4_error; + + return 0; + +ae4_error: + ae4_deinit(ae4); + + return ret; +} + +static void ae4_pci_remove(struct pci_dev *pdev) +{ + struct ae4_device *ae4 = dev_get_drvdata(&pdev->dev); + + ae4_destroy_work(ae4); + ae4_deinit(ae4); +} + +static const struct pci_device_id ae4_pci_table[] = { + { PCI_VDEVICE(AMD, 0x14C8), }, + { PCI_VDEVICE(AMD, 0x14DC), }, + { PCI_VDEVICE(AMD, 0x149B), }, + /* Last entry must be zero */ + { 0, } +}; +MODULE_DEVICE_TABLE(pci, ae4_pci_table); + +static struct pci_driver ae4_pci_driver = { + .name = "ae4dma", + .id_table = ae4_pci_table, + .probe = ae4_pci_probe, + .remove = ae4_pci_remove, +}; + +module_pci_driver(ae4_pci_driver); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("AMD AE4DMA driver"); diff --git a/drivers/dma/amd/ae4dma/ae4dma.h b/drivers/dma/amd/ae4dma/ae4dma.h new file mode 100644 index 000000000000..a63525792080 --- /dev/null +++ b/drivers/dma/amd/ae4dma/ae4dma.h @@ -0,0 +1,85 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * AMD AE4DMA driver + * + * Copyright (c) 2024, Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * Author: Basavaraj Natikar + */ +#ifndef __AE4DMA_H__ +#define __AE4DMA_H__ + +#include "../common/amd_dma.h" + +#define MAX_AE4_HW_QUEUES 16 + +#define AE4_DESC_COMPLETED 0x03 + +#define AE4_MAX_IDX_OFF 0x08 +#define AE4_RD_IDX_OFF 0x0C +#define AE4_WR_IDX_OFF 0x10 +#define AE4_INTR_STS_OFF 0x14 +#define AE4_Q_BASE_L_OFF 0x18 +#define AE4_Q_BASE_H_OFF 0x1C +#define AE4_Q_SZ 0x20 + +struct ae4_msix { + int msix_count; + struct msix_entry msix_entry[MAX_AE4_HW_QUEUES]; +}; + +struct ae4_cmd_queue { + struct ae4_device *ae4; + struct pt_cmd_queue cmd_q; + struct list_head cmd; + /* protect command operations */ + struct mutex cmd_lock; + struct delayed_work p_work; + struct workqueue_struct *pws; + struct completion cmp; + wait_queue_head_t q_w; + atomic64_t intr_cnt; + atomic64_t done_cnt; + u64 q_cmd_count; + u32 dridx; + u32 id; +}; + +union dwou { + u32 dw0; + struct dword0 { + u8 byte0; + u8 byte1; + u16 timestamp; + } dws; +}; + +struct dword1 { + u8 status; + u8 err_code; + u16 desc_id; +}; + +struct ae4dma_desc { + union dwou dwouv; + struct dword1 dw1; + u32 length; + u32 rsvd; + u32 src_hi; + u32 src_lo; + u32 dst_hi; + u32 dst_lo; +}; + +struct ae4_device { + struct pt_device pt; + struct ae4_msix *ae4_msix; + struct ae4_cmd_queue ae4cmd_q[MAX_AE4_HW_QUEUES]; + unsigned int ae4_irq[MAX_AE4_HW_QUEUES]; + unsigned int cmd_q_count; +}; + +int ae4_core_init(struct ae4_device *ae4); +void ae4_destroy_work(struct ae4_device *ae4); +#endif diff --git a/drivers/dma/amd/common/amd_dma.h b/drivers/dma/amd/common/amd_dma.h new file mode 100644 index 000000000000..f9f396cd4371 --- /dev/null +++ b/drivers/dma/amd/common/amd_dma.h @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * AMD DMA Driver common + * + * Copyright (c) 2024, Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * Author: Basavaraj Natikar + */ + +#ifndef AMD_DMA_H +#define AMD_DMA_H + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../ptdma/ptdma.h" +#include "../../virt-dma.h" + +#endif From patchwork Mon Jul 1 16:42:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13718379 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2089.outbound.protection.outlook.com [40.107.223.89]) (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 B261716DC24 for ; Mon, 1 Jul 2024 16:43:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719852190; cv=fail; b=OgwjGZKmUk7gBp4jf1bFzlelOlIUqA9RY/QMDcHB3TkisrBEnwg6sx0ukXt0Kx7D88jmD+qN71rBmtwBwgYPu0HqQSGz2+1N8JdQcEGaFKnZu03qTcaydwUKGcyORDNrgX1K+jzbDmH1tPJqTy9A4S2NDv3EEQZI2RKaKTTA+i0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719852190; c=relaxed/simple; bh=5Tk7JSbDOUAghY1I1UWZd76BhZQR75/+/njfJBKxCuc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cRDGsNhGkZZvjewHlaYE5Jiu4ok0EDIOjritq54/A5EdTaNpgSJGpOPNZCaCFa6fLxLYWl3mC0GHynU3gGwMlaTy28OdgNZUnmjNUi3TGK8fiMDbODp9Jiq3v4T8NCKNMX11h02dEIaoasXiRRRUzkfiWTw8EprMVmpyGoCq0a8= 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=APZ+Nv0U; arc=fail smtp.client-ip=40.107.223.89 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="APZ+Nv0U" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wj5PqZr0QRVis4w3ZWWEg11/2ABAS/qnnIH+EqF2NXeMKz175XNucciM55Gdd6XIEXx9/vefOVA/N1zlvEKklG+ZtYEgQBdyDfLpoEux9akIMxkJvRPNbC1kVTIMQNnFfPcEPuM7DWZfrUUKqrDqdOgAD8ethiI98KfOVUKcX8NkCkNlXZWzK8wdRdNzkbgs0NMf2OD64Sly3SYEPIAUdy93+Ceh4hniUMQDEoV+e4FUW5wPuGpOss29tOaJHxPCVjvm7/s/iQGZAF+KwOLjpikwtPIOJtVLDOqrngasCtkFr419MqDyJtKtmUGezNbhTN5PNftxfwNcQ+icLeumAg== 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=FlDSbivbAY07eP0fzFajGziLM7VZZJ0ttzSt0YY/ICM=; b=RYpjrurb3Q5CJKjrY1rop9yXQDOsuTdhXXFc6seTyBvNrk63AAlF6tVSim50lCNyflH384KjIzltVvihRM/2+H2PNCbzsP9nLNqcoRq5RzdVV0BkrKV6YWWtJoRkKhdwLxTRM/ibE2m046mKAw2VrIpGnUXv+fyJ++HeKxsQNx9VQ8irJxyvah8B2L/gC7EhuUgHfrTUlQdIISeOHBmHaoTFwyfgUYNQlXyc+6BTZ0I/N3jRBZNP1ju5s3hnVvTVSA1tpx+bMDcJ4W6U2s5eIOItUEn6AiC/laiXBlUrtf5KF87addTSMCyMRmM6HRomGgcgyLe4PYp5TWN8JNPTaw== 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=FlDSbivbAY07eP0fzFajGziLM7VZZJ0ttzSt0YY/ICM=; b=APZ+Nv0U/IPjKqRJMELP7A3lINjkUn2dtPOAtLaPXGpaqE6NwnsZ51cy4Mo8ZIcoalUHxIwYmltxikgxMeXXB2uBPKD1SQWSd0D9/SYgKPRKMI7MjSSMuzYqXRBF1lIWmZ5yP18/pyliO2A7KJ3oe/n/IRBXXdx0T5C704Aq1MU= Received: from SJ0PR03CA0033.namprd03.prod.outlook.com (2603:10b6:a03:33e::8) by DM4PR12MB9072.namprd12.prod.outlook.com (2603:10b6:8:be::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.26; Mon, 1 Jul 2024 16:43:02 +0000 Received: from SJ5PEPF000001D5.namprd05.prod.outlook.com (2603:10b6:a03:33e:cafe::56) by SJ0PR03CA0033.outlook.office365.com (2603:10b6:a03:33e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.32 via Frontend Transport; Mon, 1 Jul 2024 16:43:02 +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 SJ5PEPF000001D5.mail.protection.outlook.com (10.167.242.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7741.18 via Frontend Transport; Mon, 1 Jul 2024 16:43:02 +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, 1 Jul 2024 11:42:59 -0500 From: Basavaraj Natikar To: , CC: , , , , Basavaraj Natikar Subject: [PATCH v4 3/7] dmaengine: ptdma: Move common functions to common code Date: Mon, 1 Jul 2024 22:12:29 +0530 Message-ID: <20240701164233.2563221-4-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240701164233.2563221-1-Basavaraj.Natikar@amd.com> References: <20240701164233.2563221-1-Basavaraj.Natikar@amd.com> Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D5:EE_|DM4PR12MB9072:EE_ X-MS-Office365-Filtering-Correlation-Id: 541e228b-f583-4cc3-fcc5-08dc99ecdf9d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: MIFO++6/AHDk3lKLRbe6eEHmav5wbtk0LD/1NwnE5K1/jcoQLlTZsRLfWgtn72rZAi1Ek1mbi7kDJEpgKQD0qek5NUxdyj81aFfdrbwVioQd2fTfdJ9JxrRQSS8ax+7RNZrRO+xF0GhAssFbAnQR/98keKu4BEoRkM+9oK4X49UZcCdBA2biwtEXuXRfOOhJJVKT0A6dnchI5l2wBpJEzgKDBb4Cq+FKbhK7V2iJsP8JxqMu5ed/IV2I9Rx8csHxB/QZNUDMKKJXnh0n4jAcyHqOGXjWRsfYPvDERTPfA/7BMMOsJoOy4BtvTglEAXMfYWdQlWOxsauPCG7hpbT6nuJgVJ5ux7lZQPER6U0qzXaILRTWJDqyLHbpFvQLxiMzwyxwpwxij5oG8U4JE7aQG7atkqDXPx4rLPkKASZI0qLNwKH4UgKgOSjFSywK8xvLYrcg6lLbZJ7eK0HwoVhXcFN9eLEG04R4FL5sp/0pYlNJ/uVGcITEpJNPVwnWQ2YBT8SOOajW9tz9+2+CEYVRZsEkN2T6nrIHys7big1uNHqL1Yh3YfFV/NWao89YkZdU3ETQ/U/dbodLJlT9fDtpE9nE7lLIOShS+pdwlwIQIEg1i2z/OSNKWjxVQGO/WrA92tPc+4fukn7wCbitXLA3iS9Yu+dzjIaoaFZZ9ZRa+STy7M9NqHADJjyxMfOEw8oQOg+6ZRLBZoX2WuWdoIy7JH0/ymRcaQHzRfp/tLduyjx0JISNdamz564iobRCkeGndE7sQRu32G/6I+UXZzXU6oLxXEiAHbWbqmhW+5ScgvFdx2O45fqzYcufZVnX5MXyDvUQzGXGQlRhXtjdvhIKck3cDWY8B4VKYH/8yqHx0n4yReKhN2GNOfxHeanW2gvk5X4tkX795c70Th3xkeC/l6bFcGmF1VQv9psQVgypeglAQSiY8wjjnWePgFwu0Q14eC/FtmdNxIdKSHRZ+NhWpeQFWxCxKL4e0v2hE14Y/5LJkmbS1/G9cH+RpL4vJFjnAj6dBq1JiIFEXeYGyygL7w7XKaPitXEg0k0GXy5ReFRKTytojJ74ozxKRmZFFysvhqXZB1bsxxXH58200MHpJIiwVctbeUvGhjePQ91h9g6GiOP8wexsOdOuiekN0qQ030XDzEvo0t5u0wLfhBhNIVn9DqeclyTHBRCxJwL7hAxsrtgU2eIaM3cpeK60CKTBK99fNPd2HCOR2WHObCU/9mppEQCAVlxkBwd7Qki/dYrO/T/fjd8EVzvzh+MaRKCN2K9nFiXfGaN3jxMcfmmRioUU+fLk62mfdtlIre169C4gLEY/midW25seJ3/Z2RDjZ7JyvGruJpLW9sCXGzgaIa3k2RDbjQQCfQUU+rqcA4EbVC8GzO4QJ3zvKPlFEOwvubAFQ0gym36QQ2C82tO3X27DFI1esTyHB8jgSQzQVgg= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2024 16:43:02.1366 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 541e228b-f583-4cc3-fcc5-08dc99ecdf9d 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: SJ5PEPF000001D5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB9072 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 3d4c2c21a503..6ddd94363ab6 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 Jul 1 16:42:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13718380 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2059.outbound.protection.outlook.com [40.107.223.59]) (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 F033D16D9DF for ; Mon, 1 Jul 2024 16:43:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719852191; cv=fail; b=Ab90m/MbZb8LtjiodgN0xz68iQp5FGydBYsLxE+96hPSpjMTePhIGjoTAgKL/wZXHYklVtwuYdg8wNVPUx4FIxc+LVM4HCsPg2k22SwxWlVCWDNxspbaB01zuMIKi6pWSn89En2SZNZZC6l0+lX+9KJS7ZJJ8KsFCvZ2uhSyCqo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719852191; c=relaxed/simple; bh=JQAu7eqhXnjzxhQzyOhqOfX5IHAFHsv5X1prBhtKzEo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=W2YF5rUZHkjVg2SVjrJe/St6xw/yh6AbILI1kp+6HZjavLytPykojjKmJ+cAlJNAWq9jzEa7rP6ZENTUV7CTDsDGeXjaZFB0xo9S6gL3Qd27EOh0zo5eeubf/ZAXZi6RGqnMeuMiVr4nyz781gZVU8hWK/7FWc/T6rJDVOrI5W4= 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=t9UTjz9w; arc=fail smtp.client-ip=40.107.223.59 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="t9UTjz9w" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aMzZ08FlR65eaeY4IbyC17wM0KVDZ6vyvFzgPU8vl307wtcON5kfZMIiazcXruH/ygg56YbNe0F4eHnKVlUAGzksyAf+vAVfm7lNOn9TYj8UiPtskMjAkrFGQ1nI+YB1iRVnaMUU7bWToUnOF00WrtwEm7kYboinUQO655dkBPQ7KNxnJbiJ2+VztFcjs/AyFXDRJERWfZZoCA6nIjyr+uAOReOPicdVxpk5AEv7dRz+Bl50lfSZvoHFmdCRYmOU/ZlrhgK8sQ6GJyKPcoorR7SJd3cFg3Rr8Qx9M8KhcXF2+MDyN7h0jtkuZyRcUAuw+B16IDqsATQsi/jtCdwMvg== 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=bq0eNhIEhQPuhzlsB6Y/lodnDkn8A63gKTNJ86G5msA=; b=U8zqK9+yBTvr5pf4f11CQXhxC2X3J5XYNe8DhYIk0CLrk9Tb5e+DcGS5S5IA3NyQWMtT1Tch7g8D7x63yPWQaA5V6s8We5DzjSFBvbtGObPe248teSNglEv5uFkxmVKAH2gHd2ulWmYpnOp4lC/Mwj2ZHAWswBE0sTnYcjEvevX4A5AyJfAK/W5hSagQhyLUvkeVzYN6Fa13VdTJOJoSioljitQo7oYHDR2bTzO2LAmPYOF89MlCg/AvhRhvx64WFrDJTsr0ArAYLz+VdzjLa+d7KNUvgXljSU8ZSnQovNiGzRVVoV8+E9KmXSAM1vEHejtje+4BnvjQgW5BKAlVJA== 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=bq0eNhIEhQPuhzlsB6Y/lodnDkn8A63gKTNJ86G5msA=; b=t9UTjz9wQKUo7KhfPT2cwRLUrJax8nS6zCM+qOk/QyYm8hqz8bPdXuz7QjoN3APRlu6V+yOJIt1lEuIecp4HcPoDh0+fcOOeLn2yz7DOK99w6NgZTxpKszZ7YMGAfNKTJ0z4TdBpjtYBgFR3IE0XH9IQquhVwjNk15/M6iVaHyA= Received: from SJ0PR03CA0060.namprd03.prod.outlook.com (2603:10b6:a03:33e::35) by DM6PR12MB4466.namprd12.prod.outlook.com (2603:10b6:5:2ae::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.32; Mon, 1 Jul 2024 16:43:07 +0000 Received: from SJ5PEPF000001D5.namprd05.prod.outlook.com (2603:10b6:a03:33e:cafe::d9) by SJ0PR03CA0060.outlook.office365.com (2603:10b6:a03:33e::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.33 via Frontend Transport; Mon, 1 Jul 2024 16:43:07 +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 SJ5PEPF000001D5.mail.protection.outlook.com (10.167.242.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7741.18 via Frontend Transport; Mon, 1 Jul 2024 16:43:07 +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, 1 Jul 2024 11:43:02 -0500 From: Basavaraj Natikar To: , CC: , , , , Basavaraj Natikar Subject: [PATCH v4 4/7] dmaengine: ptdma: Extend ptdma to support multi-channel and version Date: Mon, 1 Jul 2024 22:12:30 +0530 Message-ID: <20240701164233.2563221-5-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240701164233.2563221-1-Basavaraj.Natikar@amd.com> References: <20240701164233.2563221-1-Basavaraj.Natikar@amd.com> Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D5:EE_|DM6PR12MB4466:EE_ X-MS-Office365-Filtering-Correlation-Id: 273951fa-ca8e-45f6-3b1d-08dc99ece288 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: UxFkQwxQACFtDgy+uOoBiiUnbz/TQtsrKsEt5PGb9sNSwVg+a+jiGI1pIvrEkaOysDbL0JPl+Gb0mSvAWABD79w1+KRlGoqXJ1XdUM3b6xY25J8BmZIqJcfYFoIsYMFtA/2BgImUj3o84omyDGizgYuoeqGaBWQlDJEuAN44NFTWWfRMIT9mNq5Z0vwwxg8aK05WgGbVThfoSSn4meO2qpbd27cSJylNwrCorHPurXMYVPFMQxtN/yzmKd9pKMuTJd0raYEi8CRMX8oIzgfhxsM9bkzdCwPiDyUr3nJgdHxiWDkYRusC8oMG9P/3Lm6ALrYZjZu/lSOG4d/rmFR9kmxbEFCXcpUMEAqSxrAy9+vBvCVafdoTi2dnGuBfCDELtV9yXkx9W7nFMjsHaINcAgg0C7agVawB+qBOiCrnW7w/x58OCinKkVXsj58yw+DC+NxeJteVneorrywMHzPc1BsIbj6n0h0w5zzabbHt00A90PxwkQVsWLQJ568fPnAZccjGun20+ME7SIuBcCeh9YWQWZzDi9Wzfk1bXFxBd4DkJl2WUpA2naALKQzL+FEG324S+ejvHnZYbzHN0RkjKDF+5ZxY+K2ls+Ga7Ku6UatZORzUoPssgvGvLDCMlidFOHE+NRcCoO3P/hhQS7UTPARz6QTYxDzs2ghBl1X3UAITdR0diMlfSN8+3pJ5/3l0YQMiNCVanBg8yL2ppG2b3UTtmG0+JbipujMowzAs/yIEKCXkdzb02/wosSCPo66aYNs4K0cgvatNG2KGkz4jceFFKC22t5IFuenW8i5+HCHF8JwXEEytHYfkhM+Hhb0ZhD2yLYf42iGMz5u3rH6qcymGhZhG5SqkBEIAduoDBPoMgc0JIIW2jAIBvk5+ozfBSInUsVPE5cKNXNOC39bVigVOYkNXBo7qoE9PZtDb32SvvIZGSsFE3NEGwBVB3XJ3szvhaaKweOn/E2nfth9ws9BqwxMMEl7Hm5R4LNNvfwY2OiNMw5YTZEpjyCZzgTnd0nC5IsO0RfrF7QLi+GH2qgJg23e6//atF3toUozJUUV/2W1jY4CtRuSUMg03UviS+LkjrlqtLEM3EJZf+TQfVcEbpG0Lo0kXSmBMSAIfYd8UQTNlHUj7HchwvlKOXwYmxr6nSmtmkbt/xtzXTP5MKao6dDanQGscetq0/tsf1J1y3asJYRNSGcOocgwIVaLeJ5QZIAAOlSPm5/KeiA5YjHGfJ5ohj6Ws89Jtl+49I1NxXRHNmHDGf31CDUwDe7sM1swsh1s7MQBwbPm8JqfqXvrowQTWjXD3MpNNDKVltMTzQlensHYHItJJXeku6y5danjMWoasyCuDCoTDq1rP72zV6NaVvZXIDFF+PABfzEvxCZIsNYkhKnUIGRtW9gIgZnL9JC0G8DUJTRK+GcOaOUFgawHZArBbWT4N32tt/j4= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(376014)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2024 16:43:07.0272 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 273951fa-ca8e-45f6-3b1d-08dc99ece288 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: SJ5PEPF000001D5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4466 To support multi-channel functionality with AE4DMA engine, extend the PTDMA code with reusable components. Reviewed-by: Raju Rangoju Signed-off-by: Basavaraj Natikar --- drivers/dma/amd/ae4dma/ae4dma.h | 2 + drivers/dma/amd/common/amd_dma.h | 1 + drivers/dma/amd/ptdma/ptdma-dmaengine.c | 105 +++++++++++++++++++----- drivers/dma/amd/ptdma/ptdma.h | 2 + 4 files changed, 90 insertions(+), 20 deletions(-) diff --git a/drivers/dma/amd/ae4dma/ae4dma.h b/drivers/dma/amd/ae4dma/ae4dma.h index a63525792080..5f9dab5f05f4 100644 --- a/drivers/dma/amd/ae4dma/ae4dma.h +++ b/drivers/dma/amd/ae4dma/ae4dma.h @@ -24,6 +24,8 @@ #define AE4_Q_BASE_H_OFF 0x1C #define AE4_Q_SZ 0x20 +#define AE4_DMA_VERSION 4 + struct ae4_msix { int msix_count; struct msix_entry msix_entry[MAX_AE4_HW_QUEUES]; diff --git a/drivers/dma/amd/common/amd_dma.h b/drivers/dma/amd/common/amd_dma.h index 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 Jul 1 16:42:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13718381 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2073.outbound.protection.outlook.com [40.107.244.73]) (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 9CC8716D9DF for ; Mon, 1 Jul 2024 16:43:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719852194; cv=fail; b=a05a4TpbhZyQ3ToWk+pNBNoIAArqEBG6HXBVHkUkGe+gc62Cfp2d3WIIjtBdtl3KcidgIafW+5CRgrjqsiiGVHSryMFp3j+ZeLJwcJJWUFkEagNa/rRGUdrbTZEN2P2QMv6V7Bg4qFcqfbBxilTkTmGP9GCj0uBhdIlIk3JCaGM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719852194; c=relaxed/simple; bh=BaHjlUXLULEhv2gSIRawq6RzeDlfcsC3UDuLcE/Mb/I=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VzT4mDkYDOOZYH9QlA+fV9QMXXAfxTuSx221uah2fqIgihjv6jfKtazfMJEJrPJE4Nw8MeNw4sy2kwSI/fIGLPcjfTNUAwziOpL6SoZ+dbSk0qy5yPe8LR+pFf8fIzmAbp+WO/7lW1SjpPLCaLEMUNoRLiT5XamupU/sQXTla8g= 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=E8KA3iHU; arc=fail smtp.client-ip=40.107.244.73 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="E8KA3iHU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DwWV+YaBwkKQf5O/2c5BhpcgkkWi41mwndsbyJbL0rIQLyBBnxuAMKZLufRYsx97J4ckLJPpINlIzAhzr8Iqp9jAABKbQcThUu2H85rLhyYWAc4ihy4Sr87Xk3pJ5IgBi/qVmt8gBmitJ/Z3q4ykTDAI8bYLs3wHno3GFTKgzjjbXiTsjOmiwb5XX3y5Y265AUYvg2OqlJpHg6ymeOdJkI4KEHVyAyT1UOZz4DndhOVAvXz7DBYgNY94R5zmoJp/1kFZRiWGMh1lcsmsQiMg9ybHgisazMapGxlw3dS3Dx0AZvMWqbzY++hXIKqmTFbHUqtNX5n8SwlDiuQm3Hj8fA== 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=yWSygaxOuSirtVIZozU1GmuR2V30/9zmuFQGXlN5JMc=; b=VFkmCqXPkCt//zAOyTYKhTwbuKUjPxNDsouMdd5UOiG+oDGP6lRkUAGrN0TJDr4WJcCLZqe5X5RIxWPFekui8hkFSrBt2cdibxNSte8ZNEifdJAaxn5tPI7rCaJ8cw/VYtwbszAZVwj3fxGCGjExfQ9YP+X8l6QvtY9goB5sYBu37G+NiUf+nsFayH5ClUlf6jWWvTaerQilmGrrkei3rZXzLuTEVBTPwE2eMvTD16sd91pSYMIuOrttLqpWlnefLmab/oAmlRhu+i1AMNBgRxSJAybCGKc1IsKAEcaJndYoK22+55A12ZxZm93NziomkwSCs5CNs3YhPHmbREqa1g== 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=yWSygaxOuSirtVIZozU1GmuR2V30/9zmuFQGXlN5JMc=; b=E8KA3iHUQCbRTpZf3e0R3f4rcArI7WhjVMgKKlblwOS2KygadcUxibK0Y1SGG/91zBIWNnYMsKzMLDfo3CyA1Zx4bGlaf8lMnhtqWTQ6YvnDxjObPPojZZRQ4g+O343JDkFu+pBAIDvjw7SM1uc6Utc92NtRsia0RKmtc050Mv8= Received: from SJ0PR03CA0052.namprd03.prod.outlook.com (2603:10b6:a03:33e::27) by MW4PR12MB6876.namprd12.prod.outlook.com (2603:10b6:303:208::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.32; Mon, 1 Jul 2024 16:43:08 +0000 Received: from SJ5PEPF000001D5.namprd05.prod.outlook.com (2603:10b6:a03:33e:cafe::68) by SJ0PR03CA0052.outlook.office365.com (2603:10b6:a03:33e::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.33 via Frontend Transport; Mon, 1 Jul 2024 16:43:08 +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 SJ5PEPF000001D5.mail.protection.outlook.com (10.167.242.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7741.18 via Frontend Transport; Mon, 1 Jul 2024 16:43:07 +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, 1 Jul 2024 11:43:04 -0500 From: Basavaraj Natikar To: , CC: , , , , Basavaraj Natikar Subject: [PATCH v4 5/7] dmaengine: ae4dma: Register AE4DMA using pt_dmaengine_register Date: Mon, 1 Jul 2024 22:12:31 +0530 Message-ID: <20240701164233.2563221-6-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240701164233.2563221-1-Basavaraj.Natikar@amd.com> References: <20240701164233.2563221-1-Basavaraj.Natikar@amd.com> Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D5:EE_|MW4PR12MB6876:EE_ X-MS-Office365-Filtering-Correlation-Id: 7421865e-12fe-4505-837f-08dc99ece312 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: PopweHdQvFOeZa/N16RSYgaTta3naDWoTM76wlzWmU89Lm9Lr5dvzmf0ov5WZEcBAqyVJLX4+ETVLNDS0DZWvs7TZPrluwU0UJ+Z95BQmOPMbEeVyb8CXiW3dpW3HwypZA2PSPGrOZzANwzXz8uE2p0iKm8QkWlHd2BBYAaarCOJ3btp2sWhTUqG/k8WW/OnP0aXbl6wAAXWRrSia0jEK54gpg3rPSDdbEMccDfNeIO6B2IFl2HEj3++2kkvWVRE9xEB4jgV8+zAGlgtpQ91xPBTk3kwa23yG2jMu6r1E+CKGJni35abPkEgg4uoKh1H/pm2okdOArePm+pWQGchWA5QCeYbiTlpDB7NMo9pImSMfAN8nPCwEzV2Hk7zmrxe4YmiFfy2Id6DCJtDJZ1RknQ/zjmkAj7BSCTxnXhxjdrbWAO1xVJU+yyMK3Q/9VK+Q0yn26YIkBO1q1I8YjE1PAjK93QUm2UnwIe6XAZIfzdEpbOJdlpLrm66sPjzKtShU8PzSpnsK/cbTTcRGU9vB8LeNqWx6T0Zq4+rjzWMir8niHlKQ5M0+pO83NfHudsVf6WlpnOmhF7grz85nPWuSWF85NOGsSi7dLoV2+bAP3XHEvwsqTVx2JhbFznPM4SOICxA+5vhOLaklS/hl1kjzz97tln2zUwvGdT7+rgaJRRf2LNeX7DDlioVvJ7sSn2wt34lAjGZr9ilAMEGmFWnn4PirXUt2EN1Kgj8r65GQDoav1K/JtvR1AV3R9+UXTs0qJOOpFzd0wVUb7YG5fAbcRWM8EV3jy4y0FNa0PUD+ucNYc08bEDsKB/PxLklvafw4BkNYlUXHb4xsiaIqgf79S1UV8QASP9KqKWdAfAEkgTFR4sVKWPnU4YxHBqsgedAYeayfH0TiimEcYwoTrQJ7RCRlAkA2ZBCqorn4dq+cmWTa0mht86MdAmlzKGtHsS7CIZlRXDRW5D2NnLtkhvK0EF2X9c1l9zfIBjqQ9T7SMGmEQNpdkYx62Ju2NRiAYtX85oVJwviCkefUCYSCpZzsvpM3S/dG6/25iLXG9HfakW8DgHSmLceA20+hCsWqvbAy8+UWy1KwlSR05FBdSHbLPtv9dSWdyc8Xx6N4PoC1wWJicoAeziJoRoJiNBk/drHgJrWMpGyAqlj3YKzLtucKvoqj4txUauEezMyWlCyMptQisSRHWfCkRyn3nL679p3P/ZlCLKt0pYSVGSr7Iy51xs6Hv9gaoBz3FoZ/Tt5yRn7EeiGNpcWUktICuNac8WpfQMAAS3UDQVBHNEAY8Lk604fuj6ot5c/FJDIxxTRyuEBsiITkevMmJHIDmPE4sxY/ePbGSzyDQW28ANFT165hamztc/XVUz9F6Umt2AF6ASoSerykfJpZv1yjqszLLbTPtobbwZlE/RSlP1rUg1jh8dy/Rw93653kcO8SzucA4E= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(376014)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2024 16:43:07.9334 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7421865e-12fe-4505-837f-08dc99ece312 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: SJ5PEPF000001D5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6876 Use the pt_dmaengine_register function to register a AE4DMA DMA engine. Reviewed-by: Raju Rangoju Signed-off-by: Basavaraj Natikar Reviewed-by: Philipp Stanner --- drivers/dma/amd/ae4dma/ae4dma-dev.c | 60 +++++++++++++++++++++++++ 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, 64 insertions(+) diff --git a/drivers/dma/amd/ae4dma/ae4dma-dev.c b/drivers/dma/amd/ae4dma/ae4dma-dev.c index c38464b96fc6..205bb8822f84 100644 --- a/drivers/dma/amd/ae4dma/ae4dma-dev.c +++ b/drivers/dma/amd/ae4dma/ae4dma-dev.c @@ -61,6 +61,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,53 @@ static irqreturn_t ae4_core_irq_handler(int irq, void *data) return IRQ_HANDLED; } +static int ae4_core_execute_cmd(struct ae4dma_desc *desc, struct ae4_cmd_queue *ae4cmd_q) +{ + bool soc = FIELD_GET(DWORD0_SOC, desc->dwouv.dw0); + struct pt_cmd_queue *cmd_q = &ae4cmd_q->cmd_q; + + if (soc) { + desc->dwouv.dw0 |= FIELD_PREP(DWORD0_IOC, desc->dwouv.dw0); + desc->dwouv.dw0 &= ~DWORD0_SOC; + } + + mutex_lock(&ae4cmd_q->cmd_lock); + memcpy(&cmd_q->qbase[ae4cmd_q->tail_wi], desc, sizeof(struct ae4dma_desc)); + ae4cmd_q->q_cmd_count++; + ae4cmd_q->tail_wi = (ae4cmd_q->tail_wi + 1) % CMD_Q_LEN; + writel(ae4cmd_q->tail_wi, cmd_q->reg_control + AE4_WR_IDX_OFF); + mutex_unlock(&ae4cmd_q->cmd_lock); + + wake_up(&ae4cmd_q->q_w); + + return 0; +} + +int pt_core_perform_passthru(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; @@ -194,5 +250,9 @@ int ae4_core_init(struct ae4_device *ae4) init_completion(&ae4cmd_q->cmp); } + ret = pt_dmaengine_register(pt); + if (ret) + ae4_destroy_work(ae4); + return ret; } diff --git a/drivers/dma/amd/ae4dma/ae4dma-pci.c b/drivers/dma/amd/ae4dma/ae4dma-pci.c index 43d36e9d1efb..aad0dc4294a3 100644 --- a/drivers/dma/amd/ae4dma/ae4dma-pci.c +++ b/drivers/dma/amd/ae4dma/ae4dma-pci.c @@ -98,6 +98,7 @@ static int ae4_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) pt = &ae4->pt; pt->dev = dev; + pt->ver = AE4_DMA_VERSION; pt->io_regs = pcim_iomap_table(pdev)[0]; if (!pt->io_regs) { diff --git a/drivers/dma/amd/ae4dma/ae4dma.h b/drivers/dma/amd/ae4dma/ae4dma.h index 5f9dab5f05f4..1bc8abcd1d44 100644 --- a/drivers/dma/amd/ae4dma/ae4dma.h +++ b/drivers/dma/amd/ae4dma/ae4dma.h @@ -25,6 +25,7 @@ #define AE4_Q_SZ 0x20 #define AE4_DMA_VERSION 4 +#define CMD_AE4_DESC_DW0_VAL 2 struct ae4_msix { int msix_count; @@ -45,6 +46,7 @@ struct ae4_cmd_queue { atomic64_t done_cnt; u64 q_cmd_count; u32 dridx; + u32 tail_wi; u32 id; }; diff --git a/drivers/dma/amd/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 Jul 1 16:42:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13718382 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2089.outbound.protection.outlook.com [40.107.223.89]) (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 DB22316D9DF for ; Mon, 1 Jul 2024 16:43:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719852196; cv=fail; b=sR88P4M3V0zW9gjPUON4WZyVUmxSuKsqeXF4IEG2h8V8Djbs2Qjh6ZB6J8OvYWDBFkGRf0XRAaFFmhI1ogMJHJWeX+kT4c1Q+JTCrt5e/IZU3Sz9lSPnXgPc/5ly67QP6M6arMTYAEN4mjdK32vMaJaWOeWKliUwd2SFKnh+B3o= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719852196; c=relaxed/simple; bh=b0aowZT5jOnuAEJvm1jtpE5bCOc6J1cqlzYDaL7Savc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fJ6ZIttkQ0ENdrYzEq2jdRqke85h5so7EMgBflHBDhAnNXNa5CB1njh4y6JEQjXHpRgD9ZNYMhh2f7J+z8oRUAT+5Zjji0a1AQr/4crPXuY9ob7ipEgmI6AtZxBiIhhxAmRrnD9Q8ldPCDcREFZfDCjoSmMWs1IJhq6am5cpI/w= 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=hwkq6Bn7; arc=fail smtp.client-ip=40.107.223.89 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="hwkq6Bn7" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G6va07x7P/21K4/k+a1D/wmKvaMao5UJOKnUp7cBuHElpEQNG5HCrAe8FJUtWu8+AR/b5toRcA8UKFrnhqHIfZfinOZ/9Hjmbv1hOfZtv3u0lUt0Vo5xF1I8uIA7Qb4KCbTgE1OHALlS0N+YdREgGzTxtj3o9MRmr4cdhkLOMGYq6iPq8goU0ndI+vgtjfxe6IIcS1Iew5tQkIjkP2bUtwdLkbeiFwY+/u1azt4wvq+8YYY8zUjoboZYE596nIRLVl6FEwW0zTH5BHkCS3vV09wbv1ul++TijwgqyklFkkqxGjFJ36qaSi3kXKcPS9OiIOOGkMqnfL6QPPcDUFdvrQ== 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=jMQsJVT8BYzgVJ4WnQd3p5WoiBYB7BazGg4WmaFr6YE2pxua+JzW68o1nv9eMQ3NNuO+/kuTc61PJ6BjB15e6hpm8Y6ViKp/etXE1AdJXOdp5eM4MWAPMxs+2zImseRipBwYQaOKPBTy4oFzFo1z7gIVDADXCbfksMZyIjRkfyV09W1GJHWUzXCv9mUZpW68Ur632uP+7a76Amtatw0xJQzxSPnSueXIDMFlgjpbzEDW5nnsiU9I6C30EmxXZefCkF/dmUad9IG1bweaUzYdT3/ftUz3aq7EpUA9wfvS6uqOVt8Z1Gu2uPdaKzOvPB3xd7F1WEyKJReVo2MWMahzdw== 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=hwkq6Bn7vG72cppolTwtMZuv2hX9nFzeHomWzGs/3veS5hkiYGLYnkwTfVTAQcYpoogbbbBnVy68dD8Dg27lAd1cZhp9qty+diAViBzm/wEFsvn3Bv/XPPLRO5l38YfCjVUke++z4SoOQCiMB1mphSJAcmCX0tP494FfTXRfqlc= Received: from MW4PR04CA0360.namprd04.prod.outlook.com (2603:10b6:303:8a::35) by SA3PR12MB7832.namprd12.prod.outlook.com (2603:10b6:806:31f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.32; Mon, 1 Jul 2024 16:43:10 +0000 Received: from SJ5PEPF000001D6.namprd05.prod.outlook.com (2603:10b6:303:8a:cafe::7d) by MW4PR04CA0360.outlook.office365.com (2603:10b6:303:8a::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.33 via Frontend Transport; Mon, 1 Jul 2024 16:43:10 +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 SJ5PEPF000001D6.mail.protection.outlook.com (10.167.242.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7741.18 via Frontend Transport; Mon, 1 Jul 2024 16:43:09 +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, 1 Jul 2024 11:43:06 -0500 From: Basavaraj Natikar To: , CC: , , , , Basavaraj Natikar Subject: [PATCH v4 6/7] dmaengine: ptdma: Extend ptdma-debugfs to support multi-queue Date: Mon, 1 Jul 2024 22:12:32 +0530 Message-ID: <20240701164233.2563221-7-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240701164233.2563221-1-Basavaraj.Natikar@amd.com> References: <20240701164233.2563221-1-Basavaraj.Natikar@amd.com> Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D6:EE_|SA3PR12MB7832:EE_ X-MS-Office365-Filtering-Correlation-Id: d7087f47-ca54-41b8-1f48-08dc99ece446 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|82310400026|376014; X-Microsoft-Antispam-Message-Info: 0G856cPRgtmesRSu/XCGr2dPX+itCXhyfmNwaWRgYF4Yr73arZtRvqo0zLGl80RgdLlT3nf/VdWc461gpYYFCG1jbrOcMK5Q4dCFJeZ7KiRTEUlr00cezaOfW8I1dqyJCbImy4khcqdgIs81FSDxB2DhzXCOAR8Xsj3UcTlljxsEQgnCexwW2ITtRx8hfYNetWsywL+G1SlGhcuft7rYREDRQcCOIvnYJ1D4kfvzgdselHiiwMv/ByabUkLJnNdE+1PMvWa3AEoT8NUMDNZdn6ZMnNxj0B4yYZet0mfItA75TwLVaQ7zYTUgpKwNmpzrXhxhqqaWQVfXDfYh7w3Z7s2ACrnkyjsYkRTN9MGMLmHXP2EeLys0FGYPBd54DI7F14MtRSbD20qcXrKVvIW63HX1ALxYDud7ZSzkJEm7nRHdcA1+iMVC0tov0v5yqALIa8/XP6w25+YLcUXOV4WIb88yMeSdXGpwVap+M+bRiBld41LPpgURPXYid2Lq0i/YtlA8I5++pO2m+xRRFwORZQOANgd7rZQNjtP2BssnjyQZAo47BJxwo7EaZWz1l7ue41xwMFgISrL1CiiaBSQ6KspUoWxYdl4Euscw5W1WDb9neKeiqquRDZYFuBLw9u0v9To7TRiwdNDLhJS3l+pqPD0qC4bMDEYZB6tOJuIt96RuMyX7Ts636W/XZN+MOjvoA4edQvCAuR9fMueQsDAPI8KjQPhRcqE61X9aADmm/F/U/NmXmWslucnrK/9RzqghMrCVhdgKJnxdPQXG6XIbpczFBK5Fe0qOoNQOWVDb3L6z4xMG7+/OBUBIVDfritoT04aDq880x5cEMpHPFW1bTzzUpx9McaQ4VtQRsm3DOAKGiO6fJ6zCsAxN/LedpW7NH5Uz+l2o9ynrn3YVFdU4NEzkyXbKQw1RGjFUsHhAvmbvDrFTz8LRPfwb5cOXkFgUo2Kf2w2cL+clRiaw04nj2mygmh8VgwKAxDS5gpPeoOcIOr/tkg+a3R1xoGtxgobR8U3/6yIzs348bfcg6lQYaru0xmc08ebCGxXjnednJG+ja+Qv7W/yDRNjvd9p+SCJ6ohIjjI6KSo/0d0Fn5Ix3EHo8xGGsladvqFoHgM+eGqLbZ8b9XJoTo9vlnQGyMXZB8ISTeXhdAdd7yuGhb0q48FSG3l11Bu+CiXlxRS7TayaKBthGsqHSH76uAn5VZsNwGHYDzyo8Grq6X5KSgJPdwzikB/Z/UbDsOXpuDtByXOT18+JVJNbqIT71qASrlHxjdoGFIaJ4S9tcTcaRmnC/6Thz1vTtWJiHE9HtHelOqX+GsYwfeoataqIrdflIpRGmBiqrbqj81w0cIGxuPOAQ0bjVuy2XVR53Ozv0VMywm8O/TwivBdi7FzcP+AjLj5K4Dn65wtOTrTLDlGnxDg39tyr6IjJppm8qSbxQ55HYhY13S5oPgvMeVIYOCCZYsj9 X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(82310400026)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2024 16:43:09.9493 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d7087f47-ca54-41b8-1f48-08dc99ece446 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: SJ5PEPF000001D6.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7832 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 Jul 1 16:42:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13718383 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) (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 D6FCA16D9DF for ; Mon, 1 Jul 2024 16:43:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719852198; cv=fail; b=iVPveWXbMkK2WX4ghwQpcr7Go7/6L8VzUr26k1wK4O8ODo0/IMT/j8gtwNfcT47g4P5Z19O0m6QzFBzmKqF00nwh+e8xDWsLS7f4rJ5Iv8JnSHrljpWvhZeIXBRRIaU/VWhA2gF7EDHyTo3qOdxh8yRsG0Dsd0y4JOlNbk71NWg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719852198; c=relaxed/simple; bh=EgwuVUp24q0fhUp6EreOhzBfYt0Z7vKTMr/1gkvY2Ro=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=C9fIHDdDyNZCHwfEqoZUcpXtykG9WAt01t5gUkaGdR+1AbBP1Y3Ggo+c5OKRO9suGjXfg1YhiWxwZMjaZHivDbJDCgUVN9J4Ad+44S6GKda0ZB7tcG3uXiB8pIEz5t3NAwcq7gEB3D5tTzApPyB/O28LJFnMiCWRI1JpHRhOohM= 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=X9972ZpF; arc=fail smtp.client-ip=40.107.236.40 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="X9972ZpF" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B7qG0nglsWquBSOdFIanCinzVpc27jqp8WAsB8bMp+vjrV/HEq9ZCyJVAHrh8es0biJEZsT96rHZf3LtseKgncEGR6uTbQCW6GCt/QMbGUzCVCKCaDDVVcsXcOsDELHMbq0XE/0N450dl37JgIFBtcy8xnenZLMsUsX4CXyErrT7xcSa/sPm2oc9L1GoD5h5arwrv1UzL2XkYYSqZxPMp91dgs7kLv0smfFBZmWKSU13U3hdpp2XQqHvX4cv5Ak6+6z5UqT77Pt3GaMv6YFi6U5WBa4+rAx7QgablXUbgZbGEj4+bBQwavUF7G+kmA51cPa3s28GjHTqaMeiDrCTZw== 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=TXurI5GeEpreoCLuS/wxIvkufR9Qh0W7OApTu6/79lY=; b=XEfS4vld25oJxOpvVtkDOlgZj+UUl/6xvCYGfh6DQLBRSw4JBLa3DE+lApibABYlmWaKbSLWQ5mBdSys6oLjlgtBH+dyL5dNBes7lZ3AKM1qd30oJUHPxJnQBz6fGGgG+HMsHnSzgPk5SXyKUtAaXwF6N26G4R2NK1zWQ8uTed1zMgRjZJwttJnHUwgOPWif+QYcO5EKEZZvf5Bql/SOn+9nn+RkeC9q1D+m0GFSJT1vC5Ojkq+QeTzr9vwW3aoX3deOYLJ83N4bKRRNq6qwQ7gtCdoFxo2V1m/EzF2X/ceKfI/n2QRvw4oP/MXCui7A3siZHmEyA03yStSuw6YI4g== 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=TXurI5GeEpreoCLuS/wxIvkufR9Qh0W7OApTu6/79lY=; b=X9972ZpFCrORrssnycx0M2eWHDwrsVB+yiddoaYHoA1ISpJ46zgntPLFLt2ZMnQCyAhfKHnxfjjSEZugQd5tXFFaG6kTIJEi4DZ1nsr5LyXDFWJXln6sHMDVEt7s6minSUQob4BA421V/xLeGE8XGYsDx/WigUASUEqqfAF++4g= Received: from MW4PR04CA0334.namprd04.prod.outlook.com (2603:10b6:303:8a::9) by CY8PR12MB8363.namprd12.prod.outlook.com (2603:10b6:930:7a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.32; Mon, 1 Jul 2024 16:43:14 +0000 Received: from SJ5PEPF000001D6.namprd05.prod.outlook.com (2603:10b6:303:8a:cafe::4e) by MW4PR04CA0334.outlook.office365.com (2603:10b6:303:8a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.32 via Frontend Transport; Mon, 1 Jul 2024 16:43:14 +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 SJ5PEPF000001D6.mail.protection.outlook.com (10.167.242.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7741.18 via Frontend Transport; Mon, 1 Jul 2024 16:43:13 +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, 1 Jul 2024 11:43:09 -0500 From: Basavaraj Natikar To: , CC: , , , , Basavaraj Natikar Subject: [PATCH v4 7/7] dmaengine: ae4dma: Register debugfs using ptdma_debugfs_setup Date: Mon, 1 Jul 2024 22:12:33 +0530 Message-ID: <20240701164233.2563221-8-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240701164233.2563221-1-Basavaraj.Natikar@amd.com> References: <20240701164233.2563221-1-Basavaraj.Natikar@amd.com> Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D6:EE_|CY8PR12MB8363:EE_ X-MS-Office365-Filtering-Correlation-Id: a9ad519d-100e-4f3b-3fcd-08dc99ece6ad X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: tN3cVBK7Kd+v1iBstaHIEiWL58Oscm8Ln5QP/LncrNU9LTjW/YpvE3tVtd+6WWW8VsB7Pu8l+cKf9pexlOzfHz8RJfpH//nHo7+3/vOFn4MHTPdry8RdAHRzAM5Kw9nSehwfRQ+JstC/9p2eFa1BRE7YONiF6B2mk2/gpYGbJG2fn/TUGjJHJzAJGEkmIO0xbKr5Y4H8KhOhG/RYjmgFrW2y48jprC71T0zk+5sGcoBsl/BynWVUiNmGtAxZmiKIyjI4px9NO36gL6lmmtBeArwCSIp03Lg+Abfg0WfkB0YXNARdaxraEyUpi1+RN5gX18v+xMr0e4Q/hRrEHxBF4ow3Vw23fvcggAuCsICcTF5ZJoU3kjK4Hg0Uk5oxRvwi7AXk2ammXy2/nkehukMQ0d8wkUDUM02UxjVkLgwyVBnfWJgQ1BcM/2YX8NYkG87eNHNJw1pwaio0au8JTiD1DghbXQoalq5DuOLqnbLrOAupYAQzD5GvwX5bhRvIc88TLp46gN+SvlvR9/p8TQUdd3bZVRm3q/E9tWSR52VEk6ZkAlv+eF33qcD1cA/H6BtyC+kquF1ZzXVB5hG7aYzhF8azniQ2px7CIdr8xhQJL1kgFLVpjMwv4DZWZct1vEOiGOtrjScGpEgUg2GhFeG1QbKHIOfy2wlsE6MSmXQvnBp1fn61EQip0CGxPgD2+5jrjVXaYUraQILX8zssRkQDUvNBXSXacPyO6HJa6FhJbiFnOY6dsAlMlbzNzvcbdw1zY5kv7Vj8Zeq64zkQ2id7dX6GFSBFBgisKGAzcT0UswmMdGlC4rwR5C9qhFPMllxrJnaACt8KNwrdaRdsMcJJeozIY09/8tp9/y2fyUAgiYpEjsBI5+90Akv/ikBszQDK6Ui6sg82fEGoocpz53uGQ3afrJlCZrYveyMY4H9gSbp0N2UxxGD6SmZdAjLUN//BrwVOQniOHanUIY8hOJ1jbf8tMB/hPQIEBs/XrjPduyCmZVjBJghMTKupAE9XJqQfsUHGmzE3DSUhcrm6TALH/hKD3o1QhyfC47env389XG/YAZC57a6mv0CnCs4EFwOnPZUoaDexyYYcql2b3AN916x5wGWtp7e+svQRiRo5HMTojf1udOaG0NewBOP9B7vVIipVdsBKfBVvcL3cqNuoe2mgWBpvgz0oFpPnQjioYg4mfFw2rOARkKjmhtpzq4MrBULaRPRGFq8/VjHe5QbKnvPt9W03U9MFeNaqA0dFN02zvL3GT+sG4QhWy4Toi32ekkSv2KmWiIOpVTIwtO+SSXbyRGS6A10ZkIGTfKBSq5RKVKFNB3XUmvGaeuiSNZJWacETxKWfFsWotG9BnoLMNYM8OO910Oim/n3c14Qsm5bUZWrFgXIh9Lwfw9xe7SHa7o+EK9hsOmh3mbo1zJLoBOg+OTT1DdJuDA3PgCg8xilQygVn5BFfPYVDpw6fnqap X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(1800799024)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2024 16:43:13.9806 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a9ad519d-100e-4f3b-3fcd-08dc99ece6ad 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: SJ5PEPF000001D6.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB8363 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 205bb8822f84..f318f7db5844 100644 --- a/drivers/dma/amd/ae4dma/ae4dma-dev.c +++ b/drivers/dma/amd/ae4dma/ae4dma-dev.c @@ -253,6 +253,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);