xtensa_cache:Disable clean/flush optimization in case of SMP restriction

In a multicore task scenario, there may be a situation where the task runs on different cores at different time slices (when the task is not bound to a particular core).
When the task calls cache clean/flush(range > cache size), depending on the optimization, clean_all, flush_all are called. however, at this point, there may be dirty data or incomplete data profiles in the cache on the kernel that is running the task, which may result in dirty data being flushed into memory or make the application think that the flushed data should be successfully flushed into memory, leading to unknown consequences.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
This commit is contained in:
chenrun1 2024-02-28 11:42:17 +08:00 committed by Xiang Xiao
parent 91cf97ed84
commit bb4d710d62

View file

@ -498,10 +498,12 @@ void up_clean_dcache(uintptr_t start, uintptr_t end)
start &= ~(XCHAL_DCACHE_LINESIZE - 1);
#ifndef CONFIG_SMP
if ((end - start) >= XCHAL_DCACHE_SIZE)
{
return up_clean_dcache_all();
}
#endif
for (; start < end; start += XCHAL_DCACHE_LINESIZE)
{
@ -580,10 +582,12 @@ void up_flush_dcache(uintptr_t start, uintptr_t end)
start &= ~(XCHAL_DCACHE_LINESIZE - 1);
#ifndef CONFIG_SMP
if ((end - start) >= XCHAL_DCACHE_SIZE)
{
return up_clean_dcache_all();
}
#endif
for (; start < end; start += XCHAL_DCACHE_LINESIZE)
{