as_disable() flushes the caches and only then switches the address
space to UNMAPPED with UPDATE. Between the two, accesses through the
address space can bring its data back into the L2 and load/store caches
that the flush has just cleaned.
Flush only once UPDATE(UNMAPPED) has completed, like panthor does since
commit 9a96e169c926 ("drm/panthor: Move cache-flush after
UPDATE(UNMAPPED)").
Signed-off-by: Daniel Almeida <[email protected]>
---
drivers/gpu/drm/tyr/mmu/address_space.rs | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/tyr/mmu/address_space.rs
b/drivers/gpu/drm/tyr/mmu/address_space.rs
index dddf5d41f3cc..fa4c26a6eb12 100644
--- a/drivers/gpu/drm/tyr/mmu/address_space.rs
+++ b/drivers/gpu/drm/tyr/mmu/address_space.rs
@@ -312,9 +312,6 @@ fn as_enable(
fn as_disable(&mut self, io: &IoMem<'_>, as_nr: usize) -> Result {
self.validate_as_slot(as_nr)?;
- // Flush AS before disabling
- self.flush_caches(io)?;
-
// Release any pending LOCK before disabling the address space.
self.as_send_cmd_and_wait(io, as_nr, MmuCommand::Unlock)?;
@@ -351,6 +348,10 @@ fn as_disable(&mut self, io: &IoMem<'_>, as_nr: usize) ->
Result {
self.as_send_cmd_and_wait(io, as_nr, MmuCommand::Update)?;
+ // Flush only after UPDATE(UNMAPPED) has completed, so this address
space
+ // can no longer bring data into the caches.
+ self.flush_caches(io)?;
+
Ok(())
}
--
2.56.0