+ int n_regs;
};
static inline struct amdgpu_device *drm_to_adev(struct
drm_device *ddev)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index 164d6a9e9fbb..fb99f3d657a4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -1609,6 +1609,65 @@ DEFINE_DEBUGFS_ATTRIBUTE(fops_ib_preempt, NULL,
DEFINE_DEBUGFS_ATTRIBUTE(fops_sclk_set, NULL,
amdgpu_debugfs_sclk_set, "%llu\n");
+static ssize_t amdgpu_reset_dump_register_list_read(struct file *f,
+ char __user *buf, size_t size, loff_t *pos)
+{
+ struct amdgpu_device *adev = (struct amdgpu_device
*)file_inode(f)->i_private;
+ char *reg_offset;
+ int i, r, len;
+
+ reg_offset = kmalloc(2048, GFP_KERNEL);
+ memset(reg_offset, 0, 2048);
+ for (i = 0; i < adev->n_regs; i++)
+ sprintf(reg_offset + strlen(reg_offset), "0x%x ",
adev->reset_dump_reg_list[i]);
+
+ sprintf(reg_offset + strlen(reg_offset), "\n");
+ len = strlen(reg_offset);
+
+ if (*pos >= len)
+ return 0;
+
+ r = copy_to_user(buf, reg_offset, len);
+ *pos += len - r;
+ kfree(reg_offset);
+
+ return len - r;
+}
+
+static ssize_t amdgpu_reset_dump_register_list_write(struct file
*f, const char __user *buf,
+ size_t size, loff_t *pos)
+{
+ struct amdgpu_device *adev = (struct amdgpu_device
*)file_inode(f)->i_private;
+ char *reg_offset, *reg;
+ int ret, i = 0;
+
+ reg_offset = kmalloc(size, GFP_KERNEL);
+ memset(reg_offset, 0, size);
+ ret = copy_from_user(reg_offset, buf, size);
+
+ if (ret)
+ return -EFAULT;
+
+ while ((reg = strsep(®_offset, " ")) != NULL) {
+ ret = kstrtouint(reg, 16, &adev->reset_dump_reg_list[i]);
+ if (ret)
+ return -EINVAL;
+ i++;
+ }
+
+ adev->n_regs = i;
+ kfree(reg_offset);
+
+ return size;
+}
+
+static const struct file_operations amdgpu_reset_dump_register_list
= {
+ .owner = THIS_MODULE,
+ .read = amdgpu_reset_dump_register_list_read,
+ .write = amdgpu_reset_dump_register_list_write,
+ .llseek = default_llseek
+};
+
int amdgpu_debugfs_init(struct amdgpu_device *adev)
{
struct dentry *root = adev_to_drm(adev)->primary->debugfs_root;
@@ -1672,6 +1731,8 @@ int amdgpu_debugfs_init(struct amdgpu_device
*adev)
&amdgpu_debugfs_test_ib_fops);
debugfs_create_file("amdgpu_vm_info", 0444, root, adev,
&amdgpu_debugfs_vm_info_fops);
+ debugfs_create_file("amdgpu_reset_dump_register_list", 0644,
root, adev,
+ &amdgpu_reset_dump_register_list);
adev->debugfs_vbios_blob.data = adev->bios;
adev->debugfs_vbios_blob.size = adev->bios_size;