public inbox for rust-for-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH V4 0/3] Rust support for powerpc
@ 2026-02-09 10:54 Mukesh Kumar Chaurasiya (IBM)
  2026-02-09 10:54 ` [PATCH V4 1/3] powerpc/jump_label: adjust inline asm to be consistent Mukesh Kumar Chaurasiya (IBM)
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Mukesh Kumar Chaurasiya (IBM) @ 2026-02-09 10:54 UTC (permalink / raw)
  To: linkmauve, ojeda, boqun.feng, gary, bjorn3_gh, lossin, a.hindborg,
	aliceryhl, tmgross, dakr, corbet, maddy, mpe, npiggin, chleroy,
	peterz, jpoimboe, jbaron, rostedt, ardb, rust-for-linux,
	linux-doc, linux-kernel, linuxppc-dev
  Cc: 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 and power10 pseries qemu. I
I request Link to test the ppc32 part as i don't have a hardware to test
it out. 

[1] https://lore.kernel.org/all/20260204030507.8203-1-linkmauve@linkmauve.fr
[2] https://lore.kernel.org/all/20260204042417.83903-1-mkchauras@gmail.com

Changelog:
V3 -> V4:
- Co-developed-by header added in patch 1
V3: https://lore.kernel.org/all/20260205180429.3280657-1-mkchauras@gmail.com

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/20260204210125.613350-1-mkchauras@gmail.com

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

Link Mauve (1):
  rust: Add PowerPC support

Mukesh Kumar Chaurasiya (IBM) (2):
  powerpc/jump_label: adjust inline asm to be consistent
  powerpc: Enable Rust for ppc64le

 Documentation/rust/arch-support.rst   |  1 +
 arch/powerpc/Kconfig                  |  2 ++
 arch/powerpc/Makefile                 |  9 +++++++++
 arch/powerpc/include/asm/jump_label.h | 23 +++++++++++++----------
 rust/Makefile                         | 12 +++++++++++-
 5 files changed, 36 insertions(+), 11 deletions(-)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH V4 1/3] powerpc/jump_label: adjust inline asm to be consistent
  2026-02-09 10:54 [PATCH V4 0/3] Rust support for powerpc Mukesh Kumar Chaurasiya (IBM)
@ 2026-02-09 10:54 ` Mukesh Kumar Chaurasiya (IBM)
  2026-02-09 10:54 ` [PATCH V4 2/3] rust: Add PowerPC support Mukesh Kumar Chaurasiya (IBM)
  2026-02-09 10:54 ` [PATCH V4 3/3] powerpc: Enable Rust for ppc64le Mukesh Kumar Chaurasiya (IBM)
  2 siblings, 0 replies; 14+ messages in thread
From: Mukesh Kumar Chaurasiya (IBM) @ 2026-02-09 10:54 UTC (permalink / raw)
  To: linkmauve, ojeda, boqun.feng, gary, bjorn3_gh, lossin, a.hindborg,
	aliceryhl, tmgross, dakr, corbet, maddy, mpe, npiggin, chleroy,
	peterz, jpoimboe, jbaron, rostedt, ardb, rust-for-linux,
	linux-doc, linux-kernel, linuxppc-dev
  Cc: 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")'

Co-developed-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Signed-off-by: Mukesh Kumar Chaurasiya (IBM) <mkchauras@gmail.com>
---
 arch/powerpc/include/asm/jump_label.h | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/include/asm/jump_label.h b/arch/powerpc/include/asm/jump_label.h
