summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
diff options
context:
space:
mode:
authorNicholas Kazlauskas <nicholas.kazlauskas@amd.com>2023-12-05 11:22:56 -0500
committerAlex Deucher <alexander.deucher@amd.com>2023-12-19 14:59:02 -0500
commite5ffd1263dd5b44929c676171802e7b6af483f21 (patch)
treef50175b36f1a3472bade0b6e1fc8af61a198793b /drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
parent8892780834ae294bc3697c7d0e056d7743900b39 (diff)
drm/amd/display: Wake DMCUB before executing GPINT commands
[Why] DMCUB can be in idle when we attempt to interface with the HW through the GPINT mailbox resulting in a system hang. [How] Add dc_wake_and_execute_gpint() to wrap the wake, execute, sleep sequence. If the GPINT executes successfully then DMCUB will be put back into sleep after the optional response is returned. It functions similar to the inbox command interface. Cc: Mario Limonciello <mario.limonciello@amd.com> Cc: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org Reviewed-by: Hansen Dsouza <hansen.dsouza@amd.com> Acked-by: Wayne Lin <wayne.lin@amd.com> Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c')
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c29
1 files changed, 5 insertions, 24 deletions
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
index 98b41ec7288e..68a846323912 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
@@ -2976,7 +2976,6 @@ static int dmub_trace_mask_set(void *data, u64 val)
struct amdgpu_device *adev = data;
struct dmub_srv *srv = adev->dm.dc->ctx->dmub_srv->dmub;
enum dmub_gpint_command cmd;
- enum dmub_status status;
u64 mask = 0xffff;
u8 shift = 0;
u32 res;
@@ -3003,13 +3002,7 @@ static int dmub_trace_mask_set(void *data, u64 val)
break;
}
- status = dmub_srv_send_gpint_command(srv, cmd, res, 30);
-
- if (status == DMUB_STATUS_TIMEOUT)
- return -ETIMEDOUT;
- else if (status == DMUB_STATUS_INVALID)
- return -EINVAL;
- else if (status != DMUB_STATUS_OK)
+ if (!dc_wake_and_execute_gpint(adev->dm.dc->ctx, cmd, res, NULL, DM_DMUB_WAIT_TYPE_WAIT))
return -EIO;
usleep_range(100, 1000);
@@ -3026,7 +3019,6 @@ static int dmub_trace_mask_show(void *data, u64 *val)
enum dmub_gpint_command cmd = DMUB_GPINT__GET_TRACE_BUFFER_MASK_WORD0;
struct amdgpu_device *adev = data;
struct dmub_srv *srv = adev->dm.dc->ctx->dmub_srv->dmub;
- enum dmub_status status;
u8 shift = 0;
u64 raw = 0;
u64 res = 0;
@@ -3036,23 +3028,12 @@ static int dmub_trace_mask_show(void *data, u64 *val)
return -EINVAL;
while (i < 4) {
- status = dmub_srv_send_gpint_command(srv, cmd, 0, 30);
-
- if (status == DMUB_STATUS_OK) {
- status = dmub_srv_get_gpint_response(srv, (u32 *) &raw);
-
- if (status == DMUB_STATUS_INVALID)
- return -EINVAL;
- else if (status != DMUB_STATUS_OK)
- return -EIO;
- } else if (status == DMUB_STATUS_TIMEOUT) {
- return -ETIMEDOUT;
- } else if (status == DMUB_STATUS_INVALID) {
- return -EINVAL;
- } else {
+ uint32_t response;
+
+ if (!dc_wake_and_execute_gpint(adev->dm.dc->ctx, cmd, 0, &response, DM_DMUB_WAIT_TYPE_WAIT_WITH_REPLY))
return -EIO;
- }
+ raw = response;
usleep_range(100, 1000);
cmd++;