Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: fix SDMA suspend/resume on SR-IOV

Update all SDMA versions that support SR-IOV to properly
tear down the ttm buffer functions on suspend.

Tested-by: Bokun Zhang <Bokun.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

+18 -13
+4 -1
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
··· 1940 1940 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1941 1941 int i; 1942 1942 1943 - if (amdgpu_sriov_vf(adev)) 1943 + if (amdgpu_sriov_vf(adev)) { 1944 + /* disable the scheduler for SDMA */ 1945 + amdgpu_sdma_unset_buffer_funcs_helper(adev); 1944 1946 return 0; 1947 + } 1945 1948 1946 1949 for (i = 0; i < adev->sdma.num_instances; i++) { 1947 1950 amdgpu_irq_put(adev, &adev->sdma.ecc_irq,
+4 -1
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
··· 1456 1456 { 1457 1457 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1458 1458 1459 - if (amdgpu_sriov_vf(adev)) 1459 + if (amdgpu_sriov_vf(adev)) { 1460 + /* disable the scheduler for SDMA */ 1461 + amdgpu_sdma_unset_buffer_funcs_helper(adev); 1460 1462 return 0; 1463 + } 1461 1464 1462 1465 sdma_v5_0_ctx_switch_enable(adev, false); 1463 1466 sdma_v5_0_enable(adev, false);
+6 -10
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
··· 1349 1349 { 1350 1350 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1351 1351 1352 - /* 1353 - * Under SRIOV, the VF cannot single-mindedly stop SDMA engine 1354 - * However, we still need to clean up the DRM entity 1355 - * Therefore, we will re-enable SDMA afterwards. 1356 - */ 1352 + if (amdgpu_sriov_vf(adev)) { 1353 + /* disable the scheduler for SDMA */ 1354 + amdgpu_sdma_unset_buffer_funcs_helper(adev); 1355 + return 0; 1356 + } 1357 + 1357 1358 sdma_v5_2_ctx_switch_enable(adev, false); 1358 1359 sdma_v5_2_enable(adev, false); 1359 - 1360 - if (amdgpu_sriov_vf(adev)) { 1361 - sdma_v5_2_enable(adev, true); 1362 - sdma_v5_2_ctx_switch_enable(adev, true); 1363 - } 1364 1360 1365 1361 return 0; 1366 1362 }
+4 -1
drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c
··· 1311 1311 { 1312 1312 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1313 1313 1314 - if (amdgpu_sriov_vf(adev)) 1314 + if (amdgpu_sriov_vf(adev)) { 1315 + /* disable the scheduler for SDMA */ 1316 + amdgpu_sdma_unset_buffer_funcs_helper(adev); 1315 1317 return 0; 1318 + } 1316 1319 1317 1320 sdma_v6_0_ctx_switch_enable(adev, false); 1318 1321 sdma_v6_0_enable(adev, false);