From nobody Sat May 18 18:57:59 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=1610010744; cv=none; d=zohomail.com; s=zohoarc; b=M3vR403CYBNG3nToOQEM1RqYCsm0WnFVnbkLl4ldOdSLOHIh7X/jDISGOWs+n+v/D8Nd/5gVSw4DIk08/40TEs4rlRQ22gSlrbOlGdiMijp8c5OOFseW1kGNEexR64PYjCbPOtUcBcBULtVPTT7ybmfaEa5lAR4GhIPzfZ4atag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610010744; 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=UCKfYwVUp2AnLp7b4k76IN1PdwE4C4J0YTeAJRWAw9I=; b=iRLyU/9Gp4YEPh8mGY85kcVlLKRUznYsXCAJyNgCQq95IXOeirvN53GWsizQjDpRxOEdDkGKxM0j2tgp2FwiFrXbi0TOCxWEL9RPUyKihiuTzRf1DdtSz/tHhkHhG/4Hmg1F3L4DoNxt73hAT/DRgn2/erEqISEx5Ek2bONkqdk= 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 1610010743991685.7002646534856; Thu, 7 Jan 2021 01:12:23 -0800 (PST) Received: from localhost ([::1]:49706 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxRLC-0000nd-V7 for importer@patchew.org; Thu, 07 Jan 2021 04:12:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46802) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxRKS-0008Sq-2Z; Thu, 07 Jan 2021 04:11:36 -0500 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:24019) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxRKP-0005JK-AX; Thu, 07 Jan 2021 04:11:35 -0500 Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 07 Jan 2021 17:11:29 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jan 2021 00:54:28 -0800 Received: from usa002483.ad.shared (HELO jedi-01.hgst.com) ([10.86.62.136]) by uls-op-cesaip02.wdc.com with ESMTP; 07 Jan 2021 01:11:30 -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=1610010693; x=1641546693; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=I/MhugurugNGvvWXulRQVrb0yhFYNb+h9xyzU5fFVjs=; b=ls+dSK+Z3Guwy5B4N+qgKFdRMPoOvICIvVQS2W/MSW8th3Xk/laP8pZ5 Fjv7747FAXjyizYwU0nAuzuggum5MKKAX6v5veNjmDkoYzVS2IJ1GyTnU RBFpPj08OL6MQ9hzVnG/BItG2s01ypQYQt+Hapmh2kRhS3/gyDKYo1AsJ 6IPprq/k4/GzEng1FkqvgQAnXS/RIa4HLGBA7RJwh1LOSE+sajlq2WD9e V7mok/h5quzgj0UWQfjqrZZ9sJk14kGj2e4tpJGx2xx+YT0iZatHsseEp EzBWhDhj3MSABir4AdTEbCs3eN7OyramHMjlXbo5ux/IBCeEYLrtiWYpr g==; IronPort-SDR: y8zCJN3MiIqCkPom/4ZIBGgLiAUrlC/KgJEUWya1ZNiuYzuAQx0ghiFMkm529bRI3dt+kTdN92 uqzSh34joPhyNnmfStjg0XIjw5mQ07k/VSmXcZJiVVoUIM9zcfplom7JGeUIANuQJcm24cMleJ 0JNqyYfu9cPkShEuF8f/4PylqICGcoZiNVci/psQVhdeNqPqqSARuq5D/ec2eV4A8km3tmMREf GzbD8pGXIrFRLeuQL9SIqozwPUFqxJ+865A1zhOFvyigxrYxBLESTamDS0EDFI4r8KYg9SjANm osk= X-IronPort-AV: E=Sophos;i="5.79,329,1602518400"; d="scan'208";a="161137545" IronPort-SDR: pHJeTlnExuXeJtYLm3KqXtXzck0iKZFZ0B5NVVxoRC6PkR0Twy2HfKFHxRDM7mg6kie2JKCD1N BzrOKFKjr8FIyBvhOmRkuawO6gBU2IiwuqQWPXS6RN3RCaa6XDAZLdQmcoac50+3RqVsbu8aSy 1GpLjkoJhBsgHA4BbSVcYeUeokU5+LmWPfIQgExhs4xga0dTDQYtCxzS5ZlEu6LAffaCwoUb3/ iwvSQO7+Xg1n2qRK9YTrY0eJSE5IL/xcvQRkjgHlt5hCUkc8jt51kRLAsT+GOIj2gb1qAzvdS5 Q47eeLnJcnc+xLfK+UAX00Mc IronPort-SDR: f5F+ouawqWDH9Tr4YAF9RDJWd3yx4bBp/oA8AetxHMxBa2j4DSu6okX42YkaaV8s4MlKN5ll/Z KqdGg6vfxKTxHPKc3Gbsd6ifCR5acb/9VVr3m94DU4dgtVW1fKdgtj0XHwBq5/w22/mdQDAsq4 l+OQupdnlEl6p93umbbNIlIzChksA6RyKe5th/Pa6qTI6WumGSlusW51a77oW0DNXKratAPKro 6I/Wnr8c3K1NuR9YtfmA66y2FBlVfL6BpRQy/NZbn70IbM/WEf3HAujrPSFhkRhUHcGzlwwmY/ 13Y= WDCIronportException: Internal From: Atish Patra To: qemu-devel@nongnu.org Subject: [v2 PATCH] RISC-V: Place DTB at 3GB boundary instead of 4GB Date: Thu, 7 Jan 2021 01:11:27 -0800 Message-Id: <20210107091127.3407870-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=634a5def5=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: qemu-riscv@nongnu.org, Sagar Karandikar , Bastian Koppelmann , Bin Meng , 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. While at it, place the DTB further away to avoid in memory placeme= nt issues in future. Fix this by placing the DTB at 16MB from 3GB or end of DRAM whichever is lo= wer. Fixes: 66b1205bc5ab ("RISC-V: Copy the fdt in dram instead of ROM") Reviewed-by: Bin Meng Tested-by: Bin Meng Signed-off-by: Atish Patra --- Changes from v2->v1 1. Added the fixes tag and updated aligned down address to 16MB. --- hw/riscv/boot.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c index d62f3dc7581e..2ed23c7e9849 100644 --- a/hw/riscv/boot.c +++ b/hw/riscv/boot.c @@ -202,11 +202,11 @@ uint32_t riscv_load_fdt(hwaddr dram_base, uint64_t me= m_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. + * Thus, put it at an 16MB aligned address that less than fdt size fro= m the + * end of dram or 3GB whichever is lesser. */ - temp =3D MIN(dram_end, 4096 * MiB); - fdt_addr =3D QEMU_ALIGN_DOWN(temp - fdtsize, 2 * MiB); + temp =3D MIN(dram_end, 3072 * MiB); + fdt_addr =3D QEMU_ALIGN_DOWN(temp - fdtsize, 16 * MiB); =20 fdt_pack(fdt); /* copy in the device tree */ --=20 2.25.1