Skip to content

Commit 09b5855

Browse files
Jie1zhangalexdeucher
authored andcommitted
drm/amdgpu: Fix SDMA engine reset with logical instance ID
This commit makes the following improvements to SDMA engine reset handling: 1. Clarifies in the function documentation that instance_id refers to a logical ID 2. Adds conversion from logical to physical instance ID before performing reset using GET_INST(SDMA0, instance_id) macro 3. Improves error messaging to indicate when a logical instance reset fails 4. Adds better code organization with blank lines for readability The change ensures proper SDMA engine reset by using the correct physical instance ID while maintaining the logical ID interface for callers. V2: Remove harvest_config check and convert directly to physical instance (Lijo) Suggested-by: Jonathan Kim <[email protected]> Signed-off-by: Jesse Zhang <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]> (cherry picked from commit 5efa621) Cc: [email protected]
1 parent 8541714 commit 09b5855

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,10 @@ static int amdgpu_sdma_soft_reset(struct amdgpu_device *adev, u32 instance_id)
540540
case IP_VERSION(4, 4, 2):
541541
case IP_VERSION(4, 4, 4):
542542
case IP_VERSION(4, 4, 5):
543-
/* For SDMA 4.x, use the existing DPM interface for backward compatibility */
544-
r = amdgpu_dpm_reset_sdma(adev, 1 << instance_id);
543+
/* For SDMA 4.x, use the existing DPM interface for backward compatibility,
544+
* we need to convert the logical instance ID to physical instance ID before reset.
545+
*/
546+
r = amdgpu_dpm_reset_sdma(adev, 1 << GET_INST(SDMA0, instance_id));
545547
break;
546548
case IP_VERSION(5, 0, 0):
547549
case IP_VERSION(5, 0, 1):
@@ -568,7 +570,7 @@ static int amdgpu_sdma_soft_reset(struct amdgpu_device *adev, u32 instance_id)
568570
/**
569571
* amdgpu_sdma_reset_engine - Reset a specific SDMA engine
570572
* @adev: Pointer to the AMDGPU device
571-
* @instance_id: ID of the SDMA engine instance to reset
573+
* @instance_id: Logical ID of the SDMA engine instance to reset
572574
*
573575
* Returns: 0 on success, or a negative error code on failure.
574576
*/
@@ -601,7 +603,7 @@ int amdgpu_sdma_reset_engine(struct amdgpu_device *adev, uint32_t instance_id)
601603
/* Perform the SDMA reset for the specified instance */
602604
ret = amdgpu_sdma_soft_reset(adev, instance_id);
603605
if (ret) {
604-
dev_err(adev->dev, "Failed to reset SDMA instance %u\n", instance_id);
606+
dev_err(adev->dev, "Failed to reset SDMA logical instance %u\n", instance_id);
605607
goto exit;
606608
}
607609

0 commit comments

Comments
 (0)