Skip to contentSkip to conversation

Rust Support for powerpc

PATCH Applied Mukesh Kumar Chaurasiya (IBM) 7 participants 24 messages Jul 8 – Aug 17

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v17 cover Rust Support for powerpc

Enable experimental rust support for ppc64le and ppc32be. The patch for ppc32 has been provided by Link Mauve[1] and ppc64le support[2] has been merged over it. ppc32 needs some toolchain fixes mentioned in the patch rust: Add PowerPC support and the discussion for that is done here[1].

This has been tested on
- powernv9 hardware
- pseries P11 hardware
- pseries(9, 10) qemu
- powernv(9, 10) qemu
- rustdoc on x86 and powerpc64le
- rusttest on x86 and powerpc64le

We are actively working with our LLVM team to get the target for ppc, ppc64 and ppc64le in the rust compiler.

[1] https://lore.kernel.org/all/[email protected]
[2] https://lore.kernel.org/all/[email protected]

Changelog:
V16 -> V17:
- Rebased to latest v7.2-rc2

V15 -> V16:
- Rebased to latest v7.1-rc4
V15: https://lore.kernel.org/all/[email protected]/

V14 -> V15:
- Fix an issue with rustdoc build on ppc64le
V14: https://lore.kernel.org/all/[email protected]/

V13 -> V14:
- 2nd patch is rewritten (Christian)
- Fixed a small typo in rust/Makefile (Sashiko)
- Fixed commit message in Patch 4 (Sashiko)
V13: https://lore.kernel.org/all/[email protected]/

V12 -> V13:
- Added a patch for fixing build issue on ppc32 by Link Mauve
- Added another patch to fix a build issue in dma-buf
- Added another patch to enforce minimum rustc version for powerpc
V12: https://lore.kernel.org/all/[email protected]/

V11 -> V12:
- Rebased to mainline (rust/Makefile conflict resolved)
V11: https://lore.kernel.org/all/[email protected]/

V10 -> V11:
- Updated rust/Makefile
- Not all libraries are move to rust/host directory now. Only proc_macro2, quote and syn are moved
- Special handling for pin init is added. Details in commit
- Removed mkdir for rust/host, this is now handled by toolchain.
V10: https://lore.kernel.org/all/[email protected]/

V9 -> V10:
- rust/Makefile updated with review comments from Miguel
- Patch 1/4 updated with commit message and subject
V9: https://lore.kernel.org/all/[email protected]/

V8 -> V9:
- rust/Makefile updated with a directory instead of abspath
V8: https://lore.kernel.org/all/[email protected]/

V7 -> V8:
- rust/Makefile updated to separate host libraries from target
V7: https://lore.kernel.org/all/[email protected]/

Changelog:
V6 -> V7:
- Documentation removed as powerpc is still under development
- Added a fix for race condition in rust/Makefile
V6: https://lore.kernel.org/all/[email protected]

V5 -> V6:
- Added a missing Tested by from Venkat which got missed since V3
- Support is marked as Maintained instead of experimental
V5: https://lore.kernel.org/all/[email protected]

V4 -> V5:
- Removed a nested ifdef from PPC64 for Little endian toolchain
V4: https://lore.kernel.org/all/[email protected]

V3 -> V4:
- Co-developed-by header added in patch 1
V3: https://lore.kernel.org/all/[email protected]

V2 -> V3:
- Splited HAVE_RUST in 2 lines
- BINDGEN_TARGET_powerpc initialized before assigning the same to BINDGEN_TARGET
V2: https://lore.kernel.org/all/[email protected]

V1 -> V2:
- jump label fix for rust has been moved to a separate patch
- PPC32 support has been taken
- rust support has been marked experimental
- target.json dependency has been removed
- HAVE_RUST now depends on CPU_LITTLE_ENDIAN for PPC64
V1: https://lore.kernel.org/all/[email protected]

Link Mauve (2):
rust: Make __udivdi3() and __umoddi3() panic
rust: Add PowerPC support

Mukesh Kumar Chaurasiya (IBM) (5):
rust: Fix "multiple candidates for rmeta dependency core" error
dma-resv: Fix undefined symbol when CONFIG_DMA_SHARED_BUFFER is
disabled
powerpc/jump_label: adjust inline asm to be consistent rust/powerpc: Set min rustc version for powerpc
powerpc: Enable Rust for ppc64le

 arch/powerpc/Kconfig                  |  2 +
 arch/powerpc/Makefile                 |  7 ++++
 arch/powerpc/include/asm/jump_label.h | 23 ++++++-----
 rust/Makefile                         | 56 +++++++++++++++++----------
 rust/compiler_builtins.rs             |  6 +++
 rust/helpers/helpers.c                |  2 +
 scripts/min-tool-version.sh           |  2 +
 7 files changed, 68 insertions(+), 30 deletions(-)
Signature · 1 line
2.55.0
#1 lore raw

PATCH v17 1/7 rust: Fix "multiple candidates for rmeta dependency core" error

When building Rust code for powerpc64le with LLVM=1 and -j1, rustc encounters an error: "multiple candidates for rmeta dependency core found", with two candidates:
1. The host's standard library from the rustup toolchain
2. The kernel's custom libcore.rmeta in the rust/ directory

This occurs because the build system uses -L$(objtree)/rust for host library builds (proc_macro2, quote, syn), which causes rustc to search the rust/ directory. During this search, rustc finds both the kernel's custom libcore.rmeta and gains access to the host's standard library, creating a conflict.

The solution is to separate host libraries into a dedicated rust/host/ subdirectory and use -L$(objtree)/rust/host for host builds instead of -L$(objtree)/rust. This ensures that:

1. Host library builds (proc_macro2, quote, syn) only search rust/host/ and never encounter the kernel's libcore.rmeta
2. Proc macro builds use -L$(objtree)/rust/host to find their dependencies

Special handling is added for rustdoc-pin_init, which is a host build (to access the alloc crate) but depends on proc macros from the main rust/ directory. It uses explicit --extern paths to reference the proc macros without adding -L$(objtree)/rust, which would reintroduce the conflict.

The rust/host/ directory is added to clean-files to ensure it's removed during make clean.

---
 rust/Makefile | 42 +++++++++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 19 deletions(-)
rust/Makefile +23 -19
index a870d1616c71..17b2f329c13d 100644
@@ -3,6 +3,9 @@
 # Where to place rustdoc generated documentation
 rustdoc_output := $(objtree)/Documentation/output/rust/rustdoc
 
+# Clean generated host directory
+clean-files := host/
+
 obj-$(CONFIG_RUST) += core.o compiler_builtins.o ffi.o
 always-$(CONFIG_RUST) += exports_core_generated.h
 
@@ -33,7 +36,7 @@ endif
 
 obj-$(CONFIG_RUST) += exports.o
 
-always-$(CONFIG_RUST) += libproc_macro2.rlib libquote.rlib libsyn.rlib
+always-$(CONFIG_RUST) += host/libproc_macro2.rlib host/libquote.rlib host/libsyn.rlib
 
 always-$(CONFIG_RUST_KERNEL_DOCTESTS) += doctests_kernel_generated.rs
 always-$(CONFIG_RUST_KERNEL_DOCTESTS) += doctests_kernel_generated_kunit.c
@@ -163,7 +166,7 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $<
 	$(rustc_target_envs) \
 	OBJTREE=$(abspath $(objtree)) \
 	$(RUSTDOC) $(filter-out $(skip_flags) --remap-path-scope=%,$(if $(rustdoc_host),$(rust_common_flags),$(rust_flags))) \
-		$(rustc_target_flags) -L$(objtree)/$(obj) \
+		$(rustc_target_flags) -L$(objtree)/$(obj)$(if $(rustdoc_host),/host) \
 		-Zunstable-options --generate-link-to-definition \
 		--output $(rustdoc_output) \
 		--crate-name $(subst rustdoc-,,$@) \
@@ -261,6 +264,7 @@ rustdoc-pin_init_internal: $(src)/pin-init/internal/src/lib.rs \
 
 rustdoc-pin_init: private rustdoc_host = yes
 rustdoc-pin_init: private rustc_target_flags = $(pin_init-flags) \
+    --extern pin_init_internal=$(objtree)/$(obj)/$(libpin_init_internal_name) \
     --extern alloc --cfg feature=\"alloc\"
 rustdoc-pin_init: $(src)/pin-init/src/lib.rs rustdoc-pin_init_internal \
     rustdoc-macros FORCE
@@ -572,23 +576,23 @@ quiet_cmd_rustc_procmacrolibrary = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_Q
 	$(if $(skip_clippy),$(RUSTC),$(RUSTC_OR_CLIPPY)) \
 		$(filter-out $(skip_flags),$(rust_common_flags) $(rustc_target_flags)) \
 		--emit=dep-info=$(depfile) --emit=link=$@ --crate-type rlib -O \
-		--out-dir $(objtree)/$(obj) -L$(objtree)/$(obj) \
+		--out-dir $(objtree)/$(obj)/host -L$(objtree)/$(obj)/host \
 		--crate-name $(patsubst lib%.rlib,%,$(notdir $@)) $<
 
-$(obj)/libproc_macro2.rlib: private skip_clippy = 1
-$(obj)/libproc_macro2.rlib: private rustc_target_flags = $(proc_macro2-flags)
-$(obj)/libproc_macro2.rlib: $(src)/proc-macro2/lib.rs FORCE
+$(obj)/host/libproc_macro2.rlib: private skip_clippy = 1
+$(obj)/host/libproc_macro2.rlib: private rustc_target_flags = $(proc_macro2-flags)
+$(obj)/host/libproc_macro2.rlib: $(src)/proc-macro2/lib.rs FORCE
 	+$(call if_changed_dep,rustc_procmacrolibrary)
 
-$(obj)/libquote.rlib: private skip_clippy = 1
-$(obj)/libquote.rlib: private skip_flags = $(quote-skip_flags)
-$(obj)/libquote.rlib: private rustc_target_flags = $(quote-flags)
-$(obj)/libquote.rlib: $(src)/quote/lib.rs $(obj)/libproc_macro2.rlib FORCE
+$(obj)/host/libquote.rlib: private skip_clippy = 1
+$(obj)/host/libquote.rlib: private skip_flags = $(quote-skip_flags)
+$(obj)/host/libquote.rlib: private rustc_target_flags = $(quote-flags)
+$(obj)/host/libquote.rlib: $(src)/quote/lib.rs $(obj)/host/libproc_macro2.rlib FORCE
 	+$(call if_changed_dep,rustc_procmacrolibrary)
 
-$(obj)/libsyn.rlib: private skip_clippy = 1
-$(obj)/libsyn.rlib: private rustc_target_flags = $(syn-flags)
-$(obj)/libsyn.rlib: $(src)/syn/lib.rs $(obj)/libquote.rlib FORCE
+$(obj)/host/libsyn.rlib: private skip_clippy = 1
+$(obj)/host/libsyn.rlib: private rustc_target_flags = $(syn-flags)
+$(obj)/host/libsyn.rlib: $(src)/syn/lib.rs $(obj)/host/libquote.rlib FORCE
 	+$(call if_changed_dep,rustc_procmacrolibrary)
 
 quiet_cmd_rustc_procmacro = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) P $@
@@ -598,26 +602,26 @@ quiet_cmd_rustc_procmacro = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET))
 		-Clinker-flavor=gcc -Clinker=$(HOSTCC) \
 		-Clink-args='$(call escsq,$(KBUILD_PROCMACROLDFLAGS))' \
 		--emit=dep-info=$(depfile) --emit=link=$@ --extern proc_macro \