index d4eaba459a0e..a6b211502bfe 100644
--- a/arch/powerpc/include/asm/jump_label.h
+++ b/arch/powerpc/include/asm/jump_label.h
@@ -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;
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH V4 2/3] rust: Add PowerPC support
  2026-02-09 10:54 [PATCH V4 0/3] Rust support for powerpc Mukesh Kumar Chaurasiya (IBM)
  2026-02-09 10:54 ` [PATCH V4 1/3] powerpc/jump_label: adjust inline asm to be consistent Mukesh Kumar Chaurasiya (IBM)
@ 2026-02-09 10:54 ` Mukesh Kumar Chaurasiya (IBM)
  2026-02-09 12:02   ` Miguel Ojeda
  2026-02-10  5:11   ` kernel test robot
  2026-02-09 10:54 ` [PATCH V4 3/3] powerpc: Enable Rust for ppc64le Mukesh Kumar Chaurasiya (IBM)
  2 siblings, 2 replies; 14+ messages in thread
From: Mukesh Kumar Chaurasiya (IBM) @ 2026-02-09 10:54 UTC (permalink / raw)
  To: linkmauve, ojeda, boqun.feng, gary, bjorn3_gh, lossin, a.hindborg,
	aliceryhl, tmgross, dakr, corbet, maddy, mpe, npiggin, chleroy,
	peterz, jpoimboe, jbaron, rostedt, ardb, rust-for-linux,
	linux-doc, linux-kernel, linuxppc-dev
  Cc: Mukesh Kumar Chaurasiya (IBM)

From: Link Mauve <linkmauve@linkmauve.fr>

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.

Signed-off-by: Link Mauve <linkmauve@linkmauve.fr>
Signed-off-by: Mukesh Kumar Chaurasiya (IBM) <mkchauras@gmail.com>
---
 Documentation/rust/arch-support.rst | 1 +
 arch/powerpc/Kconfig                | 1 +
 arch/powerpc/Makefile               | 2 ++
 rust/Makefile                       | 4 +++-
 4 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/Documentation/rust/arch-support.rst b/Documentation/rust/arch-support.rst
index 6e6a515d0899..e26a94808e97 100644
--- a/Documentation/rust/arch-support.rst
+++ b/Documentation/rust/arch-support.rst
@@ -18,6 +18,7 @@ Architecture   Level of support  Constraints
 ``arm``        Maintained        ARMv7 Little Endian only.
 ``arm64``      Maintained        Little Endian only.
 ``loongarch``  Maintained        \-
+``powerpc``    Experimental      32-bit Big Endian only.
 ``riscv``      Maintained        ``riscv64`` and LLVM/Clang only.
 ``um``         Maintained        \-
 ``x86``        Maintained        ``x86_64`` only.
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 9537a61ebae0..17db23b82e91 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -283,6 +283,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
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index a58b1029592c..9fd82c75dcbd 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -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
diff --git a/rust/Makefile b/rust/Makefile
index 4dcc2eff51cb..ae22f2c5f0b3 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -384,13 +384,15 @@ 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
 BINDGEN_TARGET_arm64	:= aarch64-linux-gnu
 BINDGEN_TARGET_arm	:= arm-linux-gnueabi
 BINDGEN_TARGET_loongarch	:= loongarch64-linux-gnusf
+BINDGEN_TARGET_powerpc	:= powerpc-linux-gnu
 BINDGEN_TARGET_um	:= $(BINDGEN_TARGET_$(SUBARCH))
 BINDGEN_TARGET		:= $(BINDGEN_TARGET_$(SRCARCH))
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH V4 3/3] powerpc: Enable Rust for ppc64le
  2026-02-09 10:54 [PATCH V4 0/3] Rust support for powerpc Mukesh Kumar Chaurasiya (IBM)
  2026-02-09 10:54 ` [PATCH V4 1/3] powerpc/jump_label: adjust inline asm to be consistent Mukesh Kumar Chaurasiya (IBM)
  2026-02-09 10:54 ` [PATCH V4 2/3] rust: Add PowerPC support Mukesh Kumar Chaurasiya (IBM)
@ 2026-02-09 10:54 ` Mukesh Kumar Chaurasiya (IBM)
  2026-02-09 11:52   ` Miguel Ojeda
  2 siblings, 1 reply; 14+ messages in thread
From: Mukesh Kumar Chaurasiya (IBM) @ 2026-02-09 10:54 UTC (permalink / raw)
  To: linkmauve, ojeda, boqun.feng, gary, bjorn3_gh, lossin, a.hindborg,
	aliceryhl, tmgross, dakr, corbet, maddy, mpe, npiggin, chleroy,
	peterz, jpoimboe, jbaron, rostedt, ardb, rust-for-linux,
	linux-doc, linux-kernel, linuxppc-dev
  Cc: Mukesh Kumar Chaurasiya (IBM)

Enabling rust support for ppc64le only.

Tested on powernv9:

$ uname -rm
6.19.0-rc8+ ppc64le

$ sudo modprobe rust_minimal
[  632.890850] rust_minimal: Rust minimal sample (init)
[  632.890881] rust_minimal: Am I built-in? false
[  632.890898] rust_minimal: test_parameter: 1

$ sudo rmmod rust_minimal
[  648.272832] rust_minimal: My numbers are [72, 108, 200]
[  648.272873] rust_minimal: Rust minimal sample (exit)

$ sudo modprobe rust_print
[  843.410391] rust_print: Rust printing macros sample (init)
[  843.410424] rust_print: Emergency message (level 0) without args
[  843.410451] rust_print: Alert message (level 1) without args
[  843.410477] rust_print: Critical message (level 2) without args
[  843.410503] rust_print: Error message (level 3) without args
[  843.410530] rust_print: Warning message (level 4) without args
[  843.410557] rust_print: Notice message (level 5) without args
[  843.410594] rust_print: Info message (level 6) without args
[  843.410617] rust_print: A line that is continued without args
[  843.410646] rust_print: Emergency message (level 0) with args
[  843.410675] rust_print: Alert message (level 1) with args
[  843.410691] rust_print: Critical message (level 2) with args
[  843.410727] rust_print: Error message (level 3) with args
[  843.410761] rust_print: Warning message (level 4) with args
[  843.410796] rust_print: Notice message (level 5) with args
[  843.410821] rust_print: Info message (level 6) with args
[  843.410854] rust_print: A line that is continued with args
[  843.410892] rust_print: 1
[  843.410895] rust_print: "hello, world"
[  843.410924] rust_print: [samples/rust/rust_print_main.rs:35:5] c = "hello, world"
[  843.410977] rust_print: Arc<dyn Display> says 42
[  843.410979] rust_print: Arc<dyn Display> says hello, world

$ sudo rmmod rust_print
[  843.411003] rust_print: "hello, world"
[  888.499935] rust_print: Rust printing macros sample (exit)

Reviewed-by: Link Mauve <linkmauve@linkmauve.fr>
Tested-by: Link Mauve <linkmauve@linkmauve.fr>
Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Signed-off-by: Mukesh Kumar Chaurasiya (IBM) <mkchauras@gmail.com>
---
 Documentation/rust/arch-support.rst | 2 +-
 arch/powerpc/Kconfig                | 1 +
 arch/powerpc/Makefile               | 9 ++++++++-
 rust/Makefile                       | 8 ++++++++
 4 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/Documentation/rust/arch-support.rst b/Documentation/rust/arch-support.rst
index e26a94808e97..627471ac9238 100644
--- a/Documentation/rust/arch-support.rst
+++ b/Documentation/rust/arch-support.rst
@@ -18,7 +18,7 @@ Architecture   Level of support  Constraints
 ``arm``        Maintained        ARMv7 Little Endian only.
 ``arm64``      Maintained        Little Endian only.
 ``loongarch``  Maintained        \-
-``powerpc``    Experimental      32-bit Big Endian only.
+``powerpc``    Experimental      64-bit Little Endian. 32-bit Big Endian.
 ``riscv``      Maintained        ``riscv64`` and LLVM/Clang only.
 ``um``         Maintained        \-
 ``x86``        Maintained        ``x86_64`` only.
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 17db23b82e91..954af27e10c5 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -284,6 +284,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
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 9fd82c75dcbd..f93816ddc036 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -61,7 +61,14 @@ else
 KBUILD_LDFLAGS_MODULE += $(objtree)/arch/powerpc/lib/crtsavres.o
 endif
 
-KBUILD_RUSTFLAGS += --target=powerpc-unknown-linux-gnu
+ifdef CONFIG_PPC64
+ifdef CONFIG_CPU_LITTLE_ENDIAN
+KBUILD_RUSTFLAGS	+= --target=powerpc64le-unknown-linux-gnu
+endif
+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
diff --git a/rust/Makefile b/rust/Makefile
index ae22f2c5f0b3..14febe9c7643 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -392,7 +392,15 @@ BINDGEN_TARGET_x86	:= x86_64-linux-gnu
 BINDGEN_TARGET_arm64	:= aarch64-linux-gnu
 BINDGEN_TARGET_arm	:= arm-linux-gnueabi
 BINDGEN_TARGET_loongarch	:= loongarch64-linux-gnusf
+
+ifdef CONFIG_PPC64
+ifdef CONFIG_CPU_LITTLE_ENDIAN
+BINDGEN_TARGET_powerpc	:= powerpc64le-linux-gnu
+endif
+else
 BINDGEN_TARGET_powerpc	:= powerpc-linux-gnu
+endif
+
 BINDGEN_TARGET_um	:= $(BINDGEN_TARGET_$(SUBARCH))
 BINDGEN_TARGET		:= $(BINDGEN_TARGET_$(SRCARCH))
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH V4 3/3] powerpc: Enable Rust for ppc64le
  2026-02-09 10:54 ` [PATCH V4 3/3] powerpc: Enable Rust for ppc64le Mukesh Kumar Chaurasiya (IBM)
