Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4b2f7e2c authored by Jammy Zhou's avatar Jammy Zhou Committed by Alex Deucher
Browse files

drm/amdgpu: add amdgpu_get_sdma_instance helper function



This function is added to map the ring to sdma instance

Signed-off-by: default avatarJammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 36f523a7
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -2199,6 +2199,21 @@ static inline void amdgpu_ring_write(struct amdgpu_ring *ring, uint32_t v)
	ring->ring_free_dw--;
}

static inline struct amdgpu_sdma * amdgpu_get_sdma_instance(struct amdgpu_ring *ring)
{
	struct amdgpu_device *adev = ring->adev;
	int i;

	for (i = 0; i < AMDGPU_MAX_SDMA_INSTANCES; i++)
		if (&adev->sdma[i].ring == ring)
			break;

	if (i < AMDGPU_MAX_SDMA_INSTANCES)
		return &adev->sdma[i];
	else
		return NULL;
}

/*
 * ASICs macro.
 */