qemu: memory notifiers
v2 cover qemu: memory notifiers
This patch against qemu upstream adds notifiers hook which lets backends get notified on memory changes, and converts kvm to use it. It survived light testing. Avi, could you please take a look at this patch? Thanks!
--- cpu-common.h | 19 +++++++++++++++++ exec.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 78 insertions(+), 3 deletions(-)
cpu-common.h +19 -0
@@ -8,6 +8,7 @@#endif #include "bswap.h" +#include "qemu-queue.h" /* address in the RAM (different from a physical address) */ typedef unsigned long ram_addr_t ;
@@ -61,6 +62,24 @@ void cpu_physical_memory_unmap(void *buffer, target_phys_addr_t len,void *cpu_register_map_client (void *opaque,void (*callback)(void *opaque));void cpu_unregister_map_client (void *cookie); +struct CPUPhysMemoryClient ; +typedef struct CPUPhysMemoryClient CPUPhysMemoryClient ; +struct CPUPhysMemoryClient { +void (*set_memory)(struct CPUPhysMemoryClient *client, +target_phys_addr_t start_addr, +ram_addr_t size, +ram_addr_t phys_offset); +int (*sync_dirty_bitmap)(struct CPUPhysMemoryClient *client, +target_phys_addr_t start_addr, +target_phys_addr_t end_addr); +int (*migration_log)(struct CPUPhysMemoryClient *client, +int enable); +QLIST_ENTRY (CPUPhysMemoryClient) list; +}; + +void cpu_register_phys_memory_client (CPUPhysMemoryClient *); +void cpu_unregister_phys_memory_client (CPUPhysMemoryClient *); +uint32_t ldub_phys (target_phys_addr_t addr);uint32_t lduw_phys (target_phys_addr_t addr);uint32_t ldl_phys (target_phys_addr_t addr);
exec.c +59 -3
90 lines not on this page · raw message
Signature · 14 lines
1.6.6.rc1.43.gf55cc Michael S. Tsirkin (3): qemu: memory notifiers kvm: move kvm_set_phys_mem around kvm: move kvm to use memory notifiers cpu-common.h | 19 ++++ exec.c | 108 +++++++++++++++++++-- kvm-all.c | 310 +++++++++++++++++++++++++++++++-------------------------- kvm.h | 8 -- 4 files changed, 287 insertions(+), 158 deletions(-)