kvm: API to obtain max supported mem slots
RFC PATCH 1/2 kvm: API to obtain max supported mem slots
In reply to a message not in the archiveIntroduce kvm_get_max_memslots() API that can be used to obtain the maximum number of memslots supported by KVM.
--- include/sysemu/kvm.h | 1 + kvm-all.c | 7 +++++++ 2 files changed, 8 insertions(+)
include/sysemu/kvm.h +1 -0
@@ -527,4 +527,5 @@ int kvm_set_one_reg(CPUState *cs, uint64_t id, void *source);* Returns: 0 on success, or a negative errno on failure. */ int kvm_get_one_reg (CPUState *cs,uint64_t id,void *target); +int kvm_get_max_memslots (void );#endif
kvm-all.c +7 -0
@@ -126,6 +126,13 @@ static const KVMCapabilityInfo kvm_required_capabilites[] = { KVM_CAP_LAST_INFO }; +int kvm_get_max_memslots (void ) +{ +KVMState *s =KVM_STATE (current_machine->accelerator); + +return s->nr_slots; +} +static KVMSlot *kvm_get_free_slot (KVMMemoryListener *kml) {KVMState *s = kvm_state;
Signature · 1 line
2.1.0
RFC PATCH 2/2 spapr: Increase max memslots to 512
In reply to a message not in the archiveKVM now supports 512 memslots on PowerPC (earlier it was 32). Hence allow user to specify a max of 512 hotpluggable memory slots.
Instead of hard coding the max value, use the KVM supplied value if KVM is enabled. Otherwise resort to the default value of 32.
--- hw/ppc/spapr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
hw/ppc/spapr.c +4 -2
@@ -1816,11 +1816,13 @@ static void ppc_spapr_init(MachineState *machine)/* initialize hotplug memory address space */ if (machine->ram_size < machine->maxram_size) {ram_addr_t hotplug_mem_size = machine->maxram_size - machine->ram_size; +int max_memslots =kvm_enabled () ?kvm_get_max_memslots () : +SPAPR_MAX_RAM_SLOTS ; -if (machine->ram_slots >SPAPR_MAX_RAM_SLOTS ) { +if (machine->ram_slots > max_memslots) {error_report ("Specified number of memory slots %" PRIu64" exceeds max supported %d" , - machine->ram_slots,SPAPR_MAX_RAM_SLOTS ); + machine->ram_slots, max_memslots);exit (1 ); }
Signature · 1 line
2.1.0
Paolo Bonzini
Acked-byQuoted 28 lines · Bharata B Rao
Introduce
kvm_get_max_memslots()API that can be used to obtain the maximum number of memslots supported by KVM.Signed-off-by Bharata B Rao <[email protected]>--- include/sysemu/kvm.h | 1 + kvm-all.c | 7 +++++++ 2 files changed, 8 insertions(+)include/sysemu/kvm.h +1
-0@@ -527,4 +527,5 @@ int kvm_set_one_reg(CPUState *cs, uint64_t id, void *source);* Returns: 0 on success, or a negative errno on failure. */ int kvm_get_one_reg (CPUState *cs,uint64_t id,void *target); +int kvm_get_max_memslots (void );#endif kvm-all.c +0
-0@@ -126,6 +126,13 @@ static const KVMCapabilityInfo kvm_required_capabilites[] = { KVM_CAP_LAST_INFO };
kvm-all.c static const KVMCapabilityInfo kvm_required_capabilites[] = { · line 138
Quoted 10 lines
kvm-all.c +7
-0+int kvm_get_max_memslots (void ) +{ +KVMState *s =KVM_STATE (current_machine->accelerator); + +return s->nr_slots; +} +static KVMSlot *kvm_get_free_slot (KVMMemoryListener *kml) {KVMState *s = kvm_state;
Quoted 30 lines · Paolo Bonzini
Quoted 27 lines · Bharata B Rao
Introduce
kvm_get_max_memslots()API that can be used to obtain the maximum number of memslots supported by KVM.Signed-off-by Bharata B Rao <[email protected]>--- include/sysemu/kvm.h | 1 + kvm-all.c | 7 +++++++ 2 files changed, 8 insertions(+)include/sysemu/kvm.h +1
-0@@ -527,4 +527,5 @@ int kvm_set_one_reg(CPUState *cs, uint64_t id, void *source);* Returns: 0 on success, or a negative errno on failure. */ int kvm_get_one_reg (CPUState *cs,uint64_t id,void *target); +int kvm_get_max_memslots (void );#endif kvm-all.c +0
-0@@ -126,6 +126,13 @@ static const KVMCapabilityInfo kvm_required_capabilites[] = { KVM_CAP_LAST_INFO };
Quoted 13 lines
kvm-all.c static const KVMCapabilityInfo kvm_required_capabilites[] = { · line 138
Quoted 11 lines
kvm-all.c +7
-0+int kvm_get_max_memslots (void ) +{ +KVMState *s =KVM_STATE (current_machine->accelerator); + +return s->nr_slots; +} +static KVMSlot *kvm_get_free_slot (KVMMemoryListener *kml) {KVMState *s = kvm_state;Acked-by Paolo Bonzini <[email protected]>
Thanks for the ack, I've merged this into my tree.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson