All of lore.kernel.org
 help / color / mirror / Atom feed
From: Conor Dooley <conor.dooley@microchip.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: linux-riscv@lists.infradead.org, conor@kernel.org,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Wedson Almeida Filho" <wedsonaf@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Paul Walmsley" <paul.walmsley@sifive.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Nick Desaulniers" <ndesaulniers@google.com>,
	"Tom Rix" <trix@redhat.com>,
	rust-for-linux@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [RFC RESEND 2/2] RISC-V: enable building the 64-bit kernels with rust support
Date: Fri, 24 Feb 2023 15:27:39 +0000	[thread overview]
Message-ID: <Y/jXayJucRFxzJGA@wendy> (raw)
In-Reply-To: <Y/jQSUpXH5XwQTqg@dev-arch.thelio-3990X>

[-- Attachment #1: Type: text/plain, Size: 3175 bytes --]

On Fri, Feb 24, 2023 at 07:57:13AM -0700, Nathan Chancellor wrote:
> Hi Conor,
> 
> On Fri, Feb 24, 2023 at 01:50:44PM +0000, Conor Dooley wrote:
> > 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
> 
> Just a small drive by comment, you have 'if 64BIT' here...
> 
> >  	select HAVE_STACKPROTECTOR
> >  	select HAVE_SYSCALL_TRACEPOINTS
> >  	select IRQ_DOMAIN
> > diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
> > index 76989561566b..0d6fc4e25221 100644
> > --- a/arch/riscv/Makefile
> > +++ b/arch/riscv/Makefile
> > @@ -29,8 +29,8 @@ ifeq ($(CONFIG_ARCH_RV64I),y)
> >  
> >  	KBUILD_CFLAGS += -mabi=lp64
> >  	KBUILD_AFLAGS += -mabi=lp64
> > -
> >  	KBUILD_LDFLAGS += -melf64lriscv
> > +	KBUILD_RUSTFLAGS += -Ctarget-cpu=generic-rv64
> >  else
> >  	BITS := 32
> >  	UTS_MACHINE := riscv32
> > @@ -38,6 +38,7 @@ else
> >  	KBUILD_CFLAGS += -mabi=ilp32
> >  	KBUILD_AFLAGS += -mabi=ilp32
> >  	KBUILD_LDFLAGS += -melf32lriscv
> > +	KBUILD_RUSTFLAGS += -Ctarget-cpu=generic-rv32
> 
> but also add KBUILD_RUSTFLAGS for the !64BIT case. Seems like one of
> those can be removed.

Yeah & it's ditto for the rv32 handling in 1/2 as well. Ideally there
wouldn't be implicit 64-bit division and the "if 64BIT" could go
away. I just left things as-lifted, but I'll go drop anything 32-bit
related if this series looses the RFC prefix ;)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Conor Dooley <conor.dooley@microchip.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: linux-riscv@lists.infradead.org, conor@kernel.org,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Wedson Almeida Filho" <wedsonaf@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Paul Walmsley" <paul.walmsley@sifive.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Nick Desaulniers" <ndesaulniers@google.com>,
	"Tom Rix" <trix@redhat.com>,
	rust-for-linux@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [RFC RESEND 2/2] RISC-V: enable building the 64-bit kernels with rust support
Date: Fri, 24 Feb 2023 15:27:39 +0000	[thread overview]
Message-ID: <Y/jXayJucRFxzJGA@wendy> (raw)
In-Reply-To: <Y/jQSUpXH5XwQTqg@dev-arch.thelio-3990X>


[-- Attachment #1.1: Type: text/plain, Size: 3175 bytes --]

On Fri, Feb 24, 2023 at 07:57:13AM -0700, Nathan Chancellor wrote:
> Hi Conor,
> 
> On Fri, Feb 24, 2023 at 01:50:44PM +0000, Conor Dooley wrote:
> > 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
> 
> Just a small drive by comment, you have 'if 64BIT' here...
> 
> >  	select HAVE_STACKPROTECTOR
> >  	select HAVE_SYSCALL_TRACEPOINTS
> >  	select IRQ_DOMAIN
> > diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
> > index 76989561566b..0d6fc4e25221 100644
> > --- a/arch/riscv/Makefile
> > +++ b/arch/riscv/Makefile
> > @@ -29,8 +29,8 @@ ifeq ($(CONFIG_ARCH_RV64I),y)
> >  
> >  	KBUILD_CFLAGS += -mabi=lp64
> >  	KBUILD_AFLAGS += -mabi=lp64
> > -
> >  	KBUILD_LDFLAGS += -melf64lriscv
> > +	KBUILD_RUSTFLAGS += -Ctarget-cpu=generic-rv64
> >  else
> >  	BITS := 32
> >  	UTS_MACHINE := riscv32
> > @@ -38,6 +38,7 @@ else
> >  	KBUILD_CFLAGS += -mabi=ilp32
> >  	KBUILD_AFLAGS += -mabi=ilp32
> >  	KBUILD_LDFLAGS += -melf32lriscv
> > +	KBUILD_RUSTFLAGS += -Ctarget-cpu=generic-rv32
> 
> but also add KBUILD_RUSTFLAGS for the !64BIT case. Seems like one of
> those can be removed.

Yeah & it's ditto for the rv32 handling in 1/2 as well. Ideally there
wouldn't be implicit 64-bit division and the "if 64BIT" could go
away. I just left things as-lifted, but I'll go drop anything 32-bit
related if this series looses the RFC prefix ;)

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

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

  reply	other threads:[~2023-02-24 15:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24 13:50 [RFC RESEND 0/2] RISC-V: enable rust Conor Dooley
2023-02-24 13:50 ` Conor Dooley
2023-02-24 13:50 ` [RFC RESEND 1/2] scripts: generate_rust_target: enable building on RISC-V Conor Dooley
2023-02-24 13:50   ` Conor Dooley
2023-02-24 13:50 ` [RFC RESEND 2/2] RISC-V: enable building the 64-bit kernels with rust support Conor Dooley
2023-02-24 13:50   ` Conor Dooley
2023-02-24 14:57   ` Nathan Chancellor
2023-02-24 14:57     ` Nathan Chancellor
2023-02-24 15:27     ` Conor Dooley [this message]
2023-02-24 15:27       ` Conor Dooley
2023-02-24 20:45   ` Miguel Ojeda
2023-02-24 20:45     ` Miguel Ojeda
2023-02-24 21:03     ` Conor Dooley
2023-02-24 21:03       ` Conor Dooley

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=Y/jXayJucRFxzJGA@wendy \
    --to=conor.dooley@microchip.com \
    --cc=alex.gaynor@gmail.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=conor@kernel.org \
    --cc=corbet@lwn.net \
    --cc=gary@garyguo.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=ojeda@kernel.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=trix@redhat.com \
    --cc=wedsonaf@gmail.com \
    /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.