stephen_usher wrote: 23 Nov 2020 16:08
From what's been posted previously I was under the impression that the firmware asserted the CDIS line for all addresses outside of the Alt-RAM address range, turning caching off for those addresses. This is important for ST-RAM, of course, as the DMA can change the data in RAM without the CPU's knowledge.
TOS3.06 (and of course EmuTOS) flushes the 68030 data cache after disk operations, so they are fine, this does not happen on TOS2.06.
I wont pretend to be an expert on the area so please excuse me if something here is wrong, but asserting CIIN isn't going to completely disable the cache. It's to prevent data from being put into the cache on read operations.
If you need to prevent writes from creating cache-entries then that is a software issue using the WA flag and/or MMU.
And then you have this one:
Enabling write-allocation has an undesired side effect, though: as the NOT CIIN signal is ignored during write-accesses, a longword-aligned write of a longword will create a valid cache entry that may cause a cache hit during subsequent read accesses, regardless of the caching mode for that memory location as indicated by the external hardware. This behaviour can be corrected only by using the MMU to specify caching modes on a page-by-page basis
There are plenty to read on this subject on Amiga forums :)
If something, somehow, ends up getting a cache entry then subsequent reads will grab it from the cache no matter what, and that may be goodbye if your software is oblivious to it like 206 is. For example:
You allocate a buffer, then you clear it - tada! now you may have created cache entries, DMA writes to the buffer, CPU doesn't know about the DMA write and you've put it in the cache due to that clear so that's what you get back.
Perhaps maprom/fastram may be able to help TOS206 by setting Write-Allocate to off and hope no-one enables it.. if that's ok on TOS, apparently WA must be enabled on AmigaOS for some reason and I can't be bothered trying to understand why :) I have no idea what it defaults to either but it would make sense that default is enabled?
At the same time I should make sure the MMU is being set up properly to tag relevant pages while at it.
I should revisit these programs at some point, I didn't bother too much since it was easy enough to disable caching in the TOS options plus I don't use a floppy or ACSI device in my machine.
For now, I'd recommend disabling the cache in the TOS2.06 options menu, especially if you're using some kind of DMA device or the blitter.
Edit: also 68030 datasheet for some "fun" nighttime reading about its cache:
https://www.nxp.com/docs/en/reference-m ... 0UM-P1.pdf