From patchwork Tue Apr 30 21:02:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 10924187 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6400F912 for ; Tue, 30 Apr 2019 21:04:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 55F3F28A21 for ; Tue, 30 Apr 2019 21:04:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4A40D28A2E; Tue, 30 Apr 2019 21:04:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EF96E28A21 for ; Tue, 30 Apr 2019 21:04:27 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hLZu2-0007jz-PG; Tue, 30 Apr 2019 21:03:02 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hLZu1-0007h5-1B for xen-devel@lists.xenproject.org; Tue, 30 Apr 2019 21:03:01 +0000 X-Inumbo-ID: 55a3a1be-6b8b-11e9-843c-bc764e045a96 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 55a3a1be-6b8b-11e9-843c-bc764e045a96; Tue, 30 Apr 2019 21:02:59 +0000 (UTC) Received: from sstabellini-ThinkPad-X260.xilinx.com (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E28DC21744; Tue, 30 Apr 2019 21:02:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556658179; bh=za6Exya73K7slM0wbPXGyWU791U1dzjVrB9Mqj71bKg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uhWpDVuybrBDmJCFgsrHD4soAXHAnI2/aU77dNRlSHiuVTLXOtbcgFoox9FBY2wvS tZngt+KiJLWp5MinRiGTEWiMkWzZ9VgH/6n+AwYDn24zdriqzuBjbdNvxEaNz9RjhI UU2ELBowTEXvIUXWhU9XKVKIhQD6XhHgLQSSpfl0= From: Stefano Stabellini To: xen-devel@lists.xenproject.org Date: Tue, 30 Apr 2019 14:02:52 -0700 Message-Id: <1556658172-8824-10-git-send-email-sstabellini@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: Subject: [Xen-devel] [PATCH v2 10/10] xen/arm: add reserved-memory regions to the dom0 memory node X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , julien.grall@arm.com, sstabellini@kernel.org MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Reserved memory regions are automatically remapped to dom0. Their device tree nodes are also added to dom0 device tree. However, the dom0 memory node is not currently extended to cover the reserved memory regions ranges as required by the spec. This commit fixes it. Signed-off-by: Stefano Stabellini --- xen/arch/arm/domain_build.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index e5d488d..fa1ca20 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -643,7 +643,8 @@ static int __init make_memory_node(const struct domain *d, { int res, i; int reg_size = addrcells + sizecells; - int nr_cells = reg_size*kinfo->mem.nr_banks; + int nr_cells = reg_size * (kinfo->mem.nr_banks + (is_hardware_domain(d) ? + bootinfo.reserved_mem.nr_banks : 0)); __be32 reg[NR_MEM_BANKS * 4 /* Worst case addrcells + sizecells */]; __be32 *cells; @@ -673,6 +674,20 @@ static int __init make_memory_node(const struct domain *d, dt_child_set_range(&cells, addrcells, sizecells, start, size); } + if ( is_hardware_domain(d) ) + { + for ( i = 0; i < bootinfo.reserved_mem.nr_banks; i++ ) + { + u64 start = bootinfo.reserved_mem.bank[i].start; + u64 size = bootinfo.reserved_mem.bank[i].size; + + dt_dprintk(" Bank %d: %#"PRIx64"->%#"PRIx64"\n", + i, start, start + size); + + dt_child_set_range(&cells, addrcells, sizecells, start, size); + } + } + res = fdt_property(fdt, "reg", reg, nr_cells * sizeof(*reg)); if ( res ) return res;