drm/amdgpu: restore ras flags when user resets eeprom(v2)
authorGuchun Chen <guchun.chen@amd.com>
Wed, 22 Jul 2020 02:37:01 +0000 (10:37 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 4 Aug 2020 21:27:04 +0000 (17:27 -0400)
RAS flags needs to be cleaned as well when user requires
one clean eeprom.

v2: RAS flags shall be restored after eeprom reset succeeds.

Signed-off-by: Guchun Chen <guchun.chen@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c

index ab65dfd..19ac2e6 100644 (file)
@@ -368,12 +368,19 @@ static ssize_t amdgpu_ras_debugfs_ctrl_write(struct file *f, const char __user *
 static ssize_t amdgpu_ras_debugfs_eeprom_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;
+       struct amdgpu_device *adev =
+               (struct amdgpu_device *)file_inode(f)->i_private;
        int ret;
 
-       ret = amdgpu_ras_eeprom_reset_table(&adev->psp.ras.ras->eeprom_control);
+       ret = amdgpu_ras_eeprom_reset_table(
+                       &(amdgpu_ras_get_context(adev)->eeprom_control));
 
-       return ret == 1 ? size : -EIO;
+       if (ret == 1) {
+               amdgpu_ras_get_context(adev)->flags = RAS_DEFAULT_FLAGS;
+               return size;
+       } else {
+               return -EIO;
+       }
 }
 
 static const struct file_operations amdgpu_ras_debugfs_ctrl_ops = {