Skip to content

Commit e495e52

Browse files
committed
accel/qaic: Add fifo queued debugfs
When debugging functional issues with workload input processing, it is useful to know if requests are backing up in the fifo, or perhaps getting stuck elsewhere. To answer the question of how many requests are in the fifo, implement a "queued" debugfs entry per-dbc that returns the number of pending requests when read. Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Reviewed-by: Carl Vanderlip <quic_carlv@quicinc.com> Reviewed-by: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com> Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240322175730.3855440-4-quic_jhugo@quicinc.com
1 parent b05d357 commit e495e52

3 files changed

Lines changed: 41 additions & 0 deletions

File tree

drivers/accel/qaic/qaic.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ int disable_dbc(struct qaic_device *qdev, u32 dbc_id, struct qaic_user *usr);
288288
void enable_dbc(struct qaic_device *qdev, u32 dbc_id, struct qaic_user *usr);
289289
void wakeup_dbc(struct qaic_device *qdev, u32 dbc_id);
290290
void release_dbc(struct qaic_device *qdev, u32 dbc_id);
291+
void qaic_data_get_fifo_info(struct dma_bridge_chan *dbc, u32 *head, u32 *tail);
291292

292293
void wake_all_cntl(struct qaic_device *qdev);
293294
void qaic_dev_reset_clean_local_state(struct qaic_device *qdev);

drivers/accel/qaic/qaic_data.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1981,3 +1981,12 @@ void release_dbc(struct qaic_device *qdev, u32 dbc_id)
19811981
dbc->in_use = false;
19821982
wake_up(&dbc->dbc_release);
19831983
}
1984+
1985+
void qaic_data_get_fifo_info(struct dma_bridge_chan *dbc, u32 *head, u32 *tail)
1986+
{
1987+
if (!dbc || !head || !tail)
1988+
return;
1989+
1990+
*head = readl(dbc->dbc_base + REQHP_OFF);
1991+
*tail = readl(dbc->dbc_base + REQTP_OFF);
1992+
}

drivers/accel/qaic/qaic_debugfs.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,36 @@ static const struct file_operations fifo_size_fops = {
9898
.release = single_release,
9999
};
100100

101+
static int read_dbc_queued(struct seq_file *s, void *unused)
102+
{
103+
struct dma_bridge_chan *dbc = s->private;
104+
u32 tail = 0, head = 0;
105+
106+
qaic_data_get_fifo_info(dbc, &head, &tail);
107+
108+
if (head == U32_MAX || tail == U32_MAX)
109+
seq_printf(s, "%u\n", 0);
110+
else if (head > tail)
111+
seq_printf(s, "%u\n", dbc->nelem - head + tail);
112+
else
113+
seq_printf(s, "%u\n", tail - head);
114+
115+
return 0;
116+
}
117+
118+
static int queued_open(struct inode *inode, struct file *file)
119+
{
120+
return single_open(file, read_dbc_queued, inode->i_private);
121+
}
122+
123+
static const struct file_operations queued_fops = {
124+
.owner = THIS_MODULE,
125+
.open = queued_open,
126+
.read = seq_read,
127+
.llseek = seq_lseek,
128+
.release = single_release,
129+
};
130+
101131
void qaic_debugfs_init(struct qaic_drm_device *qddev)
102132
{
103133
struct qaic_device *qdev = qddev->qdev;
@@ -117,6 +147,7 @@ void qaic_debugfs_init(struct qaic_drm_device *qddev)
117147
snprintf(name, QAIC_DBC_DIR_NAME, "dbc%03u", i);
118148
debugfs_dir = debugfs_create_dir(name, debugfs_root);
119149
debugfs_create_file("fifo_size", 0400, debugfs_dir, &qdev->dbc[i], &fifo_size_fops);
150+
debugfs_create_file("queued", 0400, debugfs_dir, &qdev->dbc[i], &queued_fops);
120151
}
121152
}
122153

0 commit comments

Comments
 (0)