From patchwork Fri Oct 4 23:09:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 11175449 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 12F2D13B1 for ; Fri, 4 Oct 2019 23:11:26 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E22D621D81 for ; Fri, 4 Oct 2019 23:11:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="y99pA7Y/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E22D621D81 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iGWhq-0002Wu-D2; Fri, 04 Oct 2019 23:09:50 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iGWho-0002W8-St for xen-devel@lists.xenproject.org; Fri, 04 Oct 2019 23:09:48 +0000 X-Inumbo-ID: 0f6e11ca-e6fc-11e9-80e3-bc764e2007e4 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 0f6e11ca-e6fc-11e9-80e3-bc764e2007e4; Fri, 04 Oct 2019 23:09:48 +0000 (UTC) Received: from localhost (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 16D3221D81; Fri, 4 Oct 2019 23:09:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570230587; bh=NTT9BZoNTyxmi2wjFfJZ8/AglDBPcv+c0SqXYG7zFUI=; h=Date:From:To:cc:Subject:From; b=y99pA7Y/rd53KA+AaXkAI002jx2Gmq8AFsElWUw4TK1J2xk+Se1HhvI2Tu6PnRuJI LGQ79845YcjoKS67RlIi5EHUtSu0+kBZnFrrU0h+O7gNl07Y3Lqnwx27CBfljVob1J AXS/G23t2nLUHXPQSwux5s+TqBHv9apyUK2UHO2Q= Date: Fri, 4 Oct 2019 16:09:46 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-T480s To: xen-devel@lists.xenproject.org Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-4.13] xen/arm: fix duplicate memory node in DT 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: jgross@suse.com, oleksandr_tyshchenko@epam.com, sstabellini@kernel.org, julien@xen.org, Volodymyr_Babchuk@epam.com Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" When reserved-memory regions are present in the host device tree, dom0 is started with multiple memory nodes. Each memory node should have a unique name, but today they are all called "memory" leading to Linux printing the following warning at boot: OF: Duplicate name in base, renamed to "memory#1" This patch fixes the problem by appending a "@" to the name, as per the Device Tree specification, where matches the base of address of the first region. Reported-by: Oleksandr Tyshchenko Signed-off-by: Stefano Stabellini diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 921b054520..a4c07db383 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -646,16 +646,22 @@ static int __init make_memory_node(const struct domain *d, int res, i; int reg_size = addrcells + sizecells; int nr_cells = reg_size * mem->nr_banks; + /* Placeholder for memory@ + a 32-bit number + \0 */ + char buf[18]; __be32 reg[NR_MEM_BANKS * 4 /* Worst case addrcells + sizecells */]; __be32 *cells; BUG_ON(nr_cells >= ARRAY_SIZE(reg)); + /* Nothing to do */ + if ( mem->nr_banks == 0 ) + return 0; dt_dprintk("Create memory node (reg size %d, nr cells %d)\n", reg_size, nr_cells); /* ePAPR 3.4 */ - res = fdt_begin_node(fdt, "memory"); + snprintf(buf, sizeof(buf), "memory@%"PRIx64, mem->bank[0].start); + res = fdt_begin_node(fdt, buf); if ( res ) return res;