Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
To: Jeffrey Hugo <quic_jhugo@quicinc.com>,
	quic_carlv@quicinc.com, quic_pkanojiy@quicinc.com,
	stanislaw.gruszka@linux.intel.com
Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
	ogabbay@kernel.org
Subject: Re: [PATCH 3/3] accel/qaic: Add fifo queued debugfs
Date: Thu, 14 Mar 2024 12:44:12 +0100	[thread overview]
Message-ID: <e53e5a34-b9cd-4147-9d1a-f46f2cc65a63@linux.intel.com> (raw)
In-Reply-To: <20240311165826.1728693-4-quic_jhugo@quicinc.com>

Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>

On 11.03.2024 17:58, Jeffrey Hugo wrote:
> 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>
> ---
>  drivers/accel/qaic/qaic.h         |  1 +
>  drivers/accel/qaic/qaic_data.c    |  9 +++++++++
>  drivers/accel/qaic/qaic_debugfs.c | 31 +++++++++++++++++++++++++++++++
>  3 files changed, 41 insertions(+)
> 
> diff --git a/drivers/accel/qaic/qaic.h b/drivers/accel/qaic/qaic.h
> index 03d9c9fbffb3..02561b6cecc6 100644
> --- a/drivers/accel/qaic/qaic.h
> +++ b/drivers/accel/qaic/qaic.h
> @@ -288,6 +288,7 @@ int disable_dbc(struct qaic_device *qdev, u32 dbc_id, struct qaic_user *usr);
>  void enable_dbc(struct qaic_device *qdev, u32 dbc_id, struct qaic_user *usr);
>  void wakeup_dbc(struct qaic_device *qdev, u32 dbc_id);
>  void release_dbc(struct qaic_device *qdev, u32 dbc_id);
> +void qaic_data_get_fifo_info(struct dma_bridge_chan *dbc, u32 *head, u32 *tail);
>  
>  void wake_all_cntl(struct qaic_device *qdev);
>  void qaic_dev_reset_clean_local_state(struct qaic_device *qdev);
> diff --git a/drivers/accel/qaic/qaic_data.c b/drivers/accel/qaic/qaic_data.c
> index 2459fe4a3f95..e86e71c1cdd8 100644
> --- a/drivers/accel/qaic/qaic_data.c
> +++ b/drivers/accel/qaic/qaic_data.c
> @@ -1981,3 +1981,12 @@ void release_dbc(struct qaic_device *qdev, u32 dbc_id)
>  	dbc->in_use = false;
>  	wake_up(&dbc->dbc_release);
>  }
> +
> +void qaic_data_get_fifo_info(struct dma_bridge_chan *dbc, u32 *head, u32 *tail)
> +{
> +	if (!dbc || !head || !tail)
> +		return;
> +
> +	*head = readl(dbc->dbc_base + REQHP_OFF);
> +	*tail = readl(dbc->dbc_base + REQTP_OFF);
> +}
> diff --git a/drivers/accel/qaic/qaic_debugfs.c b/drivers/accel/qaic/qaic_debugfs.c
> index 9d56cd451b64..12a65b98701d 100644
> --- a/drivers/accel/qaic/qaic_debugfs.c
> +++ b/drivers/accel/qaic/qaic_debugfs.c
> @@ -97,6 +97,36 @@ static const struct file_operations fifo_size_fops = {
>  	.release = single_release,
>  };
>  
> +static int read_dbc_queued(struct seq_file *s, void *unused)
> +{
> +	struct dma_bridge_chan *dbc = s->private;
> +	u32 tail = 0, head = 0;
> +
> +	qaic_data_get_fifo_info(dbc, &head, &tail);
> +
> +	if (head == U32_MAX || tail == U32_MAX)
> +		seq_printf(s, "%u\n", 0);
> +	else if (head > tail)
> +		seq_printf(s, "%u\n", dbc->nelem - head + tail);
> +	else
> +		seq_printf(s, "%u\n", tail - head);
> +
> +	return 0;
> +}
> +
> +static int queued_open(struct inode *inode, struct file *file)
> +{
> +	return single_open(file, read_dbc_queued, inode->i_private);
> +}
> +
> +static const struct file_operations queued_fops = {
> +	.owner = THIS_MODULE,
> +	.open = queued_open,
> +	.read = seq_read,
> +	.llseek = seq_lseek,
> +	.release = single_release,
> +};
> +
>  void qaic_debugfs_init(struct qaic_drm_device *qddev)
>  {
>  	struct qaic_device *qdev = qddev->qdev;
> @@ -112,6 +142,7 @@ void qaic_debugfs_init(struct qaic_drm_device *qddev)
>  		snprintf(name, QAIC_DBC_DIR_NAME, "dbc%03u", i);
>  		debugfs_dir = debugfs_create_dir(name, debugfs_root);
>  		debugfs_create_file("fifo_size", 0400, debugfs_dir, &qdev->dbc[i], &fifo_size_fops);
> +		debugfs_create_file("queued", 0400, debugfs_dir, &qdev->dbc[i], &queued_fops);
>  	}
>  }
>  

      reply	other threads:[~2024-03-14 11:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-11 16:58 [PATCH 0/3] accel/qaic: Add debugfs entries Jeffrey Hugo
2024-03-11 16:58 ` [PATCH 1/3] accel/qaic: Add bootlog debugfs Jeffrey Hugo
2024-03-14 11:41   ` Jacek Lawrynowicz
2024-03-15 15:39     ` Jeffrey Hugo
2024-03-18  8:49       ` Jacek Lawrynowicz
2024-03-11 16:58 ` [PATCH 2/3] accel/qaic: Add fifo size debugfs Jeffrey Hugo
2024-03-12  8:45   ` kernel test robot
2024-03-14 11:44   ` Jacek Lawrynowicz
2024-03-11 16:58 ` [PATCH 3/3] accel/qaic: Add fifo queued debugfs Jeffrey Hugo
2024-03-14 11:44   ` Jacek Lawrynowicz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e53e5a34-b9cd-4147-9d1a-f46f2cc65a63@linux.intel.com \
    --to=jacek.lawrynowicz@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=ogabbay@kernel.org \
    --cc=quic_carlv@quicinc.com \
    --cc=quic_jhugo@quicinc.com \
    --cc=quic_pkanojiy@quicinc.com \
    --cc=stanislaw.gruszka@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox