From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLmVg-0005Oj-Ip for qemu-devel@nongnu.org; Thu, 12 Feb 2015 00:40:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLmVc-0005wp-VY for qemu-devel@nongnu.org; Thu, 12 Feb 2015 00:40:20 -0500 Received: from e23smtp03.au.ibm.com ([202.81.31.145]:33487) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLmVc-0005wU-5O for qemu-devel@nongnu.org; Thu, 12 Feb 2015 00:40:16 -0500 Received: from /spool/local by e23smtp03.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 12 Feb 2015 15:40:10 +1000 Received: from d23relay06.au.ibm.com (d23relay06.au.ibm.com [9.185.63.219]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id 894652CE8054 for ; Thu, 12 Feb 2015 16:40:07 +1100 (EST) Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay06.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t1C5dw4f42467358 for ; Thu, 12 Feb 2015 16:40:07 +1100 Received: from d23av04.au.ibm.com (localhost [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t1C5dX5h031500 for ; Thu, 12 Feb 2015 16:39:33 +1100 Date: Thu, 12 Feb 2015 11:09:14 +0530 From: Bharata B Rao Message-ID: <20150212053914.GB3307@in.ibm.com> References: <1420697420-16053-1-git-send-email-bharata@linux.vnet.ibm.com> <1420697420-16053-12-git-send-email-bharata@linux.vnet.ibm.com> <20150212051936.GB20593@voom.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150212051936.GB20593@voom.redhat.com> Subject: Re: [Qemu-devel] [RFC PATCH v1 11/13] spapr: Initialize hotplug memory address space Reply-To: bharata@linux.vnet.ibm.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson Cc: imammedo@redhat.com, agraf@suse.de, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com On Thu, Feb 12, 2015 at 04:19:36PM +1100, David Gibson wrote: > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > > index 44405b2..9ff08ff 100644 > > --- a/hw/ppc/spapr.c > > +++ b/hw/ppc/spapr.c > > @@ -120,6 +120,8 @@ struct sPAPRMachineState { > > > > /*< public >*/ > > char *kvm_type; > > + ram_addr_t hotplug_memory_base; > > + MemoryRegion hotplug_memory; > > We should really unify sPAPRMachineState with sPAPREnvironment at some > point (I realise that doesn't reasonably fit within the scope of this > series). ok. > > > }; > > > > sPAPREnvironment *spapr; > > @@ -1403,6 +1405,7 @@ static void ppc_spapr_init(MachineState *machine) > > bool kernel_le = false; > > char *filename; > > int smt = kvmppc_smt_threads(); > > + sPAPRMachineState *ms = SPAPR_MACHINE(machine); > > > > msi_supported = true; > > > > @@ -1492,6 +1495,29 @@ static void ppc_spapr_init(MachineState *machine) > > memory_region_add_subregion(sysmem, 0, rma_region); > > } > > > > + 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, 1ULL << 30); > > Is there a particular significance to the 1GiB alignment? Is it just > a conveniently large alignment, or is that value specified in PAPR > somewhere? Using a named constant would probably help to clarify that. I am basing this on x86 memory hotplug and that's how 1GB is coming. It is not PAPR specified. > > > + 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); > > diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h > > index ae8b4e1..64681c4 100644 > > --- a/include/hw/ppc/spapr.h > > +++ b/include/hw/ppc/spapr.h > > @@ -482,6 +482,9 @@ struct sPAPRTCETable { > > #define TIMEBASE_FREQ 512000000ULL > > #define SPAPR_MIN_MEMORY_BLOCK_SIZE (1 << 28) /* 256MB */ > > > > +/* Support a min of 1TB hotplug memory assuming 256MB per slot */ > > +#define SPAPR_MAX_RAM_SLOTS (1ULL << 12) > > Is this constraint arbitrary, or does it come from something in PAPR+? Arbitrary max, not defined by PAPR. Regards, Bharata.