From patchwork Wed Jun 2 01:42:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 1486316 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Q40RY4hl; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=ZVKvxejp; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FvsGP3lHGz9sSs for ; Wed, 2 Jun 2021 11:42:21 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=kQgCLvXoR1cu3xwQHJFyDdKts1hz4M9nXYQgmeT6sC4=; b=Q40RY4hltQ992D olvaM7GBqRe5K3T7SOhT1RCV5wDnmO+//rUj1xchZ+2DYuwx8jCQzMXiam61HI5FG8azIfGElogBb UB9omVdTIdfR+h19by/rVQluL37Akiuukshw//9HhQoAF3S1+ACynXuUIkwjWLragqtnexPtOQFas Vateq8CZwjTeU2DTiESrlj8JPL1NB0Zb0RMd5FlUVdyfxM6X3iKW5jwwcDF9Vr/Zw/4jha0c0Lsvr Sh3AEgR0YaZK57lguyNeP8soPGi1f8h6/vFz7VZ6s8ZhrFLpV19InsZDOybdFmW68oX7kmdrpb+fK XXuNrKCyikBFggnpZ1BA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1loFth-001Vn8-IX; Wed, 02 Jun 2021 01:42:17 +0000 Received: from esa3.hgst.iphmx.com ([216.71.153.141]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1loFtf-001Vme-GG for opensbi@lists.infradead.org; Wed, 02 Jun 2021 01:42:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1622598133; x=1654134133; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=BV0xIlmHt1twmss81MKMAzb3DgJvYykzi0FLoF54N6c=; b=ZVKvxejpZGdgvhN41baDe1K5del3ilOk2KZJipWG3tLQzqjBDjWNKREe 1eSEoVI6nzp4FR2Anrrx15mbKs49KV0Od+b5yWIWwQN+z73GB4NkkoKIg 8YQGLFRlIvUcNm08DMbAnjFduUjG7Obh+6uXs7rOfsuWmLdTXumEvYAWS Un3g8OzLEoTpIKiyOzmbSS9RDyPeaQsgBH73CV0einXF62jlZpN//ZGCq 4rUqd+Q0asNWWw12KjBwmLUEjUnipCdmGLCuQUNtadPBfcI2jFBSIX913 2SAmSn/jhILigIw+XTnFePyY9mCDqO0J+swop1UxJ7/3xpel6ZhUeq5wW w==; IronPort-SDR: 1P8qr92kBpbIXOn/lmSqfv4cl5VSmRqtsLa30L4YJPL2HFGjbhgkScr+QMsnTIn+Jn8byaP4Wm Qvbz6QAeImG57wIV0MjIOLjB1ihTMVC+qoXzVkgDeFDL5kGTvudjZSa8T8zrL+dlBhU8qQqj/d VZsU67wx/rs+ZwNQj5ikdQ2c6w7cYQ9ZG0oGX1NhnqzvdbfANoGHLN+Cy+CtR71qfGE56EzGrh kt/3x2Dg4U5+cG5ztpQVfxSJqVNfZKkWPm46qNbVmoq54pvsbnIAt+CYUyJUZ/PnyChf/vxIMA NtA= X-IronPort-AV: E=Sophos;i="5.83,241,1616428800"; d="scan'208";a="175081318" 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; 02 Jun 2021 09:42:11 +0800 IronPort-SDR: GwYFBQ8Ahr+vvwKw3I32t6+liJZW91KXEXp/29ACwWWNl6dR3wNdHUnFJAkam9LsjYmuSi2YM1 bnXfiyoVuPYmznm16VrbHbESR8SFviSApuwrz3cNoeVSkKGoubK/kwLWWNtoKPtjJmxCLCXKRf 69mtMQbTHOR1SoQbHLjKVhZ8XA0vgCFqvSOIY+769+IkOnjYLkgqTIssc/jRz2Rxr72mBzU2yW VUfbX2PFuRByFqgCbaB9/JcM3XenuS1x242fniJrjnlAzponREz7Pa/T4sLhCIGqVOgGZ39I9r lm02Zyax3owiMlet7gEc3Dmm 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; 01 Jun 2021 18:21:29 -0700 IronPort-SDR: CvSB44pnljZBTnc/25wvbCb4NwR9rnrDf1H3NjBUYIfm6FN8UXC/dndcWbwY2aiwxonJiD27+h wxU0WOY6Hwpyink/vazuPEhOwGd5tGrZlduKFRiLOlybg8FekXuNVei0mEyf2q1iQA8ctreqpc XStxN1afVurMtZdVCnwx/++b9G40Wur5+d21eCnDekruzzpS/7a9tVOP+cUJxQe0Jbc/0D5azp vvIW9coKL002BvNtEdyjlyeb2YqGqOCM5Nzud/DhPGscLzEGmHPYLpPrtwsqA+PtmoxyE2pXIZ fxM= WDCIronportException: Internal Received: from unknown (HELO yoda.wdc.com) ([10.225.163.102]) by uls-op-cesaip02.wdc.com with ESMTP; 01 Jun 2021 18:42:12 -0700 From: Atish Patra To: opensbi@lists.infradead.org Cc: anup.patel@wdc.com, Atish Patra Subject: [PATCH] firmware: Do not allow harts with different XLEN to boot Date: Tue, 1 Jun 2021 18:42:01 -0700 Message-Id: <20210602014201.246899-1-atish.patra@wdc.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210601_184215_570809_D3D2AC55 X-CRM114-Status: GOOD ( 10.35 ) X-Spam-Score: -2.5 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: OpenSBI is built separately for RV32/RV64. Thus, it shouldn't try to boot harts with a different XLEN compared to what it is compiled with. This patch fixes the issue observed in beagleV which has two U74(RV64) and one E24 (RV32) harts. Content analysis details: (-2.5 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [216.71.153.141 listed in list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org OpenSBI is built separately for RV32/RV64. Thus, it shouldn't try to boot harts with a different XLEN compared to what it is compiled with. This patch fixes the issue observed in beagleV which has two U74(RV64) and one E24 (RV32) harts. Signed-off-by: Atish Patra --- firmware/fw_base.S | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/firmware/fw_base.S b/firmware/fw_base.S index a5ce946aa3fe..ae12a126ca66 100644 --- a/firmware/fw_base.S +++ b/firmware/fw_base.S @@ -47,6 +47,16 @@ .globl _start .globl _start_warm _start: + csrr t0, misa + slti t1, t0, 0 + slli t1, t1, 1 + slli t0, t0, 1 + slti t0, t0, 0 + add t2, t0, t1 + li t3, __riscv_xlen + srli t3, t3, 5 + bne t2, t3, _start_hang + /* Find preferred boot HART id */ MOV_3R s0, a0, s1, a1, s2, a2 call fw_boot_hart