@ 2026-02-09 11:52   ` Miguel Ojeda
  2026-02-10  5:29     ` Mukesh Kumar Chaurasiya
  0 siblings, 1 reply; 14+ messages in thread
From: Miguel Ojeda @ 2026-02-09 11:52 UTC (permalink / raw)
  To: Mukesh Kumar Chaurasiya (IBM)
  Cc: linkmauve, ojeda, boqun.feng, gary, bjorn3_gh, lossin, a.hindborg,
	aliceryhl, tmgross, dakr, corbet, maddy, mpe, npiggin, chleroy,
	peterz, jpoimboe, jbaron, rostedt, ardb, rust-for-linux,
	linux-doc, linux-kernel, linuxppc-dev

On Mon, Feb 9, 2026 at 11:55 AM Mukesh Kumar Chaurasiya (IBM)
<mkchauras@gmail.com> wrote:
>
> diff --git a/rust/Makefile b/rust/Makefile
> index ae22f2c5f0b3..14febe9c7643 100644
> --- a/rust/Makefile
> +++ b/rust/Makefile
> @@ -392,7 +392,15 @@ BINDGEN_TARGET_x86 := x86_64-linux-gnu
>  BINDGEN_TARGET_arm64   := aarch64-linux-gnu
>  BINDGEN_TARGET_arm     := arm-linux-gnueabi
>  BINDGEN_TARGET_loongarch       := loongarch64-linux-gnusf
> +
> +ifdef CONFIG_PPC64
> +ifdef CONFIG_CPU_LITTLE_ENDIAN
> +BINDGEN_TARGET_powerpc := powerpc64le-linux-gnu
> +endif
> +else
>  BINDGEN_TARGET_powerpc := powerpc-linux-gnu
> +endif
> +
>  BINDGEN_TARGET_um      := $(BINDGEN_TARGET_$(SUBARCH))
>  BINDGEN_TARGET         := $(BINDGEN_TARGET_$(SRCARCH))

