Documentation/rust/arch-support.rst | 13 +++++++------ arch/loongarch/Kconfig | 1 + arch/loongarch/Makefile | 3 +++ scripts/generate_rust_target.rs | 10 ++++++++++ 4 files changed, 21 insertions(+), 6 deletions(-)
Enable Rust support for the LoongArch architecture. Previous versions: v0: https://lore.kernel.org/loongarch/20240106065941.180796-1-wangrui@loongson.cn/ Changes in v1: - Address htmldocs warning. WANG Rui (2): Documentation: rust: Add a character to the first column LoongArch: Enable initial Rust support Documentation/rust/arch-support.rst | 13 +++++++------ arch/loongarch/Kconfig | 1 + arch/loongarch/Makefile | 3 +++ scripts/generate_rust_target.rs | 10 ++++++++++ 4 files changed, 21 insertions(+), 6 deletions(-) -- 2.43.0
Hi, Thanks for the patch. On Mon, Jan 08, 2024 at 11:21:15AM +0800, WANG Rui wrote: > Enable Rust support for the LoongArch architecture. > Could you share how you build and test? For example, I wonder the clang or gcc version you used and bindgen version you used. Thanks. Regards, Boqun > Previous versions: > v0: https://lore.kernel.org/loongarch/20240106065941.180796-1-wangrui@loongson.cn/ > > Changes in v1: > - Address htmldocs warning. > > WANG Rui (2): > Documentation: rust: Add a character to the first column > LoongArch: Enable initial Rust support > > Documentation/rust/arch-support.rst | 13 +++++++------ > arch/loongarch/Kconfig | 1 + > arch/loongarch/Makefile | 3 +++ > scripts/generate_rust_target.rs | 10 ++++++++++ > 4 files changed, 21 insertions(+), 6 deletions(-) > > -- > 2.43.0 >
Hi Boqun, On Wed, Jan 10, 2024 at 3:35 AM Boqun Feng <boqun.feng@gmail.com> wrote: > > Hi, > > Thanks for the patch. > > On Mon, Jan 08, 2024 at 11:21:15AM +0800, WANG Rui wrote: > > Enable Rust support for the LoongArch architecture. > > > > Could you share how you build and test? For example, I wonder the clang > or gcc version you used and bindgen version you used. Thanks. You are welcome! The versions I'm using are listed in scripts/min-tool-version.sh, and I have tested Rust samples and the rnull block driver. llvm: main branch (ea3c7b3397f8de8e885ea7cd1ed5138ec4a72d50) rustc: 1.74.1 bindgen: 0.65.1 Here are the build steps: 1. Build llvm 2. Install rust, rust-src (using rustup) and bindgen 3. Build kernel For more details, refer to Documentation/rust/quick-start.rst; there is nothing special about it. Regards, Rui > > Regards, > Boqun > > > Previous versions: > > v0: https://lore.kernel.org/loongarch/20240106065941.180796-1-wangrui@loongson.cn/ > > > > Changes in v1: > > - Address htmldocs warning. > > > > WANG Rui (2): > > Documentation: rust: Add a character to the first column > > LoongArch: Enable initial Rust support > > > > Documentation/rust/arch-support.rst | 13 +++++++------ > > arch/loongarch/Kconfig | 1 + > > arch/loongarch/Makefile | 3 +++ > > scripts/generate_rust_target.rs | 10 ++++++++++ > > 4 files changed, 21 insertions(+), 6 deletions(-) > > > > -- > > 2.43.0 > > >
On Wed, Jan 10, 2024 at 09:41:38AM +0800, WANG Rui wrote: > Hi Boqun, > > On Wed, Jan 10, 2024 at 3:35 AM Boqun Feng <boqun.feng@gmail.com> wrote: > > > > Hi, > > > > Thanks for the patch. > > > > On Mon, Jan 08, 2024 at 11:21:15AM +0800, WANG Rui wrote: > > > Enable Rust support for the LoongArch architecture. > > > > > > > Could you share how you build and test? For example, I wonder the clang > > or gcc version you used and bindgen version you used. Thanks. > > You are welcome! The versions I'm using are listed in > scripts/min-tool-version.sh, and I have tested Rust samples and the > rnull block driver. > > llvm: main branch (ea3c7b3397f8de8e885ea7cd1ed5138ec4a72d50) This means the LLVM support is yet to release? Or does LLVM 17 also work? Regards, Boqun > rustc: 1.74.1 > bindgen: 0.65.1 > > Here are the build steps: > > 1. Build llvm > 2. Install rust, rust-src (using rustup) and bindgen > 3. Build kernel > > For more details, refer to Documentation/rust/quick-start.rst; there > is nothing special about it. > > Regards, > Rui > > > > > Regards, > > Boqun > > > > > Previous versions: > > > v0: https://lore.kernel.org/loongarch/20240106065941.180796-1-wangrui@loongson.cn/ > > > > > > Changes in v1: > > > - Address htmldocs warning. > > > > > > WANG Rui (2): > > > Documentation: rust: Add a character to the first column > > > LoongArch: Enable initial Rust support > > > > > > Documentation/rust/arch-support.rst | 13 +++++++------ > > > arch/loongarch/Kconfig | 1 + > > > arch/loongarch/Makefile | 3 +++ > > > scripts/generate_rust_target.rs | 10 ++++++++++ > > > 4 files changed, 21 insertions(+), 6 deletions(-) > > > > > > -- > > > 2.43.0 > > > > > >
On Wed, Jan 10, 2024 at 10:09 AM Boqun Feng <boqun.feng@gmail.com> wrote: > > On Wed, Jan 10, 2024 at 09:41:38AM +0800, WANG Rui wrote: > > Hi Boqun, > > > > On Wed, Jan 10, 2024 at 3:35 AM Boqun Feng <boqun.feng@gmail.com> wrote: > > > > > > Hi, > > > > > > Thanks for the patch. > > > > > > On Mon, Jan 08, 2024 at 11:21:15AM +0800, WANG Rui wrote: > > > > Enable Rust support for the LoongArch architecture. > > > > > > > > > > Could you share how you build and test? For example, I wonder the clang > > > or gcc version you used and bindgen version you used. Thanks. > > > > You are welcome! The versions I'm using are listed in > > scripts/min-tool-version.sh, and I have tested Rust samples and the > > rnull block driver. > > > > llvm: main branch (ea3c7b3397f8de8e885ea7cd1ed5138ec4a72d50) > > This means the LLVM support is yet to release? Or does LLVM 17 also > work? LLVM 17 doesn't work. The minimum LLVM version required for LoongArch is 18.0.0. This is the reason why we have updated the scripts/min-tool-version.sh. [1] [1] https://lore.kernel.org/loongarch/20240108033138.217032-1-wangrui@loongson.cn/ Regards, Rui > > Regards, > Boqun > > > rustc: 1.74.1 > > bindgen: 0.65.1 > > > > Here are the build steps: > > > > 1. Build llvm > > 2. Install rust, rust-src (using rustup) and bindgen > > 3. Build kernel > > > > For more details, refer to Documentation/rust/quick-start.rst; there > > is nothing special about it. > > > > Regards, > > Rui > > > > > > > > Regards, > > > Boqun > > > > > > > Previous versions: > > > > v0: https://lore.kernel.org/loongarch/20240106065941.180796-1-wangrui@loongson.cn/ > > > > > > > > Changes in v1: > > > > - Address htmldocs warning. > > > > > > > > WANG Rui (2): > > > > Documentation: rust: Add a character to the first column > > > > LoongArch: Enable initial Rust support > > > > > > > > Documentation/rust/arch-support.rst | 13 +++++++------ > > > > arch/loongarch/Kconfig | 1 + > > > > arch/loongarch/Makefile | 3 +++ > > > > scripts/generate_rust_target.rs | 10 ++++++++++ > > > > 4 files changed, 21 insertions(+), 6 deletions(-) > > > > > > > > -- > > > > 2.43.0 > > > > > > > > > > -- WANG Rui
On Wed, Jan 10, 2024 at 3:49 AM WANG Rui <wangrui@loongson.cn> wrote: > > LLVM 17 doesn't work. The minimum LLVM version required for LoongArch > is 18.0.0. This is the reason why we have updated the > scripts/min-tool-version.sh. [1] > > [1] https://lore.kernel.org/loongarch/20240108033138.217032-1-wangrui@loongson.cn/ Thanks! Is this targeted at 6.9? Cheers, Miguel
On Wed, Jan 10, 2024 at 6:50 PM Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> wrote: > > On Wed, Jan 10, 2024 at 3:49 AM WANG Rui <wangrui@loongson.cn> wrote: > > > > LLVM 17 doesn't work. The minimum LLVM version required for LoongArch > > is 18.0.0. This is the reason why we have updated the > > scripts/min-tool-version.sh. [1] > > > > [1] https://lore.kernel.org/loongarch/20240108033138.217032-1-wangrui@loongson.cn/ > > Thanks! Is this targeted at 6.9? 6.8 Regards, Rui > > Cheers, > Miguel >
On Thu, Jan 11, 2024 at 4:16 AM WANG Rui <wangrui@loongson.cn> wrote:
>
> 6.8
Thanks, that is quite expedited...
Please `rustfmt` the code to avoid failing the `rustfmtcheck` target.
I see you already created the 6.8 tag but I have not seen it in
linux-next yet and you did not send the PR, so it would be ideal if
you could fix this before it goes to Linus.
diff --git a/scripts/generate_rust_target.rs b/scripts/generate_rust_target.rs
index 3edda6a10..0da52b548 100644
--- a/scripts/generate_rust_target.rs
+++ b/scripts/generate_rust_target.rs
@@ -163,10 +163,7 @@ fn main() {
ts.push("target-pointer-width", "64");
} else if cfg.has("LOONGARCH") {
ts.push("arch", "loongarch64");
- ts.push(
- "data-layout",
- "e-m:e-p:64:64-i64:64-i128:128-n64-S128",
- );
+ ts.push("data-layout", "e-m:e-p:64:64-i64:64-i128:128-n64-S128");
ts.push("features", "-f,-d");
ts.push("llvm-target", "loongarch64-linux-gnusf");
ts.push("llvm-abiname", "lp64s");
Thanks!
Cheers,
Miguel
Hi, Miguel,
On Sun, Jan 14, 2024 at 11:44 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> On Thu, Jan 11, 2024 at 4:16 AM WANG Rui <wangrui@loongson.cn> wrote:
> >
> > 6.8
>
> Thanks, that is quite expedited...
>
> Please `rustfmt` the code to avoid failing the `rustfmtcheck` target.
> I see you already created the 6.8 tag but I have not seen it in
> linux-next yet and you did not send the PR, so it would be ideal if
> you could fix this before it goes to Linus.
>
> diff --git a/scripts/generate_rust_target.rs b/scripts/generate_rust_target.rs
> index 3edda6a10..0da52b548 100644
> --- a/scripts/generate_rust_target.rs
> +++ b/scripts/generate_rust_target.rs
> @@ -163,10 +163,7 @@ fn main() {
> ts.push("target-pointer-width", "64");
> } else if cfg.has("LOONGARCH") {
> ts.push("arch", "loongarch64");
> - ts.push(
> - "data-layout",
> - "e-m:e-p:64:64-i64:64-i128:128-n64-S128",
> - );
> + ts.push("data-layout", "e-m:e-p:64:64-i64:64-i128:128-n64-S128");
> ts.push("features", "-f,-d");
> ts.push("llvm-target", "loongarch64-linux-gnusf");
> ts.push("llvm-abiname", "lp64s");
>
> Thanks!
Thank you for your suggestion, but since this will be replaced by the
built-in target soon, and I don't want to change the tag to make Linus
unhappy. Let's leave it as is.
Huacai
>
> Cheers,
> Miguel
On Mon, Jan 15, 2024 at 4:23 AM Huacai Chen <chenhuacai@kernel.org> wrote: > > Thank you for your suggestion, but since this will be replaced by the > built-in target soon, and I don't want to change the tag to make Linus > unhappy. Let's leave it as is. The issue is not a big deal and I appreciate that you made the effort to enable Rust for your architecture. However, please note that we do our best to maintain a clean formatting state for Rust code (i.e. `rustfmt` should be run) and that people may see this in tests/CIs that use the Make target. I don't think Linus would mind too much, and you could point him to this email if you want (or you could put the fix on top); but if you really want to keep the tag as-is, then we should consider it as a fix for this cycle, i.e. we should not wait for e.g. the next cycle for the built-in target. Could you please send it through your tree as soon as possible? Cheers, Miguel
Hi, Miguel, On Tue, Jan 16, 2024 at 12:08 AM Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> wrote: > > On Mon, Jan 15, 2024 at 4:23 AM Huacai Chen <chenhuacai@kernel.org> wrote: > > > > Thank you for your suggestion, but since this will be replaced by the > > built-in target soon, and I don't want to change the tag to make Linus > > unhappy. Let's leave it as is. > > The issue is not a big deal and I appreciate that you made the effort > to enable Rust for your architecture. However, please note that we do > our best to maintain a clean formatting state for Rust code (i.e. > `rustfmt` should be run) and that people may see this in tests/CIs > that use the Make target. > > I don't think Linus would mind too much, and you could point him to > this email if you want (or you could put the fix on top); but if you > really want to keep the tag as-is, then we should consider it as a fix > for this cycle, i.e. we should not wait for e.g. the next cycle for > the built-in target. Could you please send it through your tree as > soon as possible? OK, since Linus said the merge window is paused now, I rebase and retag my tree and the Rust commit is like this, I think this is perfect now? https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson.git/commit/?h=loongarch-next&id=706f9e1ab7c7a58d80ef2c87d8720131253a2256 Huacai > > Cheers, > Miguel
On Tue, Jan 16, 2024 at 10:31 AM Huacai Chen <chenhuacai@kernel.org> wrote: > > OK, since Linus said the merge window is paused now, I rebase and > retag my tree and the Rust commit is like this, I think this is > perfect now? > > https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson.git/commit/?h=loongarch-next&id=706f9e1ab7c7a58d80ef2c87d8720131253a2256 Thanks a lot! That works, yeah. I also took the chance to build LLVM and QEMU and I tested the tag -- it seems to work: I see the samples (built-in) printing in the kernel log :) So in case you end up rebasing for another reason and want to add it, even if it is a simple check I did: Tested-by: Miguel Ojeda <ojeda@kernel.org> Cheers, Miguel
Hi, Miguel, On Tue, Jan 16, 2024 at 11:16 PM Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> wrote: > > On Tue, Jan 16, 2024 at 10:31 AM Huacai Chen <chenhuacai@kernel.org> wrote: > > > > OK, since Linus said the merge window is paused now, I rebase and > > retag my tree and the Rust commit is like this, I think this is > > perfect now? > > > > https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson.git/commit/?h=loongarch-next&id=706f9e1ab7c7a58d80ef2c87d8720131253a2256 > > Thanks a lot! That works, yeah. > > I also took the chance to build LLVM and QEMU and I tested the tag -- > it seems to work: I see the samples (built-in) printing in the kernel > log :) > > So in case you end up rebasing for another reason and want to add it, > even if it is a simple check I did: > > Tested-by: Miguel Ojeda <ojeda@kernel.org> OK, if Xuerui updates this patch, then I will rebase again. https://lore.kernel.org/loongarch/CAAhV-H7KteJvRVpj3Hz-Ui9VnmijcJq5D1Tb-KJvqTO_+jjp2Q@mail.gmail.com/T/#t Huacai > > Cheers, > Miguel
No need to split patches. Huacai On Mon, Jan 8, 2024 at 11:21 AM WANG Rui <wangrui@loongson.cn> wrote: > > Enable Rust support for the LoongArch architecture. > > Previous versions: > v0: https://lore.kernel.org/loongarch/20240106065941.180796-1-wangrui@loongson.cn/ > > Changes in v1: > - Address htmldocs warning. > > WANG Rui (2): > Documentation: rust: Add a character to the first column > LoongArch: Enable initial Rust support > > Documentation/rust/arch-support.rst | 13 +++++++------ > arch/loongarch/Kconfig | 1 + > arch/loongarch/Makefile | 3 +++ > scripts/generate_rust_target.rs | 10 ++++++++++ > 4 files changed, 21 insertions(+), 6 deletions(-) > > -- > 2.43.0 >
Squashed and applied, thanks. Huacai On Mon, Jan 8, 2024 at 12:23 PM Huacai Chen <chenhuacai@kernel.org> wrote: > > No need to split patches. > > Huacai > > On Mon, Jan 8, 2024 at 11:21 AM WANG Rui <wangrui@loongson.cn> wrote: > > > > Enable Rust support for the LoongArch architecture. > > > > Previous versions: > > v0: https://lore.kernel.org/loongarch/20240106065941.180796-1-wangrui@loongson.cn/ > > > > Changes in v1: > > - Address htmldocs warning. > > > > WANG Rui (2): > > Documentation: rust: Add a character to the first column > > LoongArch: Enable initial Rust support > > > > Documentation/rust/arch-support.rst | 13 +++++++------ > > arch/loongarch/Kconfig | 1 + > > arch/loongarch/Makefile | 3 +++ > > scripts/generate_rust_target.rs | 10 ++++++++++ > > 4 files changed, 21 insertions(+), 6 deletions(-) > > > > -- > > 2.43.0 > >
© 2016 - 2025 Red Hat, Inc.