From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 1A33854723 for ; Sun, 26 Apr 2026 11:01:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777201271; cv=none; b=RGTLCdwOBBNzNqNG0ALwusoHZrCSb5NrGu+Ys+qcdR+aOV+ZSJ0/w6noTvcT6LATaXX6xKpwtxM1dpw5DA9oFlGCRL+kUKO7vz3YwLQC+g4j2laqzBcSLODoFCQtekM2oGvBbaO2jU3Q/bei3I1AFESpbTttfavBuA+OSr2mz1g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777201271; c=relaxed/simple; bh=Y35TwnGeAvMsWCZrToGDNiwgBNmhmSkpO5BQeJbV4PI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eiKXP9ZhUkqEk95XL8dZ5JZPimxVlx49zigkVGb6LM2qsVNMrRgPdyX+ECj7sBgVvzEKC4+GFGoI3M0JtP4rLZ2+Y/3mDsx72MZOwqAG2XjPPMLxvTWyXvJx1yH8aO4ivEyjtfUZwuWEfHO7o05JLPItKE6uduU1iPPYDM666vg= 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=b3dSHFyt; arc=none smtp.client-ip=209.85.214.176 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="b3dSHFyt" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-2a8fba3f769so41411315ad.2 for ; Sun, 26 Apr 2026 04:01:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777201269; x=1777806069; 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=zD1QHbTvqlDponwM5P/F4+a1PSB3+J8FyHG1ndeTEn0=; b=b3dSHFytDwdOWfbCv4RaZMOMETodx8N0wtEiNZTKH2BjTLHUSjZgqhjgPsGiJNoqxQ zCJPiKzaNvn0TgKBc8lnSXyGKR24KHHIleCQvOtQTGEUY8d3b4V27nkl9yAAZCJ8SwUn Q7pZcA8oHof3yq9fTE2OfoL0BMqpzK4/NnTgq7AivA+1R9B1HMdEKzfteSGEa70qpLS6 eSW7re+ZIfRXLpH/cv7WMoElDN66cX7MG1g3wcLMXEYYNa7JDGRCr6KRUB7cfR6EqWZS nGZcf+DRC3ZjmVXUDEJrvzkQQWvY82/0n/1pXgvAedueviiY/Y9/k/KjaQbvbhR8J9De ic8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777201269; x=1777806069; 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=zD1QHbTvqlDponwM5P/F4+a1PSB3+J8FyHG1ndeTEn0=; b=Bi/AZKmJ5onaQSWHsEf5NibdtW3TQx6gsi5vhx0ix5lpG5w5flv4hbRlSL+WcercCw CurDzMEMkJfLYKenM4i1T4z6jTA3NsAPNYWEzwa9ZlvqSySD4lCZpH8jxfFxjQrh8jMG OZjjvUZElTxqTx4+XCPW+Y9nKzwTd7kjQQfheik34hfSfTz6fx7zB7TE9J55z8oLOpr/ ipZZo62awW9uUiDD9qGtezYfSNCWEFL1wPwQ/VawbAxWWM4ymTnh8KRzfjm+UtStyB6r aIno2QCuFdUNGUONk+4rLHP2xWA8xuvPBVkZZyd943ckhxQsPD8Dlc1Sb0+KCVjgsMhT maSw== X-Forwarded-Encrypted: i=1; AFNElJ820BaoZmGmV+Uqz+sdOPHMIbYb75zDj+3AhCUL3vbBtSlRcU7KqSlwoOv0Sskjq/SYJJor6w9ctF4t3/g=@vger.kernel.org X-Gm-Message-State: AOJu0YzlLlq+P5+G+FZ1z4ZZtUOVmBa4I7Bi3zugKb1INz2D79Zo23GK KUbM3EZ1dtstAGWgImrTYsRpLxGOwxChoS0jBecTesLCBwbXoKLVgvQm X-Gm-Gg: AeBDiet0TCubzdrr88NVX0cCHh1CJoo3MxuLMCDE1l5io72LwJIgt84HQmSYfz1Ma7c b1OD/SXjC38S9Gcy3bLDTMsovuVW7J7rE9y8F0GgOXZ+PTdafCcMbBUCKujO8aY69QQCtbohhoq 8Min9P/Pz4ZJPhBGgw5K4Ntk01VvmkMa7BS1TDBJ42dKbkABlCSxI9mWsYV8SvRLBAn9/jyHIG3 KsJtuZxT+QbpVAesGGdqQhrIom+ieOwUtU+v7aj9Iw89bsw6GcFXhjqVUdw54AqiTUuqYvp5Ojq rfuZiy6XDhjdSdpH140lGorbAqibOiCKcuhCGKQaDjFX7oJ03edLtDSqriHCaGSADrUID06G9zH K2EuLRm5N8G6B4wPFxJ6xaTKe3tKk/5FDx5QuuEGxwJ3Cyr8XK8Uy/azCBjkWZYssGKTrt5uvab lc1hH52W72KQ5kBTfsiDAw1NPONNf6DiXUCq/FeJK9ufyANZ3I4VSBeA+Kc7983L0+8V+SryLK0 ViCozUV77rK3UA= X-Received: by 2002:a17:903:2287:b0:2b2:be01:5532 with SMTP id d9443c01a7336-2b5f9fdbb6cmr369613895ad.35.1777201269202; Sun, 26 Apr 2026 04:01:09 -0700 (PDT) Received: from li-1a3e774c-28e4-11b2-a85c-acc9f2883e29.ibm.com.com ([106.51.164.157]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b5faa2f129sm256667235ad.29.2026.04.26.04.00.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Apr 2026 04:01:08 -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, daniel.almeida@collabora.com, fujita.tomonori@gmail.com, viresh.kumar@linaro.org, prafulrai522@gmail.com, gregkh@linuxfoundation.org, arnd@arndb.de, tamird@kernel.org, mark.rutland@arm.com, mkchauras@gmail.com, lyude@redhat.com, lina+kernel@asahilina.net, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, llvm@lists.linux.dev Cc: Link Mauve Subject: [PATCH V15 6/7] rust: Add PowerPC support Date: Sun, 26 Apr 2026 16:29:31 +0530 Message-ID: <20260426105932.2270364-7-mkchauras@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260426105932.2270364-1-mkchauras@gmail.com> References: <20260426105932.2270364-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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Link Mauve 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 Link: https://github.com/Rust-for-Linux/linux/issues/105 Link: https://github.com/linuxppc/issues/issues/451 Acked-by: Gary Guo Signed-off-by: Mukesh Kumar Chaurasiya (IBM) --- arch/powerpc/Kconfig | 1 + arch/powerpc/Makefile | 2 ++ rust/Makefile | 4 +++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index e93df95b79e7..4ac897b650d4 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -285,6 +285,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..589613eaa5dc 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 d70fb186cae9..54096ce8a675 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -400,13 +400,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