Skip to content

Commit d9a216c

Browse files
hoshinolinajannau
authored andcommitted
drm/asahi: mmu: Fix deadlock on remap ops
Signed-off-by: Asahi Lina <lina@asahilina.net>
1 parent 02b9f08 commit d9a216c

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

drivers/gpu/drm/asahi/mmu.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ struct StepContext {
228228
prev_va: Option<Pin<KBox<gpuvm::GpuVa<VmInner>>>>,
229229
next_va: Option<Pin<KBox<gpuvm::GpuVa<VmInner>>>>,
230230
vm_bo: Option<ARef<gpuvm::GpuVmBo<VmInner>>>,
231+
prev_vm_bo_1: Option<ARef<gpuvm::GpuVmBo<VmInner>>>,
232+
prev_vm_bo_2: Option<ARef<gpuvm::GpuVmBo<VmInner>>>,
231233
prot: u32,
232234
}
233235

@@ -408,6 +410,17 @@ impl gpuvm::DriverGpuVm for VmInner {
408410
}
409411
}
410412

413+
if ctx.prev_vm_bo_1.is_none() {
414+
assert!(ctx.prev_vm_bo_1.replace(vm_bo).is_none());
415+
} else if ctx.prev_vm_bo_2.is_none() {
416+
assert!(ctx.prev_vm_bo_2.replace(vm_bo).is_none());
417+
} else {
418+
dev_crit!(
419+
self.dev.as_ref(),
420+
"step_remap: too many remap ops, deadlock expected"
421+
);
422+
}
423+
411424
Ok(())
412425
}
413426
}

0 commit comments

Comments
 (0)