Skip to content

Commit

Permalink
drm/asahi: mmu: Add some barriers
Browse files Browse the repository at this point in the history
Just being paranoid.

Signed-off-by: Asahi Lina <[email protected]>
  • Loading branch information
asahilina committed Jan 20, 2025
1 parent 801116e commit ecf9fc5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/gpu/drm/asahi/mmu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ impl gpuvm::DriverGpuVm for VmInner {
self.unmap_pages(va.addr(), UAT_PGSZ, (va.range() >> UAT_PGBIT) as usize)?;

if let Some(asid) = self.slot() {
fence(Ordering::SeqCst);
mem::tlbi_range(asid as u8, va.addr() as usize, va.range() as usize);
mod_dev_dbg!(
self.dev,
Expand Down Expand Up @@ -354,6 +355,7 @@ impl gpuvm::DriverGpuVm for VmInner {
self.unmap_pages(unmap_start, UAT_PGSZ, (unmap_range >> UAT_PGBIT) as usize)?;

if let Some(asid) = self.slot() {
fence(Ordering::SeqCst);
mem::tlbi_range(asid as u8, unmap_start as usize, unmap_range as usize);
mod_dev_dbg!(
self.dev,
Expand Down Expand Up @@ -656,6 +658,7 @@ impl KernelMapping {
self.size()
);
}
fence(Ordering::SeqCst);

// If we don't have (and have never had) a VM slot, just return
let slot = match owner.slot() {
Expand Down Expand Up @@ -806,6 +809,7 @@ impl Drop for KernelMapping {
}

if let Some(asid) = owner.slot() {
fence(Ordering::SeqCst);
mem::tlbi_range(asid as u8, self.iova() as usize, self.size());
mod_dev_dbg!(
owner.dev,
Expand Down

0 comments on commit ecf9fc5

Please sign in to comment.