From: "Mukesh Kumar Chaurasiya (IBM)" <mkchauras@gmail.com>
To: maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com,
chleroy@kernel.org, peterz@infradead.org, jpoimboe@kernel.org,
jbaron@akamai.com, aliceryhl@google.com, rostedt@goodmis.org,
ardb@kernel.org, ojeda@kernel.org, boqun@kernel.org,
gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org,
a.hindborg@kernel.org, tmgross@umich.edu, dakr@kernel.org,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
rust-for-linux@vger.kernel.org
Cc: "Mukesh Kumar Chaurasiya (IBM)" <mkchauras@gmail.com>,
Link Mauve <linkmauve@linkmauve.fr>,
Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Subject: [PATCH V7 4/4] powerpc: Enable Rust for ppc64le
Date: Sun, 29 Mar 2026 21:32:54 +0530 [thread overview]
Message-ID: <20260329160254.2592207-5-mkchauras@gmail.com> (raw)
In-Reply-To: <20260329160254.2592207-1-mkchauras@gmail.com>
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>
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Signed-off-by: Mukesh Kumar Chaurasiya (IBM) <mkchauras@gmail.com>
---
arch/powerpc/Kconfig | 1 +
arch/powerpc/Makefile | 7 ++++++-
rust/Makefile | 6 ++++++
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 1246b3add8ff..a5f50434daf3 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -285,6 +285,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 589613eaa5dc..9385db478c59 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -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
diff --git a/rust/Makefile b/rust/Makefile
index 7ea7570e3f17..7fe4cbbd176e 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -410,7 +410,13 @@ 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
+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))
--
2.53.0
next prev parent reply other threads:[~2026-03-29 16:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-29 16:02 [PATCH V7 0/4] Rust support for powerpc Mukesh Kumar Chaurasiya (IBM)
2026-03-29 16:02 ` [PATCH V7 1/4] rust: Fix a race condition in Makefile Mukesh Kumar Chaurasiya (IBM)
2026-03-29 17:25 ` Miguel Ojeda
2026-03-29 18:26 ` Gary Guo
2026-03-29 16:02 ` [PATCH V7 2/4] powerpc/jump_label: adjust inline asm to be consistent Mukesh Kumar Chaurasiya (IBM)
2026-03-29 18:28 ` Gary Guo
2026-03-29 16:02 ` [PATCH V7 3/4] rust: Add PowerPC support Mukesh Kumar Chaurasiya (IBM)
2026-03-29 16:02 ` Mukesh Kumar Chaurasiya (IBM) [this message]
2026-03-29 18:33 ` [PATCH V7 4/4] powerpc: Enable Rust for ppc64le Gary Guo
2026-03-29 16:20 ` [PATCH V7 0/4] Rust support for powerpc Miguel Ojeda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260329160254.2592207-5-mkchauras@gmail.com \
--to=mkchauras@gmail.com \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=ardb@kernel.org \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=chleroy@kernel.org \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=jbaron@akamai.com \
--cc=jpoimboe@kernel.org \
--cc=linkmauve@linkmauve.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lossin@kernel.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=ojeda@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
--cc=venkat88@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox