]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amdgpu: Check VF critical region before RAS poison injection
authorXiang Liu <xiang.liu@amd.com>
Tue, 19 Aug 2025 05:06:24 +0000 (13:06 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 18 Sep 2025 13:43:10 +0000 (09:43 -0400)
Check VF critical region before RAS poison injection to ensure that the
poison injection will not hit the VF critical region.

Signed-off-by: Xiang Liu <xiang.liu@amd.com>
Reviewed-by: Shravan Kumar Gande <Shravankumar.Gande@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c

index 663b96583bfd7ffd41da82307ae2b612b3522885..e0ee211508607e4170e7d7c84be00ed5277d3221 100644 (file)
@@ -219,10 +219,17 @@ static int amdgpu_check_address_validity(struct amdgpu_device *adev,
        struct amdgpu_vram_block_info blk_info;
        uint64_t page_pfns[32] = {0};
        int i, ret, count;
+       bool hit = false;
 
        if (amdgpu_ip_version(adev, UMC_HWIP, 0) < IP_VERSION(12, 0, 0))
                return 0;
 
+       if (amdgpu_sriov_vf(adev)) {
+               if (amdgpu_virt_check_vf_critical_region(adev, address, &hit))
+                       return -EPERM;
+               return hit ? -EACCES : 0;
+       }
+
        if ((address >= adev->gmc.mc_vram_size) ||
            (address >= RAS_UMC_INJECT_ADDR_LIMIT))
                return -EFAULT;