mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
spi_flash: fix stale data being read from mmaped region
The issue that cache entries are not invalidated correctly sometimes can also be reproduced for non-encrypted flash as well. This change updates the workaround to do Cache_Flush, enabling it for non-encrypted flash, and adds a unit test.
This commit is contained in:
@@ -187,12 +187,12 @@ esp_err_t IRAM_ATTR spi_flash_mmap(size_t src_addr, size_t size, spi_flash_mmap_
|
||||
}
|
||||
|
||||
/* This is a temporary fix for an issue where some
|
||||
encrypted cache reads may see stale data.
|
||||
cache reads may see stale data.
|
||||
|
||||
Working on a long term fix that doesn't require invalidating
|
||||
entire cache.
|
||||
*/
|
||||
if (esp_flash_encryption_enabled() && !did_flush && need_flush) {
|
||||
if (!did_flush && need_flush) {
|
||||
Cache_Flush(0);
|
||||
Cache_Flush(1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user