From nobody Sat May 18 20:37:11 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail header.i=@wdc.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=wdc.com ARC-Seal: i=1; a=rsa-sha256; t=1608241810; cv=none; d=zohomail.com; s=zohoarc; b=lZCyx2kPZUDdim8KgzBct/SiY/ry0pEjLcpwr19AmzqosJqoLLqKcFM5djzwNnr13i0cg93y1Kr7nH2xrbu4GqunRUNKAJfeHhgKUKSltV1/Hd0ezYCNi4IsTvGdO6FlW3KLJ+xz+qxElGji0sEOmey6aopc33d3G1AqppvYDFo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608241810; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=QpW5SeSsMflDQC/Pu7KV/cVHmc1SibNtuoXqseANt3M=; b=fuWbH+VxYMTPyzC5SyOIgNsc452Gnb+nV2JOgbihRAxrMeybnU7/gnFM46iXr3lavFSM+C+W+S1ufHJ8/wI+3W4BaGLOQF9z3htjAhpltaRePa9bNhSzPHFHL31qQ7xWITbC5l8Wk07hw+YN/J7YZTRMleVulMKaTCReRVRKlZ0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail header.i=@wdc.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608241810629824.0020627912091; Thu, 17 Dec 2020 13:50:10 -0800 (PST) Received: from localhost ([::1]:33386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kq1A1-0003bY-0n for importer@patchew.org; Thu, 17 Dec 2020 16:50:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46910) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kq18c-00035g-U8; Thu, 17 Dec 2020 16:48:44 -0500 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:6682) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kq18Z-0008JI-4X; Thu, 17 Dec 2020 16:48:42 -0500 Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 18 Dec 2020 05:48:32 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Dec 2020 13:33:48 -0800 Received: from cnf011319.ad.shared (HELO jedi-01.hgst.com) ([10.86.62.39]) by uls-op-cesaip02.wdc.com with ESMTP; 17 Dec 2020 13:48:32 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1608241719; x=1639777719; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Eyb1s+6C1ZE1gqsUGC3r72kRqTJupLnUxPH2PkKmvHQ=; b=T0f2EErIANnae781x4vqbMG+KS+jMJ7sQorRvlnH5q3o13X7RNDeCtlD GO94o2Fa5pkxnkRlN9nvKFaGJyH3z091o6ipKTVW57v+8mQLZYOdD7Nsv +1c9IZd4u3+opLGw2JGvXXPF3nGaVsRTB9qJOUopCSOUIk44pL8cN8Xz2 qPpr8MdMStPWhKd5BSYEY973eXogRN6CnIgRm6y7HdEG+FDbeoY91/eGE 6inf/C9/Z6bPECPbMOi1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ub4WM7x8sYFQ2unvQdUIv9 h6g= WDCIronportException: Internal From: Atish Patra To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Subject: [PATCH] RISC-V: Place DTB at 3GB boundary instead of 4GB Date: Thu, 17 Dec 2020 13:48:26 -0800 Message-Id: <20201217214826.2094617-1-atish.patra@wdc.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.71.153.141; envelope-from=prvs=6131d52cb=atish.patra@wdc.com; helo=esa3.hgst.iphmx.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sagar Karandikar , Bastian Koppelmann , Anup Patel , Atish Patra , Alistair Francis , Palmer Dabbelt , Bin Meng Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Currently, we place the DTB at 2MB from 4GB or end of DRAM which ever is lesser. However, Linux kernel can address only 1GB of memory for RV32. Thus, it can not map anything beyond 3GB (assuming 2GB is the starting addr= ess). As a result, it can not process DT and panic if opensbi dynamic firmware is used. Fix this by placing the DTB at 2MB from 3GB or end of DRAM whichever is low= er. Signed-off-by: Atish Patra Reviewed-by: Bin Meng Tested-by: Bin Meng --- hw/riscv/boot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c index d62f3dc7581e..9e77b22e4d56 100644 --- a/hw/riscv/boot.c +++ b/hw/riscv/boot.c @@ -203,9 +203,9 @@ uint32_t riscv_load_fdt(hwaddr dram_base, uint64_t mem_= size, void *fdt) * We should put fdt as far as possible to avoid kernel/initrd overwri= ting * its content. But it should be addressable by 32 bit system as well. * Thus, put it at an aligned address that less than fdt size from end= of - * dram or 4GB whichever is lesser. + * dram or 3GB whichever is lesser. */ - temp =3D MIN(dram_end, 4096 * MiB); + temp =3D MIN(dram_end, 3072 * MiB); fdt_addr =3D QEMU_ALIGN_DOWN(temp - fdtsize, 2 * MiB); =20 fdt_pack(fdt); --=20 2.25.1