This looks reasonable.

My only nit is that we could trigger an error in the nested if since
you wrote the if already. Otherwise, we could remove the nested one
until ppc64 is supported, or am I missing something?

Either way, for the Rust bits if powerpc maintainers are taking this:

Acked-by: Miguel Ojeda <ojeda@kernel.org>

Thanks!

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH V4 2/3] rust: Add PowerPC support
  2026-02-09 10:54 ` [PATCH V4 2/3] rust: Add PowerPC support Mukesh Kumar Chaurasiya (IBM)
@ 2026-02-09 12:02   ` Miguel Ojeda
  2026-02-09 12:29     ` Christophe Leroy (CS GROUP)
  2026-02-10  5:11   ` kernel test robot
  1 sibling, 1 reply; 14+ messages in thread
From: Miguel Ojeda @ 2026-02-09 12:02 UTC (permalink / raw)
  To: Mukesh Kumar Chaurasiya (IBM)
  Cc: linkmauve, ojeda, boqun.feng, gary, bjorn3_gh, lossin, a.hindborg,
	aliceryhl, tmgross, dakr, corbet, maddy, mpe, npiggin, chleroy,
	peterz, jpoimboe, jbaron, rostedt, ardb, rust-for-linux,
	linux-doc, linux-kernel, linuxppc-dev

On Mon, Feb 9, 2026 at 11:55 AM Mukesh Kumar Chaurasiya (IBM)
<mkchauras@gmail.com> wrote:
>
> These changes aren’t the only ones required to get the kernel to compile
> and link on PowerPC

Is this patch not complete, then? It is up to the PowerPC maintainers
what they want to merge, of course, but I don't think we should add
the line in `Documentation/` if it does not work yet.

By the way, regarding that:

> +``powerpc``    Experimental      32-bit Big Endian only.

These levels are mapped to `MAINTAINERS` ones:

    Below is a general summary of architectures that currently work. Level of
    support corresponds to ``S`` values in the ``MAINTAINERS`` file.

But there is no "Experimental" level there. The idea is to know if
there is someone being paid to work on this, or not, etc.

This should also be changed in the other patch that adds ppc64le --
e.g. Mukesh, is IBM supporting this?

