Received: from eggs.gnu.org ([2001:4830:134:3::10]:38659) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeMYZ-00025f-6V for qemu-devel@nongnu.org; Thu, 07 Nov 2013 05:11:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VeMYT-0005ye-P8 for qemu-devel@nongnu.org; Thu, 07 Nov 2013 05:11:19 -0500 Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1812\)) From: Alexander Graf In-Reply-To: <20131107093350.16f457ba@oc7435384737.ibm.com> Date: Thu, 7 Nov 2013 11:11:06 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: References: <1383796200-13276-1-git-send-email-aik@ozlabs.ru> <20131107093350.16f457ba@oc7435384737.ibm.com> Subject: Re: [Qemu-devel] [PATCH v3] spapr: make sure RMA is in first mode of first memory node List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth Cc: Alexey Kardashevskiy , qemu-ppc , QEMU Developers On 07.11.2013, at 09:33, Thomas Huth wrote: > On Thu, 7 Nov 2013 14:50:00 +1100 > Alexey Kardashevskiy wrote: >=20 >> The SPAPR specification says that the RMA starts at the LPAR's = logical >> address 0 and is the first logical memory block reported in >> the LPAR=92s device tree. >>=20 >> So SLOF only maps the first block and that block needs to span >> the full RMA. >>=20 >> This makes sure that the RMA area is where SLOF expects it. >>=20 >> Cc: Thomas Huth >> Cc: Benjamin Herrenschmidt >> Signed-off-by: Alexey Kardashevskiy >> --- >> Changes: >> v3: >> * removed unnecessary RMA fixup from spapr_populate_memory() >>=20 >> v2: >> * changed as recommended by Alex Graf >> --- >> hw/ppc/spapr.c | 12 ++++++++---- >> 1 file changed, 8 insertions(+), 4 deletions(-) >>=20 >> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c >> index 7e53a5f..1f320f6 100644 >> --- a/hw/ppc/spapr.c >> +++ b/hw/ppc/spapr.c >> @@ -532,9 +532,6 @@ static int spapr_populate_memory(sPAPREnvironment = *spapr, void *fdt) >>=20 >> /* memory node(s) */ >> node0_size =3D (nb_numa_nodes > 1) ? node_mem[0] : ram_size; >> - if (spapr->rma_size > node0_size) { >> - spapr->rma_size =3D node0_size; >> - } >>=20 >> /* RMA */ >> mem_reg_property[0] =3D 0; >> @@ -1113,6 +1110,7 @@ static void ppc_spapr_init(QEMUMachineInitArgs = *args) >> MemoryRegion *sysmem =3D get_system_memory(); >> MemoryRegion *ram =3D g_new(MemoryRegion, 1); >> hwaddr rma_alloc_size; >> + hwaddr node0_size =3D (nb_numa_nodes > 1) ? node_mem[0] : = ram_size; >> uint32_t initrd_base =3D 0; >> long kernel_size =3D 0, initrd_size =3D 0; >> long load_limit, rtas_limit, fw_size; >> @@ -1137,7 +1135,7 @@ static void ppc_spapr_init(QEMUMachineInitArgs = *args) >> if (rma_alloc_size && (rma_alloc_size < ram_size)) { >=20 > Uh, sorry for not seeing this earlier, ... but should that be > "rma_alloc_size < node0_size" instead of "rma_alloc_size < ram_size"? > For example, if rma_alloc_size =3D 256 MB, ram_size =3D 512 MB but > node0_size =3D 128 MB, this will set rma_size to 256 MB ... >=20 >> spapr->rma_size =3D rma_alloc_size; >> } else { >> - spapr->rma_size =3D ram_size; >> + spapr->rma_size =3D node0_size; >>=20 >> /* With KVM, we don't actually know whether KVM supports an >> * unbounded RMA (PR KVM) or is limited by the hash table = size >> @@ -1154,6 +1152,12 @@ static void ppc_spapr_init(QEMUMachineInitArgs = *args) >> } >> } >>=20 >> + if (spapr->rma_size > node0_size) { >> + fprintf(stderr, "Error: Numa node 0 has to span the RMA = (%#08"HWADDR_PRIx")\n", >> + spapr->rma_size); >> + exit(1); >> + } >=20 > ... so in the above example you would get the error + exit here. > Or did I miss something? No, nice catch :). I'm really eagerly awaiting wide public availability = of HV capable POWER hardware so that we can finally get rid of all the = 970 code... Alex