summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2019-03-21 18:34:18 +0300
committerAlex Deucher <alexander.deucher@amd.com>2019-03-28 06:40:50 +0300
commitecf96b52bf98a22f14bd33c7deee0aad8eb6b569 (patch)
treed10af6d29f2407c86b97b4fd2118529b286a2b7e /drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
parentdf399b064118bf9a5b9a3faaa67feb1cbb34e9d4 (diff)
downloadlinux-ecf96b52bf98a22f14bd33c7deee0aad8eb6b569.tar.xz
drm/amdgpu: move VM table mapping into the backend as well
Clean that up further and also fix another case where the BO wasn't kmapped for CPU based updates. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
index e4bacdb44c68..4bccd69fe30d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
@@ -29,6 +29,25 @@
#define AMDGPU_VM_SDMA_MAX_NUM_DW (16u * 1024u)
/**
+ * amdgpu_vm_sdma_map_table - make sure new PDs/PTs are GTT mapped
+ *
+ * @table: newly allocated or validated PD/PT
+ */
+static int amdgpu_vm_sdma_map_table(struct amdgpu_bo *table)
+{
+ int r;
+
+ r = amdgpu_ttm_alloc_gart(&table->tbo);
+ if (r)
+ return r;
+
+ if (table->shadow)
+ r = amdgpu_ttm_alloc_gart(&table->shadow->tbo);
+
+ return r;
+}
+
+/**
* amdgpu_vm_sdma_prepare - prepare SDMA command submission
*
* @p: see amdgpu_vm_update_params definition
@@ -242,6 +261,7 @@ static int amdgpu_vm_sdma_update(struct amdgpu_vm_update_params *p,
}
const struct amdgpu_vm_update_funcs amdgpu_vm_sdma_funcs = {
+ .map_table = amdgpu_vm_sdma_map_table,
.prepare = amdgpu_vm_sdma_prepare,
.update = amdgpu_vm_sdma_update,
.commit = amdgpu_vm_sdma_commit