@@ -96,6 +96,22 @@ static KVMSlot *kvm_alloc_slot(KVMState *s)
abort();
}
+int kvm_free_slots(void)
+{
+ KVMState *s = kvm_state;
+ int i, j;
+
+ for (i = 0, j = 0; i < ARRAY_SIZE(s->slots); i++) {
+ /* KVM private memory slots and used slots */
+ if ((i >= 8 && i < 12) || s->slots[i].memory_size) {
+ continue;
+ }
+ j++;
+ }
+
+ return j;
+}
+
static KVMSlot *kvm_lookup_matching_slot(KVMState *s,
target_phys_addr_t start_addr,
target_phys_addr_t end_addr)
@@ -221,4 +221,6 @@ int kvm_irqchip_in_kernel(void);
int kvm_set_irq(int irq, int level, int *status);
+int kvm_free_slots(void);
+
#endif