From nobody Fri Apr 17 10:34:47 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 DD8904204E for ; Sat, 21 Feb 2026 03:01:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771642884; cv=none; b=gBlI/XMDBTxu111tY2vQqNxTMex6qGacSiEsqX0NgflZ9W0JXw8G8ryiY/pS887VPdNcQ8wn3+VAfn+iFUEb0PNUzFfqQIMD9KBkqs+sz4snXR2RZsGrefsQqWljzxZ5WcSyhqr1W2sh08OSL1At0ODLjV8EB8xH6t+knxPNU44= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771642884; c=relaxed/simple; bh=KwctpyjVLKsXQ7U5+18olYPJ9bygXjS/yrPcSLoGGVg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=NhIYjzxUfB9LY781lv6pj2RJff6HCa5PoAt50UoIY0DyPgeRIdSevwFmwzXlNMvODgNOwfF3roo4CMoFg3R2JjnytOv/L2RibL4Kp1ewEfe82yWZCmo8+8FBe8dhdAZbVKt4umgz2OOmRGfVhMUFlF1ToOHCVtXwQdqYzehOVcw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Mk/vOXPU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Mk/vOXPU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BF38C116C6; Sat, 21 Feb 2026 03:01:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771642884; bh=KwctpyjVLKsXQ7U5+18olYPJ9bygXjS/yrPcSLoGGVg=; h=From:To:Cc:Subject:Date:From; b=Mk/vOXPUXpDFG20dryKfkHg7K8wbnpwMFirn+E/2sfFv79+C81XlI/MkqJuaViq3X Ma3EW5NSRwrWXJVKaDiimVMDDuvdw3LhT3RUZyCkHHN7+iOfy/S6OK6w8B4g9uffWn tSfmZaDZhER9qKuTY7AqDyrsi2pXL9YY3u61X9DB6eJduqk/Z6zVqNdKw3fuhBCvFc 5+B0gkvZINPyY/JvZjwX/nVvkiV7i+s7AbaCdgASjil928ttfaql+ian/HF98iYk9m zEMMkOGCODYkg8nbFonbYv1LDxCU3bQF1ul0KZb0iCfB3q6Sx02GDycjX3rk4bbmif UQ3MpPIi4uLmQ== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] riscv: bug: Make RV32 use GENERIC_BUG_RELATIVE_POINTERS Date: Sat, 21 Feb 2026 10:42:55 +0800 Message-ID: <20260221024255.3552-1-jszhang@kernel.org> X-Mailer: git-send-email 2.51.0 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" x86 did this in commit b0a848f4a47a ("x86/bugs: Make i386 use GENERIC_BUG_RELATIVE_POINTERS") powerpc did this in commit 1baa1f70ef77 ("powerpc: Allow relative pointers in bug table entries") Similar as x86 and powerpc does, make RV32 use GENERIC_BUG_RELATIVE_POINTERS for "there is only one code path." and "less #ifdef is more better". Signed-off-by: Jisheng Zhang --- arch/riscv/Kconfig | 2 +- arch/riscv/include/asm/bug.h | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 90c531e6abf5..d0c8ffed1992 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -324,7 +324,7 @@ config STACKTRACE_SUPPORT config GENERIC_BUG def_bool y depends on BUG - select GENERIC_BUG_RELATIVE_POINTERS if 64BIT + select GENERIC_BUG_RELATIVE_POINTERS =20 config GENERIC_BUG_RELATIVE_POINTERS bool diff --git a/arch/riscv/include/asm/bug.h b/arch/riscv/include/asm/bug.h index 6f581b84d8fc..699c0cf3e4ef 100644 --- a/arch/riscv/include/asm/bug.h +++ b/arch/riscv/include/asm/bug.h @@ -29,13 +29,8 @@ =20 typedef u32 bug_insn_t; =20 -#ifdef CONFIG_GENERIC_BUG_RELATIVE_POINTERS #define __BUG_ENTRY_ADDR RISCV_INT " 1b - ." #define __BUG_ENTRY_FILE(file) RISCV_INT " " file " - ." -#else -#define __BUG_ENTRY_ADDR RISCV_PTR " 1b" -#define __BUG_ENTRY_FILE(file) RISCV_PTR " " file -#endif =20 #ifdef CONFIG_DEBUG_BUGVERBOSE #define __BUG_ENTRY(file, line, flags) \ --=20 2.51.0