From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 3AD3A38E5FE for ; Mon, 6 Apr 2026 20:02:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775505763; cv=none; b=QvAZXrItX4JQg1JKJ9a1R+gPNLxozKFlopFuKeS95vUCy/u2dnLndz0lDgjHvELSmtz4reDsDvDCuLSFsArmtCiN3W6w+JA8YI+++hWe84HSZLSvBiTp7zcE++0MQJHtd9yYPBsgGgx7MnhqmgRCLmBYLYYIIm9SYvVmAPYJohc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775505763; c=relaxed/simple; bh=pZYgWqinwCi2XlavtGMuYp6nbKIMJVmgtA/tr2/njSY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RCn1k9h1Qtz/UXCjndaTR6H2CnnxMW+Icli0hVEAa8TEqaSkAakvwzz1zU4FRlcbvZIwzxT5Svhn66yv7zq2KrRpzbUZgTW0qwCL1kCIlcKWKvXjFZPPvqy+PMFkUbMFlCDcOGiozwmsq7qGgYVbch2iJv901D4sH8s8xPG+Gto= 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=X5nJoJCm; arc=none smtp.client-ip=209.85.214.178 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="X5nJoJCm" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-2b256a4c6b5so25508215ad.0 for ; Mon, 06 Apr 2026 13:02:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775505761; x=1776110561; 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=d2r7y3l0YoAacVN6N8CSzvUk5PKNLzqAsC5O2toHlyY=; b=X5nJoJCmyMlzuvST2f5G/lWWLk5i3P++G9QmjfI5SyPoP2xb5nUSAuqDBHtcOzUZ58 35i0jWy9fIgUMiZgVm6BKPEYowdEK8KFlbyGHW4xm6O73GUveSUJbTRvvRuTVbvzuFUd SnwgIuST8gc08Lj8waMM90ss+XxcIWPf74KUcvt/D3SykrG5JBXuuelIHZ1cpl4UAyuy 2/ZJ5xCgje4knIyQh7a2tJ3/Rp1JXIIyefo9sicN1vB34lkdyr9eUxcjetn+m22IG94L uf5g7MjNcg04rMhjYieljxKlMff+Y4MC45qkzHW6k2Gb1D7RxVRM1SJo8/3RZntMT+1v eXGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775505761; x=1776110561; 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=d2r7y3l0YoAacVN6N8CSzvUk5PKNLzqAsC5O2toHlyY=; b=DetPTio5IhprM28HcQ/SkNE8qpUSEm5uOAhz12uC2wX6Sl2m/fSF26NqzU8YUIZd88 c4bjeWDZ2ac5TfKyMuaDllNRHAFUlNSKY8t4vC/WM15HV1oLfvJcRy3OBroHUeF4sAvH s/cwNwKXLEeToKGHWGypiNOo3bxaFm31UJWWzmpc0Bfe4qb1P38iIz+Lk/epHVZQfUH4 m1at7PRUftcYxQQQgfLjpjeMJEA3hrypyTclUEKpcIVAYG2WmhbYMddpi3bBJT3/+ys0 LhltYyaJwF3PC3doa7/ms3DoaR6wR3Y8KtGSKHwzJdUQsn/aubC+bF4L9F9fXvIxiPg5 PXmg== X-Forwarded-Encrypted: i=1; AJvYcCXKef2UiGXeKQeJnTXIloJQpWmut3bpYX4r9GYC4qNmZoerfq9H/FpAo0Fw/2bwgbtAYDZVEhvtnqHc96XLTw==@vger.kernel.org X-Gm-Message-State: AOJu0YwZRfnfzhHuR4Gdy2cTjES8X3+Wa0rttUzWv9S8pBZcO4OHmq30 Y8lfUAthXn8HPboOeFvgcZ6NqDl6HoK6UTl56sdGfwGwR84F88PnlaJO X-Gm-Gg: AeBDieuh65ePPxoJWbQ3tif+DxOXYM9JNGheBniyiBREjcK5rZ80DCmvJY3vLMp9h8G fyui6Xyh2M3OERqkiDm14E3XA2+ft3gyJB3fZ7GEowfS0vecCs/CrKyfiA1WTzbR+vmiYxgz71o C3m+OVx0eMTxQTlmDA9jSICe8IQZRUSuLr99DI47EwPtzUk2Y4nkTpI9BIpzypjUKKx9zM0HQPu 8bhacaqjC64hXrz8l8QkjyRnephJ4gO0LXhNTJX7DVLDG8JYOfxKw5h80sROMK5Y7oaQWbQGSJ3 sVF6JpdfUN3gTHfMHcm7h9QFwS/3eTX8I/8nr3Gir4lOwqx5hqGLVceGrW5aHp+zf/CwxLieAOa Sr18rh5VzGJA5mkudpLiUAqOOYrZm9zFTzvKpbymIy5t+rEeTGQmmonLyVgHx2L+hRQnzkRygQ/ HAHimq4P0v8X8uVlb3G8Aph9ngcLMlPNB3Oa0WOb7PBgJBvDWwPYCVX1jHSKEd6JatefqbRdmBd ec= X-Received: by 2002:a17:903:2ac5:b0:2b2:42da:25cc with SMTP id d9443c01a7336-2b28163ad55mr150030455ad.1.1775505761363; Mon, 06 Apr 2026 13:02:41 -0700 (PDT) Received: from li-1a3e774c-28e4-11b2-a85c-acc9f2883e29.ibm.com.com ([106.51.160.44]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b27497af26sm151098205ad.49.2026.04.06.13.02.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Apr 2026 13:02:41 -0700 (PDT) From: "Mukesh Kumar Chaurasiya (IBM)" 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)" , Link Mauve , Venkat Rao Bagalkote Subject: [PATCH V10 4/4] powerpc: Enable Rust for ppc64le Date: Tue, 7 Apr 2026 01:31:49 +0530 Message-ID: <20260406200149.3727922-5-mkchauras@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260406200149.3727922-1-mkchauras@gmail.com> References: <20260406200149.3727922-1-mkchauras@gmail.com> Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 says 42 [ 0.271130] rust_print: Arc 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 Tested-by: Link Mauve Reviewed-by: Christophe Leroy (CS GROUP) Tested-by: Venkat Rao Bagalkote 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) --- 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 e53cb16c06c1..e106d6feb8da 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -413,7 +413,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