aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
diff options
context:
space:
mode:
authorMonk Liu <Monk.Liu@amd.com>2016-04-19 08:11:32 -0400
committerAlex Deucher <alexander.deucher@amd.com>2016-05-11 12:31:16 -0400
commitc5637837ba5d5b5e962e73f5a1a7c5456fa85a68 (patch)
tree50b66ff9a4d96cf46ee1e6503468cf2f4c009b33 /drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
parent1f207f81e371bed8aa4c898de091d5cfbf68f59e (diff)
drm/amdgpu: keep vm in job instead of ib (v2)
ib.vm is a legacy way to get vm, after scheduler implemented vm should be get from job, and all ibs from one job share the same vm, no need to keep ib.vm just move vm field to job. this patch as well add job as paramter to ib_schedule so it can get vm from job->vm. v2: agd: sqaush in: drm/amdgpu: check if ring emit_vm_flush exists in vm flush No vm flush on engines that don't support VM. bug: https://bugs.freedesktop.org/show_bug.cgi?id=95195 Signed-off-by: Monk Liu <Monk.Liu@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
index 0129617a7962..0ed643036361 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
@@ -74,7 +74,6 @@ int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm,
74 ib->gpu_addr = amdgpu_sa_bo_gpu_addr(ib->sa_bo); 74 ib->gpu_addr = amdgpu_sa_bo_gpu_addr(ib->sa_bo);
75 } 75 }
76 76
77 ib->vm = vm;
78 ib->vm_id = 0; 77 ib->vm_id = 0;
79 78
80 return 0; 79 return 0;
@@ -117,13 +116,13 @@ void amdgpu_ib_free(struct amdgpu_device *adev, struct amdgpu_ib *ib, struct fen
117 */ 116 */
118int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, 117int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
119 struct amdgpu_ib *ibs, struct fence *last_vm_update, 118 struct amdgpu_ib *ibs, struct fence *last_vm_update,
120 struct fence **f) 119 struct amdgpu_job *job, struct fence **f)
121{ 120{
122 struct amdgpu_device *adev = ring->adev; 121 struct amdgpu_device *adev = ring->adev;
123 struct amdgpu_ib *ib = &ibs[0]; 122 struct amdgpu_ib *ib = &ibs[0];
124 struct amdgpu_ctx *ctx, *old_ctx; 123 struct amdgpu_ctx *ctx, *old_ctx;
125 struct amdgpu_vm *vm;
126 struct fence *hwf; 124 struct fence *hwf;
125 struct amdgpu_vm *vm = NULL;
127 unsigned i, patch_offset = ~0; 126 unsigned i, patch_offset = ~0;
128 127
129 int r = 0; 128 int r = 0;
@@ -132,7 +131,8 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
132 return -EINVAL; 131 return -EINVAL;
133 132
134 ctx = ibs->ctx; 133 ctx = ibs->ctx;
135 vm = ibs->vm; 134 if (job) /* for domain0 job like ring test, ibs->job is not assigned */
135 vm = job->vm;
136 136
137 if (!ring->ready) { 137 if (!ring->ready) {
138 dev_err(adev->dev, "couldn't schedule ib\n"); 138 dev_err(adev->dev, "couldn't schedule ib\n");
@@ -174,14 +174,6 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
174 old_ctx = ring->current_ctx; 174 old_ctx = ring->current_ctx;
175 for (i = 0; i < num_ibs; ++i) { 175 for (i = 0; i < num_ibs; ++i) {
176 ib = &ibs[i]; 176 ib = &ibs[i];
177
178 if (ib->ctx != ctx || ib->vm != vm) {
179 ring->current_ctx = old_ctx;
180 if (ib->vm_id)
181 amdgpu_vm_reset_id(adev, ib->vm_id);
182 amdgpu_ring_undo(ring);
183 return -EINVAL;
184 }
185 amdgpu_ring_emit_ib(ring, ib); 177 amdgpu_ring_emit_ib(ring, ib);
186 ring->current_ctx = ctx; 178 ring->current_ctx = ctx;
187 } 179 }