Merge branch 'fix/dualcore_branch_predictor_cache_race_v5.5' into 'release/v5.5'

fix(spi_flash): disable branch prediction on the parked core during flash ops (v5.5)

See merge request espressif/esp-idf!52201
This commit is contained in:
Jiang Jiang Jian
2026-09-11 12:16:45 +08:00
7 changed files with 93 additions and 24 deletions
@@ -25,10 +25,6 @@
#include "esp32c61/rom/opi_flash.h"
#endif
#if SOC_BRANCH_PREDICTOR_SUPPORTED
#include "riscv/rv_utils.h"
#endif
#define SPI_IDX 1
#if CONFIG_IDF_TARGET_ESP32
@@ -815,10 +811,6 @@ void esp_rom_opiflash_cache_mode_config(esp_rom_spiflash_read_mode_t mode, const
extern void rom_spi_flash_disable_cache(uint32_t cpuid, uint32_t *saved_state);
void spi_flash_disable_cache(uint32_t cpuid, uint32_t *saved_state)
{
#if SOC_BRANCH_PREDICTOR_SUPPORTED
//branch predictor will start cache request as well
rv_utils_dis_branch_predictor();
#endif
rom_spi_flash_disable_cache(cpuid, saved_state);
}
@@ -826,8 +818,5 @@ extern void rom_spi_flash_restore_cache(uint32_t cpuid, uint32_t saved_state);
void spi_flash_restore_cache(uint32_t cpuid, uint32_t saved_state)
{
rom_spi_flash_restore_cache(cpuid, saved_state);
#if SOC_BRANCH_PREDICTOR_SUPPORTED
rv_utils_en_branch_predictor();
#endif
}
#endif