diff options
author | Jack Xiao <Jack.Xiao@amd.com> | 2019-01-07 10:28:01 +0300 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2019-06-22 02:57:40 +0300 |
commit | ca1eb73207a49c0777b0dac3dc0be6bd07597a44 (patch) | |
tree | f34e0fd1a5617b06c60269561cedaa2059050d87 /drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | |
parent | d8780dc71d56acf734a5756cac8c7787eb6bec11 (diff) | |
download | linux-ca1eb73207a49c0777b0dac3dc0be6bd07597a44.tar.xz |
drm/amdgpu/sdma: allocate CSA per sdma ring
Allocate CSA for the given sdma ring.
Acked-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c index 115bb0c99b0f..8ad21865c9f0 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c @@ -24,6 +24,10 @@ #include "amdgpu.h" #include "amdgpu_sdma.h" +#define AMDGPU_CSA_SDMA_SIZE 64 +/* SDMA CSA reside in the 3rd page of CSA */ +#define AMDGPU_CSA_SDMA_OFFSET (4096 * 2) + /* * GPU SDMA IP block helpers function. */ @@ -56,3 +60,26 @@ int amdgpu_sdma_get_index_from_ring(struct amdgpu_ring *ring, uint32_t *index) return -EINVAL; } + +uint64_t amdgpu_sdma_get_csa_mc_addr(struct amdgpu_ring *ring, + unsigned vmid) +{ + struct amdgpu_device *adev = ring->adev; + uint64_t csa_mc_addr; + uint32_t index = 0; + int r; + + if (vmid == 0 || !amdgpu_mcbp) + return 0; + + r = amdgpu_sdma_get_index_from_ring(ring, &index); + + if (r || index > 31) + csa_mc_addr = 0; + else + csa_mc_addr = amdgpu_csa_vaddr(adev) + + AMDGPU_CSA_SDMA_OFFSET + + index * AMDGPU_CSA_SDMA_SIZE; + + return csa_mc_addr; +} |