@@ -163,6 +163,7 @@ extern KVMState *kvm_state;
/* external API */
+int kvm_free_slot_count(MachineState *ms);
bool kvm_has_free_slot(MachineState *ms);
int kvm_has_sync_mmu(void);
int kvm_has_vcpu_events(void);
@@ -132,6 +132,20 @@ static const KVMCapabilityInfo kvm_required_capabilites[] = {
KVM_CAP_LAST_INFO
};
+int kvm_free_slot_count(MachineState *ms)
+{
+ int i, count;
+ KVMState *s = KVM_STATE(ms->accelerator);
+
+ for (i = 0, count = 0; i < s->nr_slots; i++) {
+ if (s->slots[i].memory_size == 0) {
+ ++count;
+ }
+ }
+
+ return count;
+}
+
static KVMSlot *kvm_get_free_slot(KVMState *s)
{
int i;
@@ -152,4 +152,9 @@ bool kvm_has_free_slot(MachineState *ms)
{
return false;
}
+
+int kvm_free_slot_count(MachineState *ms)
+{
+ return INT_MAX;
+}
#endif
Signed-off-by: Igor Mammedov <imammedo@redhat.com> --- include/sysemu/kvm.h | 1 + kvm-all.c | 14 ++++++++++++++ kvm-stub.c | 5 +++++ 3 files changed, 20 insertions(+)