OSDN Git Service

drm/amdgpu: Adjust ras support check condition for special asic
authorYiPeng Chai <YiPeng.Chai@amd.com>
Fri, 6 Jan 2023 12:16:53 +0000 (20:16 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 17 Jan 2023 21:11:51 +0000 (16:11 -0500)
[Why]:
     Amdgpu ras uses amdgpu_ras_is_supported to check whether
  the ras block supports the ras function. amdgpu_ras_is_supported
  uses .ras_enabled to determine whether the ras function of the
  block is enabled.
     But for special asic with mem ecc enabled but sram ecc not
  enabled, some ras blocks support poison mode but their ras function
  is not enabled on .ras_enabled, these ras blocks will run abnormally.

[How]:
    If the ras block is not supported on .ras_enabled but the asic
  supports poison mode and the ras block has ras configuration, it
  can be considered that the ras block supports ras function.

Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@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 3f1e987..6e54355 100644 (file)
@@ -3022,11 +3022,26 @@ int amdgpu_ras_set_context(struct amdgpu_device *adev, struct amdgpu_ras *ras_co
 int amdgpu_ras_is_supported(struct amdgpu_device *adev,
                unsigned int block)
 {
+       int ret = 0;
        struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
 
        if (block >= AMDGPU_RAS_BLOCK_COUNT)
                return 0;
-       return ras && (adev->ras_enabled & (1 << block));
+
+       ret = ras && (adev->ras_enabled & (1 << block));
+
+       /* For the special asic with mem ecc enabled but sram ecc
+        * not enabled, even if the ras block is not supported on
+        * .ras_enabled, if the asic supports poison mode and the
+        * ras block has ras configuration, it can be considered
+        * that the ras block supports ras function.
+        */
+       if (!ret &&
+           amdgpu_ras_is_poison_mode_supported(adev) &&
+           amdgpu_ras_get_ras_block(adev, block, 0))
+               ret = 1;
+
+       return ret;
 }
 
 int amdgpu_ras_reset_gpu(struct amdgpu_device *adev)