From 6418f8b54f6552d701d05f2dd9f3e0e351da527a Mon Sep 17 00:00:00 2001 From: bunnie Date: Fri, 7 Oct 2022 18:46:59 +0800 Subject: [PATCH] add notes about making the cache flush loop more efficient on suspend --- services/xous-susres/Cargo.toml | 2 +- services/xous-susres/src/main.rs | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/services/xous-susres/Cargo.toml b/services/xous-susres/Cargo.toml index 5047a920f..ad500053b 100644 --- a/services/xous-susres/Cargo.toml +++ b/services/xous-susres/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xous-susres" -version = "0.1.5" +version = "0.1.6" authors = ["bunnie "] edition = "2018" description = "Manager of suspend/resume operations implementation" diff --git a/services/xous-susres/src/main.rs b/services/xous-susres/src/main.rs index 8a820fa9a..32899d084 100644 --- a/services/xous-susres/src/main.rs +++ b/services/xous-susres/src/main.rs @@ -329,7 +329,14 @@ mod implementation { xous::syscall::map_memory( None, None, - 512 * 1024, // L2 cache is 128k, but emperically it doesn't fully flush until 512k is written. Maybe has to do with write-back behavior?? + // L2 cache is 128k, but it takes 512k to flush it, because the L1 D$ has 4 ways + // If for some reason we can't allocate 512k we can re-write this to use + // unsafe { core::arch::asm!(".word 0x500F"); } + // to flush the L1 cache after every 4k of data written (one way size) + // however, the memory is de-allocated on resume, so this isn't + // a permanent penalty to pay, and changing this could would require + // a validation cycle that I don't want to go through right now. + 512 * 1024, xous::MemoryFlags::R | xous::MemoryFlags::W | xous::MemoryFlags::RESERVE, ).expect("couldn't allocate RAM for cache flushing") );