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,
nathan@kernel.org, nick.desaulniers+lkml@gmail.com,
morbo@google.com, justinstitt@google.com,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
rust-for-linux@vger.kernel.org, llvm@lists.linux.dev
Cc: "Mukesh Kumar Chaurasiya (IBM)" <mkchauras@gmail.com>,
Link Mauve <linkmauve@linkmauve.fr>,
Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Subject: [PATCH V8 4/4] powerpc: Enable Rust for ppc64le
Date: Fri, 3 Apr 2026 20:23:08 +0530 [thread overview]
Message-ID: <20260403145308.1042622-5-mkchauras@gmail.com> (raw)
In-Reply-To: <20260403145308.1042622-1-mkchauras@gmail.com>
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)
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>
Link: https://github.com/Rust-for-Linux/linux/issues/105
Link: https://github.com/linuxppc/issues/issues/451
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 d05e76df15a8..321b7d0e15c7 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -421,7 +421,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
prev parent reply other threads:[~2026-04-03 14:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-03 14:53 [PATCH V8 0/4] Rust support for powerpc Mukesh Kumar Chaurasiya (IBM)
2026-04-03 14:53 ` [PATCH V8 1/4] rust: Fix "multiple candidates for rmeta dependency core" error Mukesh Kumar Chaurasiya (IBM)
2026-04-03 15:09 ` Gary Guo
2026-04-04 3:39 ` Mukesh Kumar Chaurasiya
2026-04-04 20:28 ` Miguel Ojeda
2026-04-03 14:53 ` [PATCH V8 2/4] powerpc/jump_label: adjust inline asm to be consistent Mukesh Kumar Chaurasiya (IBM)
2026-04-03 14:53 ` [PATCH V8 3/4] rust: Add PowerPC support Mukesh Kumar Chaurasiya (IBM)
2026-04-03 14:53 ` Mukesh Kumar Chaurasiya (IBM) [this message]
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=20260403145308.1042622-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=justinstitt@google.com \
--cc=linkmauve@linkmauve.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=llvm@lists.linux.dev \
--cc=lossin@kernel.org \
--cc=maddy@linux.ibm.com \
--cc=morbo@google.com \
--cc=mpe@ellerman.id.au \
--cc=nathan@kernel.org \
--cc=nick.desaulniers+lkml@gmail.com \
--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