What is the point of clean and invalidate for cache in ARM Cortex processors? Clean writes the cache contents to memory, and then invalidate guarantees that these just written contents are read again on next access?
I'm quite sure I'm missing something trivial here, as otherwise there wouldn't be a separate register in SCB to clean & invalidate. I've tried googling, reading the ARM reference manual and so on, and I don't see anything pointing to different than what I wrote above?
Clean commits the dirty cache to memory and marks it clean.
Invalidate removes those cached items from memory.
If they're re-accessed, yes, they'll be reloaded into the cache, but if not...well, now the cache is available for other things.
You usually use clean and invalidate on a buffer you've completed work on and no longer care about from the processor point of view. A good example of this would be audio buffers being sent to a DMA fed I2S port or DAC device.
Later edit:
Invalidate is mostly used for when you want to get data from the outside into the processor for computation. In this case, I2S DMA input: invalidate the buffer you're interested in, then access it normally.
That being said, trying to do this can be tricky since the entire cache line is loaded/invalidated/etc. If you have any other variables near your buffer, you can end up getting those caught up in your cache manipulation and throw away "proper" data accidentally.