From patchwork Fri Mar 28 08:53:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= X-Patchwork-Id: 14031765 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2F4C1C28B20 for ; Fri, 28 Mar 2025 08:53:27 +0000 (UTC) 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=/e6Dy5iEcs9RdJMyV4ipX/hvVFnQRV5Mt2CbFxbIjr4=; b=WJ0XfiPC3yZPna Gk37Nm/xuoUvua3mflrk+mDYdBoK6SwqbbpD+BMzJmSB96/m7zmrlu7xspbXmuDdKuR7krTTdHkoq ysIkuQEdo4Rpg8auOBSHCzY3LCQOGycCXsts1ZW+xqPgVOCtKU6rH577f6NH8+Ikv8OteARc5y1JM TI5GXbm/NjfMXdhnl7QE9MaTf50wPmwgc3p4/6T6UW1/ZC8JVQXjzaAR9WpsoW6B45T8AKwRO1HjD OB5YR5nNuxEaj0phOc22w0MDYdfLS/boBk+XdIYZcss19OWHVM/oBttFHvvRv7rDANQkozV7Snyo5 4vyZaoGlTiFzmgQpw3vQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1ty5Ss-0000000CxuM-2PXp; Fri, 28 Mar 2025 08:53:22 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1ty5Sq-0000000Cxtl-1Ywz for linux-riscv@lists.infradead.org; Fri, 28 Mar 2025 08:53:21 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id F20455C4C8A; Fri, 28 Mar 2025 08:51:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC027C4CEE4; Fri, 28 Mar 2025 08:53:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743151998; bh=guCE2WsY9Defy1aDADm8ZYMxyHivzAMoig7lpN2TvHs=; h=From:To:Cc:Subject:Date:From; b=pk51dovHDmNhzcT3xYaANTDZuyU9eDeLbZNqeF67YixD9tKMIkacoy86cg5Ah3Bam uAYCG1ShZWfz7VKqky48jc9mI8XFuUsSKTYFP9vTDo6hSQ9Lsgs/2LTZXH/cxz7scH InrlmCpKroAdw4LkQ0SF9Xkuia/kCdyd64pfPyWY82QVlcuU0AEuqAkoBISHcDpAES bjZHhvhkZyJbjCRXOcyo6lE/s54EzyQ/cRBSvxnZbHToS3CAXPbDZRYGLgmjo34KUf ZRRs3W5zB+eFSHbE8RcV1VixwUPhk0CDbcjsZkQdgsLKPURhPAN95weVKhwslSD1sR 0U5UEdxVhUVBQ== From: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= To: Paul Walmsley , Palmer Dabbelt , Alexandre Ghiti , linux-riscv@lists.infradead.org Cc: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Daniel Maslowski , Li Zhengyu , linux-kernel@vger.kernel.org Subject: [PATCH fixes] riscv/purgatory: 4B align purgatory_start Date: Fri, 28 Mar 2025 09:53:11 +0100 Message-ID: <20250328085313.1193815-1-bjorn@kernel.org> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250328_015320_470740_0750652C X-CRM114-Status: UNSURE ( 8.42 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org From: Björn Töpel When a crashkernel is launched on RISC-V, the entry to purgatory is done by trapping via the stvec CSR. From riscv_kexec_norelocate(): | ... | /* | * Switch to physical addressing | * This will also trigger a jump to CSR_STVEC | * which in this case is the address of the new | * kernel. | */ | csrw CSR_STVEC, a2 | csrw CSR_SATP, zero stvec requires that the address is 4B aligned, which was not the case, e.g.: | Loaded purgatory at 0xffffc000 | kexec_file: kexec_file_load: type:1, start:0xffffd232 head:0x4 flags:0x6 The address 0xffffd232 not 4B aligned. Correct by adding proper function alignment. With this change, crashkernels loaded with kexec-file will be able to properly enter the purgatory. Fixes: 736e30af583fb ("RISC-V: Add purgatory") Signed-off-by: Björn Töpel Reviewed-by: Alexandre Ghiti --- arch/riscv/purgatory/entry.S | 1 + 1 file changed, 1 insertion(+) base-commit: acb4f33713b9f6cadb6143f211714c343465411c diff --git a/arch/riscv/purgatory/entry.S b/arch/riscv/purgatory/entry.S index 0e6ca6d5ae4b..c5db2f072c34 100644 --- a/arch/riscv/purgatory/entry.S +++ b/arch/riscv/purgatory/entry.S @@ -12,6 +12,7 @@ .text +.align 2 SYM_CODE_START(purgatory_start) lla sp, .Lstack