<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 29-05-2025 16:46, Badal Nilawar
wrote:<br>
</div>
<blockquote type="cite" cite="mid:20250529111654.3140766-12-badal.nilawar@intel.com">
<pre wrap="" class="moz-quote-pre">Add a debugfs node named vrsr_capable to check if the device
supports VRSR.
Signed-off-by: Badal Nilawar <a class="moz-txt-link-rfc2396E" href="mailto:badal.nilawar@intel.com"><badal.nilawar@intel.com></a>
---
drivers/gpu/drm/xe/xe_debugfs.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_debugfs.c b/drivers/gpu/drm/xe/xe_debugfs.c
index d83cd6ed3fa8..d969a8f6d430 100644
--- a/drivers/gpu/drm/xe/xe_debugfs.c
+++ b/drivers/gpu/drm/xe/xe_debugfs.c
@@ -226,6 +226,23 @@ static const struct file_operations atomic_svm_timeslice_ms_fops = {
.write = atomic_svm_timeslice_ms_set,
};
+static ssize_t vrsr_capable_show(struct file *f, char __user *ubuf,
+ size_t size, loff_t *pos)
+{
+ struct xe_device *xe = file_inode(f)->i_private;
+ char buf[32];
+ int len = 0;
+
+ len = scnprintf(buf, sizeof(buf), "%s\n", xe->d3cold.vrsr_capable ? "true" : "false");
+
+ return simple_read_from_buffer(ubuf, size, pos, buf, len);
+}
+
+static const struct file_operations vrsr_capable_fops = {
+ .owner = THIS_MODULE,
+ .read = vrsr_capable_show,
+};
+
void xe_debugfs_register(struct xe_device *xe)
{
struct ttm_device *bdev = &xe->ttm;
@@ -249,6 +266,9 @@ void xe_debugfs_register(struct xe_device *xe)
debugfs_create_file("atomic_svm_timeslice_ms", 0600, root, xe,
&atomic_svm_timeslice_ms_fops);
+ debugfs_create_file("vrsr_capable", 0400, root, xe,
+ &vrsr_capable_fops);</pre>
</blockquote>
Instead of <span style="white-space: pre-wrap">debugfs_create_file,</span> you
can use <span style="white-space: pre-wrap">debugfs_create_bool here, which will simplify the code.</span>
<blockquote type="cite" cite="mid:20250529111654.3140766-12-badal.nilawar@intel.com">
<pre wrap="" class="moz-quote-pre">
+
for (mem_type = XE_PL_VRAM0; mem_type <= XE_PL_VRAM1; ++mem_type) {
man = ttm_manager_type(bdev, mem_type);
</pre>
</blockquote>
</body>
</html>