This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Zeroise complete L1 and L2 caches in ARM v8?

Hi All,

my situation is, I have to zeroize complete caches in ARM-v8 (Xilinx Ultrascale+ Device). Zeroise or set every line to constant values.

Does anybody know how can I solve this?

Thanks in advance.

  • Are you trying to fill the cache RAMs with zeros? Or, ensure the cache is empty?

    Filling the cache with zeros would be harder than you might think. Cache allocation happens automatically, and not under direct control of software. So even if you do a series of reads of memory known to contain zeros, things like speculation can lead addresses other than those you expect being in the cache.

    Ensuring that the cache is "empty" is simple, as you can use invalidate operations (iterating through sets and ways). But this only marks the lines as not containing data, it doesn't set them to 0s.
  • A incomplete solution would be to repeatedly reading a block of 0xffs from RAM, thus causing the cache to fill with 0xffs.
    Invalidation and flushing will not help in this case as that does not empty the data from the cache.
    The difficulty is in ensuring that the cache is completely cleared, you would have to work out the access pattern needed to cause a complete clear based on the characteristics of the cache in question.