From nobody Fri Apr 3 11:54:58 2026 Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 658663F54C1 for ; Tue, 24 Mar 2026 11:45:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.101 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774352744; cv=none; b=CD2Bvi7bSEQznU1swf6Qr7lOSDbwOxQnk0lSebjgasnUdLWwDQL+rrZCnKAEhIKCW1iSN1W551am9wrINmBfF1KybQuAE1PdpSfn1i3Wdr+LPywZtpvFUQdt1vBnAed7xSruE9KQN4ZBvcQvjwLfmPUETP+P/d9qFuxsnDT9UJ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774352744; c=relaxed/simple; bh=iUkD25uL5C9JhoIWRlMib3XOU/cUwiMjYOoR6k1Addg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NKK8fIKgagr3hyF6vmz0F4tqCHvpy/EUV5GLlh9i05j7YHz8nUmwX5kxSYBG+idmRPF1+tVaVksLfkCZ6FbQzdhkJ0i91FNBkWlBqaHiXIQu256yS7815KZgGcBV6HFHDBfVrNRFz38GI4HQzWOpEEugc9J4ZVBQmsUfzLzSXj4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=Us6KYrPB; arc=none smtp.client-ip=115.124.30.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="Us6KYrPB" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1774352737; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=eGoUX5+U64mMyKbsYD4ZIBWAtxP/BeYqHD20VtSl4vc=; b=Us6KYrPBmSQ1bEwWXQujO8gnjEFS5409MX4jswHDMWVtnnDuTo/bV3gnv8bkI1OVofqsdP4ShJDEvlrHjon9JOxGZP/XoDnShRGmV13630CyxtTtemx0Fh59FompiGcVFJgD5sy2UhteqqFGp1jIehqFUNuUxMFTc+Z6omL0uuY= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R781e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037033178;MF=fangyu.yu@linux.alibaba.com;NM=1;PH=DS;RN=17;SR=0;TI=SMTPD_---0X.eWVFc_1774352735; Received: from localhost.localdomain(mailfrom:fangyu.yu@linux.alibaba.com fp:SMTPD_---0X.eWVFc_1774352735 cluster:ay36) by smtp.aliyun-inc.com; Tue, 24 Mar 2026 19:45:35 +0800 From: fangyu.yu@linux.alibaba.com To: pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr, songshuaishuai@tinylab.org, bjorn@rivosinc.com, ardb@kernel.org, arnd@arndb.de, bhelgaas@google.com, richard.lyu@suse.com, tzimmermann@suse.de, nathan@kernel.org Cc: guoren@kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Fangyu Yu Subject: [PATCH 2/4] riscv: kexec: Place norelocate trampoline into .kexec.tramp.text Date: Tue, 24 Mar 2026 19:45:25 +0800 Message-Id: <20260324114527.91494-3-fangyu.yu@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 (Apple Git-146) In-Reply-To: <20260324114527.91494-1-fangyu.yu@linux.alibaba.com> References: <20260324114527.91494-1-fangyu.yu@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Fangyu Yu Move riscv_kexec_norelocate out of the generic .text section and into a dedicated executable trampoline section, .kexec.tramp.text. Signed-off-by: Fangyu Yu --- arch/riscv/include/asm/kexec.h | 9 +++++++++ arch/riscv/kernel/kexec_relocate.S | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/riscv/include/asm/kexec.h b/arch/riscv/include/asm/kexec.h index b9ee8346cc8c..315dce0d9ca6 100644 --- a/arch/riscv/include/asm/kexec.h +++ b/arch/riscv/include/asm/kexec.h @@ -75,4 +75,13 @@ int load_extra_segments(struct kimage *image, unsigned l= ong kernel_start, unsigned long cmdline_len); #endif =20 +#ifndef __ASSEMBLY__ +#ifdef CONFIG_MMU +#define __kexec_tramp_text __section(".kexec.tramp.text") +#else +#define __kexec_tramp_text +#endif +#endif +extern char __kexec_tramp_text_start[]; + #endif diff --git a/arch/riscv/kernel/kexec_relocate.S b/arch/riscv/kernel/kexec_r= elocate.S index de0a4b35d01e..af6b99f5b0fd 100644 --- a/arch/riscv/kernel/kexec_relocate.S +++ b/arch/riscv/kernel/kexec_relocate.S @@ -147,7 +147,7 @@ riscv_kexec_relocate_end: =20 =20 /* Used for jumping to crashkernel */ -.section ".text" +.section ".kexec.tramp.text", "ax" SYM_CODE_START(riscv_kexec_norelocate) /* * s0: (const) Phys address to jump to --=20 2.50.1