From patchwork Fri Nov 8 03:27:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 289681 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 039672C00CE for ; Fri, 8 Nov 2013 14:28:31 +1100 (EST) Received: from localhost ([::1]:43684 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeckG-0005Km-2p for incoming@patchwork.ozlabs.org; Thu, 07 Nov 2013 22:28:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59837) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vecjr-0005KR-MT for qemu-devel@nongnu.org; Thu, 07 Nov 2013 22:28:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vecjk-0005Au-8V for qemu-devel@nongnu.org; Thu, 07 Nov 2013 22:28:03 -0500 Received: from e23smtp09.au.ibm.com ([202.81.31.142]:43829) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vecjj-0005Ae-Jx for qemu-devel@nongnu.org; Thu, 07 Nov 2013 22:27:56 -0500 Received: from /spool/local by e23smtp09.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 8 Nov 2013 13:27:50 +1000 Received: from d23dlp01.au.ibm.com (202.81.31.203) by e23smtp09.au.ibm.com (202.81.31.206) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 8 Nov 2013 13:27:47 +1000 Received: from d23relay05.au.ibm.com (d23relay05.au.ibm.com [9.190.235.152]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id 866292CE8057; Fri, 8 Nov 2013 14:27:46 +1100 (EST) Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id rA83A40M5571064; Fri, 8 Nov 2013 14:10:05 +1100 Received: from d23av03.au.ibm.com (localhost [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id rA83RjrC026213; Fri, 8 Nov 2013 14:27:45 +1100 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.190.163.12]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id rA83RjBu026207; Fri, 8 Nov 2013 14:27:45 +1100 Received: from bran.ozlabs.ibm.com (haven.au.ibm.com [9.190.164.82]) by ozlabs.au.ibm.com (Postfix) with ESMTP id D84BDA01D2; Fri, 8 Nov 2013 14:27:44 +1100 (EST) Received: from ka1.ozlabs.ibm.com (ka1.ozlabs.ibm.com [10.61.145.11]) by bran.ozlabs.ibm.com (Postfix) with ESMTP id 56A0316AB10; Fri, 8 Nov 2013 14:27:44 +1100 (EST) From: Alexey Kardashevskiy To: qemu-devel@nongnu.org Date: Fri, 8 Nov 2013 14:27:40 +1100 Message-Id: <1383881260-792-1-git-send-email-aik@ozlabs.ru> X-Mailer: git-send-email 1.8.4.rc4 MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13110803-3568-0000-0000-00000486BDE3 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 202.81.31.142 Cc: Alexey Kardashevskiy , qemu-ppc@nongnu.org, Alexander Graf , Thomas Huth Subject: [Qemu-devel] [PATCH v4] spapr: make sure RMA is in first mode of first memory node X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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’s 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. Cc: Thomas Huth Cc: Benjamin Herrenschmidt Signed-off-by: Alexey Kardashevskiy Reviewed-by: Thomas Huth --- Changes: v4: * fixed a bug with preallocated RMA (thanks to Thomas Huth) v3: * removed unnecessary RMA fixup from spapr_populate_memory() v2: * changed as recommended by Alex Graf --- hw/ppc/spapr.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 7e53a5f..036246c 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -532,9 +532,6 @@ static int spapr_populate_memory(sPAPREnvironment *spapr, void *fdt) /* memory node(s) */ node0_size = (nb_numa_nodes > 1) ? node_mem[0] : ram_size; - if (spapr->rma_size > node0_size) { - spapr->rma_size = node0_size; - } /* RMA */ mem_reg_property[0] = 0; @@ -1113,6 +1110,7 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args) MemoryRegion *sysmem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); hwaddr rma_alloc_size; + hwaddr node0_size = (nb_numa_nodes > 1) ? node_mem[0] : ram_size; uint32_t initrd_base = 0; long kernel_size = 0, initrd_size = 0; long load_limit, rtas_limit, fw_size; @@ -1134,10 +1132,10 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args) exit(1); } - if (rma_alloc_size && (rma_alloc_size < ram_size)) { + if (rma_alloc_size && (rma_alloc_size < node0_size)) { spapr->rma_size = rma_alloc_size; } else { - spapr->rma_size = ram_size; + spapr->rma_size = node0_size; /* 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) } } + 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); + } + /* We place the device tree and RTAS just below either the top of the RMA, * or just below 2GB, whichever is lowere, so that it can be * processed with 32-bit real mode code if necessary */