On Thu, Jan 24, 2019 at 12:11:55PM +0100, Philippe Mathieu-Daudé wrote: > On 1/23/19 10:22 PM, Stefan Hajnoczi wrote: > > pflash devices should mark the memory region dirty and invalidate TBs > > after directly writing to the RAM backing the ROM device. > > > > Note that pflash_cfi01_get_memory() is used by several machine types to > > populate ROM contents directly. Callers are untouched by this patch > > because they only modify memory before the guest is started. ... > > @@ -763,6 +766,8 @@ static void pflash_cfi01_realize(DeviceState *dev, Error **errp) > > error_setg(errp, "failed to read the initial flash content"); > > return; > > } > > + > > + memory_region_flush_rom_device(&pfl->mem, 0, total_len); > > The device realize() is also executed before the guest is started, is > this call really necessary? My rationale was that machine init only happens before the guest is started while ->realize() is called by hotplug too. That said, can pflash devices be hotplugged? If you guys prefer not flushing from pflash ->realize() then I'll drop it. Stefan