Skip to content

Commit 3df49b2

Browse files
committed
drm/xe: Add SR-IOV info attribute to debugfs
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
1 parent 146e438 commit 3df49b2

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

drivers/gpu/drm/xe/xe_debugfs.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "xe_device.h"
1414
#include "xe_gt_debugfs.h"
1515
#include "xe_pm.h"
16+
#include "xe_sriov.h"
1617
#include "xe_step.h"
1718

1819
#ifdef CONFIG_DRM_XE_DEBUG
@@ -70,8 +71,18 @@ static int info(struct seq_file *m, void *data)
7071
return 0;
7172
}
7273

74+
static int sriov_info(struct seq_file *m, void *data)
75+
{
76+
struct xe_device *xe = node_to_xe(m->private);
77+
struct drm_printer p = drm_seq_file_printer(m);
78+
79+
xe_sriov_print_info(xe, &p);
80+
return 0;
81+
}
82+
7383
static const struct drm_info_list debugfs_list[] = {
7484
{"info", info, 0},
85+
{ .name = "sriov_info", .show = sriov_info, },
7586
};
7687

7788
static int forcewake_open(struct inode *inode, struct file *file)

drivers/gpu/drm/xe/xe_sriov.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,17 @@ int xe_sriov_init(struct xe_device *xe)
101101

102102
return drmm_add_action_or_reset(&xe->drm, fini_sriov, xe);
103103
}
104+
105+
/**
106+
* xe_sriov_print_info - Print basic SR-IOV information.
107+
* @xe: the &xe_device to print info from
108+
* @p: the &drm_printer
109+
*
110+
* Print SR-IOV related information into provided DRM printer.
111+
*/
112+
void xe_sriov_print_info(struct xe_device *xe, struct drm_printer *p)
113+
{
114+
drm_printf(p, "supported: %s\n", str_yes_no(xe_device_has_sriov(xe)));
115+
drm_printf(p, "enabled: %s\n", str_yes_no(IS_SRIOV(xe)));
116+
drm_printf(p, "mode: %s\n", xe_sriov_mode_to_string(xe_device_sriov_mode(xe)));
117+
}

drivers/gpu/drm/xe/xe_sriov.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@
1010
#include "xe_device_types.h"
1111
#include "xe_sriov_types.h"
1212

13+
struct drm_printer;
14+
1315
const char *xe_sriov_mode_to_string(enum xe_sriov_mode mode);
1416

1517
void xe_sriov_probe_early(struct xe_device *xe);
18+
void xe_sriov_print_info(struct xe_device *xe, struct drm_printer *p);
1619
int xe_sriov_init(struct xe_device *xe);
1720

1821
static inline enum xe_sriov_mode xe_device_sriov_mode(struct xe_device *xe)

0 commit comments

Comments
 (0)