I've narrowed down a crash to code that clears MAR bits covering DDR3. Stepping into the code with the debugger, the stack becomes corrupted. I've confirmed corruption occurs the moment the MAR bit that covers the stack area is cleared in DDR3.
Is this expected behavior? According to spru862a section 2.7.1, it seems like clearing MAR bits should not affect data already cached. Or am I misinterpreting this paragraph?
"Disabling external memory caching after it was enabled should not be generally necessary. However if it is, then the following considerations should be taken into account. If the MAR bit is changed from 1 to 0, external memory addresses already cached stay in the cache and accesses to those addresses still hit. The MAR bit is only consulted if the external memory address misses in L2. (This includes the case where L2 is all SRAM. Since there is no L2 cache, this can also be interpreted as an L2 miss).
If all addresses in the respective external memory address space are made noncacheable, the addressesneed to be written back and invalidated first"
The corruption occurs on both the C6678 and the C6657 devices. I noticed a L2 corruption Errata, but it talks only about coherency operations, so I'm assuming this does not apply here.
This happens whether or not I do a full cache clean before the MAR bits are cleared. Of course, the cache clean only can do so much - any bit of code is likely to touch the cache if the stack is in DDR3.
In our application, clearing the MAR bits only occurs as part of a global cache disable. I'm assuming the original code touched the MAR bits either to address an old errata or in the hope that this would make the cache-disabled performance slightly better. So the workaround for me is simple - I just move the MAR bit clearing until after the cache is already turned off. But I worry that other folks might fall into the same trap.