-		--crate-type proc-macro -L$(objtree)/$(obj) \
+		--crate-type proc-macro -L$(objtree)/$(obj)/host \
 		--crate-name $(patsubst lib%.$(procmacro-extension),%,$(notdir $@)) \
 		@$(objtree)/include/generated/rustc_cfg $<
 
 # Procedural macros can only be used with the `rustc` that compiled it.
 $(obj)/$(libzerocopy_derive_name): private skip_clippy = 1
 $(obj)/$(libzerocopy_derive_name): private rustc_target_flags = $(zerocopy_derive-flags)
-$(obj)/$(libzerocopy_derive_name): $(src)/zerocopy-derive/lib.rs $(obj)/libproc_macro2.rlib \
-    $(obj)/libquote.rlib $(obj)/libsyn.rlib FORCE
+$(obj)/$(libzerocopy_derive_name): $(src)/zerocopy-derive/lib.rs $(obj)/host/libproc_macro2.rlib \
+    $(obj)/host/libquote.rlib $(obj)/host/libsyn.rlib FORCE
 	+$(call if_changed_dep,rustc_procmacro)
 
 $(obj)/$(libmacros_name): private rustc_target_flags = \
     --extern proc_macro2 --extern quote --extern syn
-$(obj)/$(libmacros_name): $(src)/macros/lib.rs $(obj)/libproc_macro2.rlib \
-    $(obj)/libquote.rlib $(obj)/libsyn.rlib FORCE
+$(obj)/$(libmacros_name): $(src)/macros/lib.rs $(obj)/host/libproc_macro2.rlib \
+    $(obj)/host/libquote.rlib $(obj)/host/libsyn.rlib FORCE
 	+$(call if_changed_dep,rustc_procmacro)
 
 $(obj)/$(libpin_init_internal_name): private rustc_target_flags = $(pin_init_internal-flags)
 $(obj)/$(libpin_init_internal_name): $(src)/pin-init/internal/src/lib.rs \
-    $(obj)/libproc_macro2.rlib $(obj)/libquote.rlib $(obj)/libsyn.rlib FORCE
+    $(obj)/host/libproc_macro2.rlib $(obj)/host/libquote.rlib $(obj)/host/libsyn.rlib FORCE
 	+$(call if_changed_dep,rustc_procmacro)
 
 # `rustc` requires `-Zunstable-options` to use custom target specifications
Signature · 1 line
2.55.0
#2 lore raw

PATCH v17 2/7 dma-resv: Fix undefined symbol when CONFIG_DMA_SHARED_BUFFER is disabled

In reply to Mukesh Kumar Chaurasiya (IBM)

When building with LLVM=1 for architectures like powerpc where CONFIG_DMA_SHARED_BUFFER is not enabled, the build fails with:

ld.lld: error: undefined symbol: dma_resv_reset_max_fences

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

referenced by helpers.c
rust/helpers/helpers.o:(rust_helper_dma_resv_unlock)

The issue occurs because:
1. CONFIG_DEBUG_MUTEXES=y is enabled
2. CONFIG_DMA_SHARED_BUFFER is not enabled
3. dma_resv_reset_max_fences() is declared in the header when CONFIG_DEBUG_MUTEXES is set
4. But the function is only compiled in drivers/dma-buf/dma-resv.c, which is only built when CONFIG_DMA_SHARED_BUFFER is enabled
5. Rust helpers call dma_resv_unlock() which calls dma_resv_reset_max_fences(), causing an undefined symbol

Fix this by compiling dma-resv.c file only when CONFIG_DMA_SHARED_BUFFER is enabled.

Fixes 9b836641d3bf ("rust: helpers: Add bindings/wrappers for dma_resv_lock")
---
 rust/helpers/helpers.c | 2 ++
 1 file changed, 2 insertions(+)
rust/helpers/helpers.c +2 -0
index 998e31052e66..4b90a1390ad5 100644
@@ -58,7 +58,9 @@
 #include "cred.c"
 #include "device.c"
 #include "dma.c"
+#ifdef CONFIG_DMA_SHARED_BUFFER
 #include "dma-resv.c"
+#endif
 #include "drm.c"
 #include "drm_gpuvm.c"
 #include "err.c"
Signature · 1 line
2.55.0
#3 lore raw

Re: [PATCH V17 2/7] dma-resv: Fix undefined symbol when CONFIG_DMA_SHARED_BUFFER is disabled

Quoted 18 lines · Mukesh Kumar Chaurasiya (IBM)

When building with LLVM=1 for architectures like powerpc where CONFIG_DMA_SHARED_BUFFER is not enabled, the build fails with:

ld.lld: error: undefined symbol: dma_resv_reset_max_fences

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

referenced by helpers.c
rust/helpers/helpers.o:(rust_helper_dma_resv_unlock)

The issue occurs because:
1. CONFIG_DEBUG_MUTEXES=y is enabled
2. CONFIG_DMA_SHARED_BUFFER is not enabled
3. dma_resv_reset_max_fences() is declared in the header when CONFIG_DEBUG_MUTEXES is set
4. But the function is only compiled in drivers/dma-buf/dma-resv.c, which is only built when CONFIG_DMA_SHARED_BUFFER is enabled
5. Rust helpers call dma_resv_unlock() which calls dma_resv_reset_max_fences(), causing an undefined symbol

Quoted 7 lines

Fix this by compiling dma-resv.c file only when CONFIG_DMA_SHARED_BUFFER is enabled.

Fixes 9b836641d3bf ("rust: helpers: Add bindings/wrappers for dma_resv_lock")

Andreas sent a similar one to:

https://lore.kernel.org/rust-for-linux/[email protected]/

This is earlier, but please see his approach & Sashiko's note.

Backlinking here for reference.

Cheers,
Miguel

#4 lore raw

PATCH v17 3/7 powerpc/jump_label: adjust inline asm to be consistent

In reply to Mukesh Kumar Chaurasiya (IBM)

Added support for a new macro ARCH_STATIC_BRANCH_ASM in powerpc
to avoid duplication of inline asm between C and Rust. This is
inline with 'commit aecaf181651c ("jump_label: adjust inline asm to be consistent")'

---
 arch/powerpc/include/asm/jump_label.h | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
arch/powerpc/include/asm/jump_label.h +13 -10
index d4eaba459a0e..3016e9c8d6bc 100644
@@ -15,14 +15,20 @@
 #define JUMP_ENTRY_TYPE		stringify_in_c(FTR_ENTRY_LONG)
 #define JUMP_LABEL_NOP_SIZE	4
 
+#define JUMP_TABLE_ENTRY(key, label)			\
+	".pushsection __jump_table,  \"aw\"	\n\t"	\
+	".long 1b - ., " label " - .		\n\t"	\
+	JUMP_ENTRY_TYPE key " - .		\n\t"	\
+	".popsection 				\n\t"
+
+#define ARCH_STATIC_BRANCH_ASM(key, label)		\
+	"1:	nop				\n\t"	\
+	JUMP_TABLE_ENTRY(key, label)
+
 static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
 {
-	asm goto("1:\n\t"
-		 "nop # arch_static_branch\n\t"
-		 ".pushsection __jump_table,  \"aw\"\n\t"
-		 ".long 1b - ., %l[l_yes] - .\n\t"
-		 JUMP_ENTRY_TYPE "%c0 - .\n\t"
-		 ".popsection \n\t"
+	asm goto(
+		 ARCH_STATIC_BRANCH_ASM("%c0", "%l[l_yes]")
 		 : :  "i" (&((char *)key)[branch]) : : l_yes);
 
 	return false;
@@ -34,10 +40,7 @@ static __always_inline bool arch_static_branch_jump(struct static_key *key, bool
 {
 	asm goto("1:\n\t"
 		 "b %l[l_yes] # arch_static_branch_jump\n\t"
-		 ".pushsection __jump_table,  \"aw\"\n\t"
-		 ".long 1b - ., %l[l_yes] - .\n\t"
-		 JUMP_ENTRY_TYPE "%c0 - .\n\t"
-		 ".popsection \n\t"
+		 JUMP_TABLE_ENTRY("%c0", "%l[l_yes]")
 		 : :  "i" (&((char *)key)[branch]) : : l_yes);
 
 	return false;
Signature · 1 line
2.55.0
#5 lore raw

PATCH v17 4/7 rust/powerpc: Set min rustc version for powerpc

In reply to Mukesh Kumar Chaurasiya (IBM)

Minimum rustc version required for powerpc is 1.95 as some critical features required for compiling rust code for kernel are not there.

For example Stable inline asm support which got merged in 1.95.

---
 scripts/min-tool-version.sh | 2 ++
 1 file changed, 2 insertions(+)
scripts/min-tool-version.sh +2 -0
index 031f2192b390..99bfdcaa3396 100755
@@ -33,6 +33,8 @@ llvm)
 rustc)
 	if [ "$SRCARCH" = "s390" ]; then
 		echo 1.96.0
+	elif [ "$ARCH" = powerpc ]; then
+		echo 1.95.0
 	else
 		echo 1.85.0
 	fi
Signature · 1 line
2.55.0
#6 lore raw

Re: [PATCH V17 4/7] rust/powerpc: Set min rustc version for powerpc

Hi,

Quoted 4 lines · Mukesh Kumar Chaurasiya (IBM)

Minimum rustc version required for powerpc is 1.95 as some critical features required for compiling rust code for kernel are not there.

For example Stable inline asm support which got merged in 1.95.

Didn’t we decide on 1.85.0 with the asm_experimental_arch feature instead? And possibly on 64-bit 1.87.0 if it isn’t possible to disable altivec correctly there?

Quoted 24 lines
---
 scripts/min-tool-version.sh | 2 ++
 1 file changed, 2 insertions(+)
scripts/min-tool-version.sh +2 -0
index 031f2192b390..99bfdcaa3396 100755
@@ -33,6 +33,8 @@ llvm)
 rustc)
 	if [ "$SRCARCH" = "s390" ]; then
 		echo 1.96.0
+	elif [ "$ARCH" = powerpc ]; then
+		echo 1.95.0
 	else
 		echo 1.85.0
 	fi
Signature · 1 line
2.55.0
Signature · 1 line
Link Mauve
#7 lore raw

Re: [PATCH V17 4/7] rust/powerpc: Set min rustc version for powerpc

Quoted 12 lines · Link Mauve

Hi,

Quoted 4 lines · Mukesh Kumar Chaurasiya (IBM)

Minimum rustc version required for powerpc is 1.95 as some critical features required for compiling rust code for kernel are not there.

For example Stable inline asm support which got merged in 1.95.

Didn’t we decide on 1.85.0 with the asm_experimental_arch feature instead? And possibly on 64-bit 1.87.0 if it isn’t possible to disable altivec correctly there?

1.85.0 or 1.85.1 is not feasible for ppc64le.
PPC maintainer is ok with 1.95 for PPC. It's still experimental for PPC.

Regards,
Mukesh

Quoted 27 lines
Quoted 24 lines
---
 scripts/min-tool-version.sh | 2 ++
 1 file changed, 2 insertions(+)
scripts/min-tool-version.sh +2 -0
index 031f2192b390..99bfdcaa3396 100755
@@ -33,6 +33,8 @@ llvm)
 rustc)
 	if [ "$SRCARCH" = "s390" ]; then
 		echo 1.96.0
