Received: from eggs.gnu.org ([2001:4830:134:3::10]:42134) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtoSj-0004pJ-Ro for qemu-devel@nongnu.org; Thu, 19 Dec 2013 20:01:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VtoSa-0002Od-4w for qemu-devel@nongnu.org; Thu, 19 Dec 2013 20:01:09 -0500 From: Alexander Graf Date: Fri, 20 Dec 2013 02:00:53 +0100 Message-Id: <1387501254-60704-32-git-send-email-agraf@suse.de> In-Reply-To: <1387501254-60704-1-git-send-email-agraf@suse.de> References: <1387501254-60704-1-git-send-email-agraf@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 31/32] 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: QEMU Developers Cc: Alexey Kardashevskiy , "qemu-ppc@nongnu.org" , Anthony Liguori From: Alexey Kardashevskiy 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=E2=80=99s device tree. So SLOF only maps the first block and that block needs to span the full RMA. This makes sure that the RMA area is where SLOF expects it. Reviewed-by: Thomas Huth Signed-off-by: Alexey Kardashevskiy Signed-off-by: Alexander Graf --- hw/ppc/spapr.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 38b43c9..6a79b1f 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -532,9 +532,6 @@ static int spapr_populate_memory(sPAPREnvironment *sp= apr, 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; @@ -688,7 +685,8 @@ static void spapr_reset_htab(sPAPREnvironment *spapr) =20 /* Update the RMA size if necessary */ if (spapr->vrma_adjust) { - spapr->rma_size =3D kvmppc_rma_size(ram_size, spapr->htab_shift)= ; + hwaddr node0_size =3D (nb_numa_nodes > 1) ? node_mem[0] : ram_si= ze; + spapr->rma_size =3D kvmppc_rma_size(node0_size, spapr->htab_shif= t); } } =20 @@ -1105,6 +1103,7 @@ static void ppc_spapr_init(QEMUMachineInitArgs *arg= s) 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; @@ -1126,10 +1125,10 @@ static void ppc_spapr_init(QEMUMachineInitArgs *a= rgs) exit(1); } =20 - if (rma_alloc_size && (rma_alloc_size < ram_size)) { + if (rma_alloc_size && (rma_alloc_size < node0_size)) { 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 @@ -1146,6 +1145,12 @@ static void ppc_spapr_init(QEMUMachineInitArgs *ar= gs) } } =20 + if (spapr->rma_size > node0_size) { + fprintf(stderr, "Error: Numa node 0 has to span the RMA (%#08"HW= ADDR_PRIx")\n", + spapr->rma_size); + exit(1); + } + /* We place the device tree and RTAS just below either the top of th= e RMA, * or just below 2GB, whichever is lowere, so that it can be * processed with 32-bit real mode code if necessary */ --=20 1.8.1.4