I would like to find a way for data (L1/L2) cache invalidation and flush in usermode on a Linux platform working with heterogenous non coherent caches (ARM A53 and ARM M7 cores). My problem lies on the A53 side, where an SMP Linux is running. M7 cores run a bare metal program on which I already implemented the flush / invalidation.
I know it is possible to write a kernel module for that but before doing this, I would like to know if there is any hidden API to do so? I am running on Linux 5.10.120. If not, what would be the most performant way to perform the flush / invalidation?
I used __builtin___clear_cache
, however, I found out this was for instructions only. Also I would like to have a better granularity on the operation to avoid invalidating line when flushing if not needed.
Also, the cacheflush
function in asm/cachectl.h
is not available (the header is not present for my CPU / target).
Disclaimer: This question was asked many times. Most answers try to be smart by telling "You don't need to do that...". Please refrain from answering something like this as the context in which I am asking this question requires data cache flush / invalidation.