I guess it may be simpler to not add this line here until it works
properly, and only add the ppc64le one in the next patch, with a fixed
level to one of the `MAINTAINERS` ones.

Thanks!

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH V4 2/3] rust: Add PowerPC support
  2026-02-09 12:02   ` Miguel Ojeda
@ 2026-02-09 12:29     ` Christophe Leroy (CS GROUP)
  2026-02-09 12:48       ` Miguel Ojeda
  0 siblings, 1 reply; 14+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2026-02-09 12:29 UTC (permalink / raw)
  To: Miguel Ojeda, Mukesh Kumar Chaurasiya (IBM)
  Cc: linkmauve, ojeda, boqun.feng, gary, bjorn3_gh, lossin, a.hindborg,
	aliceryhl, tmgross, dakr, corbet, maddy, mpe, npiggin, peterz,
	jpoimboe, jbaron, rostedt, ardb, rust-for-linux, linux-doc,
	linux-kernel, linuxppc-dev



Le 09/02/2026 à 13:02, Miguel Ojeda a écrit :
> On Mon, Feb 9, 2026 at 11:55 AM Mukesh Kumar Chaurasiya (IBM)
> <mkchauras@gmail.com> wrote:
>>
>> These changes aren’t the only ones required to get the kernel to compile
>> and link on PowerPC
> 
> Is this patch not complete, then? It is up to the PowerPC maintainers
> what they want to merge, of course, but I don't think we should add
> the line in `Documentation/` if it does not work yet.

As far as I understand the patch is complete, the problem is outside the 
kernel, it is in the libcore provided by rust or the rust compiler.

That libcore seems to call __udivdi3() and __umoddi3() which are not 
provided by the kernel. Instead if should call the functions do_div() 
and friends provided by include/asm-generic/div64.h, or provide 
__udivdi3() and __umoddi3() on its own.

Christophe

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH V4 2/3] rust: Add PowerPC support
  2026-02-09 12:29     ` Christophe Leroy (CS GROUP)
@ 2026-02-09 12:48       ` Miguel Ojeda
  2026-02-10  5:27         ` Mukesh Kumar Chaurasiya
  2026-02-10  9:42         ` Link Mauve
  0 siblings, 2 replies; 14+ messages in thread
From: Miguel Ojeda @ 2026-02-09 12:48 UTC (permalink / raw)
  To: Christophe Leroy (CS GROUP)
  Cc: Mukesh Kumar Chaurasiya (IBM), linkmauve, ojeda, boqun.feng, gary,
	bjorn3_gh, lossin, a.hindborg, aliceryhl, tmgross, dakr, corbet,
	maddy, mpe, npiggin, peterz, jpoimboe, jbaron, rostedt, ardb,
	rust-for-linux, linux-doc, linux-kernel, linuxppc-dev

On Mon, Feb 9, 2026 at 1:29 PM Christophe Leroy (CS GROUP)
<chleroy@kernel.org> wrote:
>
> As far as I understand the patch is complete, the problem is outside the
> kernel, it is in the libcore provided by rust or the rust compiler.
>
> That libcore seems to call __udivdi3() and __umoddi3() which are not
> provided by the kernel. Instead if should call the functions do_div()
> and friends provided by include/asm-generic/div64.h, or provide
> __udivdi3() and __umoddi3() on its own.

Yeah, but what I mean is, should we add this if it doesn't link,
especially without a note or comment of some kind? (Perhaps to your
tracking issue in GitHub?)

i.e. if I understand correctly, you prefer to not add the panicking
intrinsics to `rust/compiler_builtins.rs`, which I agree isn't ideal.
By the way, it would be nice if IBM could join one of the meetings
with have with upstream Rust to raise this topic again with them.

In any case, it is up to you, of course. My only concern on the Rust
bits is on the docs side, the rest looks fine.

Thanks!

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH V4 2/3] rust: Add PowerPC support
  2026-02-09 10:54 ` [PATCH V4 2/3] rust: Add PowerPC support Mukesh Kumar Chaurasiya (IBM)
  2026-02-09 12:02   ` Miguel Ojeda
@ 2026-02-10  5:11   ` kernel test robot
  1 sibling, 0 replies; 14+ messages in thread
