diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2019-01-29 11:46:04 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2019-01-29 11:46:04 +0000 |
commit | 047be4ed24b3a408acccf9316d619477c06cca42 (patch) | |
tree | 494083f60d91dd1cb28a9c8ea78f0b4863fa0905 /exec.c | |
parent | bf8d09694ccc07487cd73d7562081fdaec3370c8 (diff) | |
download | qemu-047be4ed24b3a408acccf9316d619477c06cca42.zip qemu-047be4ed24b3a408acccf9316d619477c06cca42.tar.gz qemu-047be4ed24b3a408acccf9316d619477c06cca42.tar.bz2 |
memory: add memory_region_flush_rom_device()
ROM devices go via MemoryRegionOps->write() callbacks for write
operations and do not dirty/invalidate that memory. Device emulation
must be able to mark memory ranges that have been modified internally
(e.g. using memory_region_get_ram_ptr()).
Introduce the memory_region_flush_rom_device() API for this purpose.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20190123212234.32068-2-stefanha@redhat.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
[PMM: fix block comment style]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'exec.c')
-rw-r--r-- | exec.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -3162,6 +3162,19 @@ static void invalidate_and_set_dirty(MemoryRegion *mr, hwaddr addr, cpu_physical_memory_set_dirty_range(addr, length, dirty_log_mask); } +void memory_region_flush_rom_device(MemoryRegion *mr, hwaddr addr, hwaddr size) +{ + /* + * In principle this function would work on other memory region types too, + * but the ROM device use case is the only one where this operation is + * necessary. Other memory regions should use the + * address_space_read/write() APIs. + */ + assert(memory_region_is_romd(mr)); + + invalidate_and_set_dirty(mr, addr, size); +} + static int memory_access_size(MemoryRegion *mr, unsigned l, hwaddr addr) { unsigned access_size_max = mr->ops->valid.max_access_size; |