From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57916) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZC8el-0003od-Es for qemu-devel@nongnu.org; Mon, 06 Jul 2015 11:50:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZC8eg-000533-FT for qemu-devel@nongnu.org; Mon, 06 Jul 2015 11:50:07 -0400 Date: Mon, 6 Jul 2015 17:49:48 +0200 From: Thomas Huth Message-ID: <20150706174948.5dc3b8a8@thh440s> In-Reply-To: <1435567472-20338-3-git-send-email-bharata@linux.vnet.ibm.com> References: <1435567472-20338-1-git-send-email-bharata@linux.vnet.ibm.com> <1435567472-20338-3-git-send-email-bharata@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v6 2/6] spapr: Add LMB DR connectors List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao , david@gibson.dropbear.id.au Cc: agraf@suse.de, aik@ozlabs.ru, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, tyreld@linux.vnet.ibm.com, imammedo@redhat.com, nfont@linux.vnet.ibm.com On Mon, 29 Jun 2015 14:14:28 +0530 Bharata B Rao 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 > Signed-off-by: Michael Roth > [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