mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
ramblock-notifier: new
This adds a notify interface of ram block additions and removals. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
fb5e19d2e1
commit
0987d735a3
6 changed files with 112 additions and 49 deletions
|
@ -163,6 +163,7 @@ static void xen_remap_bucket(MapCacheEntry *entry,
|
|||
err = g_malloc0(nb_pfn * sizeof (int));
|
||||
|
||||
if (entry->vaddr_base != NULL) {
|
||||
ram_block_notify_remove(entry->vaddr_base, entry->size);
|
||||
if (munmap(entry->vaddr_base, entry->size) != 0) {
|
||||
perror("unmap fails");
|
||||
exit(-1);
|
||||
|
@ -188,6 +189,7 @@ static void xen_remap_bucket(MapCacheEntry *entry,
|
|||
entry->valid_mapping = (unsigned long *) g_malloc0(sizeof(unsigned long) *
|
||||
BITS_TO_LONGS(size >> XC_PAGE_SHIFT));
|
||||
|
||||
ram_block_notify_add(entry->vaddr_base, entry->size);
|
||||
bitmap_zero(entry->valid_mapping, nb_pfn);
|
||||
for (i = 0; i < nb_pfn; i++) {
|
||||
if (!err[i]) {
|
||||
|
@ -397,6 +399,7 @@ static void xen_invalidate_map_cache_entry_unlocked(uint8_t *buffer)
|
|||
}
|
||||
|
||||
pentry->next = entry->next;
|
||||
ram_block_notify_remove(entry->vaddr_base, entry->size);
|
||||
if (munmap(entry->vaddr_base, entry->size) != 0) {
|
||||
perror("unmap fails");
|
||||
exit(-1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue