[PATCH 8/9] coalesce mmio regions without an explicit call

Glauber Costa
2008-08-13T00:54:00Z

Try to coalesce mmio regions inside kvm_cpu_register_physical_memory().
Coalescing is done if area has TLB_MMIO flags set, or anything greater than that.

The original explicit function turns into an empty function. This is to be
bisection friendly. Direct calls are to be removed in a later commit.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
libkvm/libkvm.c | 4 ++++
qemu/qemu-kvm.c | 13 +++----------
2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
index d62cb2a..c563bb6 100644
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -1107,6 +1107,9 @@ int kvm_register_coalesced_mmio(kvm_context_t kvm, uint64_t addr, uint32_t size)
perror("kvm_register_coalesced_mmio_zone");
return -errno;
}
+#ifdef DEBUG_MEMREG
+ printf("Registered coalesced mmio region for %llx (%lx)\n", addr, size);
+#endif
return 0;
}
#endif
@@ -1129,6 +1132,7 @@ int kvm_unregister_coalesced_mmio(kvm_context_t kvm, uint64_t addr, uint32_t siz
perror("kvm_unregister_coalesced_mmio_zone");
return -errno;
}
+ printf("Unregistered coalesced mmio region for %llx (%lx)\n", addr, size);
return 0;
}
#endif
diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
index 96b622b..29c5c1d 100644
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -800,6 +800,7 @@ void kvm_cpu_register_physical_memory(target_phys_addr_t start_addr,
printf("No free mmio slots\n");
exit(1);
}
+ kvm_register_coalesced_mmio(kvm_context, start_addr, size);
return;
}
r = kvm_is_intersecting_mem(kvm_context, start_addr);
@@ -1035,13 +1036,5 @@ void kvm_mutex_lock(void)
cpu_single_env = NULL;
}

-int qemu_kvm_register_coalesced_mmio(target_phys_addr_t addr, unsigned int size)
-{
- return kvm_register_coalesced_mmio(kvm_context, addr, size);
-}
-
-int qemu_kvm_unregister_coalesced_mmio(target_phys_addr_t addr,
- unsigned int size)
-{
- return kvm_unregister_coalesced_mmio(kvm_context, addr, size);
-}
+int qemu_kvm_register_coalesced_mmio(target_phys_addr_t addr, unsigned int size) {}
+int qemu_kvm_unregister_coalesced_mmio(target_phys_addr_t addr, unsigned int size) {}
--
1.5.5.1