Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dmaengine: ptdma: Extend ptdma-debugfs to support multi-queue

To support multi-channel functionality with AE4DMA engine, extend the
ptdma-debugfs with reusable components.

Reviewed-by: Raju Rangoju <Raju.Rangoju@amd.com>
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Link: https://lore.kernel.org/r/20241025095931.726018-6-Basavaraj.Natikar@amd.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Basavaraj Natikar and committed by
Vinod Koul
b10b278e 98f5a443

+55 -19
+55 -19
drivers/dma/amd/ptdma/ptdma-debugfs.c
··· 13 13 #include <linux/seq_file.h> 14 14 15 15 #include "ptdma.h" 16 + #include "../ae4dma/ae4dma.h" 16 17 17 18 /* DebugFS helpers */ 18 19 #define RI_VERSION_NUM 0x0000003F ··· 24 23 static int pt_debugfs_info_show(struct seq_file *s, void *p) 25 24 { 26 25 struct pt_device *pt = s->private; 26 + struct ae4_device *ae4; 27 27 unsigned int regval; 28 28 29 29 seq_printf(s, "Device name: %s\n", dev_name(pt->dev)); 30 - seq_printf(s, " # Queues: %d\n", 1); 31 - seq_printf(s, " # Cmds: %d\n", pt->cmd_count); 30 + 31 + if (pt->ver == AE4_DMA_VERSION) { 32 + ae4 = container_of(pt, struct ae4_device, pt); 33 + seq_printf(s, " # Queues: %d\n", ae4->cmd_q_count); 34 + seq_printf(s, " # Cmds per queue: %d\n", CMD_Q_LEN); 35 + } else { 36 + seq_printf(s, " # Queues: %d\n", 1); 37 + seq_printf(s, " # Cmds: %d\n", pt->cmd_count); 38 + } 32 39 33 40 regval = ioread32(pt->io_regs + CMD_PT_VERSION); 34 41 ··· 64 55 static int pt_debugfs_queue_show(struct seq_file *s, void *p) 65 56 { 66 57 struct pt_cmd_queue *cmd_q = s->private; 58 + struct pt_device *pt; 67 59 unsigned int regval; 68 60 69 61 if (!cmd_q) ··· 72 62 73 63 seq_printf(s, " Pass-Thru: %ld\n", cmd_q->total_pt_ops); 74 64 75 - regval = ioread32(cmd_q->reg_control + 0x000C); 65 + pt = cmd_q->pt; 66 + if (pt->ver == AE4_DMA_VERSION) { 67 + regval = readl(cmd_q->reg_control + 0x4); 68 + seq_printf(s, " Enabled Interrupts:: status 0x%x\n", regval); 69 + } else { 70 + regval = ioread32(cmd_q->reg_control + 0x000C); 76 71 77 - seq_puts(s, " Enabled Interrupts:"); 78 - if (regval & INT_EMPTY_QUEUE) 79 - seq_puts(s, " EMPTY"); 80 - if (regval & INT_QUEUE_STOPPED) 81 - seq_puts(s, " STOPPED"); 82 - if (regval & INT_ERROR) 83 - seq_puts(s, " ERROR"); 84 - if (regval & INT_COMPLETION) 85 - seq_puts(s, " COMPLETION"); 86 - seq_puts(s, "\n"); 72 + seq_puts(s, " Enabled Interrupts:"); 73 + if (regval & INT_EMPTY_QUEUE) 74 + seq_puts(s, " EMPTY"); 75 + if (regval & INT_QUEUE_STOPPED) 76 + seq_puts(s, " STOPPED"); 77 + if (regval & INT_ERROR) 78 + seq_puts(s, " ERROR"); 79 + if (regval & INT_COMPLETION) 80 + seq_puts(s, " COMPLETION"); 81 + seq_puts(s, "\n"); 82 + } 87 83 88 84 return 0; 89 85 } ··· 100 84 101 85 void ptdma_debugfs_setup(struct pt_device *pt) 102 86 { 103 - struct pt_cmd_queue *cmd_q; 104 87 struct dentry *debugfs_q_instance; 88 + struct ae4_cmd_queue *ae4cmd_q; 89 + struct pt_cmd_queue *cmd_q; 90 + struct ae4_device *ae4; 91 + char name[30]; 92 + int i; 105 93 106 94 if (!debugfs_initialized()) 107 95 return; ··· 116 96 debugfs_create_file("stats", 0400, pt->dma_dev.dbg_dev_root, pt, 117 97 &pt_debugfs_stats_fops); 118 98 119 - cmd_q = &pt->cmd_q; 120 99 121 - debugfs_q_instance = 122 - debugfs_create_dir("q", pt->dma_dev.dbg_dev_root); 100 + if (pt->ver == AE4_DMA_VERSION) { 101 + ae4 = container_of(pt, struct ae4_device, pt); 102 + for (i = 0; i < ae4->cmd_q_count; i++) { 103 + ae4cmd_q = &ae4->ae4cmd_q[i]; 104 + cmd_q = &ae4cmd_q->cmd_q; 123 105 124 - debugfs_create_file("stats", 0400, debugfs_q_instance, cmd_q, 125 - &pt_debugfs_queue_fops); 106 + memset(name, 0, sizeof(name)); 107 + snprintf(name, 29, "q%d", ae4cmd_q->id); 108 + 109 + debugfs_q_instance = 110 + debugfs_create_dir(name, pt->dma_dev.dbg_dev_root); 111 + 112 + debugfs_create_file("stats", 0400, debugfs_q_instance, cmd_q, 113 + &pt_debugfs_queue_fops); 114 + } 115 + } else { 116 + debugfs_q_instance = 117 + debugfs_create_dir("q", pt->dma_dev.dbg_dev_root); 118 + cmd_q = &pt->cmd_q; 119 + debugfs_create_file("stats", 0400, debugfs_q_instance, cmd_q, 120 + &pt_debugfs_queue_fops); 121 + } 126 122 }