On Mon, 29 Jun 2015 14:14:28 +0530 Bharata B Rao <bhar...@linux.vnet.ibm.com> wrote:
> Enable memory hotplug for pseries 2.4 and add LMB DR connectors. > With memory hotplug, enforce RAM size, NUMA node memory size and maxmem > to be a multiple of SPAPR_MEMORY_BLOCK_SIZE (256M) since that's the > granularity in which LMBs are represented and hot-added. > > LMB DR connectors will be used by the memory hotplug code. > > Signed-off-by: Bharata B Rao <bhar...@linux.vnet.ibm.com> > Signed-off-by: Michael Roth <mdr...@linux.vnet.ibm.com> > [spapr_drc_reset implementation] > --- > hw/ppc/spapr.c | 88 > ++++++++++++++++++++++++++++++++++++++++++++++++++ > include/hw/ppc/spapr.h | 1 + > 2 files changed, 89 insertions(+) > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 241ecad..bee868c 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c ... > +/* > + * If RAM size, maxmem size and individual node mem sizes aren't aligned > + * to SPAPR_MEMORY_BLOCK_SIZE(256MB), then refuse to start the guest > + * since we can't support such unaligned sizes with DRCONF_MEMORY. > + */ > +static void spapr_validate_node_memory(MachineState *machine) > +{ > + int i; > + > + if (machine->maxram_size % SPAPR_MEMORY_BLOCK_SIZE || > + machine->ram_size % SPAPR_MEMORY_BLOCK_SIZE) { > + error_report("Can't support memory configuration where RAM size " > + "0x" RAM_ADDR_FMT " or maxmem size " > + "0x" RAM_ADDR_FMT " isn't aligned to %lld MB", > + machine->ram_size, machine->maxram_size, > + SPAPR_MEMORY_BLOCK_SIZE/M_BYTE); > + exit(EXIT_FAILURE); > + } > + > + for (i = 0; i < nb_numa_nodes; i++) { > + if (numa_info[i].node_mem && > + numa_info[i].node_mem % SPAPR_MEMORY_BLOCK_SIZE) { > + error_report("Can't support memory configuration where memory " > + "size %lx of node %d isn't aligned to %lld MB", > + numa_info[i].node_mem, i, > + SPAPR_MEMORY_BLOCK_SIZE/M_BYTE); FYI, this causes a compiler warning when compiling for a 32-bit host: hw/ppc/spapr.c: In function 'spapr_validate_node_memory': hw/ppc/spapr.c:1638:26: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'uint64_t' [-Wformat=] I think you have to use PRIx64 or something similar here. Thomas