+	elif [ "$ARCH" = powerpc ]; then
+		echo 1.95.0
 	else
 		echo 1.85.0
 	fi
Signature · 1 line
2.55.0
Signature · 1 line
Link Mauve
#8 lore raw

PATCH v17 5/7 rust: Make __udivdi3() and __umoddi3() panic

In reply to Mukesh Kumar Chaurasiya (IBM)

From: Link Mauve <[email protected]>

The core crate currently depends on these two functions for i64/u64/ i128/u128/core::time::Duration formatting, but we shouldn’t use that in the kernel so let’s panic if they are ever called.

This doesn’t yet fix drm_panic_qr.rs, which also uses __udivdi3 when CONFIG_CC_OPTIMIZE_FOR_SIZE=y, but at least makes the rest of the kernel build on PPC32.

---
 rust/Makefile             | 4 ++++
 rust/compiler_builtins.rs | 6 ++++++
 2 files changed, 10 insertions(+)
rust/Makefile +4 -0
index 17b2f329c13d..7aa8fcad4c43 100644
@@ -677,6 +677,10 @@ ifneq ($(or $(CONFIG_ARM64),$(and $(CONFIG_RISCV),$(CONFIG_64BIT))),)
 		__ashrti3 \
 		__ashlti3 __lshrti3
 endif
+ifdef CONFIG_PPC32
+	redirect-intrinsics += \
+		__udivdi3 __umoddi3
+endif
 
 ifdef CONFIG_MODVERSIONS
 cmd_gendwarfksyms = $(if $(skip_gendwarfksyms),, \
rust/compiler_builtins.rs +6 -0
index dd16c1dc899c..fc6b54636dd5 100644
@@ -97,5 +97,11 @@ pub extern "C" fn $ident() {
     __aeabi_uldivmod,
 });
 
+#[cfg(target_arch = "powerpc")]
+define_panicking_intrinsics!("`u64` division/modulo should not be used", {
+    __udivdi3,
+    __umoddi3,
+});
+
 // NOTE: if you are adding a new intrinsic here, you should also add it to
 // `redirect-intrinsics` in `rust/Makefile`.
Signature · 1 line
2.55.0
#9 lore raw

PATCH v17 6/7 rust: Add PowerPC support

In reply to Mukesh Kumar Chaurasiya (IBM)

From: Link Mauve <[email protected]>

For now only Big Endian 32-bit PowerPC is supported, as that is the only hardware I have. This has been tested on the Nintendo Wii so far, but I plan on also using it on the GameCube, Wii U and Apple G4.

These changes aren’t the only ones required to get the kernel to compile and link on PowerPC, libcore will also have to be changed to not use integer division to format u64, u128 and core::time::Duration, otherwise __udivdi3() and __umoddi3() will have to be added. I have tested this change by replacing the three implementations with unimplemented!() and it linked just fine.

---
 arch/powerpc/Kconfig  | 1 +
 arch/powerpc/Makefile | 2 ++
 rust/Makefile         | 4 +++-
 3 files changed, 6 insertions(+), 1 deletion(-)
arch/powerpc/Kconfig +1 -0
index f7ce5fff81f0..badd7c99b87f 100644
@@ -285,6 +285,7 @@ config PPC
 	select HAVE_REGS_AND_STACK_ACCESS_API
 	select HAVE_RELIABLE_STACKTRACE
 	select HAVE_RSEQ
+	select HAVE_RUST			if PPC32
 	select HAVE_SAMPLE_FTRACE_DIRECT	if HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
 	select HAVE_SAMPLE_FTRACE_DIRECT_MULTI	if HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
 	select HAVE_SETUP_PER_CPU_AREA		if PPC64
arch/powerpc/Makefile +2 -0
index a58b1029592c..589613eaa5dc 100644
@@ -61,6 +61,8 @@ else
 KBUILD_LDFLAGS_MODULE += $(objtree)/arch/powerpc/lib/crtsavres.o
 endif
 
+KBUILD_RUSTFLAGS 	+= --target=powerpc-unknown-linux-gnu
+
 ifdef CONFIG_CPU_LITTLE_ENDIAN
 KBUILD_CPPFLAGS	+= -mlittle-endian
 KBUILD_LDFLAGS	+= -EL
rust/Makefile +3 -1
index 7aa8fcad4c43..61e7dc496fe4 100644
@@ -448,7 +448,8 @@ bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \
 	-fstrict-flex-arrays=% -fmin-function-alignment=% \
 	-fzero-init-padding-bits=% -mno-fdpic \
 	-fdiagnostics-show-context -fdiagnostics-show-context=% \
-	--param=% --param asan-% -fno-isolate-erroneous-paths-dereference
+	--param=% --param asan-% -fno-isolate-erroneous-paths-dereference \
+	-ffixed-r2 -mmultiple -mno-readonly-in-sdata
 
 # Derived from `scripts/Makefile.clang`.
 BINDGEN_TARGET_x86	:= x86_64-linux-gnu
@@ -458,6 +459,7 @@ BINDGEN_TARGET_loongarch	:= loongarch64-linux-gnusf
 BINDGEN_TARGET_s390	:= s390x-linux-gnu
 # This is only for i386 UM builds, which need the 32-bit target not -m32
 BINDGEN_TARGET_i386	:= i386-linux-gnu
+BINDGEN_TARGET_powerpc	:= powerpc-linux-gnu
 BINDGEN_TARGET_um	:= $(BINDGEN_TARGET_$(SUBARCH))
 BINDGEN_TARGET		:= $(BINDGEN_TARGET_$(SRCARCH))
 
Signature · 1 line
2.55.0
#10 lore raw

PATCH v17 7/7 powerpc: Enable Rust for ppc64le

In reply to Mukesh Kumar Chaurasiya (IBM)

Enabling rust support for ppc64le.

Tested on pseries Power11:

╰─❯ dmesg | grep rust
[    0.225728] Initialise system trusted keyrings
[    0.270961] rust_minimal: Rust minimal sample (init)
[    0.270968] rust_minimal: Am I built-in? true
[    0.270974] rust_minimal: test_parameter: 1
[    0.270983] rust_misc_device: Initialising Rust Misc Device Sample
[    0.271012] rust_print: Rust printing macros sample (init)
[    0.271019] rust_print: Emergency message (level 0) without args
[    0.271023] rust_print: Alert message (level 1) without args
[    0.271026] rust_print: Critical message (level 2) without args
[    0.271030] rust_print: Error message (level 3) without args
[    0.271033] rust_print: Warning message (level 4) without args
[    0.271037] rust_print: Notice message (level 5) without args
[    0.271040] rust_print: Info message (level 6) without args
[    0.271043] rust_print: A line that is continued without args
[    0.271054] rust_print: Emergency message (level 0) with args
[    0.271064] rust_print: Alert message (level 1) with args
[    0.271072] rust_print: Critical message (level 2) with args
[    0.271077] rust_print: Error message (level 3) with args
[    0.271083] rust_print: Warning message (level 4) with args
[    0.271091] rust_print: Notice message (level 5) with args
[    0.271097] rust_print: Info message (level 6) with args
[    0.271102] rust_print: A line that is continued with args
[    0.271110] rust_print: 1
[    0.271113] rust_print: "hello, world"
[    0.271121] rust_print: [samples/rust/rust_print_main.rs:35:5] c = "hello, world"
[    0.271129] rust_print: Arc<dyn Display> says 42
[    0.271130] rust_print: Arc<dyn Display> says hello, world
[    0.271136] rust_print: "hello, world"
[    0.271198] usbcore: registered new interface driver rust_driver_usb
[    0.271207] rust_faux_driver: Initialising Rust Faux Device Sample
[    0.271227] faux_driver rust-faux-sample-device: Hello from faux device!
[    0.271297] rust_configfs: Rust configfs sample (init)
---
 arch/powerpc/Kconfig  | 1 +
 arch/powerpc/Makefile | 7 ++++++-
 rust/Makefile         | 6 ++++++
 3 files changed, 13 insertions(+), 1 deletion(-)
arch/powerpc/Kconfig +1 -0
index badd7c99b87f..650283107b92 100644
@@ -286,6 +286,7 @@ config PPC
 	select HAVE_RELIABLE_STACKTRACE
 	select HAVE_RSEQ
 	select HAVE_RUST			if PPC32
+	select HAVE_RUST			if PPC64 && CPU_LITTLE_ENDIAN
 	select HAVE_SAMPLE_FTRACE_DIRECT	if HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
 	select HAVE_SAMPLE_FTRACE_DIRECT_MULTI	if HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
 	select HAVE_SETUP_PER_CPU_AREA		if PPC64
arch/powerpc/Makefile +6 -1
index 589613eaa5dc..9385db478c59 100644
@@ -61,7 +61,12 @@ else
 KBUILD_LDFLAGS_MODULE += $(objtree)/arch/powerpc/lib/crtsavres.o
 endif
 
-KBUILD_RUSTFLAGS 	+= --target=powerpc-unknown-linux-gnu
+ifdef CONFIG_PPC64
+KBUILD_RUSTFLAGS	+= --target=powerpc64le-unknown-linux-gnu
+KBUILD_RUSTFLAGS	+= -Ctarget-feature=-mma,-vsx,-hard-float,-altivec
+else
+KBUILD_RUSTFLAGS	+= --target=powerpc-unknown-linux-gnu
+endif
 
 ifdef CONFIG_CPU_LITTLE_ENDIAN
 KBUILD_CPPFLAGS	+= -mlittle-endian
rust/Makefile +6 -0
index 61e7dc496fe4..d2f74998d3c1 100644
@@ -459,7 +459,13 @@ BINDGEN_TARGET_loongarch	:= loongarch64-linux-gnusf
 BINDGEN_TARGET_s390	:= s390x-linux-gnu
 # This is only for i386 UM builds, which need the 32-bit target not -m32
 BINDGEN_TARGET_i386	:= i386-linux-gnu
+
+ifdef CONFIG_PPC64
+BINDGEN_TARGET_powerpc	:= powerpc64le-linux-gnu
+else
 BINDGEN_TARGET_powerpc	:= powerpc-linux-gnu
+endif
+
 BINDGEN_TARGET_um	:= $(BINDGEN_TARGET_$(SUBARCH))
 BINDGEN_TARGET		:= $(BINDGEN_TARGET_$(SRCARCH))
 
Signature · 1 line
2.55.0
maintainer Applied
#11 lore raw
In reply to Mukesh Kumar Chaurasiya (IBM)
Quoted 13 lines · Mukesh Kumar Chaurasiya (IBM)

Enable experimental rust support for ppc64le and ppc32be. The patch for ppc32 has been provided by Link Mauve[1] and ppc64le support[2] has been merged over it. ppc32 needs some toolchain fixes mentioned in the patch rust: Add PowerPC support and the discussion for that is done here[1].

This has been tested on
- powernv9 hardware
- pseries P11 hardware
- pseries(9, 10) qemu
- powernv(9, 10) qemu
- rustdoc on x86 and powerpc64le
- rusttest on x86 and powerpc64le

Quoted 1 line

[...]

Applied to powerpc/next.

[1/7] rust: Fix "multiple candidates for rmeta dependency core" error

      https://git.kernel.org/powerpc/c/00cdfd072c709c608606461d7d44d4613119bfa9
[2/7] dma-resv: Fix undefined symbol when CONFIG_DMA_SHARED_BUFFER is disabled
      https://git.kernel.org/powerpc/c/be809b60cbb61aab96179f44ac3670242ae72996
