diff options
author | Christian König <christian.koenig@amd.com> | 2017-11-06 09:37:01 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-12-06 12:48:05 -0500 |
commit | bb7939b2030ab55acd203c86160c37db22f5796a (patch) | |
tree | 862995ae5c903f912e675d5e89b0ba774cde34c9 /drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | |
parent | 6af046d26f34278eacd6ecddb37170624f6d4251 (diff) |
drm/amdgpu: fix VA hole handling on Vega10 v3
Similar to the CPU address space the VA on Vega10 has a hole in it.
v2: use dev_dbg instead of dev_err
v3: add some more comments to explain how the hw works
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
CC: stable@vger.kernel.org
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index 5e89d7a7178f..93d3cef66503 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | |||
@@ -870,8 +870,8 @@ static int amdgpu_cs_ib_vm_chunk(struct amdgpu_device *adev, | |||
870 | struct amdgpu_bo_va_mapping *m; | 870 | struct amdgpu_bo_va_mapping *m; |
871 | struct amdgpu_bo *aobj = NULL; | 871 | struct amdgpu_bo *aobj = NULL; |
872 | struct amdgpu_cs_chunk *chunk; | 872 | struct amdgpu_cs_chunk *chunk; |
873 | uint64_t offset, va_start; | ||
873 | struct amdgpu_ib *ib; | 874 | struct amdgpu_ib *ib; |
874 | uint64_t offset; | ||
875 | uint8_t *kptr; | 875 | uint8_t *kptr; |
876 | 876 | ||
877 | chunk = &p->chunks[i]; | 877 | chunk = &p->chunks[i]; |
@@ -881,14 +881,14 @@ static int amdgpu_cs_ib_vm_chunk(struct amdgpu_device *adev, | |||
881 | if (chunk->chunk_id != AMDGPU_CHUNK_ID_IB) | 881 | if (chunk->chunk_id != AMDGPU_CHUNK_ID_IB) |
882 | continue; | 882 | continue; |
883 | 883 | ||
884 | r = amdgpu_cs_find_mapping(p, chunk_ib->va_start, | 884 | va_start = chunk_ib->va_start & AMDGPU_VA_HOLE_MASK; |
885 | &aobj, &m); | 885 | r = amdgpu_cs_find_mapping(p, va_start, &aobj, &m); |
886 | if (r) { | 886 | if (r) { |
887 | DRM_ERROR("IB va_start is invalid\n"); | 887 | DRM_ERROR("IB va_start is invalid\n"); |
888 | return r; | 888 | return r; |
889 | } | 889 | } |
890 | 890 | ||
891 | if ((chunk_ib->va_start + chunk_ib->ib_bytes) > | 891 | if ((va_start + chunk_ib->ib_bytes) > |
892 | (m->last + 1) * AMDGPU_GPU_PAGE_SIZE) { | 892 | (m->last + 1) * AMDGPU_GPU_PAGE_SIZE) { |
893 | DRM_ERROR("IB va_start+ib_bytes is invalid\n"); | 893 | DRM_ERROR("IB va_start+ib_bytes is invalid\n"); |
894 | return -EINVAL; | 894 | return -EINVAL; |
@@ -901,7 +901,7 @@ static int amdgpu_cs_ib_vm_chunk(struct amdgpu_device *adev, | |||
901 | } | 901 | } |
902 | 902 | ||
903 | offset = m->start * AMDGPU_GPU_PAGE_SIZE; | 903 | offset = m->start * AMDGPU_GPU_PAGE_SIZE; |
904 | kptr += chunk_ib->va_start - offset; | 904 | kptr += va_start - offset; |
905 | 905 | ||
906 | memcpy(ib->ptr, kptr, chunk_ib->ib_bytes); | 906 | memcpy(ib->ptr, kptr, chunk_ib->ib_bytes); |
907 | amdgpu_bo_kunmap(aobj); | 907 | amdgpu_bo_kunmap(aobj); |