From: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
To: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>,
dri-devel@lists.freedesktop.org
Cc: Oded Gabbay <ogabbay@kernel.org>, Jeffrey Hugo <quic_jhugo@quicinc.com>
Subject: Re: [PATCH 3/5] accel/ivpu: Add debugfs files for testing device reset
Date: Fri, 7 Jul 2023 09:10:24 +0200 [thread overview]
Message-ID: <a1d2cd0b-57ee-2156-60e8-6978b0aecbe3@linux.intel.com> (raw)
In-Reply-To: <20230524074847.866711-4-stanislaw.gruszka@linux.intel.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
On 24.05.2023 09:48, Stanislaw Gruszka wrote:
> Add new debugfs files to validate device recovery functionality.
>
> Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
> ---
> drivers/accel/ivpu/ivpu_debugfs.c | 41 +++++++++++++++++++++++++++++++
> drivers/accel/ivpu/ivpu_pm.c | 1 +
> drivers/accel/ivpu/ivpu_pm.h | 1 +
> 3 files changed, 43 insertions(+)
>
> diff --git a/drivers/accel/ivpu/ivpu_debugfs.c b/drivers/accel/ivpu/ivpu_debugfs.c
> index a9180fae43b6..e2502d2b53c0 100644
> --- a/drivers/accel/ivpu/ivpu_debugfs.c
> +++ b/drivers/accel/ivpu/ivpu_debugfs.c
> @@ -77,11 +77,31 @@ static int last_bootmode_show(struct seq_file *s, void *v)
> return 0;
> }
>
> +static int reset_counter_show(struct seq_file *s, void *v)
> +{
> + struct drm_info_node *node = (struct drm_info_node *)s->private;
> + struct ivpu_device *vdev = to_ivpu_device(node->minor->dev);
> +
> + seq_printf(s, "%d\n", atomic_read(&vdev->pm->reset_counter));
> + return 0;
> +}
> +
> +static int reset_pending_show(struct seq_file *s, void *v)
> +{
> + struct drm_info_node *node = (struct drm_info_node *)s->private;
> + struct ivpu_device *vdev = to_ivpu_device(node->minor->dev);
> +
> + seq_printf(s, "%d\n", atomic_read(&vdev->pm->in_reset));
> + return 0;
> +}
> +
> static const struct drm_info_list vdev_debugfs_list[] = {
> {"bo_list", bo_list_show, 0},
> {"fw_trace_capability", fw_trace_capability_show, 0},
> {"fw_trace_config", fw_trace_config_show, 0},
> {"last_bootmode", last_bootmode_show, 0},
> + {"reset_counter", reset_counter_show, 0},
> + {"reset_pending", reset_pending_show, 0},
> };
>
> static int fw_log_show(struct seq_file *s, void *v)
> @@ -216,6 +236,24 @@ ivpu_reset_engine_fn(struct file *file, const char __user *user_buf, size_t size
> return size;
> }
>
> +static ssize_t
> +ivpu_force_recovery_fn(struct file *file, const char __user *user_buf, size_t size, loff_t *pos)
> +{
> + struct ivpu_device *vdev = file->private_data;
> +
> + if (!size)
> + return -EINVAL;
> +
> + ivpu_pm_schedule_recovery(vdev);
> + return size;
> +}
> +
> +static const struct file_operations ivpu_force_recovery_fops = {
> + .owner = THIS_MODULE,
> + .open = simple_open,
> + .write = ivpu_force_recovery_fn,
> +};
> +
> static const struct file_operations ivpu_reset_engine_fops = {
> .owner = THIS_MODULE,
> .open = simple_open,
> @@ -229,6 +267,9 @@ void ivpu_debugfs_init(struct drm_minor *minor)
> drm_debugfs_create_files(vdev_debugfs_list, ARRAY_SIZE(vdev_debugfs_list),
> minor->debugfs_root, minor);
>
> + debugfs_create_file("force_recovery", 0200, minor->debugfs_root, vdev,
> + &ivpu_force_recovery_fops);
> +
> debugfs_create_file("fw_log", 0644, minor->debugfs_root, vdev,
> &fw_log_fops);
> debugfs_create_file("fw_trace_destination_mask", 0200, minor->debugfs_root, vdev,
> diff --git a/drivers/accel/ivpu/ivpu_pm.c b/drivers/accel/ivpu/ivpu_pm.c
> index aa4d56dc52b3..e6f27daf5560 100644
> --- a/drivers/accel/ivpu/ivpu_pm.c
> +++ b/drivers/accel/ivpu/ivpu_pm.c
> @@ -259,6 +259,7 @@ void ivpu_pm_reset_prepare_cb(struct pci_dev *pdev)
> pm_runtime_get_sync(vdev->drm.dev);
>
> ivpu_dbg(vdev, PM, "Pre-reset..\n");
> + atomic_inc(&vdev->pm->reset_counter);
> atomic_set(&vdev->pm->in_reset, 1);
> ivpu_shutdown(vdev);
> ivpu_pm_prepare_cold_boot(vdev);
> diff --git a/drivers/accel/ivpu/ivpu_pm.h b/drivers/accel/ivpu/ivpu_pm.h
> index baca98187255..fd4eada1290f 100644
> --- a/drivers/accel/ivpu/ivpu_pm.h
> +++ b/drivers/accel/ivpu/ivpu_pm.h
> @@ -14,6 +14,7 @@ struct ivpu_pm_info {
> struct ivpu_device *vdev;
> struct work_struct recovery_work;
> atomic_t in_reset;
> + atomic_t reset_counter;
> bool is_warmboot;
> u32 suspend_reschedule_counter;
> };
next prev parent reply other threads:[~2023-07-07 7:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-24 7:48 [PATCH 0/5] accel/ivpu: Add debugfs support Stanislaw Gruszka
2023-05-24 7:48 ` [PATCH 1/5] accel/ivpu: Initial " Stanislaw Gruszka
2023-07-07 7:11 ` Jacek Lawrynowicz
2023-05-24 7:48 ` [PATCH 2/5] accel/ivpu: Add firmware tracing support Stanislaw Gruszka
2023-07-07 7:11 ` Jacek Lawrynowicz
2023-05-24 7:48 ` [PATCH 3/5] accel/ivpu: Add debugfs files for testing device reset Stanislaw Gruszka
2023-07-07 7:10 ` Jacek Lawrynowicz [this message]
2023-05-24 7:48 ` [PATCH 4/5] accel/ivpu: Print firmware name and version Stanislaw Gruszka
2023-05-24 7:48 ` [PATCH 5/5] accel/ivpu: Add fw_name file to debugfs Stanislaw Gruszka
2023-05-24 7:55 ` [PATCH 0/5] accel/ivpu: Add debugfs support Oded Gabbay
2023-05-24 8:29 ` Stanislaw Gruszka
2023-05-24 9:52 ` Oded Gabbay
2023-07-07 8:04 ` Stanislaw Gruszka
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=a1d2cd0b-57ee-2156-60e8-6978b0aecbe3@linux.intel.com \
--to=jacek.lawrynowicz@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=ogabbay@kernel.org \
--cc=quic_jhugo@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.