Message ID | 1427117764-23008-22-git-send-email-bharata@linux.vnet.ibm.com |
---|---|
State | New |
Headers | show |
On Mon, Mar 23, 2015 at 07:06:02PM +0530, Bharata B Rao wrote: > Initialize a hotplug memory region under which all the hotplugged > memory is accommodated. Also enable memory hotplug by setting > CONFIG_MEM_HOTPLUG. > > Modelled on i386 memory hotplug. > > Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com> > --- > default-configs/ppc64-softmmu.mak | 1 + > hw/ppc/spapr.c | 50 +++++++++++++++++++++++++++++++++++++++ > include/hw/ppc/spapr.h | 12 ++++++++++ > 3 files changed, 63 insertions(+) > > diff --git a/default-configs/ppc64-softmmu.mak b/default-configs/ppc64-softmmu.mak > index 22ef132..16b3011 100644 > --- a/default-configs/ppc64-softmmu.mak > +++ b/default-configs/ppc64-softmmu.mak > @@ -51,3 +51,4 @@ CONFIG_XICS_KVM=$(and $(CONFIG_PSERIES),$(CONFIG_KVM)) > # For PReP > CONFIG_MC146818RTC=y > CONFIG_ISA_TESTDEV=y > +CONFIG_MEM_HOTPLUG=y > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 3e56d9e..e43bb49 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -125,8 +125,13 @@ struct sPAPRMachineState { > > /*< public >*/ > char *kvm_type; > + ram_addr_t hotplug_memory_base; > + MemoryRegion hotplug_memory; > + bool enforce_aligned_dimm; > }; > > +#define SPAPR_MACHINE_ENFORCE_ALIGNED_DIMM "enforce-aligned-dimm" What's the rationale for including this option? > + > sPAPREnvironment *spapr; > > static XICSState *try_create_xics(const char *type, int nr_servers, > @@ -1499,6 +1504,7 @@ static void ppc_spapr_init(MachineState *machine) > int smt = kvmppc_smt_threads(); > Object *socket; > int sockets; > + sPAPRMachineState *ms = SPAPR_MACHINE(machine); > > msi_supported = true; > > @@ -1585,6 +1591,36 @@ static void ppc_spapr_init(MachineState *machine) > memory_region_add_subregion(sysmem, 0, rma_region); > } > > + /* initialize hotplug memory address space */ > + if (machine->ram_size < machine->maxram_size) { > + ram_addr_t hotplug_mem_size = > + machine->maxram_size - machine->ram_size; > + > + if (machine->ram_slots > SPAPR_MAX_RAM_SLOTS) { > + error_report("unsupported amount of memory slots: %"PRIu64, > + machine->ram_slots); > + exit(EXIT_FAILURE); > + } > + > + ms->hotplug_memory_base = ROUND_UP(machine->ram_size, > + SPAPR_HOTPLUG_MEM_ALIGN); > + > + if (ms->enforce_aligned_dimm) { > + hotplug_mem_size += SPAPR_HOTPLUG_MEM_ALIGN * machine->ram_slots; > + } > + > + if ((ms->hotplug_memory_base + hotplug_mem_size) < hotplug_mem_size) { > + error_report("unsupported amount of maximum memory: " RAM_ADDR_FMT, > + machine->maxram_size); > + exit(EXIT_FAILURE); > + } > + > + memory_region_init(&ms->hotplug_memory, OBJECT(ms), > + "hotplug-memory", hotplug_mem_size); > + memory_region_add_subregion(sysmem, ms->hotplug_memory_base, > + &ms->hotplug_memory); > + } > + > filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, "spapr-rtas.bin"); > spapr->rtas_size = get_image_size(filename); > spapr->rtas_blob = g_malloc(spapr->rtas_size); > @@ -1827,13 +1863,27 @@ static void spapr_set_kvm_type(Object *obj, const char *value, Error **errp) > sm->kvm_type = g_strdup(value); > } > > +static bool spapr_machine_get_aligned_dimm(Object *obj, Error **errp) > +{ > + sPAPRMachineState *ms = SPAPR_MACHINE(obj); > + > + return ms->enforce_aligned_dimm; > +} > + > static void spapr_machine_initfn(Object *obj) > { > + sPAPRMachineState *ms = SPAPR_MACHINE(obj); > + > object_property_add_str(obj, "kvm-type", > spapr_get_kvm_type, spapr_set_kvm_type, NULL); > object_property_set_description(obj, "kvm-type", > "Specifies the KVM virtualization mode (HV, PR)", > NULL); > + > + ms->enforce_aligned_dimm = true; > + object_property_add_bool(obj, SPAPR_MACHINE_ENFORCE_ALIGNED_DIMM, > + spapr_machine_get_aligned_dimm, > + NULL, NULL); > } > > static void ppc_cpu_do_nmi_on_cpu(void *arg) > diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h > index ecac6e3..53560e9 100644 > --- a/include/hw/ppc/spapr.h > +++ b/include/hw/ppc/spapr.h > @@ -542,6 +542,18 @@ struct sPAPREventLogEntry { > > #define SPAPR_MEMORY_BLOCK_SIZE (1 << 28) /* 256MB */ > > +/* > + * This defines the maximum number of DIMM slots we can have for sPAPR > + * guest. This is not defined by sPAPR but we are defining it to 4096 slots > + * here. With the worst case addition of SPAPR_MEMORY_BLOCK_SIZE > + * (256MB) memory per slot, we should be able to support 1TB of guest > + * hotpluggable memory. > + */ > +#define SPAPR_MAX_RAM_SLOTS (1ULL << 12) > + > +/* 1GB alignment for hotplug memory region */ > +#define SPAPR_HOTPLUG_MEM_ALIGN (1ULL << 30) > + > void spapr_events_init(sPAPREnvironment *spapr); > void spapr_events_fdt_skel(void *fdt, uint32_t epow_irq); > int spapr_h_cas_compose_response(target_ulong addr, target_ulong size);
On Wed, Mar 25, 2015 at 04:58:18PM +1100, David Gibson wrote: > On Mon, Mar 23, 2015 at 07:06:02PM +0530, Bharata B Rao wrote: > > Initialize a hotplug memory region under which all the hotplugged > > memory is accommodated. Also enable memory hotplug by setting > > CONFIG_MEM_HOTPLUG. > > > > Modelled on i386 memory hotplug. > > > > Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com> > > --- > > default-configs/ppc64-softmmu.mak | 1 + > > hw/ppc/spapr.c | 50 +++++++++++++++++++++++++++++++++++++++ > > include/hw/ppc/spapr.h | 12 ++++++++++ > > 3 files changed, 63 insertions(+) > > > > diff --git a/default-configs/ppc64-softmmu.mak b/default-configs/ppc64-softmmu.mak > > index 22ef132..16b3011 100644 > > --- a/default-configs/ppc64-softmmu.mak > > +++ b/default-configs/ppc64-softmmu.mak > > @@ -51,3 +51,4 @@ CONFIG_XICS_KVM=$(and $(CONFIG_PSERIES),$(CONFIG_KVM)) > > # For PReP > > CONFIG_MC146818RTC=y > > CONFIG_ISA_TESTDEV=y > > +CONFIG_MEM_HOTPLUG=y > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > > index 3e56d9e..e43bb49 100644 > > --- a/hw/ppc/spapr.c > > +++ b/hw/ppc/spapr.c > > @@ -125,8 +125,13 @@ struct sPAPRMachineState { > > > > /*< public >*/ > > char *kvm_type; > > + ram_addr_t hotplug_memory_base; > > + MemoryRegion hotplug_memory; > > + bool enforce_aligned_dimm; > > }; > > > > +#define SPAPR_MACHINE_ENFORCE_ALIGNED_DIMM "enforce-aligned-dimm" > > What's the rationale for including this option? I couldn't see any use, but added it to be similar with x86. May be Igor can tell us ? Regards, Bharata.
On Mon, 13 Apr 2015 08:29:33 +0530 Bharata B Rao <bharata@linux.vnet.ibm.com> wrote: > On Wed, Mar 25, 2015 at 04:58:18PM +1100, David Gibson wrote: > > On Mon, Mar 23, 2015 at 07:06:02PM +0530, Bharata B Rao wrote: > > > Initialize a hotplug memory region under which all the hotplugged > > > memory is accommodated. Also enable memory hotplug by setting > > > CONFIG_MEM_HOTPLUG. > > > > > > Modelled on i386 memory hotplug. > > > > > > Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com> > > > --- > > > default-configs/ppc64-softmmu.mak | 1 + > > > hw/ppc/spapr.c | 50 +++++++++++++++++++++++++++++++++++++++ > > > include/hw/ppc/spapr.h | 12 ++++++++++ > > > 3 files changed, 63 insertions(+) > > > > > > diff --git a/default-configs/ppc64-softmmu.mak b/default-configs/ppc64-softmmu.mak > > > index 22ef132..16b3011 100644 > > > --- a/default-configs/ppc64-softmmu.mak > > > +++ b/default-configs/ppc64-softmmu.mak > > > @@ -51,3 +51,4 @@ CONFIG_XICS_KVM=$(and $(CONFIG_PSERIES),$(CONFIG_KVM)) > > > # For PReP > > > CONFIG_MC146818RTC=y > > > CONFIG_ISA_TESTDEV=y > > > +CONFIG_MEM_HOTPLUG=y > > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > > > index 3e56d9e..e43bb49 100644 > > > --- a/hw/ppc/spapr.c > > > +++ b/hw/ppc/spapr.c > > > @@ -125,8 +125,13 @@ struct sPAPRMachineState { > > > > > > /*< public >*/ > > > char *kvm_type; > > > + ram_addr_t hotplug_memory_base; > > > + MemoryRegion hotplug_memory; > > > + bool enforce_aligned_dimm; > > > }; > > > > > > +#define SPAPR_MACHINE_ENFORCE_ALIGNED_DIMM "enforce-aligned-dimm" > > > > What's the rationale for including this option? > > I couldn't see any use, but added it to be similar with x86. May be Igor > can tell us ? at least on x86 KVM requires memory region be aligned (otherwise it would abort) and also performance wise it's better to map regions at offsets aligned at backend page size (especially applicable for hugepages). so region base on x86 is 1Gb aligned to support upto 1Gb hugepages. > > Regards, > Bharata. >
On Mon, Apr 13, 2015 at 04:04:24PM +0200, Igor Mammedov wrote: > On Mon, 13 Apr 2015 08:29:33 +0530 > Bharata B Rao <bharata@linux.vnet.ibm.com> wrote: > > > On Wed, Mar 25, 2015 at 04:58:18PM +1100, David Gibson wrote: > > > On Mon, Mar 23, 2015 at 07:06:02PM +0530, Bharata B Rao wrote: > > > > Initialize a hotplug memory region under which all the hotplugged > > > > memory is accommodated. Also enable memory hotplug by setting > > > > CONFIG_MEM_HOTPLUG. > > > > > > > > Modelled on i386 memory hotplug. > > > > > > > > Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com> > > > > --- > > > > default-configs/ppc64-softmmu.mak | 1 + > > > > hw/ppc/spapr.c | 50 +++++++++++++++++++++++++++++++++++++++ > > > > include/hw/ppc/spapr.h | 12 ++++++++++ > > > > 3 files changed, 63 insertions(+) > > > > > > > > diff --git a/default-configs/ppc64-softmmu.mak b/default-configs/ppc64-softmmu.mak > > > > index 22ef132..16b3011 100644 > > > > --- a/default-configs/ppc64-softmmu.mak > > > > +++ b/default-configs/ppc64-softmmu.mak > > > > @@ -51,3 +51,4 @@ CONFIG_XICS_KVM=$(and $(CONFIG_PSERIES),$(CONFIG_KVM)) > > > > # For PReP > > > > CONFIG_MC146818RTC=y > > > > CONFIG_ISA_TESTDEV=y > > > > +CONFIG_MEM_HOTPLUG=y > > > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > > > > index 3e56d9e..e43bb49 100644 > > > > --- a/hw/ppc/spapr.c > > > > +++ b/hw/ppc/spapr.c > > > > @@ -125,8 +125,13 @@ struct sPAPRMachineState { > > > > > > > > /*< public >*/ > > > > char *kvm_type; > > > > + ram_addr_t hotplug_memory_base; > > > > + MemoryRegion hotplug_memory; > > > > + bool enforce_aligned_dimm; > > > > }; > > > > > > > > +#define SPAPR_MACHINE_ENFORCE_ALIGNED_DIMM "enforce-aligned-dimm" > > > > > > What's the rationale for including this option? > > > > I couldn't see any use, but added it to be similar with x86. May be Igor > > can tell us ? > at least on x86 KVM requires memory region be aligned (otherwise it would abort) > and also performance wise it's better to map regions at offsets aligned at > backend page size (especially applicable for hugepages). > > so region base on x86 is 1Gb aligned to support upto 1Gb hugepages. My question was specifically about the enforce-aligned-dimm object property that has a get method. I was wondering where this property is consumed. All I could see is that PCMachineState.enforce_aligned_dimm used/referenced directly. > > > > > Regards, > > Bharata. > >
On Mon, 13 Apr 2015 19:57:05 +0530 Bharata B Rao <bharata@linux.vnet.ibm.com> wrote: > On Mon, Apr 13, 2015 at 04:04:24PM +0200, Igor Mammedov wrote: > > On Mon, 13 Apr 2015 08:29:33 +0530 > > Bharata B Rao <bharata@linux.vnet.ibm.com> wrote: > > > > > On Wed, Mar 25, 2015 at 04:58:18PM +1100, David Gibson wrote: > > > > On Mon, Mar 23, 2015 at 07:06:02PM +0530, Bharata B Rao wrote: > > > > > Initialize a hotplug memory region under which all the hotplugged > > > > > memory is accommodated. Also enable memory hotplug by setting > > > > > CONFIG_MEM_HOTPLUG. > > > > > > > > > > Modelled on i386 memory hotplug. > > > > > > > > > > Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com> > > > > > --- > > > > > default-configs/ppc64-softmmu.mak | 1 + > > > > > hw/ppc/spapr.c | 50 +++++++++++++++++++++++++++++++++++++++ > > > > > include/hw/ppc/spapr.h | 12 ++++++++++ > > > > > 3 files changed, 63 insertions(+) > > > > > > > > > > diff --git a/default-configs/ppc64-softmmu.mak b/default-configs/ppc64-softmmu.mak > > > > > index 22ef132..16b3011 100644 > > > > > --- a/default-configs/ppc64-softmmu.mak > > > > > +++ b/default-configs/ppc64-softmmu.mak > > > > > @@ -51,3 +51,4 @@ CONFIG_XICS_KVM=$(and $(CONFIG_PSERIES),$(CONFIG_KVM)) > > > > > # For PReP > > > > > CONFIG_MC146818RTC=y > > > > > CONFIG_ISA_TESTDEV=y > > > > > +CONFIG_MEM_HOTPLUG=y > > > > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > > > > > index 3e56d9e..e43bb49 100644 > > > > > --- a/hw/ppc/spapr.c > > > > > +++ b/hw/ppc/spapr.c > > > > > @@ -125,8 +125,13 @@ struct sPAPRMachineState { > > > > > > > > > > /*< public >*/ > > > > > char *kvm_type; > > > > > + ram_addr_t hotplug_memory_base; > > > > > + MemoryRegion hotplug_memory; > > > > > + bool enforce_aligned_dimm; > > > > > }; > > > > > > > > > > +#define SPAPR_MACHINE_ENFORCE_ALIGNED_DIMM "enforce-aligned-dimm" > > > > > > > > What's the rationale for including this option? > > > > > > I couldn't see any use, but added it to be similar with x86. May be Igor > > > can tell us ? > > at least on x86 KVM requires memory region be aligned (otherwise it would abort) > > and also performance wise it's better to map regions at offsets aligned at > > backend page size (especially applicable for hugepages). > > > > so region base on x86 is 1Gb aligned to support upto 1Gb hugepages. > > My question was specifically about the enforce-aligned-dimm object property > that has a get method. I was wondering where this property is consumed. All > I could see is that PCMachineState.enforce_aligned_dimm used/referenced > directly. I think that you don't heed it, it was introduce to to keep memory layout compatible with old machine types that didn't have aligned memhp region. Since there is nothing to keep compatible in this target, you can just drop property and always align region as fit for spapr. > > > > > > > > > Regards, > > > Bharata. > > > >
On Mon, Apr 13, 2015 at 04:55:52PM +0200, Igor Mammedov wrote: > On Mon, 13 Apr 2015 19:57:05 +0530 > Bharata B Rao <bharata@linux.vnet.ibm.com> wrote: > > > On Mon, Apr 13, 2015 at 04:04:24PM +0200, Igor Mammedov wrote: > > > On Mon, 13 Apr 2015 08:29:33 +0530 > > > Bharata B Rao <bharata@linux.vnet.ibm.com> wrote: > > > > > > > On Wed, Mar 25, 2015 at 04:58:18PM +1100, David Gibson wrote: > > > > > On Mon, Mar 23, 2015 at 07:06:02PM +0530, Bharata B Rao wrote: > > > > > > Initialize a hotplug memory region under which all the hotplugged > > > > > > memory is accommodated. Also enable memory hotplug by setting > > > > > > CONFIG_MEM_HOTPLUG. > > > > > > > > > > > > Modelled on i386 memory hotplug. > > > > > > > > > > > > Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com> > > > > > > --- > > > > > > default-configs/ppc64-softmmu.mak | 1 + > > > > > > hw/ppc/spapr.c | 50 +++++++++++++++++++++++++++++++++++++++ > > > > > > include/hw/ppc/spapr.h | 12 ++++++++++ > > > > > > 3 files changed, 63 insertions(+) > > > > > > > > > > > > diff --git a/default-configs/ppc64-softmmu.mak b/default-configs/ppc64-softmmu.mak > > > > > > index 22ef132..16b3011 100644 > > > > > > --- a/default-configs/ppc64-softmmu.mak > > > > > > +++ b/default-configs/ppc64-softmmu.mak > > > > > > @@ -51,3 +51,4 @@ CONFIG_XICS_KVM=$(and $(CONFIG_PSERIES),$(CONFIG_KVM)) > > > > > > # For PReP > > > > > > CONFIG_MC146818RTC=y > > > > > > CONFIG_ISA_TESTDEV=y > > > > > > +CONFIG_MEM_HOTPLUG=y > > > > > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > > > > > > index 3e56d9e..e43bb49 100644 > > > > > > --- a/hw/ppc/spapr.c > > > > > > +++ b/hw/ppc/spapr.c > > > > > > @@ -125,8 +125,13 @@ struct sPAPRMachineState { > > > > > > > > > > > > /*< public >*/ > > > > > > char *kvm_type; > > > > > > + ram_addr_t hotplug_memory_base; > > > > > > + MemoryRegion hotplug_memory; > > > > > > + bool enforce_aligned_dimm; > > > > > > }; > > > > > > > > > > > > +#define SPAPR_MACHINE_ENFORCE_ALIGNED_DIMM "enforce-aligned-dimm" > > > > > > > > > > What's the rationale for including this option? > > > > > > > > I couldn't see any use, but added it to be similar with x86. May be Igor > > > > can tell us ? > > > at least on x86 KVM requires memory region be aligned (otherwise it would abort) > > > and also performance wise it's better to map regions at offsets aligned at > > > backend page size (especially applicable for hugepages). > > > > > > so region base on x86 is 1Gb aligned to support upto 1Gb hugepages. > > > > My question was specifically about the enforce-aligned-dimm object property > > that has a get method. I was wondering where this property is consumed. All > > I could see is that PCMachineState.enforce_aligned_dimm used/referenced > > directly. > I think that you don't heed it, it was introduce to to keep memory layout > compatible with old machine types that didn't have aligned memhp region. > > Since there is nothing to keep compatible in this target, you can just > drop property and always align region as fit for spapr. That sounds like a good idea to me.
diff --git a/default-configs/ppc64-softmmu.mak b/default-configs/ppc64-softmmu.mak index 22ef132..16b3011 100644 --- a/default-configs/ppc64-softmmu.mak +++ b/default-configs/ppc64-softmmu.mak @@ -51,3 +51,4 @@ CONFIG_XICS_KVM=$(and $(CONFIG_PSERIES),$(CONFIG_KVM)) # For PReP CONFIG_MC146818RTC=y CONFIG_ISA_TESTDEV=y +CONFIG_MEM_HOTPLUG=y diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 3e56d9e..e43bb49 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -125,8 +125,13 @@ struct sPAPRMachineState { /*< public >*/ char *kvm_type; + ram_addr_t hotplug_memory_base; + MemoryRegion hotplug_memory; + bool enforce_aligned_dimm; }; +#define SPAPR_MACHINE_ENFORCE_ALIGNED_DIMM "enforce-aligned-dimm" + sPAPREnvironment *spapr; static XICSState *try_create_xics(const char *type, int nr_servers, @@ -1499,6 +1504,7 @@ static void ppc_spapr_init(MachineState *machine) int smt = kvmppc_smt_threads(); Object *socket; int sockets; + sPAPRMachineState *ms = SPAPR_MACHINE(machine); msi_supported = true; @@ -1585,6 +1591,36 @@ static void ppc_spapr_init(MachineState *machine) memory_region_add_subregion(sysmem, 0, rma_region); } + /* initialize hotplug memory address space */ + if (machine->ram_size < machine->maxram_size) { + ram_addr_t hotplug_mem_size = + machine->maxram_size - machine->ram_size; + + if (machine->ram_slots > SPAPR_MAX_RAM_SLOTS) { + error_report("unsupported amount of memory slots: %"PRIu64, + machine->ram_slots); + exit(EXIT_FAILURE); + } + + ms->hotplug_memory_base = ROUND_UP(machine->ram_size, + SPAPR_HOTPLUG_MEM_ALIGN); + + if (ms->enforce_aligned_dimm) { + hotplug_mem_size += SPAPR_HOTPLUG_MEM_ALIGN * machine->ram_slots; + } + + if ((ms->hotplug_memory_base + hotplug_mem_size) < hotplug_mem_size) { + error_report("unsupported amount of maximum memory: " RAM_ADDR_FMT, + machine->maxram_size); + exit(EXIT_FAILURE); + } + + memory_region_init(&ms->hotplug_memory, OBJECT(ms), + "hotplug-memory", hotplug_mem_size); + memory_region_add_subregion(sysmem, ms->hotplug_memory_base, + &ms->hotplug_memory); + } + filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, "spapr-rtas.bin"); spapr->rtas_size = get_image_size(filename); spapr->rtas_blob = g_malloc(spapr->rtas_size); @@ -1827,13 +1863,27 @@ static void spapr_set_kvm_type(Object *obj, const char *value, Error **errp) sm->kvm_type = g_strdup(value); } +static bool spapr_machine_get_aligned_dimm(Object *obj, Error **errp) +{ + sPAPRMachineState *ms = SPAPR_MACHINE(obj); + + return ms->enforce_aligned_dimm; +} + static void spapr_machine_initfn(Object *obj) { + sPAPRMachineState *ms = SPAPR_MACHINE(obj); + object_property_add_str(obj, "kvm-type", spapr_get_kvm_type, spapr_set_kvm_type, NULL); object_property_set_description(obj, "kvm-type", "Specifies the KVM virtualization mode (HV, PR)", NULL); + + ms->enforce_aligned_dimm = true; + object_property_add_bool(obj, SPAPR_MACHINE_ENFORCE_ALIGNED_DIMM, + spapr_machine_get_aligned_dimm, + NULL, NULL); } static void ppc_cpu_do_nmi_on_cpu(void *arg) diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index ecac6e3..53560e9 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -542,6 +542,18 @@ struct sPAPREventLogEntry { #define SPAPR_MEMORY_BLOCK_SIZE (1 << 28) /* 256MB */ +/* + * This defines the maximum number of DIMM slots we can have for sPAPR + * guest. This is not defined by sPAPR but we are defining it to 4096 slots + * here. With the worst case addition of SPAPR_MEMORY_BLOCK_SIZE + * (256MB) memory per slot, we should be able to support 1TB of guest + * hotpluggable memory. + */ +#define SPAPR_MAX_RAM_SLOTS (1ULL << 12) + +/* 1GB alignment for hotplug memory region */ +#define SPAPR_HOTPLUG_MEM_ALIGN (1ULL << 30) + void spapr_events_init(sPAPREnvironment *spapr); void spapr_events_fdt_skel(void *fdt, uint32_t epow_irq); int spapr_h_cas_compose_response(target_ulong addr, target_ulong size);
Initialize a hotplug memory region under which all the hotplugged memory is accommodated. Also enable memory hotplug by setting CONFIG_MEM_HOTPLUG. Modelled on i386 memory hotplug. Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com> --- default-configs/ppc64-softmmu.mak | 1 + hw/ppc/spapr.c | 50 +++++++++++++++++++++++++++++++++++++++ include/hw/ppc/spapr.h | 12 ++++++++++ 3 files changed, 63 insertions(+)