[3/7] powerpc/jump_label: adjust inline asm to be consistent
      https://git.kernel.org/powerpc/c/13244c0a40139fe66c4c5c5655f4d732a6002957
[4/7] rust/powerpc: Set min rustc version for powerpc
      https://git.kernel.org/powerpc/c/e299147cdc8e19c6421a6b7863dc82a35b09d967
[5/7] rust: Make __udivdi3() and __umoddi3() panic
      https://git.kernel.org/powerpc/c/c93c194e4ee71a734986fd99a8b1ec9fbb7a9b8b
[6/7] rust: Add PowerPC support
      https://git.kernel.org/powerpc/c/73b741adb264967093ef4eb59905618a7e0d0de0
[7/7] powerpc: Enable Rust for ppc64le
      https://git.kernel.org/powerpc/c/bc87cbdb952e9223616b839d64bdb4723aa2ed1d

cheers

#12 lore raw

Hi,

Quoted 33 lines · Madhavan Srinivasan
Quoted 13 lines · Mukesh Kumar Chaurasiya (IBM)

Enable experimental rust support for ppc64le and ppc32be. The patch for ppc32 has been provided by Link Mauve[1] and ppc64le support[2] has been merged over it. ppc32 needs some toolchain fixes mentioned in the patch rust: Add PowerPC support and the discussion for that is done here[1].

This has been tested on
- powernv9 hardware
- pseries P11 hardware
- pseries(9, 10) qemu
- powernv(9, 10) qemu
- rustdoc on x86 and powerpc64le
- rusttest on x86 and powerpc64le

Quoted 1 line

[...]

Applied to powerpc/next.

[1/7] rust: Fix "multiple candidates for rmeta dependency core" error

      https://git.kernel.org/powerpc/c/00cdfd072c709c608606461d7d44d4613119bfa9
[2/7] dma-resv: Fix undefined symbol when CONFIG_DMA_SHARED_BUFFER is disabled
      https://git.kernel.org/powerpc/c/be809b60cbb61aab96179f44ac3670242ae72996
[3/7] powerpc/jump_label: adjust inline asm to be consistent
      https://git.kernel.org/powerpc/c/13244c0a40139fe66c4c5c5655f4d732a6002957
[4/7] rust/powerpc: Set min rustc version for powerpc
      https://git.kernel.org/powerpc/c/e299147cdc8e19c6421a6b7863dc82a35b09d967
[5/7] rust: Make __udivdi3() and __umoddi3() panic
      https://git.kernel.org/powerpc/c/c93c194e4ee71a734986fd99a8b1ec9fbb7a9b8b
[6/7] rust: Add PowerPC support
      https://git.kernel.org/powerpc/c/73b741adb264967093ef4eb59905618a7e0d0de0
[7/7] powerpc: Enable Rust for ppc64le
      https://git.kernel.org/powerpc/c/bc87cbdb952e9223616b839d64bdb4723aa2ed1d
Quoted 2 lines

cheers

I just tested those again in linux-next, with the Wii support series on top, but now the kernel fails to build due to ARCH_WARN_ASM and ARCH_WARN_REACHABLE not being defined on PowerPC:

```
error: no rules expected `ARCH_WARN_ASM`
   --> /home/linkmauve/dev/linux/wii/rust/kernel/generated_arch_warn_asm.rs:1:28
    |
  1 | ::kernel::concat_literals!(ARCH_WARN_ASM("{file}", "{line}", "{flags}", "{size}"))
    |                            ^^^^^^^^^^^^^ no rules expected this token in macro call
    |
   ::: ../rust/kernel/lib.rs:279:1
    |
279 | macro_rules! concat_literals {
    | ---------------------------- when calling this macro
    |
    = note: while trying to match sequence start

error: no rules expected `ARCH_WARN_REACHABLE`
   --> /home/linkmauve/dev/linux/wii/rust/kernel/generated_arch_reachable_asm.rs:1:28
    |
  1 | ::kernel::concat_literals!(ARCH_WARN_REACHABLE)
    |                            ^^^^^^^^^^^^^^^^^^^ no rules expected this token in macro call
    |
   ::: ../rust/kernel/lib.rs:279:1
    |
279 | macro_rules! concat_literals {
    | ---------------------------- when calling this macro
    |
    = note: while trying to match sequence start

error: aborting due to 2 previous errors
```

This is in addition to the bindings::kvfree_call_rcu() call, but that one is already being handled in a different thread.

Signature · 1 line
Link Mauve
#13 lore raw
Quoted 72 lines · On Tue, 4 Aug 2026 12:11:57 +0200 Link Mauve <[email protected]> wrote:

Hi,

Quoted 33 lines · Madhavan Srinivasan
Quoted 13 lines · Mukesh Kumar Chaurasiya (IBM)

Enable experimental rust support for ppc64le and ppc32be. The patch for ppc32 has been provided by Link Mauve[1] and ppc64le support[2] has been merged over it. ppc32 needs some toolchain fixes mentioned in the patch rust: Add PowerPC support and the discussion for that is done here[1].

This has been tested on
- powernv9 hardware
- pseries P11 hardware
- pseries(9, 10) qemu
- powernv(9, 10) qemu
- rustdoc on x86 and powerpc64le
- rusttest on x86 and powerpc64le

Quoted 1 line

[...]

Applied to powerpc/next.

[1/7] rust: Fix "multiple candidates for rmeta dependency core" error

      https://git.kernel.org/powerpc/c/00cdfd072c709c608606461d7d44d4613119bfa9
[2/7] dma-resv: Fix undefined symbol when CONFIG_DMA_SHARED_BUFFER is disabled
      https://git.kernel.org/powerpc/c/be809b60cbb61aab96179f44ac3670242ae72996
[3/7] powerpc/jump_label: adjust inline asm to be consistent
      https://git.kernel.org/powerpc/c/13244c0a40139fe66c4c5c5655f4d732a6002957
[4/7] rust/powerpc: Set min rustc version for powerpc
      https://git.kernel.org/powerpc/c/e299147cdc8e19c6421a6b7863dc82a35b09d967
[5/7] rust: Make __udivdi3() and __umoddi3() panic
      https://git.kernel.org/powerpc/c/c93c194e4ee71a734986fd99a8b1ec9fbb7a9b8b
[6/7] rust: Add PowerPC support
      https://git.kernel.org/powerpc/c/73b741adb264967093ef4eb59905618a7e0d0de0
[7/7] powerpc: Enable Rust for ppc64le
      https://git.kernel.org/powerpc/c/bc87cbdb952e9223616b839d64bdb4723aa2ed1d
Quoted 2 lines

cheers

I just tested those again in linux-next, with the Wii support series on top, but now the kernel fails to build due to ARCH_WARN_ASM and ARCH_WARN_REACHABLE not being defined on PowerPC:

```
error: no rules expected `ARCH_WARN_ASM`
   --> /home/linkmauve/dev/linux/wii/rust/kernel/generated_arch_warn_asm.rs:1:28
    |
  1 | ::kernel::concat_literals!(ARCH_WARN_ASM("{file}", "{line}", "{flags}", "{size}"))
    |                            ^^^^^^^^^^^^^ no rules expected this token in macro call
    |
   ::: ../rust/kernel/lib.rs:279:1
    |
279 | macro_rules! concat_literals {
    | ---------------------------- when calling this macro
    |
    = note: while trying to match sequence start

error: no rules expected `ARCH_WARN_REACHABLE`
   --> /home/linkmauve/dev/linux/wii/rust/kernel/generated_arch_reachable_asm.rs:1:28
    |
  1 | ::kernel::concat_literals!(ARCH_WARN_REACHABLE)
    |                            ^^^^^^^^^^^^^^^^^^^ no rules expected this token in macro call
    |
   ::: ../rust/kernel/lib.rs:279:1
    |
279 | macro_rules! concat_literals {
    | ---------------------------- when calling this macro
    |
    = note: while trying to match sequence start

error: aborting due to 2 previous errors
```
Quoted 2 lines

This is in addition to the bindings::kvfree_call_rcu() call, but that one is already being handled in a different thread.

Looks like powerpc needs something like the followings:

arch/powerpc/include/asm/bug.h +16 -12
index 0db48977c70c..8aba39e0cf26 100644
@@ -32,34 +32,38 @@
 #endif /* verbose */
 
 #else /* !__ASSEMBLER__ */
-/* _EMIT_BUG_ENTRY expects args %0,%1,%2,%3 to be FILE, LINE, flags and
-   sizeof(struct bug_entry), respectively */
 #ifdef CONFIG_DEBUG_BUGVERBOSE
-#define _EMIT_BUG_ENTRY				\
+#define _EMIT_BUG_ENTRY(file, line, flags)	\
 	".section __bug_table,\"aw\"\n"		\
 	"2:	.4byte 1b - .\n"		\
-	"	.4byte %0 - .\n"		\
-	"	.short %1, %2\n"		\
-	".org 2b+%3\n"				\
-	".previous\n"
+	"	.4byte " file " - .\n"		\
+	"	.short " line ", " flags "\n"
 #else
-#define _EMIT_BUG_ENTRY				\
+#define _EMIT_BUG_ENTRY(file, line, flags)	\
 	".section __bug_table,\"aw\"\n"		\
 	"2:	.4byte 1b - .\n"		\
