From nobody Sat Feb 7 18:15:39 2026 Received: from mail-qv1-f46.google.com (mail-qv1-f46.google.com [209.85.219.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 766D63054E4 for ; Thu, 5 Feb 2026 19:57:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770321448; cv=none; b=m055TfLvUj3grlxVEaCIMKC4e31Glo/wvF5IvMWFRBvh+z0uXtZQwdIbYpIOD+orDkNhFv0N258Zja1y8tLn8Bu+SofQRe9LpOTBRtifk0/2pkiz3FejW1tR/VpWXCkspzb4AY/B4XsLizchUP6LkP+ohebAZ3snCQxmvGbPb4U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770321448; c=relaxed/simple; bh=pZ1U1Cu6MPwvJitbLSTqOvwj/6OfA38gALmI+6KPpx8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JZI4pgpP6YRgiDm3EAtT+DsXPWa4X6uy+hn1wVfF/HeKpZhXu5xo9BoHBHZKy2mG5fj/BLwoA7uiDc1bORuKBIe1LabSehexWg8S7ckl2sburzJmVR3BrTY2EU57szr9JWndAPNTFIsRt0dqU0wso8caHUqsLvQgge+NKOKcDHg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BV13FfT4; arc=none smtp.client-ip=209.85.219.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BV13FfT4" Received: by mail-qv1-f46.google.com with SMTP id 6a1803df08f44-88ffcb14e11so19318826d6.0 for ; Thu, 05 Feb 2026 11:57:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770321447; x=1770926247; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Rvyue3lXA3fGB8HdBoKvnw8CYi0+bdICYfINuIQp+GA=; b=BV13FfT4FNFsLppMb2Uz6ojDRiiVrnumOcDbpmu4hRM+oR4l+W5wK4DqL7v1LXZ6rd zlxpDcjyOYPmbfzXVVTPpsl3/m/3sK13/X4UiupbsSDpCMn4Vb8opzIDEmgyecTepj6s tJBLC5sm0ZJaFZk6GlvrjUCa9UwUScCV7uQS5S1ukBbyEjnz+vax7VGDYgVQ5JUcro25 CGjEhD4JRPQtUrAITHoUwTHuFFVtz5bMdb/pxM/oeh79aQgvFCU6i2cNmq2Q3wZadbRK rsG3YXhlh0mKbJouUmeSNH8IuRsAUeYX/4w88ES+acU4ll/naOhvjHLH6mghWKlBb/Xp PdDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770321447; x=1770926247; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Rvyue3lXA3fGB8HdBoKvnw8CYi0+bdICYfINuIQp+GA=; b=r2HJt1GajscBmY8AYvy3fNSlUGuA3f+//RYrWWgsMVjVaAk70hx819jsjvUiL6dDXc AVUpwn13sU+bRGY31ClrBnVgAJrUzeWh3DPaOcJT9k7D2Gba3KnbP69F9mXf6FGaFLNQ oZX5ywqqQH58M4xmissblU/Vqh5I6vphNpsqoxc9cGEVWLJRbjQ44d3TlKZKmt50y1YG rRUdNy/lkNCs1bsoIAr3A0+m1+wvf1EOl3ki9ux4JBHcc0yqRXVJ9hPyRffIC1S6Z/ap QQZ27kYVxWx9WBsgyIOn7FkDFc7BUTw3rMyxX5DVq4x+qGoGvzFYRnsBNEO4/lDyGxf3 lJjQ== X-Forwarded-Encrypted: i=1; AJvYcCVNu5y12HmR9gqlishAXR+8mCJPfICvVQCzbqbh0DvVldU0Idu1N/rrHQXhTC25cDKz5jyA+GoLqZl198M=@vger.kernel.org X-Gm-Message-State: AOJu0Ywi5WjoNHLaHFIDbcWnAHVn+ab3/STbKbiTeNr9Vg3Ois287HlY +tJPcWpqwgNNTgg/Bq4rTz+CAwtwsJDOYj4py3MO2XzIZ7m5krTLREPIHFHG6w== X-Gm-Gg: AZuq6aLa5JrU3KB5Yl8axgzbqtJP2afbGFYrv2NA3oXa6lvSOywWVYRqy6u/V85HfRW XqbIF3J1EcXMEdEyCpeD99yh4W8eWV7udMukeujKOmM/WKIH43WSK/mZs5BI8ODpNeWLm1cehRV 5sj0HwuAs2C7BuATbbc+Mk4GnGYEGojUjEHV8La6eLPYQ3ZwP+P0tVRL2k+Hvm+cDsgUl6A5qHt gcjmZivOtjAc/3k2HTJVPyQTgtzgo7moblUIKstu8/5tVMoAWC176jqkX6QPN5VL0m+35iwLMwU wu9MY+mBVQz/76Fhhmst33EVetVgXSpI/Vy6wUd8WxjzgIQBaHnGu2W4kyrbxDAcqfvncjlBG+R 4tcQCz0zzaU2HrXMv2gJwAWQGOzdhZMZOipXJvFKB2vYwfyEAvGkNNGbYQ6k1OdHQd4+Yj2eVFn TCt/vOQTcxzVUY6ssIaec//RutD0XEnsFRCu+ib0lwkyO427pAuWI9I3SzGNTh8Q== X-Received: by 2002:a05:6a20:d12f:b0:38d:f0f3:b96d with SMTP id adf61e73a8af0-393acf88673mr215443637.2.1770314709806; Thu, 05 Feb 2026 10:05:09 -0800 (PST) Received: from li-1a3e774c-28e4-11b2-a85c-acc9f2883e29.ibm.com.com ([106.51.167.8]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c6dcb5436c5sm99812a12.15.2026.02.05.10.05.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Feb 2026 10:05:09 -0800 (PST) From: "Mukesh Kumar Chaurasiya (IBM)" To: linkmauve@linkmauve.fr, ojeda@kernel.org, boqun.feng@gmail.com, gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org, a.hindborg@kernel.org, aliceryhl@google.com, tmgross@umich.edu, dakr@kernel.org, corbet@lwn.net, maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com, chleroy@kernel.org, peterz@infradead.org, jpoimboe@kernel.org, jbaron@akamai.com, rostedt@goodmis.org, ardb@kernel.org, rust-for-linux@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Cc: "Mukesh Kumar Chaurasiya (IBM)" Subject: [PATCH V3 3/3] powerpc: Enable Rust for ppc64le Date: Thu, 5 Feb 2026 23:34:29 +0530 Message-ID: <20260205180429.3280657-4-mkchauras@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260205180429.3280657-1-mkchauras@gmail.com> References: <20260205180429.3280657-1-mkchauras@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 =3D "he= llo, world" [ 843.410977] rust_print: Arc says 42 [ 843.410979] rust_print: Arc 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 Tested-by: Link Mauve Reviewed-by: Christophe Leroy (CS GROUP) Signed-off-by: Mukesh Kumar Chaurasiya (IBM) --- 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 +=3D $(objtree)/arch/powerpc/lib/crtsavres.o endif =20 -KBUILD_RUSTFLAGS +=3D --target=3Dpowerpc-unknown-linux-gnu +ifdef CONFIG_PPC64 +ifdef CONFIG_CPU_LITTLE_ENDIAN +KBUILD_RUSTFLAGS +=3D --target=3Dpowerpc64le-unknown-linux-gnu +endif +KBUILD_RUSTFLAGS +=3D -Ctarget-feature=3D-mma,-vsx,-hard-float,-altivec +else +KBUILD_RUSTFLAGS +=3D --target=3Dpowerpc-unknown-linux-gnu +endif =20 ifdef CONFIG_CPU_LITTLE_ENDIAN KBUILD_CPPFLAGS +=3D -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 :=3D x86_64-linux-gnu BINDGEN_TARGET_arm64 :=3D aarch64-linux-gnu BINDGEN_TARGET_arm :=3D arm-linux-gnueabi BINDGEN_TARGET_loongarch :=3D loongarch64-linux-gnusf + +ifdef CONFIG_PPC64 +ifdef CONFIG_CPU_LITTLE_ENDIAN +BINDGEN_TARGET_powerpc :=3D powerpc64le-linux-gnu +endif +else BINDGEN_TARGET_powerpc :=3D powerpc-linux-gnu +endif + BINDGEN_TARGET_um :=3D $(BINDGEN_TARGET_$(SUBARCH)) BINDGEN_TARGET :=3D $(BINDGEN_TARGET_$(SRCARCH)) =20 --=20 2.52.0