From: kernel test robot @ 2026-02-10  5:11 UTC (permalink / raw)
  To: Mukesh Kumar Chaurasiya (IBM), linkmauve, ojeda, boqun.feng, gary,
	bjorn3_gh, lossin, a.hindborg, aliceryhl, tmgross, dakr, corbet,
	maddy, mpe, npiggin, chleroy, peterz, jpoimboe, jbaron, rostedt,
	ardb, rust-for-linux, linux-doc, linux-kernel, linuxppc-dev
  Cc: oe-kbuild-all, Mukesh Kumar Chaurasiya (IBM)

Hi Mukesh,

kernel test robot noticed the following build errors:

[auto build test ERROR on v6.19]
[also build test ERROR on linus/master next-20260209]
[cannot apply to powerpc/next powerpc/fixes rust/rust-next ah-configfs/configfs-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Mukesh-Kumar-Chaurasiya-IBM/powerpc-jump_label-adjust-inline-asm-to-be-consistent/20260209-185801
base:   v6.19
patch link:    https://lore.kernel.org/r/20260209105456.1551677-3-mkchauras%40gmail.com
patch subject: [PATCH V4 2/3] rust: Add PowerPC support
config: powerpc-randconfig-r073-20260210 (https://download.01.org/0day-ci/archive/20260210/202602101353.da6BkK6l-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
rustc: rustc 1.88.0 (6b00bc388 2025-06-23)
smatch version: v0.5.0-8994-gd50c5a4c
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260210/202602101353.da6BkK6l-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202602101353.da6BkK6l-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   clang: error: unsupported option '-fsanitize=thread' for target 'powerpc-unknown-linux-gnu'
   make[3]: *** [rust/Makefile:624: rust/helpers/helpers.o] Error 1
>> 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]
>> error[E0658]: inline assembly is not stable yet on this architecture
   --> rust/kernel/sync/barrier.rs:19:14
   |
   19 |     unsafe { core::arch::asm!("") };
   |              ^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #93335 <https://github.com/rust-lang/rust/issues/93335> for more information
   = help: add `#![feature(asm_experimental_arch)]` to the crate attributes to enable
   = note: this compiler was built on 2025-06-23; consider upgrading it if it is out of date

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH V4 2/3] rust: Add PowerPC support
  2026-02-09 12:48       ` Miguel Ojeda
@ 2026-02-10  5:27         ` Mukesh Kumar Chaurasiya
  2026-02-10  9:17           ` Miguel Ojeda
  2026-02-10  9:42         ` Link Mauve
  1 sibling, 1 reply; 14+ messages in thread
From: Mukesh Kumar Chaurasiya @ 2026-02-10  5:27 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Christophe Leroy (CS GROUP), linkmauve, ojeda, boqun.feng, gary,
	bjorn3_gh, lossin, a.hindborg, aliceryhl, tmgross, dakr, corbet,
	maddy, mpe, npiggin, peterz, jpoimboe, jbaron, rostedt, ardb,
	rust-for-linux, linux-doc, linux-kernel, linuxppc-dev

On Mon, Feb 09, 2026 at 01:48:01PM +0100, Miguel Ojeda wrote:
> On Mon, Feb 9, 2026 at 1:29 PM Christophe Leroy (CS GROUP)
> <chleroy@kernel.org> wrote:
> >
> > As far as I understand the patch is complete, the problem is outside the
> > kernel, it is in the libcore provided by rust or the rust compiler.
> >
> > That libcore seems to call __udivdi3() and __umoddi3() which are not
> > provided by the kernel. Instead if should call the functions do_div()
> > and friends provided by include/asm-generic/div64.h, or provide
> > __udivdi3() and __umoddi3() on its own.
> 
> Yeah, but what I mean is, should we add this if it doesn't link,
> especially without a note or comment of some kind? (Perhaps to your
> tracking issue in GitHub?)
> 
Hey,

I'll put this as a note in out rust support issue on github.


> i.e. if I understand correctly, you prefer to not add the panicking
> intrinsics to `rust/compiler_builtins.rs`, which I agree isn't ideal.
> By the way, it would be nice if IBM could join one of the meetings
> with have with upstream Rust to raise this topic again with them.
> 
Sure, i'll try to join the call and bring this up.

> In any case, it is up to you, of course. My only concern on the Rust
> bits is on the docs side, the rest looks fine.
> 
> Thanks!
> 
> Cheers,
> Miguel

Regards,
Mukesh

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH V4 3/3] powerpc: Enable Rust for ppc64le
  2026-02-09 11:52   ` Miguel Ojeda
@ 2026-02-10  5:29     ` Mukesh Kumar Chaurasiya
  0 siblings, 0 replies; 14+ messages in thread
