Skip to content

Commit 4eb70cd

Browse files
committed
drm/lima: always set page directory when switch vm
We need to flush TLB anyway before every task start, and the page directory will be set to empty vm after suspend/resume, so always set it to the task vm even no ctx switch happens. Tested-by: Bhushan Shah <bshah@kde.org> Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com> Signed-off-by: Qiang Yu <yuq825@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200421133551.31481-5-yuq825@gmail.com
1 parent 2494326 commit 4eb70cd

2 files changed

Lines changed: 5 additions & 12 deletions

File tree

‎drivers/gpu/drm/lima/lima_mmu.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ void lima_mmu_switch_vm(struct lima_ip *ip, struct lima_vm *vm)
113113
LIMA_MMU_STATUS, v,
114114
v & LIMA_MMU_STATUS_STALL_ACTIVE);
115115

116-
if (vm)
117-
mmu_write(LIMA_MMU_DTE_ADDR, vm->pd.dma);
116+
mmu_write(LIMA_MMU_DTE_ADDR, vm->pd.dma);
118117

119118
/* flush the TLB */
120119
mmu_write(LIMA_MMU_COMMAND, LIMA_MMU_COMMAND_ZAP_CACHE);

‎drivers/gpu/drm/lima/lima_sched.c‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ static struct dma_fence *lima_sched_run_job(struct drm_sched_job *job)
200200
struct lima_sched_pipe *pipe = to_lima_pipe(job->sched);
201201
struct lima_fence *fence;
202202
struct dma_fence *ret;
203-
struct lima_vm *vm = NULL, *last_vm = NULL;
204203
int i;
205204

206205
/* after GPU reset */
@@ -239,21 +238,16 @@ static struct dma_fence *lima_sched_run_job(struct drm_sched_job *job)
239238
for (i = 0; i < pipe->num_l2_cache; i++)
240239
lima_l2_cache_flush(pipe->l2_cache[i]);
241240

242-
if (task->vm != pipe->current_vm) {
243-
vm = lima_vm_get(task->vm);
244-
last_vm = pipe->current_vm;
245-
pipe->current_vm = task->vm;
246-
}
241+
lima_vm_put(pipe->current_vm);
242+
pipe->current_vm = lima_vm_get(task->vm);
247243

248244
if (pipe->bcast_mmu)
249-
lima_mmu_switch_vm(pipe->bcast_mmu, vm);
245+
lima_mmu_switch_vm(pipe->bcast_mmu, pipe->current_vm);
250246
else {
251247
for (i = 0; i < pipe->num_mmu; i++)
252-
lima_mmu_switch_vm(pipe->mmu[i], vm);
248+
lima_mmu_switch_vm(pipe->mmu[i], pipe->current_vm);
253249
}
254250

255-
lima_vm_put(last_vm);
256-
257251
trace_lima_task_run(task);
258252

259253
pipe->error = false;

0 commit comments

Comments
 (0)