diff options
author | Andrey Grodzovsky <andrey.grodzovsky@amd.com> | 2020-03-04 16:36:42 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2020-03-06 14:32:24 -0500 |
commit | 90f88cdd7c8d6a6a3be18353d6a03798f9a03168 (patch) | |
tree | 901c12d9e8065a884f8030f38d1419933071b9e7 /drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | |
parent | 5e208eb62bb308ebf70fd03145c54215d72e7ba6 (diff) | |
download | kernel_replicant_linux-90f88cdd7c8d6a6a3be18353d6a03798f9a03168.tar.gz kernel_replicant_linux-90f88cdd7c8d6a6a3be18353d6a03798f9a03168.tar.bz2 kernel_replicant_linux-90f88cdd7c8d6a6a3be18353d6a03798f9a03168.zip |
drm/amdgpu: Fix GPU reset error.
Problem:
During GU reset PSP's sysfs was being wrongly reinitilized
during call to amdgpu_device_ip_late_init which was failing
with duplicate error.
Fix:
Move psp_sysfs_init to psp_sw_init to avoid this. Add guards
in sysfs file's read and write hook agains premature call
if PSP is not finished initialization.
Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index 3836acc2e95e..6d9b05e21f97 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -117,16 +117,6 @@ static int psp_early_init(void *handle) return 0; } -static int psp_late_init(void *handle) -{ - struct amdgpu_device *adev = (struct amdgpu_device *)handle; - - if (adev->asic_type == CHIP_NAVI10) - return psp_sysfs_init(adev); - - return 0; -} - static int psp_sw_init(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle; @@ -150,6 +140,13 @@ static int psp_sw_init(void *handle) return ret; } + if (adev->asic_type == CHIP_NAVI10) { + ret= psp_sysfs_init(adev); + if (ret) { + return ret; + } + } + return 0; } @@ -1843,6 +1840,11 @@ static ssize_t psp_usbc_pd_fw_sysfs_read(struct device *dev, uint32_t fw_ver; int ret; + if (!adev->ip_blocks[AMD_IP_BLOCK_TYPE_PSP].status.late_initialized) { + DRM_INFO("PSP block is not ready yet."); + return -EBUSY; + } + mutex_lock(&adev->psp.mutex); ret = psp_read_usbc_pd_fw(&adev->psp, &fw_ver); mutex_unlock(&adev->psp.mutex); @@ -1868,6 +1870,10 @@ static ssize_t psp_usbc_pd_fw_sysfs_write(struct device *dev, char fw_name[100]; const struct firmware *usbc_pd_fw; + if (!adev->ip_blocks[AMD_IP_BLOCK_TYPE_PSP].status.late_initialized) { + DRM_INFO("PSP block is not ready yet."); + return -EBUSY; + } snprintf(fw_name, sizeof(fw_name), "amdgpu/%s", buf); ret = request_firmware(&usbc_pd_fw, fw_name, adev->dev); @@ -1919,7 +1925,7 @@ static DEVICE_ATTR(usbc_pd_fw, S_IRUGO | S_IWUSR, const struct amd_ip_funcs psp_ip_funcs = { .name = "psp", .early_init = psp_early_init, - .late_init = psp_late_init, + .late_init = NULL, .sw_init = psp_sw_init, .sw_fini = psp_sw_fini, .hw_init = psp_hw_init, |