drm/xe: Add SR-IOV info attribute to debugfs
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Thu, 4 Apr 2024 15:44:31 +0000 (17:44 +0200)
committerMichal Wajdeczko <michal.wajdeczko@intel.com>
Wed, 10 Apr 2024 09:26:21 +0000 (11:26 +0200)
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>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240404154431.583-4-michal.wajdeczko@intel.com
drivers/gpu/drm/xe/xe_debugfs.c
drivers/gpu/drm/xe/xe_sriov.c
drivers/gpu/drm/xe/xe_sriov.h

index 86150cafe0ffe9b971a287fc6e4d9963b346629d..c9b30dbdc14dce02a58de7316db97023477a9410 100644 (file)
@@ -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)
index 94fa98d8206e1f17e91b692c2954a80081584af2..d324f131e3da254059d36c093c32ebb4b07c3052 100644 (file)
@@ -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)));
+}
index 9e3f58874e9804d3580d1e1941463325e6de644a..f9dec84d77e3b1f660bb04955f17a0e4e6523e9d 100644 (file)
 #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)