]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu: Fix register access violation
authorHawking Zhang <Hawking.Zhang@amd.com>
Fri, 21 Jun 2024 03:25:30 +0000 (11:25 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 27 Jun 2024 21:10:35 +0000 (17:10 -0400)
fault_status is read only register. fault_cntl
is not accessible from guest environment.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c

index e14acab5cceb1977920c6cd23ce873de47e68de8..72109abe7c86c8ad44c144d3cbbf4f7c77c8d691 100644 (file)
@@ -629,9 +629,11 @@ static bool gfxhub_v1_2_query_utcl2_poison_status(struct amdgpu_device *adev,
 
        status = RREG32_SOC15(GC, GET_INST(GC, xcc_id), regVM_L2_PROTECTION_FAULT_STATUS);
        fed = REG_GET_FIELD(status, VM_L2_PROTECTION_FAULT_STATUS, FED);
-       /* reset page fault status */
-       WREG32_P(SOC15_REG_OFFSET(GC, GET_INST(GC, xcc_id),
-                       regVM_L2_PROTECTION_FAULT_STATUS), 1, ~1);
+       if (!amdgpu_sriov_vf(adev)) {
+               /* clear page fault status and address */
+               WREG32_P(SOC15_REG_OFFSET(GC, GET_INST(GC, xcc_id),
+                        regVM_L2_PROTECTION_FAULT_CNTL), 1, ~1);
+       }
 
        return fed;
 }
index 88b4644f8e9601c80d21b6a29ffcfa5d8600a232..b73136d390cc03ba7efd371fbb5db30515caf0ce 100644 (file)
@@ -672,7 +672,8 @@ static int gmc_v9_0_process_interrupt(struct amdgpu_device *adev,
            (amdgpu_ip_version(adev, GC_HWIP, 0) >= IP_VERSION(9, 4, 2)))
                return 0;
 
-       WREG32_P(hub->vm_l2_pro_fault_cntl, 1, ~1);
+       if (!amdgpu_sriov_vf(adev))
+               WREG32_P(hub->vm_l2_pro_fault_cntl, 1, ~1);
 
        amdgpu_vm_update_fault_cache(adev, entry->pasid, addr, status, vmhub);
 
index 7a1ff298417abeb08cb67a9ea080f6469d77c168..8d7267a013d2435dc0d8fe1b32c1670fc332de04 100644 (file)
@@ -566,9 +566,11 @@ static bool mmhub_v1_8_query_utcl2_poison_status(struct amdgpu_device *adev,
 
        status = RREG32_SOC15(MMHUB, hub_inst, regVM_L2_PROTECTION_FAULT_STATUS);
        fed = REG_GET_FIELD(status, VM_L2_PROTECTION_FAULT_STATUS, FED);
-       /* reset page fault status */
-       WREG32_P(SOC15_REG_OFFSET(MMHUB, hub_inst,
-                       regVM_L2_PROTECTION_FAULT_STATUS), 1, ~1);
+       if (!amdgpu_sriov_vf(adev)) {
+               /* clear page fault status and address */
+               WREG32_P(SOC15_REG_OFFSET(MMHUB, hub_inst,
+                        regVM_L2_PROTECTION_FAULT_STATUS), 1, ~1);
+       }
 
        return fed;
 }