-	"	.short %2\n"			\
-	".org 2b+%3\n"				\
-	".previous\n"
+	"	.short " flags "\n"
 #endif
 
 #define BUG_ENTRY(cond_str, insn, flags, ...)		\
 	__asm__ __volatile__(				\
 		"1:	" insn "\n"			\
-		_EMIT_BUG_ENTRY				\
+		_EMIT_BUG_ENTRY("%0", "%1", "%2")	\
+		".org 2b+%3\n"				\
+		".previous\n"				\
 		: : "i" (WARN_CONDITION_STR(cond_str) __FILE__), "i" (__LINE__),	\
 		  "i" (flags),				\
 		  "i" (sizeof(struct bug_entry)),	\
 		  ##__VA_ARGS__)
 
+#define ARCH_WARN_ASM(file, line, flags, size)		\
+		"1:	twi 31, 0, 0\n"			\
+		_EMIT_BUG_ENTRY(file, line, flags)	\
+		".org 2b+" size "\n"			\
+		".previous\n"
+
+#define ARCH_WARN_REACHABLE
+
 /*
  * BUG_ON() and WARN_ON() do their best to cooperate with compile-time
  * optimisations. However depending on the complexity of the condition
#14 lore raw
Quoted 125 lines · FUJITA Tomonori
Quoted 72 lines · On Tue, 4 Aug 2026 12:11:57 +0200 Link Mauve <[email protected]> wrote:

Hi,

Quoted 33 lines · Madhavan Srinivasan
Quoted 13 lines · Mukesh Kumar Chaurasiya (IBM)

Enable experimental rust support for ppc64le and ppc32be. The patch for ppc32 has been provided by Link Mauve[1] and ppc64le support[2] has been merged over it. ppc32 needs some toolchain fixes mentioned in the patch rust: Add PowerPC support and the discussion for that is done here[1].

This has been tested on
- powernv9 hardware
- pseries P11 hardware
- pseries(9, 10) qemu
- powernv(9, 10) qemu
- rustdoc on x86 and powerpc64le
- rusttest on x86 and powerpc64le

Quoted 1 line

[...]

Applied to powerpc/next.

[1/7] rust: Fix "multiple candidates for rmeta dependency core" error

      https://git.kernel.org/powerpc/c/00cdfd072c709c608606461d7d44d4613119bfa9
[2/7] dma-resv: Fix undefined symbol when CONFIG_DMA_SHARED_BUFFER is disabled
      https://git.kernel.org/powerpc/c/be809b60cbb61aab96179f44ac3670242ae72996
[3/7] powerpc/jump_label: adjust inline asm to be consistent
      https://git.kernel.org/powerpc/c/13244c0a40139fe66c4c5c5655f4d732a6002957
[4/7] rust/powerpc: Set min rustc version for powerpc
      https://git.kernel.org/powerpc/c/e299147cdc8e19c6421a6b7863dc82a35b09d967
[5/7] rust: Make __udivdi3() and __umoddi3() panic
      https://git.kernel.org/powerpc/c/c93c194e4ee71a734986fd99a8b1ec9fbb7a9b8b
[6/7] rust: Add PowerPC support
      https://git.kernel.org/powerpc/c/73b741adb264967093ef4eb59905618a7e0d0de0
[7/7] powerpc: Enable Rust for ppc64le
      https://git.kernel.org/powerpc/c/bc87cbdb952e9223616b839d64bdb4723aa2ed1d
Quoted 2 lines

cheers

I just tested those again in linux-next, with the Wii support series on top, but now the kernel fails to build due to ARCH_WARN_ASM and ARCH_WARN_REACHABLE not being defined on PowerPC:

```
error: no rules expected `ARCH_WARN_ASM`
   --> /home/linkmauve/dev/linux/wii/rust/kernel/generated_arch_warn_asm.rs:1:28
    |
  1 | ::kernel::concat_literals!(ARCH_WARN_ASM("{file}", "{line}", "{flags}", "{size}"))
    |                            ^^^^^^^^^^^^^ no rules expected this token in macro call
    |
   ::: ../rust/kernel/lib.rs:279:1
    |
279 | macro_rules! concat_literals {
    | ---------------------------- when calling this macro
    |
    = note: while trying to match sequence start

error: no rules expected `ARCH_WARN_REACHABLE`
   --> /home/linkmauve/dev/linux/wii/rust/kernel/generated_arch_reachable_asm.rs:1:28
    |
  1 | ::kernel::concat_literals!(ARCH_WARN_REACHABLE)
    |                            ^^^^^^^^^^^^^^^^^^^ no rules expected this token in macro call
    |
   ::: ../rust/kernel/lib.rs:279:1
    |
279 | macro_rules! concat_literals {
    | ---------------------------- when calling this macro
    |
    = note: while trying to match sequence start

error: aborting due to 2 previous errors
```
Quoted 2 lines

This is in addition to the bindings::kvfree_call_rcu() call, but that one is already being handled in a different thread.

Looks like powerpc needs something like the followings:

arch/powerpc/include/asm/bug.h +9 -12
index 0db48977c70c..8aba39e0cf26 100644
@@ -32,34 +32,38 @@
 #endif /* verbose */
 
 #else /* !__ASSEMBLER__ */
-/* _EMIT_BUG_ENTRY expects args %0,%1,%2,%3 to be FILE, LINE, flags and
-   sizeof(struct bug_entry), respectively */
 #ifdef CONFIG_DEBUG_BUGVERBOSE
-#define _EMIT_BUG_ENTRY				\
+#define _EMIT_BUG_ENTRY(file, line, flags)	\
 	".section __bug_table,\"aw\"\n"		\
 	"2:	.4byte 1b - .\n"		\
-	"	.4byte %0 - .\n"		\
-	"	.short %1, %2\n"		\
-	".org 2b+%3\n"				\
-	".previous\n"
+	"	.4byte " file " - .\n"		\
+	"	.short " line ", " flags "\n"
 #else
-#define _EMIT_BUG_ENTRY				\
+#define _EMIT_BUG_ENTRY(file, line, flags)	\
 	".section __bug_table,\"aw\"\n"		\
 	"2:	.4byte 1b - .\n"		\
-	"	.short %2\n"			\
-	".org 2b+%3\n"				\
-	".previous\n"
+	"	.short " flags "\n"
 #endif
 
 #define BUG_ENTRY(cond_str, insn, flags, ...)		\
 	__asm__ __volatile__(				\
 		"1:	" insn "\n"			\
-		_EMIT_BUG_ENTRY				\
+		_EMIT_BUG_ENTRY("%0", "%1", "%2")	\
+		".org 2b+%3\n"				\
+		".previous\n"				\
 		: : "i" (WARN_CONDITION_STR(cond_str) __FILE__), "i" (__LINE__),	\
 		  "i" (flags),				\
 		  "i" (sizeof(struct bug_entry)),	\
 		  ##__VA_ARGS__)
 
+#define ARCH_WARN_ASM(file, line, flags, size)		\

arch/powerpc/include/asm/bug.h line 69

Quoted 10 lines
arch/powerpc/include/asm/bug.h +7 -0
+		"1:	twi 31, 0, 0\n"			\
+		_EMIT_BUG_ENTRY(file, line, flags)	\
+		".org 2b+" size "\n"			\
+		".previous\n"
+
+#define ARCH_WARN_REACHABLE
+
 /*
  * BUG_ON() and WARN_ON() do their best to cooperate with compile-time
  * optimisations. However depending on the complexity of the condition

Yeah, This makes sense.

I'll work on this and send out a fix soon.

Thanks and Regards,
Mukesh

#15 lore raw

Hi Mukesh,

Quoted 96 lines · Mukesh Kumar Chaurasiya
Quoted 82 lines · FUJITA Tomonori
Quoted 24 lines · On Tue, 4 Aug 2026 12:11:57 +0200 Link Mauve <[email protected]> wrote:

I just tested those again in linux-next, with the Wii support series on top, but now the kernel fails to build due to ARCH_WARN_ASM and ARCH_WARN_REACHABLE not being defined on PowerPC:

```
error: no rules expected `ARCH_WARN_ASM`
   --> /home/linkmauve/dev/linux/wii/rust/kernel/generated_arch_warn_asm.rs:1:28
    |
  1 | ::kernel::concat_literals!(ARCH_WARN_ASM("{file}", "{line}", "{flags}", "{size}"))
    |                            ^^^^^^^^^^^^^ no rules expected this token in macro call
    |
   ::: ../rust/kernel/lib.rs:279:1
    |
279 | macro_rules! concat_literals {
    | ---------------------------- when calling this macro
    |
    = note: while trying to match sequence start

error: no rules expected `ARCH_WARN_REACHABLE`
   --> /home/linkmauve/dev/linux/wii/rust/kernel/generated_arch_reachable_asm.rs:1:28
    |
  1 | ::kernel::concat_literals!(ARCH_WARN_REACHABLE)
    |                            ^^^^^^^^^^^^^^^^^^^ no rules expected this token in macro call
    |
   ::: ../rust/kernel/lib.rs:279:1
Quoted 8 lines
    |
279 | macro_rules! concat_literals {
    | ---------------------------- when calling this macro
    |
    = note: while trying to match sequence start

error: aborting due to 2 previous errors
```

Looks like powerpc needs something like the followings:

arch/powerpc/include/asm/bug.h +9 -12
index 0db48977c70c..8aba39e0cf26 100644
@@ -32,34 +32,38 @@
 #endif /* verbose */
 
 #else /* !__ASSEMBLER__ */
-/* _EMIT_BUG_ENTRY expects args %0,%1,%2,%3 to be FILE, LINE, flags and
-   sizeof(struct bug_entry), respectively */
 #ifdef CONFIG_DEBUG_BUGVERBOSE
-#define _EMIT_BUG_ENTRY				\
+#define _EMIT_BUG_ENTRY(file, line, flags)	\
 	".section __bug_table,\"aw\"\n"		\
 	"2:	.4byte 1b - .\n"		\
-	"	.4byte %0 - .\n"		\
-	"	.short %1, %2\n"		\
-	".org 2b+%3\n"				\
-	".previous\n"
+	"	.4byte " file " - .\n"		\
+	"	.short " line ", " flags "\n"
 #else
-#define _EMIT_BUG_ENTRY				\
+#define _EMIT_BUG_ENTRY(file, line, flags)	\
 	".section __bug_table,\"aw\"\n"		\
 	"2:	.4byte 1b - .\n"		\
-	"	.short %2\n"			\
-	".org 2b+%3\n"				\
-	".previous\n"
+	"	.short " flags "\n"
 #endif
 
 #define BUG_ENTRY(cond_str, insn, flags, ...)		\
 	__asm__ __volatile__(				\
 		"1:	" insn "\n"			\
-		_EMIT_BUG_ENTRY				\
+		_EMIT_BUG_ENTRY("%0", "%1", "%2")	\
+		".org 2b+%3\n"				\
+		".previous\n"				\
 		: : "i" (WARN_CONDITION_STR(cond_str) __FILE__), "i" (__LINE__),	\
 		  "i" (flags),				\
 		  "i" (sizeof(struct bug_entry)),	\
 		  ##__VA_ARGS__)
 
+#define ARCH_WARN_ASM(file, line, flags, size)		\

arch/powerpc/include/asm/bug.h line 69

Quoted 10 lines
arch/powerpc/include/asm/bug.h +7 -0
+		"1:	twi 31, 0, 0\n"			\
+		_EMIT_BUG_ENTRY(file, line, flags)	\
+		".org 2b+" size "\n"			\
+		".previous\n"
+
+#define ARCH_WARN_REACHABLE
+
 /*
  * BUG_ON() and WARN_ON() do their best to cooperate with compile-time
  * optimisations. However depending on the complexity of the condition

Yeah, This makes sense.

Quoted 1 line

I'll work on this and send out a fix soon.

Did a fix for this ever materialize? I am still seeing the errors that Link posted above in next-20260817.

Signature · 2 lines
Cheers,
Nathan
#16 lore raw
In reply to FUJITA Tomonori

Le 04/08/2026 à 15:40, FUJITA Tomonori a écrit :

Quoted 121 lines

[Vous ne recevez pas souvent de courriers de [email protected]. D?couvrez pourquoi ceci est important ? https://aka.ms/LearnAboutSenderIdentification ]

Quoted 72 lines · On Tue, 4 Aug 2026 12:11:57 +0200 Link Mauve <[email protected]> wrote:

Hi,

Quoted 33 lines · Madhavan Srinivasan
Quoted 13 lines · Mukesh Kumar Chaurasiya (IBM)

Enable experimental rust support for ppc64le and ppc32be. The patch for ppc32 has been provided by Link Mauve[1] and ppc64le support[2] has been merged over it. ppc32 needs some toolchain fixes mentioned in the patch rust: Add PowerPC support and the discussion for that is done here[1].

This has been tested on
- powernv9 hardware
- pseries P11 hardware
- pseries(9, 10) qemu
- powernv(9, 10) qemu
- rustdoc on x86 and powerpc64le
- rusttest on x86 and powerpc64le

Quoted 1 line

[...]

Applied to powerpc/next.

[1/7] rust: Fix "multiple candidates for rmeta dependency core" error

       https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpowerpc%2Fc%2F00cdfd072c709c608606461d7d44d4613119bfa9&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C34e4deafcc1d41c1738a08def22e01b0%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639214476617198585%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=4qQe1qS37TGv6%2Bf9H56kWVqMYSAHsWiDx5oz8WHZ8%2Bg%3D&reserved=0
[2/7] dma-resv: Fix undefined symbol when CONFIG_DMA_SHARED_BUFFER is disabled
       https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpowerpc%2Fc%2Fbe809b60cbb61aab96179f44ac3670242ae72996&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C34e4deafcc1d41c1738a08def22e01b0%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639214476617235654%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=cw2l64D3ah%2FM3pxFmvMpUnNmcqcSvN3RFoDiYAIR76g%3D&reserved=0
[3/7] powerpc/jump_label: adjust inline asm to be consistent
       https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpowerpc%2Fc%2F13244c0a40139fe66c4c5c5655f4d732a6002957&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C34e4deafcc1d41c1738a08def22e01b0%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639214476617259593%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=xNvcH9k5RA5ktJupn90VdDuwx4YBvezuDcapqKlYfjs%3D&reserved=0
[4/7] rust/powerpc: Set min rustc version for powerpc
       https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpowerpc%2Fc%2Fe299147cdc8e19c6421a6b7863dc82a35b09d967&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C34e4deafcc1d41c1738a08def22e01b0%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639214476617280683%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=uNZA7AulROQGv%2B2l4M%2FqC5W4ncWktRoSRRp8eaF%2FcCY%3D&reserved=0
[5/7] rust: Make __udivdi3() and __umoddi3() panic
       https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpowerpc%2Fc%2Fc93c194e4ee71a734986fd99a8b1ec9fbb7a9b8b&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C34e4deafcc1d41c1738a08def22e01b0%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639214476617303292%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=znZPWXM7k5FpRlekIyUN1bHzmMyk1YESR56WsiwBuMA%3D&reserved=0
[6/7] rust: Add PowerPC support
       https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpowerpc%2Fc%2F73b741adb264967093ef4eb59905618a7e0d0de0&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C34e4deafcc1d41c1738a08def22e01b0%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639214476617326590%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=aFHGhd7RX%2Ft5%2BMjqt6pBmIKPKAKmFEQndKP1F%2F8HSxk%3D&reserved=0
[7/7] powerpc: Enable Rust for ppc64le
       https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpowerpc%2Fc%2Fbc87cbdb952e9223616b839d64bdb4723aa2ed1d&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C34e4deafcc1d41c1738a08def22e01b0%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639214476617346994%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=ITEFv9C1CSUVLqJNe5Y8sStUE3KoOVYVzSzbP0qis74%3D&reserved=0
Quoted 2 lines

cheers

I just tested those again in linux-next, with the Wii support series on top, but now the kernel fails to build due to ARCH_WARN_ASM and ARCH_WARN_REACHABLE not being defined on PowerPC:

```
error: no rules expected `ARCH_WARN_ASM`
    --> /home/linkmauve/dev/linux/wii/rust/kernel/generated_arch_warn_asm.rs:1:28
     |
   1 | ::kernel::concat_literals!(ARCH_WARN_ASM("{file}", "{line}", "{flags}", "{size}"))
     |                            ^^^^^^^^^^^^^ no rules expected this token in macro call
     |
    ::: ../rust/kernel/lib.rs:279:1
     |
279 | macro_rules! concat_literals {
     | ---------------------------- when calling this macro
     |
     = note: while trying to match sequence start

error: no rules expected `ARCH_WARN_REACHABLE`
    --> /home/linkmauve/dev/linux/wii/rust/kernel/generated_arch_reachable_asm.rs:1:28
     |
   1 | ::kernel::concat_literals!(ARCH_WARN_REACHABLE)
     |                            ^^^^^^^^^^^^^^^^^^^ no rules expected this token in macro call
     |
    ::: ../rust/kernel/lib.rs:279:1
     |
279 | macro_rules! concat_literals {
     | ---------------------------- when calling this macro
     |
     = note: while trying to match sequence start

error: aborting due to 2 previous errors
```
Quoted 2 lines

This is in addition to the bindings::kvfree_call_rcu() call, but that one is already being handled in a different thread.

Looks like powerpc needs something like the followings:

arch/powerpc/include/asm/bug.h +8 -12
index 0db48977c70c..8aba39e0cf26 100644
@@ -32,34 +32,38 @@
  #endif /* verbose */
 
  #else /* !__ASSEMBLER__ */
-/* _EMIT_BUG_ENTRY expects args %0,%1,%2,%3 to be FILE, LINE, flags and
-   sizeof(struct bug_entry), respectively */
  #ifdef CONFIG_DEBUG_BUGVERBOSE
-#define _EMIT_BUG_ENTRY                                \
+#define _EMIT_BUG_ENTRY(file, line, flags)     \
         ".section __bug_table,\"aw\"\n"         \
         "2:     .4byte 1b - .\n"                \
-       "       .4byte %0 - .\n"                \
-       "       .short %1, %2\n"                \
-       ".org 2b+%3\n"                          \
-       ".previous\n"
+       "       .4byte " file " - .\n"          \
+       "       .short " line ", " flags "\n"
  #else
-#define _EMIT_BUG_ENTRY                                \
+#define _EMIT_BUG_ENTRY(file, line, flags)     \
         ".section __bug_table,\"aw\"\n"         \
         "2:     .4byte 1b - .\n"                \
-       "       .short %2\n"                    \
-       ".org 2b+%3\n"                          \
-       ".previous\n"
+       "       .short " flags "\n"
  #endif
 
  #define BUG_ENTRY(cond_str, insn, flags, ...)          \
         __asm__ __volatile__(                           \
                 "1:     " insn "\n"                     \
-               _EMIT_BUG_ENTRY                         \
+               _EMIT_BUG_ENTRY("%0", "%1", "%2")       \
+               ".org 2b+%3\n"                          \
+               ".previous\n"                           \

arch/powerpc/include/asm/bug.h line 63

Quoted 10 lines
arch/powerpc/include/asm/bug.h +5 -0
                 : : "i" (WARN_CONDITION_STR(cond_str) __FILE__), "i" (__LINE__),        \
                   "i" (flags),                          \
                   "i" (sizeof(struct bug_entry)),       \
                   ##__VA_ARGS__)
 
+#define ARCH_WARN_ASM(file, line, flags, size)         \
+               "1:     twi 31, 0, 0\n"                 \
+               _EMIT_BUG_ENTRY(file, line, flags)      \
+               ".org 2b+" size "\n"                    \
+               ".previous\n"

Will this build ? Isn't ARCH_WARN_ASM() for use in ASM .S files ? _EMIT_BUG_ENTRY is defined in a !__ASSEMBLER__ ifdef.

powerpc already has EMIT_BUG_ENTRY macro for ASM for that. Why do you need to modify _EMIT_BUG_ENTRY and BUG_ENTRY() which are for C only (in a #ifdef !__ASSEMBLER__) ?

https://elixir.bootlin.com/linux/v7.2-rc5/source/arch/powerpc/include/asm/bug.h#L10

Christophe

#17 lore raw
Quoted 134 lines · On Wed, 5 Aug 2026 14:56:41 +0200 "Christophe Leroy (CS GROUP)"…

Le 04/08/2026 à 15:40, FUJITA Tomonori a écrit :

Quoted 131 lines

[Vous ne recevez pas souvent de courriers de [email protected]. D?couvrez pourquoi ceci est important ?
https://aka.ms/LearnAboutSenderIdentification ]

Quoted 80 lines · On Tue, 4 Aug 2026 12:11:57 +0200 Link Mauve <[email protected]> wrote:

Hi,

Quoted 39 lines · Madhavan Srinivasan
Quoted 17 lines · Mukesh Kumar Chaurasiya (IBM)

Enable experimental rust support for ppc64le and ppc32be. The patch for
ppc32 has been provided by Link Mauve[1] and ppc64le support[2] has been
merged over it. ppc32 needs some toolchain fixes mentioned in the patch
rust: Add PowerPC support and the discussion for that is done here[1].

This has been tested on
- powernv9 hardware
- pseries P11 hardware
- pseries(9, 10) qemu
- powernv(9, 10) qemu
- rustdoc on x86 and powerpc64le
- rusttest on x86 and powerpc64le

Quoted 1 line

[...]

Applied to powerpc/next.

[1/7] rust: Fix "multiple candidates for rmeta dependency core" error

       https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpowerpc%2Fc%2F00cdfd072c709c608606461d7d44d4613119bfa9&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C34e4deafcc1d41c1738a08def22e01b0%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639214476617198585%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=4qQe1qS37TGv6%2Bf9H56kWVqMYSAHsWiDx5oz8WHZ8%2Bg%3D&reserved=0
[2/7] dma-resv: Fix undefined symbol when CONFIG_DMA_SHARED_BUFFER is
disabled
       https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpowerpc%2Fc%2Fbe809b60cbb61aab96179f44ac3670242ae72996&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C34e4deafcc1d41c1738a08def22e01b0%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639214476617235654%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=cw2l64D3ah%2FM3pxFmvMpUnNmcqcSvN3RFoDiYAIR76g%3D&reserved=0
[3/7] powerpc/jump_label: adjust inline asm to be consistent
       https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpowerpc%2Fc%2F13244c0a40139fe66c4c5c5655f4d732a6002957&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C34e4deafcc1d41c1738a08def22e01b0%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639214476617259593%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=xNvcH9k5RA5ktJupn90VdDuwx4YBvezuDcapqKlYfjs%3D&reserved=0
[4/7] rust/powerpc: Set min rustc version for powerpc
       https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpowerpc%2Fc%2Fe299147cdc8e19c6421a6b7863dc82a35b09d967&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C34e4deafcc1d41c1738a08def22e01b0%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639214476617280683%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=uNZA7AulROQGv%2B2l4M%2FqC5W4ncWktRoSRRp8eaF%2FcCY%3D&reserved=0
[5/7] rust: Make __udivdi3() and __umoddi3() panic
       https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpowerpc%2Fc%2Fc93c194e4ee71a734986fd99a8b1ec9fbb7a9b8b&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C34e4deafcc1d41c1738a08def22e01b0%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639214476617303292%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=znZPWXM7k5FpRlekIyUN1bHzmMyk1YESR56WsiwBuMA%3D&reserved=0
[6/7] rust: Add PowerPC support
       https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpowerpc%2Fc%2F73b741adb264967093ef4eb59905618a7e0d0de0&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C34e4deafcc1d41c1738a08def22e01b0%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639214476617326590%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=aFHGhd7RX%2Ft5%2BMjqt6pBmIKPKAKmFEQndKP1F%2F8HSxk%3D&reserved=0
[7/7] powerpc: Enable Rust for ppc64le
       https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpowerpc%2Fc%2Fbc87cbdb952e9223616b839d64bdb4723aa2ed1d&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C34e4deafcc1d41c1738a08def22e01b0%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639214476617346994%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=ITEFv9C1CSUVLqJNe5Y8sStUE3KoOVYVzSzbP0qis74%3D&reserved=0
Quoted 2 lines

cheers

I just tested those again in linux-next, with the Wii support series on
top, but now the kernel fails to build due to ARCH_WARN_ASM and ARCH_WARN_REACHABLE not being defined on PowerPC:

```
error: no rules expected `ARCH_WARN_ASM`
    --> /home/linkmauve/dev/linux/wii/rust/kernel/generated_arch_warn_asm.rs:1:28
     |
   1 | ::kernel::concat_literals!(ARCH_WARN_ASM("{file}", "{line}",
   "{flags}", "{size}"))
     |                            ^^^^^^^^^^^^^ no rules expected this token in macro call
     |
    ::: ../rust/kernel/lib.rs:279:1
     |
279 | macro_rules! concat_literals {
     | ---------------------------- when calling this macro
     |
     = note: while trying to match sequence start

error: no rules expected `ARCH_WARN_REACHABLE`
    --> /home/linkmauve/dev/linux/wii/rust/kernel/generated_arch_reachable_asm.rs:1:28
     |
   1 | ::kernel::concat_literals!(ARCH_WARN_REACHABLE)
     |                            ^^^^^^^^^^^^^^^^^^^ no rules expected this token in macro call
     |
    ::: ../rust/kernel/lib.rs:279:1
     |
279 | macro_rules! concat_literals {
     | ---------------------------- when calling this macro
     |
     = note: while trying to match sequence start

error: aborting due to 2 previous errors
```
Quoted 2 lines

This is in addition to the bindings::kvfree_call_rcu() call, but that one is already being handled in a different thread.

Looks like powerpc needs something like the followings:

arch/powerpc/include/asm/bug.h +8 -13
index 0db48977c70c..8aba39e0cf26 100644
@@ -32,34 +32,38 @@
  #endif /* verbose */
  #else /* !__ASSEMBLER__ */
-/* _EMIT_BUG_ENTRY expects args %0,%1,%2,%3 to be FILE, LINE, flags
-and
-   sizeof(struct bug_entry), respectively */
  #ifdef CONFIG_DEBUG_BUGVERBOSE
-#define _EMIT_BUG_ENTRY                                \
+#define _EMIT_BUG_ENTRY(file, line, flags)     \
         ".section __bug_table,\"aw\"\n"         \
         "2:     .4byte 1b - .\n"                \
-       "       .4byte %0 - .\n"                \
-       "       .short %1, %2\n"                \
-       ".org 2b+%3\n"                          \
-       ".previous\n"
+       "       .4byte " file " - .\n"          \
+       "       .short " line ", " flags "\n"
  #else
-#define _EMIT_BUG_ENTRY                                \
+#define _EMIT_BUG_ENTRY(file, line, flags)     \
         ".section __bug_table,\"aw\"\n"         \
         "2:     .4byte 1b - .\n"                \
-       "       .short %2\n"                    \
-       ".org 2b+%3\n"                          \
-       ".previous\n"
+       "       .short " flags "\n"
  #endif
  #define BUG_ENTRY(cond_str, insn, flags, ...)          \
         __asm__ __volatile__(                           \
                 "1:     " insn "\n"                     \
-               _EMIT_BUG_ENTRY                         \
+               _EMIT_BUG_ENTRY("%0", "%1", "%2")       \
+               ".org 2b+%3\n"                          \
+               ".previous\n"                           \
                 : : "i" (WARN_CONDITION_STR(cond_str) __FILE__), "i" (__LINE__), \
                   "i" (flags),                          \
                   "i" (sizeof(struct bug_entry)),       \
Quoted 8 lines

arch/powerpc/include/asm/bug.h line 63

Quoted 6 lines
arch/powerpc/include/asm/bug.h +5 -0
                   ##__VA_ARGS__)
+#define ARCH_WARN_ASM(file, line, flags, size)         \
+               "1:     twi 31, 0, 0\n"                 \
+               _EMIT_BUG_ENTRY(file, line, flags)      \
+               ".org 2b+" size "\n"                    \
+               ".previous\n"

Will this build ? Isn't ARCH_WARN_ASM() for use in ASM .S files ?

No. It's used by Rust code; the C preprocessor uses ARCH_WARN_ASM() to generate the code for Rust inline assembly.

#18 lore raw
In reply to Link Mauve
Quoted 36 lines · Link Mauve

Hi,

Quoted 33 lines · Madhavan Srinivasan
Quoted 13 lines · Mukesh Kumar Chaurasiya (IBM)

Enable experimental rust support for ppc64le and ppc32be. The patch for ppc32 has been provided by Link Mauve[1] and ppc64le support[2] has been merged over it. ppc32 needs some toolchain fixes mentioned in the patch rust: Add PowerPC support and the discussion for that is done here[1].

This has been tested on
- powernv9 hardware
- pseries P11 hardware
- pseries(9, 10) qemu
- powernv(9, 10) qemu
- rustdoc on x86 and powerpc64le
- rusttest on x86 and powerpc64le

Quoted 1 line

[...]

Applied to powerpc/next.

[1/7] rust: Fix "multiple candidates for rmeta dependency core" error

      https://git.kernel.org/powerpc/c/00cdfd072c709c608606461d7d44d4613119bfa9
[2/7] dma-resv: Fix undefined symbol when CONFIG_DMA_SHARED_BUFFER is disabled
      https://git.kernel.org/powerpc/c/be809b60cbb61aab96179f44ac3670242ae72996
[3/7] powerpc/jump_label: adjust inline asm to be consistent
      https://git.kernel.org/powerpc/c/13244c0a40139fe66c4c5c5655f4d732a6002957
[4/7] rust/powerpc: Set min rustc version for powerpc
      https://git.kernel.org/powerpc/c/e299147cdc8e19c6421a6b7863dc82a35b09d967
[5/7] rust: Make __udivdi3() and __umoddi3() panic
      https://git.kernel.org/powerpc/c/c93c194e4ee71a734986fd99a8b1ec9fbb7a9b8b
[6/7] rust: Add PowerPC support
      https://git.kernel.org/powerpc/c/73b741adb264967093ef4eb59905618a7e0d0de0
[7/7] powerpc: Enable Rust for ppc64le
      https://git.kernel.org/powerpc/c/bc87cbdb952e9223616b839d64bdb4723aa2ed1d
Quoted 6 lines
Quoted 2 lines

cheers

I just tested those again in linux-next, with the Wii support series on top, but now the kernel fails to build due to ARCH_WARN_ASM and ARCH_WARN_REACHABLE not being defined on PowerPC:

I also see the following warnings (in addition to that error):

warning: unknown and unstable feature specified for -Ctarget-feature: mma
|
= note: it is still passed through to the codegen backend, but use of this feature might be unsound and the behavior of this feature can change in the future = help: consider filing a feature request

warning: unstable feature specified for -Ctarget-feature: vsx
|
= note: this feature is not stably supported; its behavior can change in the future

warning: unknown and unstable feature specified for -Ctarget-feature: hard-float
|
= note: it is still passed through to the codegen backend, but use of this feature might be unsound and the behavior of this feature can change in the future = help: consider filing a feature request

warning: unstable feature specified for -Ctarget-feature: altivec
|
= note: this feature is not stably supported; its behavior can change in the future

clang diag: arch/powerpc/include/uapi/asm/ioctl.h:5:9: warning: '_IOC_SIZEBITS' macro redefined [-Wmacro-redefined] clang diag: arch/powerpc/include/uapi/asm/ioctl.h:6:9: warning: '_IOC_DIRBITS' macro redefined [-Wmacro-redefined] clang diag: arch/powerpc/include/uapi/asm/ioctl.h:8:9: warning: '_IOC_NONE' macro redefined [-Wmacro-redefined] clang diag: arch/powerpc/include/uapi/asm/ioctl.h:10:9: warning: '_IOC_WRITE' macro redefined [-Wmacro-redefined]
warning: 4 warnings emitted

when building this series in next-20260804 with rustc 1.97.1. I am not sure where the clang diagnostic warnings come from. I assume the target feature warnings are expected but it would be good to get those addressed sooner rather than later. I see '-hard-float' has an issue open

https://github.com/rust-lang/rust/issues/117347

but I don't think I see issues open for the other ones.

Signature · 2 lines
Cheers,
Nathan
#19 lore raw

Hi,

Quoted 3 lines · Nathan Chancellor
Quoted 2 lines · Link Mauve

Hi,

[…]

Quoted 16 lines
Quoted 4 lines

I just tested those again in linux-next, with the Wii support series on top, but now the kernel fails to build due to ARCH_WARN_ASM and ARCH_WARN_REACHABLE not being defined on PowerPC:

I also see the following warnings (in addition to that error):

warning: unknown and unstable feature specified for -Ctarget-feature: mma
|
= note: it is still passed through to the codegen backend, but use of this feature might be unsound and the behavior of this feature can change in the future = help: consider filing a feature request

warning: unstable feature specified for -Ctarget-feature: vsx
|
= note: this feature is not stably supported; its behavior can change in the future

Quoted 8 lines

warning: unknown and unstable feature specified for -Ctarget-feature: hard-float
|
= note: it is still passed through to the codegen backend, but use of this feature might be unsound and the behavior of this feature can change in the future = help: consider filing a feature request

warning: unstable feature specified for -Ctarget-feature: altivec
|
= note: this feature is not stably supported; its behavior can change in the future

Those four are explicitly disabled in arch/powerpc/Makefile, but only for CONFIG_PPC64, not for CONFIG_PPC… Maybe they should, I’ve only tested 32-bit on the Wii which has no altivec or vsx, but has hard floats, and I’m not sure about mma.

Could you test this patch on your platform? I’ll submit it properly if it does fix those four warnings:

```
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 9385db478c59..8fba9310acfa 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -63,10 +63,10 @@ endif

 ifdef CONFIG_PPC64
 KBUILD_RUSTFLAGS       += --target=powerpc64le-unknown-linux-gnu
-KBUILD_RUSTFLAGS       += -Ctarget-feature=-mma,-vsx,-hard-float,-altivec
 else
 KBUILD_RUSTFLAGS       += --target=powerpc-unknown-linux-gnu
 endif
+KBUILD_RUSTFLAGS       += -Ctarget-feature=-mma,-vsx,-hard-float,-altivec

 ifdef CONFIG_CPU_LITTLE_ENDIAN
 KBUILD_CPPFLAGS        += -mlittle-endian
```
Quoted 6 lines

clang diag: arch/powerpc/include/uapi/asm/ioctl.h:5:9: warning: '_IOC_SIZEBITS' macro redefined [-Wmacro-redefined] clang diag: arch/powerpc/include/uapi/asm/ioctl.h:6:9: warning: '_IOC_DIRBITS' macro redefined [-Wmacro-redefined] clang diag: arch/powerpc/include/uapi/asm/ioctl.h:8:9: warning: '_IOC_NONE' macro redefined [-Wmacro-redefined] clang diag: arch/powerpc/include/uapi/asm/ioctl.h:10:9: warning: '_IOC_WRITE' macro redefined [-Wmacro-redefined]
warning: 4 warnings emitted

I have no idea about those.

Quoted 8 lines

when building this series in next-20260804 with rustc 1.97.1. I am not sure where the clang diagnostic warnings come from. I assume the target feature warnings are expected but it would be good to get those addressed sooner rather than later. I see '-hard-float' has an issue open

https://github.com/rust-lang/rust/issues/117347

In the kernel we want to disallow all floats, unless there is a very specific and cibled usecase. This issue is about enabling them.

And no, warnings are never expected, you just tested on a platform neither of us tested until now. :)

Quoted 6 lines

but I don't think I see issues open for the other ones.

Signature · 2 lines
Cheers,
Nathan
Signature · 1 line
Link Mauve
#20 lore raw
In reply to Nathan Chancellor
Quoted 55 lines · Nathan Chancellor
Quoted 36 lines · Link Mauve

Hi,

Quoted 33 lines · Madhavan Srinivasan
Quoted 13 lines · Mukesh Kumar Chaurasiya (IBM)

Enable experimental rust support for ppc64le and ppc32be. The patch for ppc32 has been provided by Link Mauve[1] and ppc64le support[2] has been merged over it. ppc32 needs some toolchain fixes mentioned in the patch rust: Add PowerPC support and the discussion for that is done here[1].

This has been tested on
- powernv9 hardware
- pseries P11 hardware
- pseries(9, 10) qemu
- powernv(9, 10) qemu
- rustdoc on x86 and powerpc64le
- rusttest on x86 and powerpc64le

Quoted 1 line

[...]

Applied to powerpc/next.

[1/7] rust: Fix "multiple candidates for rmeta dependency core" error

      https://git.kernel.org/powerpc/c/00cdfd072c709c608606461d7d44d4613119bfa9
[2/7] dma-resv: Fix undefined symbol when CONFIG_DMA_SHARED_BUFFER is disabled
      https://git.kernel.org/powerpc/c/be809b60cbb61aab96179f44ac3670242ae72996
[3/7] powerpc/jump_label: adjust inline asm to be consistent
      https://git.kernel.org/powerpc/c/13244c0a40139fe66c4c5c5655f4d732a6002957
[4/7] rust/powerpc: Set min rustc version for powerpc
      https://git.kernel.org/powerpc/c/e299147cdc8e19c6421a6b7863dc82a35b09d967
[5/7] rust: Make __udivdi3() and __umoddi3() panic
      https://git.kernel.org/powerpc/c/c93c194e4ee71a734986fd99a8b1ec9fbb7a9b8b
[6/7] rust: Add PowerPC support
      https://git.kernel.org/powerpc/c/73b741adb264967093ef4eb59905618a7e0d0de0
[7/7] powerpc: Enable Rust for ppc64le
      https://git.kernel.org/powerpc/c/bc87cbdb952e9223616b839d64bdb4723aa2ed1d
Quoted 6 lines
Quoted 2 lines

cheers

I just tested those again in linux-next, with the Wii support series on top, but now the kernel fails to build due to ARCH_WARN_ASM and ARCH_WARN_REACHABLE not being defined on PowerPC:

I also see the following warnings (in addition to that error):

warning: unknown and unstable feature specified for -Ctarget-feature: mma
|
= note: it is still passed through to the codegen backend, but use of this feature might be unsound and the behavior of this feature can change in the future = help: consider filing a feature request

warning: unstable feature specified for -Ctarget-feature: vsx
|
= note: this feature is not stably supported; its behavior can change in the future

Quoted 9 lines

warning: unknown and unstable feature specified for -Ctarget-feature: hard-float
|
= note: it is still passed through to the codegen backend, but use of this feature might be unsound and the behavior of this feature can change in the future = help: consider filing a feature request

warning: unstable feature specified for -Ctarget-feature: altivec
|
= note: this feature is not stably supported; its behavior can change in the future

Hey Nathan,

For these i'll raise issues.

Quoted 6 lines

clang diag: arch/powerpc/include/uapi/asm/ioctl.h:5:9: warning: '_IOC_SIZEBITS' macro redefined [-Wmacro-redefined] clang diag: arch/powerpc/include/uapi/asm/ioctl.h:6:9: warning: '_IOC_DIRBITS' macro redefined [-Wmacro-redefined] clang diag: arch/powerpc/include/uapi/asm/ioctl.h:8:9: warning: '_IOC_NONE' macro redefined [-Wmacro-redefined] clang diag: arch/powerpc/include/uapi/asm/ioctl.h:10:9: warning: '_IOC_WRITE' macro redefined [-Wmacro-redefined]
warning: 4 warnings emitted

For these warnings below diff should fix it. I'll send out a patch soon.

rust/uapi/uapi_helper.h +1 -1
index 06d7d1a2e8da..acec2d2fede7 100644
@@ -6,7 +6,7 @@
  * Sorted alphabetically.
  */
 
-#include <uapi/asm-generic/ioctl.h>
+#include <uapi/linux/ioctl.h>
 #include <uapi/drm/drm.h>
 #include <uapi/drm/nova_drm.h>
 #include <uapi/drm/panthor_drm.h>

Regards,
Mukesh

Quoted 13 lines

when building this series in next-20260804 with rustc 1.97.1. I am not sure where the clang diagnostic warnings come from. I assume the target feature warnings are expected but it would be good to get those addressed sooner rather than later. I see '-hard-float' has an issue open

https://github.com/rust-lang/rust/issues/117347

but I don't think I see issues open for the other ones.

Signature · 2 lines
Cheers,
Nathan
#21 lore raw
Quoted 61 lines · Mukesh Kumar Chaurasiya
Quoted 60 lines · Nathan Chancellor
Quoted 36 lines · Link Mauve

Hi,

Quoted 33 lines · Madhavan Srinivasan
Quoted 13 lines · Mukesh Kumar Chaurasiya (IBM)

Enable experimental rust support for ppc64le and ppc32be. The patch for ppc32 has been provided by Link Mauve[1] and ppc64le support[2] has been merged over it. ppc32 needs some toolchain fixes mentioned in the patch rust: Add PowerPC support and the discussion for that is done here[1].

This has been tested on
- powernv9 hardware
- pseries P11 hardware
- pseries(9, 10) qemu
- powernv(9, 10) qemu
- rustdoc on x86 and powerpc64le
- rusttest on x86 and powerpc64le

Quoted 1 line

[...]

Applied to powerpc/next.

[1/7] rust: Fix "multiple candidates for rmeta dependency core" error

      https://git.kernel.org/powerpc/c/00cdfd072c709c608606461d7d44d4613119bfa9
[2/7] dma-resv: Fix undefined symbol when CONFIG_DMA_SHARED_BUFFER is disabled
      https://git.kernel.org/powerpc/c/be809b60cbb61aab96179f44ac3670242ae72996
[3/7] powerpc/jump_label: adjust inline asm to be consistent
      https://git.kernel.org/powerpc/c/13244c0a40139fe66c4c5c5655f4d732a6002957
[4/7] rust/powerpc: Set min rustc version for powerpc
      https://git.kernel.org/powerpc/c/e299147cdc8e19c6421a6b7863dc82a35b09d967
[5/7] rust: Make __udivdi3() and __umoddi3() panic
      https://git.kernel.org/powerpc/c/c93c194e4ee71a734986fd99a8b1ec9fbb7a9b8b
[6/7] rust: Add PowerPC support
      https://git.kernel.org/powerpc/c/73b741adb264967093ef4eb59905618a7e0d0de0
[7/7] powerpc: Enable Rust for ppc64le
      https://git.kernel.org/powerpc/c/bc87cbdb952e9223616b839d64bdb4723aa2ed1d
Quoted 6 lines
Quoted 2 lines

cheers

I just tested those again in linux-next, with the Wii support series on top, but now the kernel fails to build due to ARCH_WARN_ASM and ARCH_WARN_REACHABLE not being defined on PowerPC:

I also see the following warnings (in addition to that error):

warning: unknown and unstable feature specified for -Ctarget-feature: mma
|
= note: it is still passed through to the codegen backend, but use of this feature might be unsound and the behavior of this feature can change in the future = help: consider filing a feature request

warning: unstable feature specified for -Ctarget-feature: vsx
|
= note: this feature is not stably supported; its behavior can change in the future

warning: unknown and unstable feature specified for -Ctarget-feature: hard-float
|
= note: it is still passed through to the codegen backend, but use of this feature might be unsound and the behavior of this feature can change in the future = help: consider filing a feature request

Quoted 7 lines
Quoted 4 lines

warning: unstable feature specified for -Ctarget-feature: altivec
|
= note: this feature is not stably supported; its behavior can change in the future

Hey Nathan,

For these i'll raise issues.

Here's bug on rustc for the same.
https://github.com/rust-lang/rust/issues/160561

Regards,
Mukesh

Quoted 38 lines
Quoted 6 lines

clang diag: arch/powerpc/include/uapi/asm/ioctl.h:5:9: warning: '_IOC_SIZEBITS' macro redefined [-Wmacro-redefined] clang diag: arch/powerpc/include/uapi/asm/ioctl.h:6:9: warning: '_IOC_DIRBITS' macro redefined [-Wmacro-redefined] clang diag: arch/powerpc/include/uapi/asm/ioctl.h:8:9: warning: '_IOC_NONE' macro redefined [-Wmacro-redefined] clang diag: arch/powerpc/include/uapi/asm/ioctl.h:10:9: warning: '_IOC_WRITE' macro redefined [-Wmacro-redefined]
warning: 4 warnings emitted

For these warnings below diff should fix it. I'll send out a patch soon.

rust/uapi/uapi_helper.h +1 -1
index 06d7d1a2e8da..acec2d2fede7 100644
@@ -6,7 +6,7 @@
  * Sorted alphabetically.
  */
 
-#include <uapi/asm-generic/ioctl.h>
+#include <uapi/linux/ioctl.h>
 #include <uapi/drm/drm.h>
 #include <uapi/drm/nova_drm.h>
 #include <uapi/drm/panthor_drm.h>

Regards,
Mukesh

Quoted 13 lines

when building this series in next-20260804 with rustc 1.97.1. I am not sure where the clang diagnostic warnings come from. I assume the target feature warnings are expected but it would be good to get those addressed sooner rather than later. I see '-hard-float' has an issue open

https://github.com/rust-lang/rust/issues/117347

but I don't think I see issues open for the other ones.

Signature · 2 lines
Cheers,
Nathan
#22 lore raw
In reply to Mukesh Kumar Chaurasiya

On Wed, Aug 05, 2026 at 05:40:42PM +0530, Mukesh Kumar Chaurasiya wrote:
[…]

Quoted 7 lines

For these warnings below diff should fix it. I'll send out a patch soon.

rust/uapi/uapi_helper.h +0 -0
index 06d7d1a2e8da..acec2d2fede7 100644

rust/uapi/uapi_helper.h line 12

Quoted 8 lines
rust/uapi/uapi_helper.h +1 -1
@@ -6,7 +6,7 @@
  * Sorted alphabetically.
  */
 
-#include <uapi/asm-generic/ioctl.h>
+#include <uapi/linux/ioctl.h>
 #include <uapi/drm/drm.h>
 #include <uapi/drm/nova_drm.h>
 #include <uapi/drm/panthor_drm.h>

You likely want to keep the alphabetical sort here.

Quoted 17 lines

Regards,
Mukesh

Quoted 13 lines

when building this series in next-20260804 with rustc 1.97.1. I am not sure where the clang diagnostic warnings come from. I assume the target feature warnings are expected but it would be good to get those addressed sooner rather than later. I see '-hard-float' has an issue open

https://github.com/rust-lang/rust/issues/117347

but I don't think I see issues open for the other ones.

Signature · 2 lines
Cheers,
Nathan
Signature · 1 line
Link Mauve
#23 lore raw
Quoted 12 lines · Link Mauve

On Wed, Aug 05, 2026 at 05:40:42PM +0530, Mukesh Kumar Chaurasiya wrote:
[…]

Quoted 10 lines

For these warnings below diff should fix it. I'll send out a patch soon.

rust/uapi/uapi_helper.h +0 -0
index 06d7d1a2e8da..acec2d2fede7 100644
@@ -6,7 +6,7 @@
  * Sorted alphabetically.
  */
 
Quoted 8 lines

rust/uapi/uapi_helper.h line 12

Quoted 5 lines
rust/uapi/uapi_helper.h +1 -1
-#include <uapi/asm-generic/ioctl.h>
+#include <uapi/linux/ioctl.h>
 #include <uapi/drm/drm.h>
 #include <uapi/drm/nova_drm.h>
 #include <uapi/drm/panthor_drm.h>

You likely want to keep the alphabetical sort here.

Yeah, Thanks,

I'll take care of this in the patch.

Regards,
Mukesh

[...]