Add support of AMD AE4DMA DMA Engine
Subsystems (3)
Basavaraj Natikar
maintainerv7 cover Add support of AMD AE4DMA DMA Engine
AMD AE4DMA Controller is a multi-queue DMA controller. Its design differs significantly from PTDMA controller, although some functionalities overlap. All functionalities similar to PTDMA are extended and merged within PTDMA code to support both PTDMA and AE4DMA for code reuse. A new AE4DMA driver directory is created to house unique AE4DMA code, ensuring efficient handling of AE4DMA functionalities.
Changes in v7:
- Changed the subject line to reflect the driver name.
- Moved the code to reflect the changes in the first place.
Changes in v6:
- Moved the wake_up call just before the return statement.
- Changed hex values to lowercase.
- Removed the common directory and added header files directly into the C files.
Changes in v5:
- Initialized the buffer to zero before using snprintf.
- Changed the function name to avoid a duplicate symbol error, as pointed out in the link below.
Changes in v4:
- Removed blank lines and grouped the mutexes into a single block.
- Replaced all magic numbers with #define macros.
- Added short comment for error codes.
- Replaced the while loop with a for loop.
Changes in v3:
- Added COMPILE_TEST to the Kconfig.
- Considered using pci_alloc_irq_vectors and pci_free_irq_vectors.
- Removed mb() and atomic variables where applicable.
Changes in v2:
- Changed all variants of "mb" to "dma_mb.
- Changed cancel_delayed_work to cancel_delayed_work_sync.
- Removed 32bit dma_set_mask_and_coherent.
- Rearrange the order of the #include directives alphabetically.
Basavaraj Natikar (6):
dmaengine: Move AMD PTDMA driver to amd directory
dmaengine: ae4dma: Add AMD ae4dma controller driver
dmaengine: ptdma: Extend ptdma to support multi-channel and version
dmaengine: ae4dma: Register AE4DMA using pt_dmaengine_register
dmaengine: ptdma: Extend ptdma-debugfs to support multi-queue
dmaengine: ae4dma: Register debugfs using ptdma_debugfs_setup
MAINTAINERS | 10 +-
drivers/dma/Kconfig | 2 -
drivers/dma/Makefile | 1 -
drivers/dma/amd/Kconfig | 28 +++
drivers/dma/amd/Makefile | 2 +
drivers/dma/amd/ae4dma/Makefile | 10 +
drivers/dma/amd/ae4dma/ae4dma-dev.c | 157 ++++++++++++
drivers/dma/amd/ae4dma/ae4dma-pci.c | 158 ++++++++++++
drivers/dma/amd/ae4dma/ae4dma.h | 100 ++++++++
drivers/dma/{ => amd}/ptdma/Makefile | 0
drivers/dma/{ => amd}/ptdma/ptdma-debugfs.c | 79 ++++--
drivers/dma/{ => amd}/ptdma/ptdma-dev.c | 0
drivers/dma/{ => amd}/ptdma/ptdma-dmaengine.c | 225 ++++++++++++++++--
drivers/dma/{ => amd}/ptdma/ptdma-pci.c | 0
drivers/dma/{ => amd}/ptdma/ptdma.h | 4 +-
drivers/dma/ptdma/Kconfig | 13 -
16 files changed, 725 insertions(+), 64 deletions(-)
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
rename drivers/dma/{ => amd}/ptdma/Makefile (100%)
rename drivers/dma/{ => amd}/ptdma/ptdma-debugfs.c (52%)
rename drivers/dma/{ => amd}/ptdma/ptdma-dev.c (100%)
rename drivers/dma/{ => amd}/ptdma/ptdma-dmaengine.c (59%)
rename drivers/dma/{ => amd}/ptdma/ptdma-pci.c (100%)
rename drivers/dma/{ => amd}/ptdma/ptdma.h (99%)
delete mode 100644 drivers/dma/ptdma/KconfigSignature · 1 line
2.25.1
Basavaraj Natikar
maintainerPATCH v7 1/6 dmaengine: Move AMD PTDMA driver to amd directory
PTDMA driver is the AMD DMA driver, and newer AMD platforms support newer DMA engines. Hence, move the current drivers to the AMD directory. This would also mean that future driver submissions to the AMD DMA driver will also land in the AMD-specific directory.
---
MAINTAINERS | 4 ++--
drivers/dma/Kconfig | 2 --
drivers/dma/Makefile | 1 -
drivers/dma/amd/Kconfig | 13 +++++++++++++
drivers/dma/amd/Makefile | 1 +
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 +-
drivers/dma/ptdma/Kconfig | 13 -------------
12 files changed, 18 insertions(+), 21 deletions(-)
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%)
delete mode 100644 drivers/dma/ptdma/KconfigMAINTAINERS +2 -2
@@ -1149,8 +1149,8 @@ F: tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py AMD PTDMA DRIVER M: Basavaraj Natikar <[email protected]> L: [email protected] -S: Maintained -F: drivers/dma/ptdma/ +S: Supported +F: drivers/dma/amd/ptdma/ AMD QDMA DRIVER M: Nishad Saraf <[email protected]>
drivers/dma/Kconfig +0 -2
@@ -740,8 +740,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"
drivers/dma/Makefile +0 -1
@@ -16,7 +16,6 @@ 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-$(CONFIG_APPLE_ADMAC) += apple-admac.o obj-$(CONFIG_AT_HDMAC) += at_hdmac.o obj-$(CONFIG_AT_XDMAC) += at_xdmac.o
drivers/dma/amd/Kconfig +13 -0
@@ -1,4 +1,17 @@ # SPDX-License-Identifier: GPL-2.0-only +# +config AMD_PTDMA + tristate "AMD PassThru DMA Engine" + depends on X86_64 && PCI + select DMA_ENGINE + select DMA_VIRTUAL_CHANNELS + help + Enable support for the AMD PTDMA 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. config AMD_QDMA tristate "AMD Queue-based DMA"
drivers/dma/amd/Makefile +1 -0
@@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_AMD_PTDMA) += ptdma/ obj-$(CONFIG_AMD_QDMA) += qdma/
drivers/dma/amd/ptdma/Makefile renamed from drivers/dma/ptdma/Makefile +0 -0
drivers/dma/amd/ptdma/ptdma-debugfs.c renamed from drivers/dma/ptdma/ptdma-debugfs.c +0 -0
drivers/dma/amd/ptdma/ptdma-dev.c renamed from drivers/dma/ptdma/ptdma-dev.c +0 -0
drivers/dma/amd/ptdma/ptdma-dmaengine.c renamed from drivers/dma/ptdma/ptdma-dmaengine.c +1 -2
@@ -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) {
drivers/dma/amd/ptdma/ptdma-pci.c renamed from drivers/dma/ptdma/ptdma-pci.c +0 -0
drivers/dma/amd/ptdma/ptdma.h renamed from drivers/dma/ptdma/ptdma.h +1 -1
@@ -22,7 +22,7 @@#include <linux/wait.h> #include <linux/dmapool.h> -#include "../virt-dma.h" +#include "../../virt-dma.h" #define MAX_PT_NAME_LEN 16#define MAX_DMAPOOL_NAME_LEN 32
drivers/dma/ptdma/Kconfig deleted +0 -13
@@ -1,13 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -config AMD_PTDMA - tristate "AMD PassThru DMA Engine" - depends on X86_64 && PCI - select DMA_ENGINE - select DMA_VIRTUAL_CHANNELS - help - Enable support for the AMD PTDMA 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.
Signature · 1 line
2.25.1
Basavaraj Natikar
maintainerPATCH v7 2/6 dmaengine: ae4dma: Add AMD ae4dma controller driver
In reply to Basavaraj NatikarAdd 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.
--- MAINTAINERS | 6 + drivers/dma/amd/Kconfig | 15 +++ drivers/dma/amd/Makefile | 1 + drivers/dma/amd/ae4dma/Makefile | 10 ++ drivers/dma/amd/ae4dma/ae4dma-dev.c | 151 +++++++++++++++++++++++ drivers/dma/amd/ae4dma/ae4dma-pci.c | 157 ++++++++++++++++++++++++ drivers/dma/amd/ae4dma/ae4dma.h | 96 +++++++++++++++ drivers/dma/amd/ptdma/ptdma-dmaengine.c | 49 ++++++++ 8 files changed, 485 insertions(+) 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
MAINTAINERS +6 -0
@@ -971,6 +971,12 @@ L: [email protected] S: Supported F: drivers/ras/amd/atl/* +AMD AE4DMA DRIVER +M: Basavaraj Natikar <[email protected]> +L: [email protected] +S: Supported +F: drivers/dma/amd/ae4dma/ + AMD AXI W1 DRIVER M: Kris Chaplin <[email protected]> R: Thomas Delev <[email protected]>
drivers/dma/amd/Kconfig +15 -0
@@ -1,5 +1,20 @@ # SPDX-License-Identifier: GPL-2.0-only # + +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. + config AMD_PTDMA tristate "AMD PassThru DMA Engine" depends on X86_64 && PCI
drivers/dma/amd/Makefile +1 -0
@@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_AMD_AE4DMA) += ae4dma/ obj-$(CONFIG_AMD_PTDMA) += ptdma/ obj-$(CONFIG_AMD_QDMA) += qdma/
drivers/dma/amd/ae4dma/Makefile new file +10 -0
@@ -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
drivers/dma/amd/ae4dma/ae4dma-dev.c new file +151 -0
151 lines not on this page · raw message
drivers/dma/amd/ae4dma/ae4dma-pci.c new file +157 -0
157 lines not on this page · raw message
drivers/dma/amd/ae4dma/ae4dma.h new file +96 -0
96 lines not on this page · raw message
drivers/dma/amd/ptdma/ptdma-dmaengine.c +49 -0
57 lines not on this page · raw message
Signature · 1 line
2.25.1
Basavaraj Natikar
maintainerPATCH v7 3/6 dmaengine: ptdma: Extend ptdma to support multi-channel and version
In reply to Basavaraj NatikarTo support multi-channel functionality with AE4DMA engine, extend the PTDMA code with reusable components.
--- drivers/dma/amd/ae4dma/ae4dma.h | 2 + drivers/dma/amd/ptdma/ptdma-dmaengine.c | 105 +++++++++++++++++++----- drivers/dma/amd/ptdma/ptdma.h | 2 + 3 files changed, 89 insertions(+), 20 deletions(-)
drivers/dma/amd/ae4dma/ae4dma.h +2 -0
@@ -34,6 +34,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 ];
drivers/dma/amd/ptdma/ptdma-dmaengine.c +85 -20
196 lines not on this page · raw message
drivers/dma/amd/ptdma/ptdma.h +2 -0
@@ -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; };/*
Signature · 1 line
2.25.1
Basavaraj Natikar
maintainerPATCH v7 4/6 dmaengine: ae4dma: Register AE4DMA using pt_dmaengine_register
In reply to Basavaraj NatikarUse the pt_dmaengine_register function to register a AE4DMA DMA engine.
--- drivers/dma/amd/ae4dma/ae4dma-dev.c | 4 ++ drivers/dma/amd/ae4dma/ae4dma-pci.c | 1 + drivers/dma/amd/ae4dma/ae4dma.h | 2 + drivers/dma/amd/ptdma/ptdma-dmaengine.c | 68 ++++++++++++++++++++++++- 4 files changed, 73 insertions(+), 2 deletions(-)
drivers/dma/amd/ae4dma/ae4dma-dev.c +4 -0
@@ -147,5 +147,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; }
drivers/dma/amd/ae4dma/ae4dma-pci.c +1 -0
@@ -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) {
drivers/dma/amd/ae4dma/ae4dma.h +2 -0
@@ -35,6 +35,7 @@#define AE4_Q_SZ 0x20#define AE4_DMA_VERSION 4 +#define CMD_AE4_DESC_DW0_VAL 2struct ae4_msix {int msix_count;
@@ -55,6 +56,7 @@ struct ae4_cmd_queue {atomic64_t done_cnt;u64 q_cmd_count;u32 dridx; +u32 tail_wi;u32 id; };
drivers/dma/amd/ptdma/ptdma-dmaengine.c +66 -2
98 lines not on this page · raw message
Signature · 1 line
2.25.1
kernel test robot
build botRe: [PATCH v7 4/6] dmaengine: ae4dma: Register AE4DMA using pt_dmaengine_register
kernel test robot noticed the following build errors:
Hi Basavaraj,
kernel test robot noticed the following build errors:
[auto build test ERROR on vkoul-dmaengine/next]
[also build test ERROR on linus/master v6.12-rc4 next-20241024] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Basavaraj-Natikar/dmaengine-Move-AMD-PTDMA-driver-to-amd-directory/20241023-203903 base: https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git next patch link: https://lore.kernel.org/r/20241023123613.710671-5-Basavaraj.Natikar%40amd.com patch subject: [PATCH v7 4/6] dmaengine: ae4dma: Register AE4DMA using pt_dmaengine_register config: x86_64-buildonly-randconfig-004-20241024 (https://download.01.org/0day-ci/archive/20241025/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241025/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
drivers/dma/amd/ptdma/ptdma-dmaengine.c: In function 'ae4_core_execute_cmd':
>> drivers/dma/amd/ptdma/ptdma-dmaengine.c:115:20: error: implicit declaration of function 'FIELD_GET' [-Werror=implicit-function-declaration]
115 | bool soc = FIELD_GET(DWORD0_SOC, desc->dwouv.dw0);
| ^~~~~~~~~
>> drivers/dma/amd/ptdma/ptdma-dmaengine.c:119:36: error: implicit declaration of function 'FIELD_PREP' [-Werror=implicit-function-declaration]
119 | desc->dwouv.dw0 |= FIELD_PREP(DWORD0_IOC, desc->dwouv.dw0);
| ^~~~~~~~~~cc1: some warnings being treated as errors
vim +/FIELD_GET +115 drivers/dma/amd/ptdma/ptdma-dmaengine.c
112
113 static int ae4_core_execute_cmd(struct ae4dma_desc *desc, struct ae4_cmd_queue *ae4cmd_q)
114 {
> 115 bool soc = FIELD_GET(DWORD0_SOC, desc->dwouv.dw0);
116 struct pt_cmd_queue *cmd_q = &ae4cmd_q->cmd_q;
117
118 if (soc) {
> 119 desc->dwouv.dw0 |= FIELD_PREP(DWORD0_IOC, desc->dwouv.dw0); 120 desc->dwouv.dw0 &= ~DWORD0_SOC;
121 }
122
123 mutex_lock(&ae4cmd_q->cmd_lock);
124 memcpy(&cmd_q->qbase[ae4cmd_q->tail_wi], desc, sizeof(struct ae4dma_desc));
125 ae4cmd_q->q_cmd_count++;
126 ae4cmd_q->tail_wi = (ae4cmd_q->tail_wi + 1) % CMD_Q_LEN;
127 writel(ae4cmd_q->tail_wi, cmd_q->reg_control + AE4_WR_IDX_OFF);
128 mutex_unlock(&ae4cmd_q->cmd_lock);
129
130 wake_up(&ae4cmd_q->q_w);
131
132 return 0;
133 }
134
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH v7 4/6] dmaengine: ae4dma: Register AE4DMA using pt_dmaengine_register
In reply to Basavaraj Natikarkernel test robot noticed the following build errors:
Hi Basavaraj,
kernel test robot noticed the following build errors:
[auto build test ERROR on vkoul-dmaengine/next]
[also build test ERROR on linus/master v6.12-rc4 next-20241024] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Basavaraj-Natikar/dmaengine-Move-AMD-PTDMA-driver-to-amd-directory/20241023-203903 base: https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git next patch link: https://lore.kernel.org/r/20241023123613.710671-5-Basavaraj.Natikar%40amd.com patch subject: [PATCH v7 4/6] dmaengine: ae4dma: Register AE4DMA using pt_dmaengine_register config: x86_64-buildonly-randconfig-003-20241025 (https://download.01.org/0day-ci/archive/20241025/[email protected]/config) compiler: clang version 19.1.2 (https://github.com/llvm/llvm-project 7ba7d8e2f7b6445b60679da826210cdde29eaf8b) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241025/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from drivers/dma/amd/ptdma/ptdma-dmaengine.c:12:
In file included from drivers/dma/amd/ptdma/ptdma.h:17:
In file included from include/linux/dmaengine.h:12:
In file included from include/linux/scatterlist.h:8:
In file included from include/linux/mm.h:2213:
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
>> drivers/dma/amd/ptdma/ptdma-dmaengine.c:115:13: error: call to undeclared function 'FIELD_GET'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
115 | bool soc = FIELD_GET(DWORD0_SOC, desc->dwouv.dw0);
| ^
>> drivers/dma/amd/ptdma/ptdma-dmaengine.c:119:22: error: call to undeclared function 'FIELD_PREP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
119 | desc->dwouv.dw0 |= FIELD_PREP(DWORD0_IOC, desc->dwouv.dw0);
| ^1 warning and 2 errors generated.
vim +/FIELD_GET +115 drivers/dma/amd/ptdma/ptdma-dmaengine.c
112
113 static int ae4_core_execute_cmd(struct ae4dma_desc *desc, struct ae4_cmd_queue *ae4cmd_q)
114 {
> 115 bool soc = FIELD_GET(DWORD0_SOC, desc->dwouv.dw0);
116 struct pt_cmd_queue *cmd_q = &ae4cmd_q->cmd_q;
117
118 if (soc) {
> 119 desc->dwouv.dw0 |= FIELD_PREP(DWORD0_IOC, desc->dwouv.dw0); 120 desc->dwouv.dw0 &= ~DWORD0_SOC;
121 }
122
123 mutex_lock(&ae4cmd_q->cmd_lock);
124 memcpy(&cmd_q->qbase[ae4cmd_q->tail_wi], desc, sizeof(struct ae4dma_desc));
125 ae4cmd_q->q_cmd_count++;
126 ae4cmd_q->tail_wi = (ae4cmd_q->tail_wi + 1) % CMD_Q_LEN;
127 writel(ae4cmd_q->tail_wi, cmd_q->reg_control + AE4_WR_IDX_OFF);
128 mutex_unlock(&ae4cmd_q->cmd_lock);
129
130 wake_up(&ae4cmd_q->q_w);
131
132 return 0;
133 }
134
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Basavaraj Natikar
maintainerPATCH v7 5/6 dmaengine: ptdma: Extend ptdma-debugfs to support multi-queue
In reply to Basavaraj NatikarTo support multi-channel functionality with AE4DMA engine, extend the ptdma-debugfs with reusable components.
--- drivers/dma/amd/ptdma/ptdma-debugfs.c | 78 +++++++++++++++++++-------- 1 file changed, 57 insertions(+), 21 deletions(-)
drivers/dma/amd/ptdma/ptdma-debugfs.c +57 -21
@@ -13,6 +13,7 @@#include <linux/seq_file.h> #include "ptdma.h" +#include "../ae4dma/ae4dma.h" /* DebugFS helpers */ #define RI_VERSION_NUM 0x0000003F
@@ -23,11 +24,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 +64,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 +72,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 +100,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 +116,27 @@ void ptdma_debugfs_setup(struct pt_device *pt)debugfs_create_file ("stats" ,0400 , pt->dma_dev.dbg_dev_root, pt, &pt_debugfs_stats_fops); - cmd_q = &pt->cmd_q; - - debugfs_q_instance = -debugfs_create_dir ("q" , pt->dma_dev.dbg_dev_root); -debugfs_create_file ("stats" ,0400 , debugfs_q_instance, cmd_q, - &pt_debugfs_queue_fops); +if (pt->ver ==AE4_DMA_VERSION ) { + ae4 = container_of(pt, struct ae4_device, pt); +for (i =0 ; i < ae4->cmd_q_count; i++) { + ae4cmd_q = &ae4->ae4cmd_q[i]; + cmd_q = &ae4cmd_q->cmd_q; + +memset (name,0 ,sizeof (name)); +snprintf (name,29 ,"q%d" , ae4cmd_q->id); + + debugfs_q_instance = +debugfs_create_dir (name, pt->dma_dev.dbg_dev_root); + +debugfs_create_file ("stats" ,0400 , debugfs_q_instance, cmd_q, + &pt_debugfs_queue_fops); + } + }else { + debugfs_q_instance = +debugfs_create_dir ("q" , pt->dma_dev.dbg_dev_root); + cmd_q = &pt->cmd_q; +debugfs_create_file ("stats" ,0400 , debugfs_q_instance, cmd_q, + &pt_debugfs_queue_fops); + } }
Signature · 1 line
2.25.1
Basavaraj Natikar
maintainerPATCH v7 6/6 dmaengine: ae4dma: Register debugfs using ptdma_debugfs_setup
In reply to Basavaraj NatikarUse the ptdma_debugfs_setup function to register debugfs for AE4DMA DMA engine.
--- drivers/dma/amd/ae4dma/ae4dma-dev.c | 2 ++ drivers/dma/amd/ptdma/ptdma-debugfs.c | 1 + 2 files changed, 3 insertions(+)
drivers/dma/amd/ae4dma/ae4dma-dev.c +2 -0
@@ -150,6 +150,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; }
drivers/dma/amd/ptdma/ptdma-debugfs.c +1 -0
@@ -140,3 +140,4 @@ void ptdma_debugfs_setup(struct pt_device *pt) &pt_debugfs_queue_fops); } } +EXPORT_SYMBOL_GPL (ptdma_debugfs_setup);
Signature · 1 line
2.25.1