From: John Harrison <john.c.harrison@intel.com>
To: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>,
<intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH v2 11/12] drm/xe/pxp: Add PXP debugfs support
Date: Tue, 8 Oct 2024 18:26:55 -0700 [thread overview]
Message-ID: <6fdf094e-59a1-4d45-b814-ed72361ff672@intel.com> (raw)
In-Reply-To: <20240816190024.2176976-12-daniele.ceraolospurio@intel.com>
On 8/16/2024 12:00, Daniele Ceraolo Spurio wrote:
> This patch introduces 2 PXP debugfs entries:
>
> - info: prints the current PXP status and key instance
> - terminate: simulate a termination interrupt
>
> The first one is useful for debug, while the second one can be used for
> testing the termination flow.
>
> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> ---
> drivers/gpu/drm/xe/Makefile | 1 +
> drivers/gpu/drm/xe/xe_debugfs.c | 3 +
> drivers/gpu/drm/xe/xe_pxp_debugfs.c | 120 ++++++++++++++++++++++++++++
> drivers/gpu/drm/xe/xe_pxp_debugfs.h | 13 +++
> 4 files changed, 137 insertions(+)
> create mode 100644 drivers/gpu/drm/xe/xe_pxp_debugfs.c
> create mode 100644 drivers/gpu/drm/xe/xe_pxp_debugfs.h
>
> diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile
> index a508b9166b88..7cc65f419710 100644
> --- a/drivers/gpu/drm/xe/Makefile
> +++ b/drivers/gpu/drm/xe/Makefile
> @@ -84,6 +84,7 @@ xe-y += xe_bb.o \
> xe_pt.o \
> xe_pt_walk.o \
> xe_pxp.o \
> + xe_pxp_debugfs.o \
> xe_pxp_submit.o \
> xe_query.o \
> xe_range_fence.o \
> diff --git a/drivers/gpu/drm/xe/xe_debugfs.c b/drivers/gpu/drm/xe/xe_debugfs.c
> index 1011e5d281fa..a04f9c2d886b 100644
> --- a/drivers/gpu/drm/xe/xe_debugfs.c
> +++ b/drivers/gpu/drm/xe/xe_debugfs.c
> @@ -17,6 +17,7 @@
> #include "xe_gt_printk.h"
> #include "xe_guc_ads.h"
> #include "xe_pm.h"
> +#include "xe_pxp_debugfs.h"
> #include "xe_sriov.h"
> #include "xe_step.h"
>
> @@ -214,6 +215,8 @@ void xe_debugfs_register(struct xe_device *xe)
> for_each_gt(gt, xe, id)
> xe_gt_debugfs_register(gt);
>
> + xe_pxp_debugfs_register(xe->pxp);
> +
> #ifdef CONFIG_FAULT_INJECTION
> fault_create_debugfs_attr("fail_gt_reset", root, >_reset_failure);
> #endif
> diff --git a/drivers/gpu/drm/xe/xe_pxp_debugfs.c b/drivers/gpu/drm/xe/xe_pxp_debugfs.c
> new file mode 100644
> index 000000000000..00c8179a9f0f
> --- /dev/null
> +++ b/drivers/gpu/drm/xe/xe_pxp_debugfs.c
> @@ -0,0 +1,120 @@
> +// SPDX-License-Identifier: MIT
> +/*
> + * Copyright © 2024 Intel Corporation
> + */
> +
> +#include "xe_pxp_debugfs.h"
> +
> +#include <linux/debugfs.h>
> +
> +#include <drm/drm_debugfs.h>
> +#include <drm/drm_managed.h>
> +#include <drm/drm_print.h>
> +
> +#include "xe_device.h"
> +#include "xe_pxp.h"
> +#include "xe_pxp_types.h"
> +#include "regs/xe_gt_regs.h"
> +
> +static struct xe_pxp *node_to_pxp(struct drm_info_node *node)
> +{
> + return node->info_ent->data;
> +}
> +
> +static const char *pxp_status_to_str(struct xe_pxp *pxp)
> +{
> + lockdep_assert_held(&pxp->mutex);
> +
> + switch (pxp->status) {
> + case XE_PXP_ERROR:
> + return "error";
> + case XE_PXP_NEEDS_TERMINATION:
> + return "needs termination";
> + case XE_PXP_TERMINATION_IN_PROGRESS:
> + return "termination in progress";
> + case XE_PXP_READY_TO_START:
> + return "ready to start";
> + case XE_PXP_ACTIVE:
> + return "active";
> + case XE_PXP_SUSPENDED:
> + return "suspended";
> + default:
> + return "unknown";
> + }
> +};
> +
> +static int pxp_info(struct seq_file *m, void *data)
> +{
> + struct xe_pxp *pxp = node_to_pxp(m->private);
> + struct drm_printer p = drm_seq_file_printer(m);
> + const char *status;
> +
> + if (!xe_pxp_is_enabled(pxp))
> + return -ENODEV;
> +
> + mutex_lock(&pxp->mutex);
> + status = pxp_status_to_str(pxp);
> + mutex_unlock(&pxp->mutex);
> +
> + drm_printf(&p, "status: %s\n", status);
> + drm_printf(&p, "instance counter: %u\n", pxp->key_instance);
Maybe cache this inside the mutex lock as well? So that the instance and
the status were at least a valid pair at one point even if things might
have changed since.
John.
> +
> + return 0;
> +}
> +
> +static int pxp_terminate(struct seq_file *m, void *data)
> +{
> + struct xe_pxp *pxp = node_to_pxp(m->private);
> + struct drm_printer p = drm_seq_file_printer(m);
> +
> + if (!xe_pxp_is_enabled(pxp))
> + return -ENODEV;
> +
> + /* simulate a termination interrupt */
> + spin_lock_irq(&pxp->xe->irq.lock);
> + xe_pxp_irq_handler(pxp->xe, KCR_PXP_STATE_TERMINATED_INTERRUPT);
> + spin_unlock_irq(&pxp->xe->irq.lock);
> +
> + drm_printf(&p, "Termination queued\n");
> +
> + return 0;
> +}
> +
> +static const struct drm_info_list debugfs_list[] = {
> + {"info", pxp_info, 0},
> + {"terminate", pxp_terminate, 0},
> +};
> +
> +void xe_pxp_debugfs_register(struct xe_pxp *pxp)
> +{
> + struct drm_minor *minor;
> + struct drm_info_list *local;
> + struct dentry *root;
> + int i;
> +
> + if (!xe_pxp_is_enabled(pxp))
> + return;
> +
> + minor = pxp->xe->drm.primary;
> + if (!minor->debugfs_root)
> + return;
> +
> +#define DEBUGFS_SIZE (ARRAY_SIZE(debugfs_list) * sizeof(struct drm_info_list))
> + local = drmm_kmalloc(&pxp->xe->drm, DEBUGFS_SIZE, GFP_KERNEL);
> + if (!local)
> + return;
> +
> + memcpy(local, debugfs_list, DEBUGFS_SIZE);
> +#undef DEBUGFS_SIZE
> +
> + for (i = 0; i < ARRAY_SIZE(debugfs_list); ++i)
> + local[i].data = pxp;
> +
> + root = debugfs_create_dir("pxp", minor->debugfs_root);
> + if (IS_ERR(root))
> + return;
> +
> + drm_debugfs_create_files(local,
> + ARRAY_SIZE(debugfs_list),
> + root, minor);
> +}
> diff --git a/drivers/gpu/drm/xe/xe_pxp_debugfs.h b/drivers/gpu/drm/xe/xe_pxp_debugfs.h
> new file mode 100644
> index 000000000000..988466aad50b
> --- /dev/null
> +++ b/drivers/gpu/drm/xe/xe_pxp_debugfs.h
> @@ -0,0 +1,13 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2024 Intel Corporation
> + */
> +
> +#ifndef __XE_PXP_DEBUGFS_H__
> +#define __XE_PXP_DEBUGFS_H__
> +
> +struct xe_pxp;
> +
> +void xe_pxp_debugfs_register(struct xe_pxp *pxp);
> +
> +#endif /* __XE_PXP_DEBUGFS_H__ */
next prev parent reply other threads:[~2024-10-09 1:27 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-16 19:00 [PATCH v2 00/12] Add PXP HWDRM support Daniele Ceraolo Spurio
2024-08-16 19:00 ` [PATCH v2 01/12] drm/xe/pxp: Initialize PXP structure and KCR reg Daniele Ceraolo Spurio
2024-10-04 20:29 ` John Harrison
2024-08-16 19:00 ` [PATCH v2 02/12] drm/xe/pxp: Allocate PXP execution resources Daniele Ceraolo Spurio
2024-08-19 9:19 ` Jani Nikula
2024-10-04 20:30 ` John Harrison
2024-11-06 22:25 ` Daniele Ceraolo Spurio
2024-08-16 19:00 ` [PATCH v2 03/12] drm/xe/pxp: Add VCS inline termination support Daniele Ceraolo Spurio
2024-10-04 22:25 ` John Harrison
2024-11-06 23:49 ` Daniele Ceraolo Spurio
2024-11-14 18:46 ` John Harrison
2024-08-16 19:00 ` [PATCH v2 04/12] drm/xe/pxp: Add GSC session invalidation support Daniele Ceraolo Spurio
2024-10-07 20:05 ` John Harrison
2024-11-07 0:15 ` Daniele Ceraolo Spurio
2024-08-16 19:00 ` [PATCH v2 05/12] drm/xe/pxp: Handle the PXP termination interrupt Daniele Ceraolo Spurio
2024-10-08 0:34 ` John Harrison
2024-11-07 0:33 ` Daniele Ceraolo Spurio
2024-11-14 19:46 ` John Harrison
2024-08-16 19:00 ` [PATCH v2 06/12] drm/xe/pxp: Add GSC session initialization support Daniele Ceraolo Spurio
2024-10-08 18:43 ` John Harrison
2024-11-07 22:37 ` Daniele Ceraolo Spurio
2024-11-14 20:36 ` John Harrison
2024-08-16 19:00 ` [PATCH v2 07/12] drm/xe/pxp: Add spport for PXP-using queues Daniele Ceraolo Spurio
2024-10-08 23:55 ` John Harrison
2024-11-07 23:57 ` Daniele Ceraolo Spurio
2024-11-14 21:20 ` John Harrison
2024-11-14 21:39 ` Daniele Ceraolo Spurio
2024-11-15 0:47 ` Daniele Ceraolo Spurio
2024-10-09 10:07 ` Jani Nikula
2024-08-16 19:00 ` [PATCH v2 08/12] drm/xe/pxp: add a query for PXP status Daniele Ceraolo Spurio
2024-10-09 0:09 ` John Harrison
2024-11-12 21:29 ` Daniele Ceraolo Spurio
2024-08-16 19:00 ` [PATCH v2 09/12] drm/xe/pxp: Add API to mark a BO as using PXP Daniele Ceraolo Spurio
2024-10-09 0:42 ` John Harrison
2024-11-12 22:23 ` Daniele Ceraolo Spurio
2024-11-15 17:49 ` John Harrison
2024-11-15 18:03 ` Daniele Ceraolo Spurio
2024-08-16 19:00 ` [PATCH v2 10/12] drm/xe/pxp: add PXP PM support Daniele Ceraolo Spurio
2024-08-26 21:55 ` Daniele Ceraolo Spurio
2024-10-09 1:12 ` John Harrison
2024-11-12 22:27 ` Daniele Ceraolo Spurio
2024-08-16 19:00 ` [PATCH v2 11/12] drm/xe/pxp: Add PXP debugfs support Daniele Ceraolo Spurio
2024-10-09 1:26 ` John Harrison [this message]
2024-08-16 19:00 ` [PATCH v2 12/12] drm/xe/pxp: Enable PXP for MTL and LNL Daniele Ceraolo Spurio
2024-10-09 1:27 ` John Harrison
2024-08-16 19:06 ` ✓ CI.Patch_applied: success for Add PXP HWDRM support (rev2) Patchwork
2024-08-16 19:07 ` ✗ CI.checkpatch: warning " Patchwork
2024-08-16 19:08 ` ✓ CI.KUnit: success " Patchwork
2024-08-16 19:23 ` ✓ CI.Build: " Patchwork
2024-08-16 19:25 ` ✗ CI.Hooks: failure " Patchwork
2024-08-16 19:27 ` ✓ CI.checksparse: success " Patchwork
2024-08-16 20:11 ` ✗ CI.BAT: failure " Patchwork
2024-08-17 4:53 ` ✗ CI.FULL: " Patchwork
2024-08-19 14:33 ` [PATCH v2 00/12] Add PXP HWDRM support Souza, Jose
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=6fdf094e-59a1-4d45-b814-ed72361ff672@intel.com \
--to=john.c.harrison@intel.com \
--cc=daniele.ceraolospurio@intel.com \
--cc=intel-xe@lists.freedesktop.org \
/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