From: Mukesh Kumar Chaurasiya @ 2026-02-10  5:29 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: linkmauve, ojeda, boqun.feng, gary, bjorn3_gh, lossin, a.hindborg,
	aliceryhl, tmgross, dakr, corbet, maddy, mpe, npiggin, chleroy,
	peterz, jpoimboe, jbaron, rostedt, ardb, rust-for-linux,
	linux-doc, linux-kernel, linuxppc-dev

On Mon, Feb 09, 2026 at 12:52:26PM +0100, Miguel Ojeda wrote:
> On Mon, Feb 9, 2026 at 11:55 AM Mukesh Kumar Chaurasiya (IBM)
> <mkchauras@gmail.com> wrote:
> >
> > diff --git a/rust/Makefile b/rust/Makefile
> > index ae22f2c5f0b3..14febe9c7643 100644
> > --- a/rust/Makefile
> > +++ b/rust/Makefile
> > @@ -392,7 +392,15 @@ BINDGEN_TARGET_x86 := x86_64-linux-gnu
> >  BINDGEN_TARGET_arm64   := aarch64-linux-gnu
> >  BINDGEN_TARGET_arm     := arm-linux-gnueabi
> >  BINDGEN_TARGET_loongarch       := loongarch64-linux-gnusf
> > +
> > +ifdef CONFIG_PPC64
> > +ifdef CONFIG_CPU_LITTLE_ENDIAN
> > +BINDGEN_TARGET_powerpc := powerpc64le-linux-gnu
> > +endif
> > +else
> >  BINDGEN_TARGET_powerpc := powerpc-linux-gnu
> > +endif
> > +
> >  BINDGEN_TARGET_um      := $(BINDGEN_TARGET_$(SUBARCH))
> >  BINDGEN_TARGET         := $(BINDGEN_TARGET_$(SRCARCH))
> 
> This looks reasonable.
> 
> My only nit is that we could trigger an error in the nested if since
> you wrote the if already. Otherwise, we could remove the nested one
> until ppc64 is supported, or am I missing something?
> 
I will remove the nested if till we have support for the ppc64 big
endian.

Regards,
Mukesh
> Either way, for the Rust bits if powerpc maintainers are taking this:
> 
> Acked-by: Miguel Ojeda <ojeda@kernel.org>
> 
> Thanks!
> 
> Cheers,
> Miguel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH V4 2/3] rust: Add PowerPC support
  2026-02-10  5:27         ` Mukesh Kumar Chaurasiya
@ 2026-02-10  9:17           ` Miguel Ojeda
  0 siblings, 0 replies; 14+ messages in thread
From: Miguel Ojeda @ 2026-02-10  9:17 UTC (permalink / raw)
  To: Mukesh Kumar Chaurasiya
  Cc: Christophe Leroy (CS GROUP), linkmauve, ojeda, boqun.feng, gary,
	bjorn3_gh, lossin, a.hindborg, aliceryhl, tmgross, dakr, corbet,
	maddy, mpe, npiggin, peterz, jpoimboe, jbaron, rostedt, ardb,
	rust-for-linux, linux-doc, linux-kernel, linuxppc-dev

On Tue, Feb 10, 2026 at 6:27 AM Mukesh Kumar Chaurasiya
<mkchauras@gmail.com> wrote:
>
> Sure, i'll try to join the call and bring this up.

Thanks! Added you to the call.

Any of the weeks we do it should be fine, but if the time zone is bad,
please let me know.

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH V4 2/3] rust: Add PowerPC support
  2026-02-09 12:48       ` Miguel Ojeda
  2026-02-10  5:27         ` Mukesh Kumar Chaurasiya
@ 2026-02-10  9:42         ` Link Mauve
  2026-02-10  9:53           ` Miguel Ojeda
  1 sibling, 1 reply; 14+ messages in thread
From: Link Mauve @ 2026-02-10  9:42 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Christophe Leroy (CS GROUP), Mukesh Kumar Chaurasiya (IBM),
	linkmauve, ojeda, boqun.feng, gary, bjorn3_gh, lossin, a.hindborg,
	aliceryhl, tmgross, dakr, corbet, maddy, mpe, npiggin, peterz,
	jpoimboe, jbaron, rostedt, ardb, rust-for-linux, linux-doc,
	linux-kernel, linuxppc-dev

Hi,

