as_disable() sends FLUSH_MEM, which cleans and invalidates the L2 and
load/store caches and then unlocks the address space. FLUSH_MEM is
deprecated from Mali-Gx20 onwards.

Do the same with GPU_COMMAND FLUSH_CACHES followed by UNLOCK, as
as_flush() and as_end_update() now do.

Signed-off-by: Daniel Almeida <[email protected]>
---
 drivers/gpu/drm/tyr/mmu/address_space.rs | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tyr/mmu/address_space.rs 
b/drivers/gpu/drm/tyr/mmu/address_space.rs
index fc617f282cbe..dddf5d41f3cc 100644
--- a/drivers/gpu/drm/tyr/mmu/address_space.rs
+++ b/drivers/gpu/drm/tyr/mmu/address_space.rs
@@ -306,14 +306,17 @@ fn as_enable(
         Ok(())
     }
 
-    /// Disables an AS slot and clears its configuration.
+    /// Disables an AS slot, clears its configuration and flushes the L2 and 
load/store caches.
     ///
     /// Returns an error if the slot is invalid or if register writes/commands 
fail.
     fn as_disable(&mut self, io: &IoMem<'_>, as_nr: usize) -> Result {
         self.validate_as_slot(as_nr)?;
 
         // Flush AS before disabling
-        self.as_send_cmd_and_wait(io, as_nr, MmuCommand::FlushMem)?;
+        self.flush_caches(io)?;
+
+        // Release any pending LOCK before disabling the address space.
+        self.as_send_cmd_and_wait(io, as_nr, MmuCommand::Unlock)?;
 
         io.write(
             TRANSTAB_LO::try_at(as_nr).ok_or(EINVAL)?,

-- 
2.56.0

Reply via email to