qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC PATCH v0 1/2] kvm: API to obtain max supported mem slots
       [not found] <1464774685-7885-1-git-send-email-bharata@linux.vnet.ibm.com>
@ 2016-06-01  9:51 ` Bharata B Rao
  2016-06-01  9:51 ` [Qemu-devel] [RFC PATCH v0 2/2] spapr: Increase max memslots to 512 Bharata B Rao
       [not found] ` <201606010952.u519n7R2025378@mx0a-001b2d01.pphosted.com>
  2 siblings, 0 replies; 4+ messages in thread
From: Bharata B Rao @ 2016-06-01  9:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-ppc, david, thuth, imammedo, pbonzini, 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 <bharata@linux.vnet.ibm.com>
---
 include/sysemu/kvm.h | 1 +
 kvm-all.c            | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 65569ed..ad6f837 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -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
diff --git a/kvm-all.c b/kvm-all.c
index d317dcb..fbd2d93 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -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;
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [RFC PATCH v0 2/2] spapr: Increase max memslots to 512
       [not found] <1464774685-7885-1-git-send-email-bharata@linux.vnet.ibm.com>
  2016-06-01  9:51 ` [Qemu-devel] [RFC PATCH v0 1/2] kvm: API to obtain max supported mem slots Bharata B Rao
@ 2016-06-01  9:51 ` Bharata B Rao
       [not found] ` <201606010952.u519n7R2025378@mx0a-001b2d01.pphosted.com>
  2 siblings, 0 replies; 4+ messages in thread
From: Bharata B Rao @ 2016-06-01  9:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-ppc, david, thuth, imammedo, pbonzini, Bharata B Rao

KVM 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.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
---
 hw/ppc/spapr.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 44e401a..3de426e 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -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);
         }
 
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [RFC PATCH v0 1/2] kvm: API to obtain max supported mem slots
       [not found] ` <201606010952.u519n7R2025378@mx0a-001b2d01.pphosted.com>
@ 2016-06-01  9:56   ` Paolo Bonzini
  2016-06-02  0:41     ` David Gibson
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2016-06-01  9:56 UTC (permalink / raw)
  To: Bharata B Rao, qemu-devel; +Cc: qemu-ppc, david, thuth, imammedo



On 01/06/2016 11:51, Bharata B Rao wrote:
> 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 <bharata@linux.vnet.ibm.com>
> ---
>  include/sysemu/kvm.h | 1 +
>  kvm-all.c            | 7 +++++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
> index 65569ed..ad6f837 100644
> --- a/include/sysemu/kvm.h
> +++ b/include/sysemu/kvm.h
> @@ -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
> diff --git a/kvm-all.c b/kvm-all.c
> index d317dcb..fbd2d93 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -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;
> 

Acked-by: Paolo Bonzini <pbonzini@redhat.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [RFC PATCH v0 1/2] kvm: API to obtain max supported mem slots
  2016-06-01  9:56   ` [Qemu-devel] [RFC PATCH v0 1/2] kvm: API to obtain max supported mem slots Paolo Bonzini
@ 2016-06-02  0:41     ` David Gibson
  0 siblings, 0 replies; 4+ messages in thread
From: David Gibson @ 2016-06-02  0:41 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Bharata B Rao, qemu-devel, qemu-ppc, thuth, imammedo

[-- Attachment #1: Type: text/plain, Size: 1703 bytes --]

On Wed, Jun 01, 2016 at 11:56:07AM +0200, Paolo Bonzini wrote:
> 
> 
> On 01/06/2016 11:51, Bharata B Rao wrote:
> > 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 <bharata@linux.vnet.ibm.com>
> > ---
> >  include/sysemu/kvm.h | 1 +
> >  kvm-all.c            | 7 +++++++
> >  2 files changed, 8 insertions(+)
> > 
> > diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
> > index 65569ed..ad6f837 100644
> > --- a/include/sysemu/kvm.h
> > +++ b/include/sysemu/kvm.h
> > @@ -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
> > diff --git a/kvm-all.c b/kvm-all.c
> > index d317dcb..fbd2d93 100644
> > --- a/kvm-all.c
> > +++ b/kvm-all.c
> > @@ -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;
> > 
> 
> Acked-by: Paolo Bonzini <pbonzini@redhat.com>

Thanks for the ack, I've merged this into my tree.

-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-06-02  0:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1464774685-7885-1-git-send-email-bharata@linux.vnet.ibm.com>
2016-06-01  9:51 ` [Qemu-devel] [RFC PATCH v0 1/2] kvm: API to obtain max supported mem slots Bharata B Rao
2016-06-01  9:51 ` [Qemu-devel] [RFC PATCH v0 2/2] spapr: Increase max memslots to 512 Bharata B Rao
     [not found] ` <201606010952.u519n7R2025378@mx0a-001b2d01.pphosted.com>
2016-06-01  9:56   ` [Qemu-devel] [RFC PATCH v0 1/2] kvm: API to obtain max supported mem slots Paolo Bonzini
2016-06-02  0:41     ` David Gibson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).