From nobody Thu Apr 25 14:30:11 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1570497365; cv=none; d=zoho.com; s=zohoarc; b=HVXOJRPNY5yT7Ql/ODKK0Ce6lRdgYnHl+UlQADX3HDANANuFiuaviCKgetP5iKihl/7bVQ4QuMm8W6Qhq/9hQbf5OYLFZO/lSLtLi5c8I8aIyGBTH4llGBaNAyZsreqGcjVDMKNHHQoE6V8AzErteb+J/bbo1ufnsnLTxoL2EWY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570497365; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=0GwoEAtPEofuIU3TfRRlc+l3vjfO9L5klsnq0zgP9Qo=; b=EtBUDn9xKftEXFsrlZKXMgU2gQ5Ts2tzJP50On1sv1QKK+7LnTY8Ih+RtOJTb1kPSzqvViOhdH9ERiDhQImn/uwd5rRDve9DX+3Q0qXI+ly8ArkkdoHMQmuAYJsz6DyLwRrWY+cAZPQUt+3A+y2G6nzjpGy77VAMEj8UJ8wyvck= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1570497365491520.4202429491716; Mon, 7 Oct 2019 18:16:05 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iHe5h-0001PA-Bt; Tue, 08 Oct 2019 01:15:05 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iHe5f-0001On-DN for xen-devel@lists.xenproject.org; Tue, 08 Oct 2019 01:15:03 +0000 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 0dfeb334-e969-11e9-8c93-bc764e2007e4; Tue, 08 Oct 2019 01:15:03 +0000 (UTC) Received: from sstabellini-ThinkPad-T480s.hsd1.ca.comcast.net (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4968E20867; Tue, 8 Oct 2019 01:15:02 +0000 (UTC) X-Inumbo-ID: 0dfeb334-e969-11e9-8c93-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570497302; bh=WP4pj+IslHYj1jI9EZ1W0JuwP7hGga0mmKu7DlziRM0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ItALgK1jPzbfMrnObzm2bSxT9k6pyQFwmn1MZ+r8giWwj8gUlr2VaN0o2ucyhQVPK 43+XdtwC7yfw2JJ6k7X+OcOAaMxbp5zAW51VH8s86GkqyqRbMxEoKSeTdU5Q3tgKgM /vHIEiFbaqMI/xVg6CwRr9OK12UlraMa88afkQUE= From: Stefano Stabellini To: Julien.Grall@arm.com Date: Mon, 7 Oct 2019 18:14:59 -0700 Message-Id: <20191008011501.21038-1-sstabellini@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Subject: [Xen-devel] [PATCH v2 1/3] xen/arm: fix buf size in make_cpus_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: jgross@suse.com, xen-devel@lists.xenproject.org, sstabellini@kernel.org, Volodymyr_Babchuk@epam.com, Stefano Stabellini MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The size of buf is calculated wrongly: the number is 64bit, not 32bit. Also the number is printed as a hexadecimal number, so we need 8 bytes for 32bit, not 10 bytes. As a result, it should be sizeof("cpu@") + 16 bytes for a 64-bit number + 1 byte for \0. Total =3D 21. Fixes: fafd682c3e (xen/arm: Create a fake cpus node in dom0 device tree) Signed-off-by: Stefano Stabellini --- Changes in v2: - patch added --- xen/arch/arm/domain_build.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 921b054520..60923a7051 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -788,8 +788,8 @@ static int __init make_cpus_node(const struct domain *d= , void *fdt) unsigned int cpu; const void *compatible =3D NULL; u32 len; - /* Placeholder for cpu@ + a 32-bit number + \0 */ - char buf[15]; + /* Placeholder for cpu@ + a 64-bit number + \0 */ + char buf[21]; u32 clock_frequency; bool clock_valid; uint64_t mpidr_aff; --=20 2.17.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Thu Apr 25 14:30:11 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1570497365; cv=none; d=zoho.com; s=zohoarc; b=jrdxZYbDznM56oIOxGLXgDOp0xYjbMQDOYWKp+tLZ7AlhJhguyOYaSRH2QzCGcezEaGrcYzlS+3MB9smoOG/uiFUdlX/MTTDlDyKj3T/l5y33P4NFPjSzbtqAqLSONXR0D8ZCglLwKnc7xEINZgm4VDZHw15Ga81V3Q6QLsndcQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570497365; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=0hYcKYkRenOSgTPzQum9OGjlSdNkaPt9FILzthXCXLk=; b=YRdWkfMR+pF2nJ7+pnYExuOaDP9v5HlaKnnPBGrmaX8/zEEr6pcIcwEUIaXunFnU9cTWbw6aseEquuFPPTj/kMRgd6qIEBT4r74ZUFf7sX3GYL+/9z9FH3taf4Zfeke63w2w7GpmIUopbMmTeEQLqbRsbyO817UmYSzHAiIV664= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1570497365489685.2897722374773; Mon, 7 Oct 2019 18:16:05 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iHe5h-0001PP-LE; Tue, 08 Oct 2019 01:15:05 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iHe5g-0001Ov-76 for xen-devel@lists.xenproject.org; Tue, 08 Oct 2019 01:15:04 +0000 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 0e3ade40-e969-11e9-97c0-12813bfff9fa; Tue, 08 Oct 2019 01:15:03 +0000 (UTC) Received: from sstabellini-ThinkPad-T480s.hsd1.ca.comcast.net (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A311A21721; Tue, 8 Oct 2019 01:15:02 +0000 (UTC) X-Inumbo-ID: 0e3ade40-e969-11e9-97c0-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570497302; bh=hiQQh+2Zwz+zNsgQjAOGWyiMN6Jk+cTk9K7Etev5C1o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YkqwjX+ezQJHy4Bizu9etCF1e+NTFbMtIHBWiFnLdl6l6QxTcBdhiwaDOlOmGJ8hf E95Bs2aErmMStNRY5Ywk7xvNd1azC98CKG+c+wb/YYSSUUY5BfA5uHO5GzRuPVHZMz YyQoGW6HXGAl/weagioW8HRNec8Ok25Ffto73LdI= From: Stefano Stabellini To: Julien.Grall@arm.com Date: Mon, 7 Oct 2019 18:15:00 -0700 Message-Id: <20191008011501.21038-2-sstabellini@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Subject: [Xen-devel] [PATCH v2 2/3] xen/arm: make_memory_node return error on nr_banks == 0 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, xen-devel@lists.xenproject.org, sstabellini@kernel.org, Volodymyr_Babchuk@epam.com, Stefano Stabellini MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Call make_memory_node for reserved_memory only if we actually have any reserved_memory regions to handle. Add a check in make_memory_node to return an error if it has been called with no memory banks as argument. Fixes: 248faa637d2 (xen/arm: add reserved-memory regions to the dom0 memory= node) Signed-off-by: Stefano Stabellini Acked-by: Julien Grall --- Changes in v2: - patch added --- xen/arch/arm/domain_build.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 60923a7051..ea01aada0b 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -650,6 +650,8 @@ static int __init make_memory_node(const struct domain = *d, __be32 *cells; =20 BUG_ON(nr_cells >=3D ARRAY_SIZE(reg)); + if ( mem->nr_banks =3D=3D 0 ) + return -ENOENT; =20 dt_dprintk("Create memory node (reg size %d, nr cells %d)\n", reg_size, nr_cells); @@ -1540,10 +1542,13 @@ static int __init handle_node(struct domain *d, str= uct kernel_info *kinfo, * Create a second memory node to store the ranges covering * reserved-memory regions. */ - res =3D make_memory_node(d, kinfo->fdt, addrcells, sizecells, - &bootinfo.reserved_mem); - if ( res ) - return res; + if ( bootinfo.reserved_mem.nr_banks > 0 ) + { + res =3D make_memory_node(d, kinfo->fdt, addrcells, sizecells, + &bootinfo.reserved_mem); + if ( res ) + return res; + } } =20 res =3D fdt_end_node(kinfo->fdt); --=20 2.17.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Thu Apr 25 14:30:11 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1570497366; cv=none; d=zoho.com; s=zohoarc; b=ZI3rsyPzlg7B5Q+guel1ofVswc6NaFdpEIQlbrI5ZvQgbRqd1Oj2pTVQobSMssZ5EIM+TkY4R6HcxWSJ8O901CLl/wYl4rl/mQesQlD6O+T1Ka5ilZVseartMK6NSa+SQmQrgI6s5ltJMSPj0rUPjQgt/hnonarujqnU4WPr6Ns= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570497366; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=MkckVyvUwxwpgn4FpxYI+FN6nZb0UEJ4U1YP6e2CH60=; b=RjXFNLX0svJBPOPiasv5hpGAu8O7P8ILwEQmD6DFbzLR8p48/83uiQvO8wcu/TgdR9bhyR+2J9VCsHdAkb4SHIqm8Vkj0VMEdippnloChDyA5BK9lXhlzDRsyHQmr2FjUMZXKwg3LxdUQ4mCsdz5sRyIxTP4xjz8U2rsRHujfXE= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1570497366091105.12109814120038; Mon, 7 Oct 2019 18:16:06 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iHe5l-0001QL-08; Tue, 08 Oct 2019 01:15:09 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iHe5k-0001Q5-1x for xen-devel@lists.xenproject.org; Tue, 08 Oct 2019 01:15:08 +0000 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 0e70af84-e969-11e9-80e3-bc764e2007e4; Tue, 08 Oct 2019 01:15:03 +0000 (UTC) Received: from sstabellini-ThinkPad-T480s.hsd1.ca.comcast.net (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0885A21871; Tue, 8 Oct 2019 01:15:03 +0000 (UTC) X-Inumbo-ID: 0e70af84-e969-11e9-80e3-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570497303; bh=06I0h/TPwCiBF+PPZDZVKMiNZZH6LxkSGHAis/wsgTk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AbsSO6scOdiKxHp++B+mY0lCUmYsx5W0LKis3YQRcF1Pg4xE/u9Prv51+raCPWfgi UWkl/VkWwiBTikLZPemupeHRp+9Aik7VWBDJHtEi1wgnF3El31bqfA/n2xS5oMm0mG 9gIETOIKpdFFM/lLCBYCCC2gBvTf7lkeS/vDEGtg= From: Stefano Stabellini To: Julien.Grall@arm.com Date: Mon, 7 Oct 2019 18:15:01 -0700 Message-Id: <20191008011501.21038-3-sstabellini@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Subject: [Xen-devel] [PATCH v2 3/3] 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, xen-devel@lists.xenproject.org, sstabellini@kernel.org, Volodymyr_Babchuk@epam.com, Stefano Stabellini MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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. Fixes: 248faa637d2 (xen/arm: add reserved-memory regions to the dom0 memory= node) Reported-by: Oleksandr Tyshchenko Signed-off-by: Stefano Stabellini Acked-by: Julien Grall --- Changes in v2: - fix buf size calculation: the number is 64bit and printed as hexadecimal - move check on nr_banks to a separate patch --- xen/arch/arm/domain_build.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index ea01aada0b..3de4dafaed 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -646,6 +646,8 @@ static int __init make_memory_node(const struct domain = *d, int res, i; int reg_size =3D addrcells + sizecells; int nr_cells =3D reg_size * mem->nr_banks; + /* Placeholder for memory@ + a 64-bit number + \0 */ + char buf[24]; __be32 reg[NR_MEM_BANKS * 4 /* Worst case addrcells + sizecells */]; __be32 *cells; =20 @@ -657,7 +659,8 @@ static int __init make_memory_node(const struct domain = *d, reg_size, nr_cells); =20 /* ePAPR 3.4 */ - res =3D fdt_begin_node(fdt, "memory"); + snprintf(buf, sizeof(buf), "memory@%"PRIx64, mem->bank[0].start); + res =3D fdt_begin_node(fdt, buf); if ( res ) return res; =20 --=20 2.17.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel