diff options
Diffstat (limited to 'softmmu')
-rw-r--r-- | softmmu/memory_mapping.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/softmmu/memory_mapping.c b/softmmu/memory_mapping.c index a2af02c41c..a62eaa49cc 100644 --- a/softmmu/memory_mapping.c +++ b/softmmu/memory_mapping.c @@ -246,6 +246,15 @@ static void guest_phys_block_add_section(GuestPhysListener *g, #endif } +static int guest_phys_ram_populate_cb(MemoryRegionSection *section, + void *opaque) +{ + GuestPhysListener *g = opaque; + + guest_phys_block_add_section(g, section); + return 0; +} + static void guest_phys_blocks_region_add(MemoryListener *listener, MemoryRegionSection *section) { @@ -257,6 +266,17 @@ static void guest_phys_blocks_region_add(MemoryListener *listener, memory_region_is_nonvolatile(section->mr)) { return; } + + /* for special sparse regions, only add populated parts */ + if (memory_region_has_ram_discard_manager(section->mr)) { + RamDiscardManager *rdm; + + rdm = memory_region_get_ram_discard_manager(section->mr); + ram_discard_manager_replay_populated(rdm, section, + guest_phys_ram_populate_cb, g); + return; + } + guest_phys_block_add_section(g, section); } |