On Mon, Feb 09, 2026 at 01:48:01PM +0100, Miguel Ojeda wrote:
> On Mon, Feb 9, 2026 at 1:29 PM Christophe Leroy (CS GROUP)
> <chleroy@kernel.org> wrote:
> >
> > As far as I understand the patch is complete, the problem is outside the
> > kernel, it is in the libcore provided by rust or the rust compiler.
> >
> > That libcore seems to call __udivdi3() and __umoddi3() which are not
> > provided by the kernel. Instead if should call the functions do_div()
> > and friends provided by include/asm-generic/div64.h, or provide
> > __udivdi3() and __umoddi3() on its own.
> 
> Yeah, but what I mean is, should we add this if it doesn't link,
> especially without a note or comment of some kind? (Perhaps to your
> tracking issue in GitHub?)
> 
> i.e. if I understand correctly, you prefer to not add the panicking
> intrinsics to `rust/compiler_builtins.rs`, which I agree isn't ideal.
> By the way, it would be nice if IBM could join one of the meetings
> with have with upstream Rust to raise this topic again with them.

I’m just an unemployed contributor, with no ties to any of that but
sheer interest, would it be ok for me to join that call as well?  I am
interested in resolving that issue in core, only three types have that
issue and only in their formatting code so far.

> 
> In any case, it is up to you, of course. My only concern on the Rust
> bits is on the docs side, the rest looks fine.
> 
> Thanks!
> 
> Cheers,
> Miguel
> 

-- 
Link Mauve

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH V4 2/3] rust: Add PowerPC support
  2026-02-10  9:42         ` Link Mauve
@ 2026-02-10  9:53           ` Miguel Ojeda
  0 siblings, 0 replies; 14+ messages in thread
From: Miguel Ojeda @ 2026-02-10  9:53 UTC (permalink / raw)
  To: Link Mauve
  Cc: Christophe Leroy (CS GROUP), Mukesh Kumar Chaurasiya (IBM), ojeda,
	boqun.feng, gary, bjorn3_gh, lossin, a.hindborg, aliceryhl,
	tmgross, dakr, corbet, maddy, mpe, npiggin, peterz, jpoimboe,
	jbaron, rostedt, ardb, rust-for-linux, linux-doc, linux-kernel,
	linuxppc-dev

On Tue, Feb 10, 2026 at 10:42 AM Link Mauve <linkmauve@linkmauve.fr> wrote:
>
> I’m just an unemployed contributor, with no ties to any of that but
> sheer interest, would it be ok for me to join that call as well?  I am
> interested in resolving that issue in core, only three types have that
> issue and only in their formatting code so far.

Sure, invited -- and thanks for wanting to solve it! (I asked Mukesh
due to the IBM affiliation -- I didn't mean to exclude you, sorry).

Regarding the issue in `core`, for context: if the solution involves
adding `cfg`s, then we will need to discuss how to approach that,
because years ago we wanted to add some to cut down things we did not
need and they preferred to avoid to keep adding more conditional
compilation, so we only got the `no_fp_fmt_parse` (ec7292ad3c35
("core: add unstable `no_fp_fmt_parse` to disable float fmt/parse
code")). At some points in the past we discussed a targeted
`cfg(linux_kernel)` one (instead of several different ones) to avoid
that.

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-02-10  9:53 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-09 10:54 [PATCH V4 0/3] Rust support for powerpc Mukesh Kumar Chaurasiya (IBM)
2026-02-09 10:54 ` [PATCH V4 1/3] powerpc/jump_label: adjust inline asm to be consistent Mukesh Kumar Chaurasiya (IBM)
2026-02-09 10:54 ` [PATCH V4 2/3] rust: Add PowerPC support Mukesh Kumar Chaurasiya (IBM)
2026-02-09 12:02   ` Miguel Ojeda
2026-02-09 12:29     ` Christophe Leroy (CS GROUP)
2026-02-09 12:48       ` Miguel Ojeda
2026-02-10  5:27         ` Mukesh Kumar Chaurasiya
2026-02-10  9:17           ` Miguel Ojeda
2026-02-10  9:42         ` Link Mauve
2026-02-10  9:53           ` Miguel Ojeda
2026-02-10  5:11   ` kernel test robot
2026-02-09 10:54 ` [PATCH V4 3/3] powerpc: Enable Rust for ppc64le Mukesh Kumar Chaurasiya (IBM)
2026-02-09 11:52   ` Miguel Ojeda
2026-02-10  5:29     ` Mukesh Kumar Chaurasiya

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