Rust for Linux List
 help / color / mirror / Atom feed
* [PATCH v1] rust: bug: use the WARN_ON() helper on powerpc
@ 2026-12-02  4:49 FUJITA Tomonori
  0 siblings, 0 replies; only message in thread
From: FUJITA Tomonori @ 2026-12-02  4:49 UTC (permalink / raw)
  To: ojeda
  Cc: a.hindborg, acourbot, aliceryhl, bjorn3_gh, boqun, chleroy, dakr,
	daniel.almeida, gary, linkmauve, linuxppc-dev, lossin, maddy,
	mkchauras, mpe, npiggin, ritesh.list, sshegde, tamird, tmgross,
	work, rust-for-linux, FUJITA Tomonori, stable

From: FUJITA Tomonori <fujita.tomonori@gmail.com>

Commit 73b741adb264 ("rust: Add PowerPC support") allows CONFIG_RUST=y
on powerpc. But powerpc does not define ARCH_WARN_ASM and
ARCH_WARN_REACHABLE, which warn_on! needs, so the build fails:

  error: no rules expected `ARCH_WARN_ASM`
     --> rust/kernel/generated_arch_warn_asm.rs:1:28

Until commit 59cf3a5bda61 ("rust: sync: add SRCU abstraction") added
a user in the kernel crate, only binder used warn_on!, so the default
build worked. Now every powerpc build with CONFIG_RUST=y fails.

Use the WARN_ON() helper on powerpc, as LoongArch and ARM already do.

Fixes: 73b741adb264 ("rust: Add PowerPC support")
Cc: stable@vger.kernel.org
Reported-by: Link Mauve <linkmauve@linkmauve.fr>
Closes: https://lore.kernel.org/all/as08wgiYOGOx5Jzo@desktop/
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
---
A patch that adds ARCH_WARN_ASM for powerpc was posted [1], but
it has not been merged yet. This patch makes the build work until then.

[1] https://lore.kernel.org/all/20260922054311.906816-1-mkchauras@gmail.com/

 rust/kernel/bug.rs | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/rust/kernel/bug.rs b/rust/kernel/bug.rs
index 3b40b0bd37b5..4e4e370237f7 100644
--- a/rust/kernel/bug.rs
+++ b/rust/kernel/bug.rs
@@ -9,7 +9,13 @@
 #[macro_export]
 #[doc(hidden)]
 #[cfg(not(testlib))]
-#[cfg(all(CONFIG_BUG, not(CONFIG_UML), not(CONFIG_LOONGARCH), not(CONFIG_ARM)))]
+#[cfg(all(
+    CONFIG_BUG,
+    not(CONFIG_UML),
+    not(CONFIG_LOONGARCH),
+    not(CONFIG_ARM),
+    not(CONFIG_PPC)
+))]
 #[cfg(CONFIG_DEBUG_BUGVERBOSE)]
 macro_rules! warn_flags {
     ($file:expr, $flags:expr) => {
@@ -49,7 +55,13 @@ macro_rules! warn_flags {
 #[macro_export]
 #[doc(hidden)]
 #[cfg(not(testlib))]
-#[cfg(all(CONFIG_BUG, not(CONFIG_UML), not(CONFIG_LOONGARCH), not(CONFIG_ARM)))]
+#[cfg(all(
+    CONFIG_BUG,
+    not(CONFIG_UML),
+    not(CONFIG_LOONGARCH),
+    not(CONFIG_ARM),
+    not(CONFIG_PPC)
+))]
 #[cfg(not(CONFIG_DEBUG_BUGVERBOSE))]
 macro_rules! warn_flags {
     ($file:expr, $flags:expr) => {
@@ -106,7 +118,7 @@ macro_rules! warn_flags {
 #[macro_export]
 #[doc(hidden)]
 #[cfg(not(testlib))]
-#[cfg(all(CONFIG_BUG, any(CONFIG_LOONGARCH, CONFIG_ARM)))]
+#[cfg(all(CONFIG_BUG, any(CONFIG_LOONGARCH, CONFIG_ARM, CONFIG_PPC)))]
 macro_rules! warn_flags {
     ($file:expr, $flags:expr) => {
         if false {

base-commit: 82d8023ec40420ed61d7a96a173ef862741f1753
-- 
2.43.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-02  4:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02  4:49 [PATCH v1] rust: bug: use the WARN_ON() helper on powerpc FUJITA Tomonori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox