All of lore.kernel.org
 help / color / mirror / Atom feed
From: Conor Dooley <conor.dooley@microchip.com>
To: <linux-riscv@lists.infradead.org>
Cc: Miguel Ojeda <ojeda@kernel.org>, <conor@kernel.org>,
	Conor Dooley <conor.dooley@microchip.com>
Subject: [RFC 2/2] RISC-V: enable building the 64-bit kernels with rust support
Date: Fri, 24 Feb 2023 13:36:10 +0000	[thread overview]
Message-ID: <20230224133609.2877396-3-conor.dooley@microchip.com> (raw)
In-Reply-To: <20230224133609.2877396-1-conor.dooley@microchip.com>

From: Miguel Ojeda <ojeda@kernel.org>

The rust modules work on 64-bit RISC-V, with no twiddling required.
Select HAS_RUST and provide the required flags to kbuild so that the
modules can be used.
32-bit is broken in core rust code, so support is limited to 64-bit
only: ld.lld: error: undefined symbol: __udivdi3

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
---
 Documentation/rust/arch-support.rst | 2 ++
 arch/riscv/Kconfig                  | 1 +
 arch/riscv/Makefile                 | 3 ++-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/Documentation/rust/arch-support.rst b/Documentation/rust/arch-support.rst
index 6982b63775da..197919158596 100644
--- a/Documentation/rust/arch-support.rst
+++ b/Documentation/rust/arch-support.rst
@@ -15,5 +15,7 @@ support corresponds to ``S`` values in the ``MAINTAINERS`` file.
 ============  ================  ==============================================
 Architecture  Level of support  Constraints
 ============  ================  ==============================================
+``riscv``     Maintained        ``rv64`` only.
+============  ================  ==============================================
 ``x86``       Maintained        ``x86_64`` only.
 ============  ================  ==============================================
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 81eb031887d2..73174157212d 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -115,6 +115,7 @@ config RISCV
 	select HAVE_POSIX_CPU_TIMERS_TASK_WORK
 	select HAVE_REGS_AND_STACK_ACCESS_API
 	select HAVE_RSEQ
+	select HAVE_RUST if 64BIT
 	select HAVE_STACKPROTECTOR
 	select HAVE_SYSCALL_TRACEPOINTS
 	select IRQ_DOMAIN
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index 76989561566b..f8b3f58f2e40 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -29,7 +29,7 @@ ifeq ($(CONFIG_ARCH_RV64I),y)
 
 	KBUILD_CFLAGS += -mabi=lp64
 	KBUILD_AFLAGS += -mabi=lp64
-
+	KBUILD_RUSTFLAGS += -Ctarget-cpu=generic-rv64
 	KBUILD_LDFLAGS += -melf64lriscv
 else
 	BITS := 32
@@ -38,6 +38,7 @@ else
 	KBUILD_CFLAGS += -mabi=ilp32
 	KBUILD_AFLAGS += -mabi=ilp32
 	KBUILD_LDFLAGS += -melf32lriscv
+	KBUILD_RUSTFLAGS += -Ctarget-cpu=generic-rv32
 endif
 
 ifeq ($(CONFIG_LD_IS_LLD),y)
-- 
2.39.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  parent reply	other threads:[~2023-02-24 13:37 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24 13:36 [RFC 0/2] RISC-V: enable rust Conor Dooley
2023-02-24 13:36 ` Conor Dooley
2023-02-24 13:36 ` [RFC 1/2] scripts: generate_rust_target: enable building on RISC-V Conor Dooley
2023-02-24 13:36 ` Conor Dooley [this message]
2023-02-24 13:39   ` [RFC 2/2] RISC-V: enable building the 64-bit kernels with rust support Conor Dooley
2023-02-24 20:42 ` [RFC 0/2] RISC-V: enable rust Miguel Ojeda
2023-02-24 20:42   ` Miguel Ojeda
2023-02-24 21:00   ` Conor Dooley
2023-02-24 21:00     ` Conor Dooley
2023-02-24 22:20     ` Miguel Ojeda
2023-02-24 22:20       ` Miguel Ojeda
2023-02-24 22:32       ` Conor Dooley
2023-02-24 22:32         ` Conor Dooley
2023-02-25  8:20         ` Miguel Ojeda
2023-02-25  8:20           ` Miguel Ojeda
2023-02-24 21:31 ` Palmer Dabbelt
2023-02-24 21:31   ` Palmer Dabbelt
2023-02-24 22:38   ` Miguel Ojeda
2023-02-24 22:38     ` Miguel Ojeda
2023-02-24 23:18     ` Palmer Dabbelt
2023-02-24 23:18       ` Palmer Dabbelt
2023-02-25  8:37       ` Miguel Ojeda
2023-02-25  8:37         ` Miguel Ojeda
2023-03-06 19:18         ` Palmer Dabbelt
2023-03-06 19:18           ` Palmer Dabbelt
2023-03-06 19:26           ` Conor Dooley
2023-03-06 19:26             ` Conor Dooley
2023-03-06 19:28           ` Miguel Ojeda
2023-03-06 19:28             ` Miguel Ojeda
2023-03-07  2:20             ` Gary Guo
2023-03-07  2:20               ` Gary Guo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230224133609.2877396-3-conor.dooley@microchip.com \
    --to=conor.dooley@microchip.com \
    --cc=conor@kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=ojeda@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.