From: "Piotr Piórkowski" <piotr.piorkowski@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 3/5] drm/xe/pf: Expose basic info about VFs in debugfs
Date: Wed, 25 Jun 2025 18:07:56 +0200 [thread overview]
Message-ID: <20250625160756.l4c5guyunsvehexd@intel.com> (raw)
In-Reply-To: <20250624200923.1348-4-michal.wajdeczko@intel.com>
Michal Wajdeczko <michal.wajdeczko@intel.com> wrote on wto [2025-cze-24 22:09:21 +0200]:
> We already have function to print summary about VFs, but we missed
> to add debugfs attribute to make it visible. Do it now.
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> ---
> drivers/gpu/drm/xe/xe_debugfs.c | 4 +++
> drivers/gpu/drm/xe/xe_sriov_pf.c | 46 ++++++++++++++++++++++++++++++++
> drivers/gpu/drm/xe/xe_sriov_pf.h | 6 +++++
> 3 files changed, 56 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_debugfs.c b/drivers/gpu/drm/xe/xe_debugfs.c
> index d83cd6ed3fa8..24a5f99ed52f 100644
> --- a/drivers/gpu/drm/xe/xe_debugfs.c
> +++ b/drivers/gpu/drm/xe/xe_debugfs.c
> @@ -20,6 +20,7 @@
> #include "xe_pm.h"
> #include "xe_pxp_debugfs.h"
> #include "xe_sriov.h"
> +#include "xe_sriov_pf.h"
> #include "xe_step.h"
>
> #ifdef CONFIG_DRM_XE_DEBUG
> @@ -273,4 +274,7 @@ void xe_debugfs_register(struct xe_device *xe)
> xe_pxp_debugfs_register(xe->pxp);
>
> fault_create_debugfs_attr("fail_gt_reset", root, >_reset_failure);
> +
> + if (IS_SRIOV_PF(xe))
> + xe_sriov_pf_debugfs_register(xe, root);
> }
> diff --git a/drivers/gpu/drm/xe/xe_sriov_pf.c b/drivers/gpu/drm/xe/xe_sriov_pf.c
> index 0f721ae17b26..32788b83b8bd 100644
> --- a/drivers/gpu/drm/xe/xe_sriov_pf.c
> +++ b/drivers/gpu/drm/xe/xe_sriov_pf.c
> @@ -3,6 +3,8 @@
> * Copyright © 2023-2024 Intel Corporation
> */
>
> +#include <linux/debugfs.h>
> +#include <drm/drm_debugfs.h>
> #include <drm/drm_managed.h>
>
> #include "xe_assert.h"
> @@ -102,3 +104,47 @@ void xe_sriov_pf_print_vfs_summary(struct xe_device *xe, struct drm_printer *p)
> drm_printf(p, "supported: %u\n", xe->sriov.pf.driver_max_vfs);
> drm_printf(p, "enabled: %u\n", pci_num_vf(pdev));
> }
> +
> +static int simple_show(struct seq_file *m, void *data)
> +{
> + struct drm_printer p = drm_seq_file_printer(m);
> + struct drm_info_node *node = m->private;
> + struct dentry *parent = node->dent->d_parent;
> + struct xe_device *xe = parent->d_inode->i_private;
> + void (*print)(struct xe_device *, struct drm_printer *) = node->info_ent->data;
> +
> + if (WARN_ON(!print))
> + return -EINVAL;
NIT:
In my opinion, checking for null pointer dereference is unnecessary, and returning the error
to userspace can be omitted in this case.
> +
> + print(xe, &p);
> + return 0;
> +}
> +
> +static const struct drm_info_list debugfs_list[] = {
> + { .name = "vfs", .show = simple_show, .data = xe_sriov_pf_print_vfs_summary },
> +};
> +
> +/**
> + * xe_sriov_pf_debugfs_register - Register PF debugfs attributes.
> + * @xe: the &xe_device
> + * @root: the root &dentry
> + *
> + * Prepare debugfs attributes exposed by the PF.
> + */
> +void xe_sriov_pf_debugfs_register(struct xe_device *xe, struct dentry *root)
> +{
> + struct drm_minor *minor = xe->drm.primary;
> + struct dentry *parent;
> +
> + /*
> + * /sys/kernel/debug/dri/0/
> + * ├── pf
> + * │ ├── ...
> + */
> + parent = debugfs_create_dir("pf", root);
> + if (IS_ERR(parent))
> + return;
> + parent->d_inode->i_private = xe;
> +
> + drm_debugfs_create_files(debugfs_list, ARRAY_SIZE(debugfs_list), parent, minor);
> +}
> diff --git a/drivers/gpu/drm/xe/xe_sriov_pf.h b/drivers/gpu/drm/xe/xe_sriov_pf.h
> index d1220e70e1c0..c392c3fcf085 100644
> --- a/drivers/gpu/drm/xe/xe_sriov_pf.h
> +++ b/drivers/gpu/drm/xe/xe_sriov_pf.h
> @@ -8,12 +8,14 @@
>
> #include <linux/types.h>
>
> +struct dentry;
> struct drm_printer;
> struct xe_device;
>
> #ifdef CONFIG_PCI_IOV
> bool xe_sriov_pf_readiness(struct xe_device *xe);
> int xe_sriov_pf_init_early(struct xe_device *xe);
> +void xe_sriov_pf_debugfs_register(struct xe_device *xe, struct dentry *root);
> void xe_sriov_pf_print_vfs_summary(struct xe_device *xe, struct drm_printer *p);
> #else
> static inline bool xe_sriov_pf_readiness(struct xe_device *xe)
> @@ -25,6 +27,10 @@ static inline int xe_sriov_pf_init_early(struct xe_device *xe)
> {
> return 0;
> }
> +
> +static inline void xe_sriov_pf_debugfs_register(struct xe_device *xe, struct dentry *root)
> +{
> +}
One minor comment above. Besides that, LGTM
Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
> #endif
>
> #endif
> --
> 2.47.1
>
--
next prev parent reply other threads:[~2025-06-25 16:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-24 20:09 [PATCH 0/5] Relax VF/PF version negotiation Michal Wajdeczko
2025-06-24 20:09 ` [PATCH 1/5] drm/xe: Combine PF and VF device data into union Michal Wajdeczko
2025-06-25 15:04 ` Piotr Piórkowski
2025-06-24 20:09 ` [PATCH 2/5] drm/xe: Move PF and VF device types to separate headers Michal Wajdeczko
2025-06-25 15:17 ` Piotr Piórkowski
2025-06-24 20:09 ` [PATCH 3/5] drm/xe/pf: Expose basic info about VFs in debugfs Michal Wajdeczko
2025-06-25 16:07 ` Piotr Piórkowski [this message]
2025-06-24 20:09 ` [PATCH 4/5] drm/xe/pf: Stop requiring VF/PF version negotiation on every GT Michal Wajdeczko
2025-06-26 7:42 ` Piotr Piórkowski
2025-06-24 20:09 ` [PATCH 5/5] drm/xe/vf: Store negotiated VF/PF ABI version at device level Michal Wajdeczko
2025-06-26 7:55 ` Piotr Piórkowski
2025-06-24 20:37 ` ✗ CI.checkpatch: warning for Relax VF/PF version negotiation Patchwork
2025-06-24 20:38 ` ✓ CI.KUnit: success " Patchwork
2025-06-24 21:28 ` ✓ Xe.CI.BAT: " Patchwork
2025-06-25 18:48 ` ✗ Xe.CI.Full: failure " Patchwork
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=20250625160756.l4c5guyunsvehexd@intel.com \
--to=piotr.piorkowski@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=michal.wajdeczko@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