On 18 October 2017 at 17:10, Cédric Le Goater <c...@kaod.org> wrote: > On 10/17/2017 05:39 PM, Peter Maydell wrote: >> A "reads like RAM but writes are ignored" lump of memory is easy... > > yes. It seems but I haven't found my way through :/
memory_region_init_rom_device() creates a memory region which is backed by RAM for reads (and for debug writes, like ELF file loading), but backed by the usual device callback functions for writes. So I think you should just be able to use one of those but with the write functions doing nothing (or warning about unimp. behaviour, assuming that your flash devices actually have some kind of command behaviour for writes). This is how we implement the flash device with actual behaviour behind them. hw/mips/boston.c actually has an example of doing a dummy flash device like this (though it uses memory_region_init_rom_device_nomigrate(), which is a bug because your memory contents won't get migrated if you do that. Use the plain function instead.) thanks -- PMM