summaryrefslogtreecommitdiff
path: root/kvm-all.c
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2010-02-17 04:20:40 -0200
committerMarcelo Tosatti <mtosatti@redhat.com>2010-02-17 04:20:40 -0200
commit7acb0371154e7f8999175a4e432bedfc88d2999c (patch)
tree15d361a2af5d9ff3471d921344888844aebbb14b /kvm-all.c
parent06a01deed6ebdd499d26cea2d9bf5527537d5980 (diff)
parent7b8f3b7834360d4777d80552db650b75dfc1010c (diff)
Merge commit '7b8f3b7834360d4777d80552db650b75dfc1010c' into upstream-merge
* commit '7b8f3b7834360d4777d80552db650b75dfc1010c': kvm: move kvm to use memory notifiers Conflicts: exec.c Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'kvm-all.c')
-rw-r--r--kvm-all.c50
1 files changed, 44 insertions, 6 deletions
diff --git a/kvm-all.c b/kvm-all.c
index b14314620..e460e7035 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -268,7 +268,7 @@ int kvm_log_stop(target_phys_addr_t phys_addr, ram_addr_t size)
KVM_MEM_LOG_DIRTY_PAGES);
}
-int kvm_set_migration_log(int enable)
+static int kvm_set_migration_log(int enable)
{
KVMState *s = kvm_state;
KVMSlot *mem;
@@ -303,8 +303,8 @@ static int test_le_bit(unsigned long nr, unsigned char *addr)
* @start_add: start of logged region.
* @end_addr: end of logged region.
*/
-int kvm_physical_sync_dirty_bitmap(target_phys_addr_t start_addr,
- target_phys_addr_t end_addr)
+static int kvm_physical_sync_dirty_bitmap(target_phys_addr_t start_addr,
+ target_phys_addr_t end_addr)
{
KVMState *s = kvm_state;
unsigned long size, allocated_size = 0;
@@ -407,9 +407,9 @@ int kvm_check_extension(KVMState *s, unsigned int extension)
}
#ifdef KVM_UPSTREAM
-void kvm_set_phys_mem(target_phys_addr_t start_addr,
- ram_addr_t size,
- ram_addr_t phys_offset)
+static void kvm_set_phys_mem(target_phys_addr_t start_addr,
+ ram_addr_t size,
+ ram_addr_t phys_offset)
{
KVMState *s = kvm_state;
ram_addr_t flags = phys_offset & ~TARGET_PAGE_MASK;
@@ -545,6 +545,43 @@ void kvm_set_phys_mem(target_phys_addr_t start_addr,
}
}
+#endif
+
+static void kvm_client_set_memory(struct CPUPhysMemoryClient *client,
+ target_phys_addr_t start_addr,
+ ram_addr_t size,
+ ram_addr_t phys_offset)
+{
+ kvm_set_phys_mem(start_addr, size, phys_offset);
+}
+
+static int kvm_client_sync_dirty_bitmap(struct CPUPhysMemoryClient *client,
+ target_phys_addr_t start_addr,
+ target_phys_addr_t end_addr)
+{
+ return kvm_physical_sync_dirty_bitmap(start_addr, end_addr);
+}
+
+static int kvm_client_migration_log(struct CPUPhysMemoryClient *client,
+ int enable)
+{
+ return kvm_set_migration_log(enable);
+}
+
+static CPUPhysMemoryClient kvm_cpu_phys_memory_client = {
+ .set_memory = kvm_client_set_memory,
+ .sync_dirty_bitmap = kvm_client_sync_dirty_bitmap,
+ .migration_log = kvm_client_migration_log,
+};
+
+
+void kvm_cpu_register_phys_memory_client(void)
+{
+ cpu_register_phys_memory_client(&kvm_cpu_phys_memory_client);
+}
+
+#ifdef KVM_UPSTREAM
+
int kvm_init(int smp_cpus)
{
static const char upgrade_note[] =
@@ -641,6 +678,7 @@ int kvm_init(int smp_cpus)
goto err;
kvm_state = s;
+ cpu_register_phys_memory_client(&kvm_cpu_phys_memory_client);
return 0;