From patchwork Wed Jan 17 10:42:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiang W X-Patchwork-Id: 1887352 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=kywECpUu; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=jKbIQ76r; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=198.137.202.133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TFMsV0XYLz23dx for ; Wed, 17 Jan 2024 21:42:53 +1100 (AEDT) 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:References:In-Reply-To: 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: List-Owner; bh=Hfu5cXs9ZyTshrn02a0xz61CYS1bbDLes6jHpfcn2k8=; b=kywECpUu+PZKdl WUjBWt0xuL24oi9B9g9ptm0sG0nYrPrpOssLAgygDNIAf3UyuwvHlcC4ieOvdBfNnhepZ5FAzkcYQ 63viK0m3a7CkZbZwS4mQcaiBGg0SV8UUOJJPNeHxRR3Kj4WwIcj0di2BKRDmQJOsq7ALAAtdapbJ2 UTEvnwrQrBJ+8egXGM4OExgjO7rED+/MTTOnbvWa2P/QRqml9Cj1yKE+PLyYQJ7+0F1mabJSOCZN2 UhuZzKjjA+UN36AlC+0kUxuC5iTgWCZ4AhOog2kOit4JV9t28lzZuWQSVIVxQ6JJPHJv9tkHssw+K z86yzDbq8tb7zI4J9GqQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rQ3NT-00FJoQ-0H; Wed, 17 Jan 2024 10:42:35 +0000 Received: from m16.mail.126.com ([220.197.31.8]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rQ3NN-00FJkL-02 for opensbi@lists.infradead.org; Wed, 17 Jan 2024 10:42:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version; bh=7T6lb 6rTK8AZBUrIRtrl67ncfcz5G25TDrAdrA4hJL0=; b=jKbIQ76rPd50Cv0FBOxJB eGS+JItZjjfm8/deXAF/uaHaGKBykLPW0YB2cf94fL/bTmIN8JQA+Z4/Y4GmlBkO fukuHHv8lNnBSuarLsNwDzIjdkModI8YvlFQntHN+106Q0XChgOqyp/eEmYZkFuu +1+LNtDAKFWuPOIN1cWJ8c= Received: from T490.lan (unknown [112.83.182.118]) by gzga-smtp-mta-g0-0 (Coremail) with SMTP id _____wC3_5cLr6dlF6RgAQ--.42458S8; Wed, 17 Jan 2024 18:42:23 +0800 (CST) From: Xiang W To: opensbi@lists.infradead.org Cc: Xiang W Subject: [PATCH v3 06/10] firmware: fw_base: Simplified setup trap handler Date: Wed, 17 Jan 2024 18:42:03 +0800 Message-ID: <20240117104212.1055737-7-wxjstz@126.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240117104212.1055737-1-wxjstz@126.com> References: <20240117104212.1055737-1-wxjstz@126.com> MIME-Version: 1.0 X-CM-TRANSID: _____wC3_5cLr6dlF6RgAQ--.42458S8 X-Coremail-Antispam: 1Uf129KBjvdXoW7Xw4fZFy3Jw45uryfur1DGFg_yoWkGFb_XF WUua4Iqw4qvrWrX3y0krW3Wwn7WrWF9F4Yg34Dur4jqr13tFWagr9rJw4DWrWrX3s2gr98 AF4DXrsrJr92kjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xRNyCJPUUUUU== X-Originating-IP: [112.83.182.118] X-CM-SenderInfo: pz0m23b26rjloofrz/xtbBdBBoOmSdLsdj5wAAsi X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240117_024229_406333_349DE25C X-CRM114-Status: UNSURE ( 5.54 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) 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: The same detection was done twice when setting mtvec and trap_exit. Merging can reduce code size. Signed-off-by: Xiang W --- firmware/fw_base.S | 16 ++++ 1 file changed, 4 insertions(+), 12 deletions(-) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [wxjstz[at]126.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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 The same detection was done twice when setting mtvec and trap_exit. Merging can reduce code size. Signed-off-by: Xiang W Reviewed-by: Anup Patel --- firmware/fw_base.S | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/firmware/fw_base.S b/firmware/fw_base.S index 7c7157d..d4a6d3a 100644 --- a/firmware/fw_base.S +++ b/firmware/fw_base.S @@ -452,22 +452,14 @@ _start_warm: srli a5, a5, ('H' - 'A') andi a5, a5, 0x1 beq a5, zero, _skip_trap_handler_rv32_hyp - lla a4, _trap_handler_rv32_hyp -_skip_trap_handler_rv32_hyp: -#endif - csrw CSR_MTVEC, a4 - -#if __riscv_xlen == 32 /* Override trap exit for H-extension */ - csrr a5, CSR_MISA - srli a5, a5, ('H' - 'A') - andi a5, a5, 0x1 - beq a5, zero, _skip_trap_exit_rv32_hyp - lla a4, _trap_exit_rv32_hyp csrr a5, CSR_MSCRATCH + lla a4, _trap_exit_rv32_hyp REG_S a4, SBI_SCRATCH_TRAP_EXIT_OFFSET(a5) -_skip_trap_exit_rv32_hyp: + lla a4, _trap_handler_rv32_hyp +_skip_trap_handler_rv32_hyp: #endif + csrw CSR_MTVEC, a4 /* Initialize SBI runtime */ csrr a0, CSR_MSCRATCH