Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Subject: [PATCH 3/3] drm/xe: Add SR-IOV info attribute to debugfs
Date: Thu,  4 Apr 2024 17:44:31 +0200	[thread overview]
Message-ID: <20240404154431.583-4-michal.wajdeczko@intel.com> (raw)
In-Reply-To: <20240404154431.583-1-michal.wajdeczko@intel.com>

As SR-IOV support varies between platforms and the driver can run
in different SR-IOV modes, add debugfs file with these details.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
---
 drivers/gpu/drm/xe/xe_debugfs.c | 11 +++++++++++
 drivers/gpu/drm/xe/xe_sriov.c   | 14 ++++++++++++++
 drivers/gpu/drm/xe/xe_sriov.h   |  3 +++
 3 files changed, 28 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_debugfs.c b/drivers/gpu/drm/xe/xe_debugfs.c
index 8abdf3c17e1d..13e13f22ccff 100644
--- a/drivers/gpu/drm/xe/xe_debugfs.c
+++ b/drivers/gpu/drm/xe/xe_debugfs.c
@@ -13,6 +13,7 @@
 #include "xe_device.h"
 #include "xe_gt_debugfs.h"
 #include "xe_pm.h"
+#include "xe_sriov.h"
 #include "xe_step.h"
 
 #ifdef CONFIG_DRM_XE_DEBUG
@@ -70,8 +71,18 @@ static int info(struct seq_file *m, void *data)
 	return 0;
 }
 
+static int sriov_info(struct seq_file *m, void *data)
+{
+	struct xe_device *xe = node_to_xe(m->private);
+	struct drm_printer p = drm_seq_file_printer(m);
+
+	xe_sriov_print_info(xe, &p);
+	return 0;
+}
+
 static const struct drm_info_list debugfs_list[] = {
 	{"info", info, 0},
+	{ .name = "sriov_info", .show = sriov_info, },
 };
 
 static int forcewake_open(struct inode *inode, struct file *file)
diff --git a/drivers/gpu/drm/xe/xe_sriov.c b/drivers/gpu/drm/xe/xe_sriov.c
index 94fa98d8206e..d324f131e3da 100644
--- a/drivers/gpu/drm/xe/xe_sriov.c
+++ b/drivers/gpu/drm/xe/xe_sriov.c
@@ -101,3 +101,17 @@ int xe_sriov_init(struct xe_device *xe)
 
 	return drmm_add_action_or_reset(&xe->drm, fini_sriov, xe);
 }
+
+/**
+ * xe_sriov_print_info - Print basic SR-IOV information.
+ * @xe: the &xe_device to print info from
+ * @p: the &drm_printer
+ *
+ * Print SR-IOV related information into provided DRM printer.
+ */
+void xe_sriov_print_info(struct xe_device *xe, struct drm_printer *p)
+{
+	drm_printf(p, "supported: %s\n", str_yes_no(xe_device_has_sriov(xe)));
+	drm_printf(p, "enabled: %s\n", str_yes_no(IS_SRIOV(xe)));
+	drm_printf(p, "mode: %s\n", xe_sriov_mode_to_string(xe_device_sriov_mode(xe)));
+}
diff --git a/drivers/gpu/drm/xe/xe_sriov.h b/drivers/gpu/drm/xe/xe_sriov.h
index 9e3f58874e98..f9dec84d77e3 100644
--- a/drivers/gpu/drm/xe/xe_sriov.h
+++ b/drivers/gpu/drm/xe/xe_sriov.h
@@ -10,9 +10,12 @@
 #include "xe_device_types.h"
 #include "xe_sriov_types.h"
 
+struct drm_printer;
+
 const char *xe_sriov_mode_to_string(enum xe_sriov_mode mode);
 
 void xe_sriov_probe_early(struct xe_device *xe);
+void xe_sriov_print_info(struct xe_device *xe, struct drm_printer *p);
 int xe_sriov_init(struct xe_device *xe);
 
 static inline enum xe_sriov_mode xe_device_sriov_mode(struct xe_device *xe)
-- 
2.43.0


  parent reply	other threads:[~2024-04-04 15:56 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-04 15:44 [PATCH 0/3] Add proper detection of the SR-IOV PF mode Michal Wajdeczko
2024-04-04 15:44 ` [PATCH 1/3] drm/xe: Add max_vfs module parameter Michal Wajdeczko
2024-04-09 17:47   ` Rodrigo Vivi
2024-04-04 15:44 ` [PATCH 2/3] drm/xe: Add proper detection of the SR-IOV PF mode Michal Wajdeczko
2024-04-09 17:47   ` Rodrigo Vivi
2024-04-09 18:39     ` Michal Wajdeczko
2024-04-09 18:42       ` Rodrigo Vivi
2024-04-04 15:44 ` Michal Wajdeczko [this message]
2024-04-09 17:48   ` [PATCH 3/3] drm/xe: Add SR-IOV info attribute to debugfs Rodrigo Vivi
2024-04-04 17:55 ` ✓ CI.Patch_applied: success for Add proper detection of the SR-IOV PF mode Patchwork
2024-04-04 17:55 ` ✗ CI.checkpatch: warning " Patchwork
2024-04-04 17:56 ` ✓ CI.KUnit: success " Patchwork
2024-04-04 18:08 ` ✓ CI.Build: " Patchwork
2024-04-04 18:10 ` ✓ CI.Hooks: " Patchwork
2024-04-04 18:12 ` ✓ CI.checksparse: " Patchwork
2024-04-04 18:22 ` ✗ CI.BAT: failure " Patchwork
2024-04-04 20:57 ` ✓ CI.Patch_applied: success for Add proper detection of the SR-IOV PF mode (rev2) Patchwork
2024-04-04 20:57 ` ✗ CI.checkpatch: warning " Patchwork
2024-04-04 20:59 ` ✓ CI.KUnit: success " Patchwork
2024-04-04 21:10 ` ✓ CI.Build: " Patchwork
2024-04-04 21:13 ` ✓ CI.Hooks: " Patchwork
2024-04-04 21:14 ` ✓ CI.checksparse: " Patchwork
2024-04-04 21:34 ` ✓ CI.BAT: " 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=20240404154431.583-4-michal.wajdeczko@intel.com \
    --to=michal.wajdeczko@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