(Note that cache_invalidate_data() is a bit of a misnomer as it
actually writes dirty cache lines to memory before invalidating them.
Also, I'm using the 'test-nios2' branch of Thomas Chou's git
repository.)
The reason this is needed is that load_flat_file() in fs/binfmt_flat.c
(which is responsible for loading executables in FLAT or ZFLAT format)
calls flush_icache_range() after loading the executable into memory.
The NiosII implementation of flush_icache_range() in
include/asm-nios2/cacheflush.h) just calls the icache_push() function
described above. However, with the old version of icache_push() there
may still be dirty data cache lines that have not yet been written to
memory. If the CPU reads instructions from these memory addresses before
the data cache lines have been flushed, it will be reading invalid
(stale) instructions.