From patchwork Tue Apr 9 17:25:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Conor Dooley X-Patchwork-Id: 13622990 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 63D75CD128A for ; Tue, 9 Apr 2024 17:25:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=1Lr6YLFb4DWGY1W0wPwSHfomq6HqeKxeoTGqSXDIk7o=; b=VsHVfU/8HI4DlQ L+MtrYDWazzBVHFqqzvyN6xfNgPjfO1HhCDhwonvFTcXr4HRaOenxXw3GttRxOyBhQTiTZIQkONKo cGl4ybhv4/v+PxtGjqbPzgUmUT2BYvZ+MleO1xCoJxt0Hu+Nfa/WBd0KrcGwt0pHhbiHIt6IMqc3U 9QH5DMA2Zp9sEYjqzAT97/zH9QMT3t7eIMgAy+ietKacbpF02HmJQ8LtldctDaIclMq6ElExycrn8 XfQr87mvCUgXgXjPM7AtCa4R3rkm4dzCuzFfTq9w3ok3QhFJ1PtjTaa5Akwzbu/6WiFIwQ8ml40uw auyDJmW/sP7tPBqm5zEw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruFDr-000000038iI-3tW3; Tue, 09 Apr 2024 17:25:27 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruFDn-000000038hN-2ksW for linux-riscv@lists.infradead.org; Tue, 09 Apr 2024 17:25:25 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id E869361694; Tue, 9 Apr 2024 17:25:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1450CC433F1; Tue, 9 Apr 2024 17:25:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712683522; bh=Z7G26vJ7drjhQBqY768GVlza2RGDKJV6xJzSOxOV+Ac=; h=From:To:Cc:Subject:Date:From; b=FtJpo53NtrsGi0x7/1DjifT6PbQ15bJ7LWhF0g/Hx+vT8eKEcS/ZCx2Cmb6mVgzja lg3s6b0HjfMK0I0K4/ZtBW1quMJTMna+WqxR1MYR2SHNTn22vT8g3flWIUHSZANvoo oxhp32sdJ1ETlfK+9F3s2LgUX3Ma5N0sF4yvXLyiteN/CJ08MyYSHQXX+3AioLSs9l YAnf84ILVJr6jsi0v9CUycXXvcJRIUdY670pH4cZPAJe4cA9tQ1HRgVLR9bksHmQJE ONVIS5XbnArcoDXpnGjALyOIgJapzffN9acXMW4Jj9CccObKivFpP18BqHp7L2yvz1 hK9TMdkBLarDw== From: Conor Dooley To: linux-riscv@lists.infradead.org Cc: conor@kernel.org, Conor Dooley , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Nathan Chancellor , Nick Desaulniers , rust-for-linux@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH v3 0/1] RISC-V: enable rust Date: Tue, 9 Apr 2024 18:25:15 +0100 Message-ID: <20240409-unsaddle-skittle-c93eb77732bb@spud> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2917; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=jBURk0m47eQdKCm4nsBSeG1Pgaujx2S3yr8amWAalEA=; b=owGbwMvMwCFWscWwfUFT0iXG02pJDGmilb/fpZtkTudRfTNRPWJyUuKBlfHWbe1qz/7HOzzr+ vWEQXprRykLgxgHg6yYIkvi7b4WqfV/XHY497yFmcPKBDKEgYtTACbSz8Dw38UquCjqvY73ndsO zGF/f/u//lDq2+rdPOmcC8OpKLXYCob/aa1ad8KXBRkkiD6OjTqRZCgS/Wy3hI6AxpPb937Uusz gBgA= X-Developer-Key: i=conor.dooley@microchip.com; a=openpgp; fpr=F9ECA03CF54F12CD01F1655722E2C55B37CF380C X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240409_102523_909352_AE8B5EE1 X-CRM114-Status: GOOD ( 17.42 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org From: Conor Dooley I've intentionally not turned on the gcc support, as discussed on v1. I've also switched over to using the target, but it is a bit heavier than the one arm64 seems to be using. RISC-V has fewer targets available and this was the closest. I preserved the redzone disabling, just moved into the Makefile. Any comment from Gary or the LLVM lads on the target would be great I think: https://github.com/rust-lang/rust/blob/master/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_none_elf.rs arm64 is using: https://github.com/rust-lang/rust/blob/master/compiler/rustc_target/src/spec/targets/aarch64_unknown_none.rs I was gonna send this yesterday, but found out last minute I had invalid code in the target generation script. The kernel test robot had given my branch the global all-clear - the rust coverage with all the "depends on !FOO" must really limit the build coverage. I built for x86 with rust enabled locally this time to make sure.. As this as lifted from the state of the Rust-for-Linux tree, the commit messages from there cannot be preserved, so these patches have commit messages that I wrote. I've tested this on Icicle, and the modules seem to work as expected. Unfortunately there appear to be implicit 32-bit divisions (or similar) in core Rust code, so, as in the downstream Rust-for-Linux tree, Rust is only enabled for 64-bit. Thanks, Conor. Changes in v3: - Use a builtin target and modify it in kbuild - Drop the kCFI patch, that's been merged independently Changes in v2: - Rebase, since a good bit of time has passed! - Add the extra patch, disabling when CFI_CLANG is enabled. Changes in v1: - rebase on v6.3-rc1 - resort the `um` entry in the arch-support table while adding RISC-V to it - drop 32-bit bits - have another crack at assigning authorship Changes in RFC-RESEND: - fix the asymmetrical additions in the Makefile bits - add cc-cover to my git send-email command... CC: Miguel Ojeda CC: Alex Gaynor CC: Wedson Almeida Filho CC: Boqun Feng CC: Gary Guo CC: Björn Roy Baron CC: Jonathan Corbet CC: Paul Walmsley CC: Palmer Dabbelt CC: Nathan Chancellor CC: Nick Desaulniers CC: rust-for-linux@vger.kernel.org CC: linux-doc@vger.kernel.org CC: linux-kernel@vger.kernel.org CC: linux-riscv@lists.infradead.org CC: llvm@lists.linux.dev Miguel Ojeda (1): RISC-V: enable building 64-bit kernels with rust support Documentation/rust/arch-support.rst | 1 + arch/riscv/Kconfig | 1 + arch/riscv/Makefile | 7 +++++++ scripts/generate_rust_target.rs | 6 ++++++ 4 files changed, 15 insertions(+) Tested-by: Björn Töpel