diff mbox series

[6/6] linux-yocto.inc: State riscv required tune_features

Message ID 1750040965-15015-7-git-send-email-mark.hatle@kernel.crashing.org
State New
Headers show
Series ISA based RISC-V tune implementation | expand

Commit Message

Mark Hatle June 16, 2025, 2:29 a.m. UTC
From: Mark Hatle <mark.hatle@amd.com>

Required:
   rv32ima_zicsr_zifencei
   rv64ima_zicsr_zifencei

See the arch/riscv/Makefile:

riscv-march-$(CONFIG_ARCH_RV32I)	:= rv32ima
riscv-march-$(CONFIG_ARCH_RV64I)	:= rv64ima
riscv-march-$(CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI) := $(riscv-march-y)_zicsr_zifencei

Signed-off-by: Mark Hatle <mark.hatle@amd.com>
---
 meta/recipes-kernel/linux/linux-yocto.inc | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Bruce Ashfield June 16, 2025, 11:05 a.m. UTC | #1
On Sun, Jun 15, 2025 at 10:29 PM Mark Hatle via lists.openembedded.org
<mark.hatle=kernel.crashing.org@lists.openembedded.org> wrote:

> From: Mark Hatle <mark.hatle@amd.com>
>
> Required:
>    rv32ima_zicsr_zifencei
>    rv64ima_zicsr_zifencei
>
> See the arch/riscv/Makefile:
>
> riscv-march-$(CONFIG_ARCH_RV32I)        := rv32ima
> riscv-march-$(CONFIG_ARCH_RV64I)        := rv64ima
> riscv-march-$(CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI) :=
> $(riscv-march-y)_zicsr_zifencei
>
> Signed-off-by: Mark Hatle <mark.hatle@amd.com>
> ---
>  meta/recipes-kernel/linux/linux-yocto.inc | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/meta/recipes-kernel/linux/linux-yocto.inc
> b/meta/recipes-kernel/linux/linux-yocto.inc
> index cdf2583698..80db85fe89 100644
> --- a/meta/recipes-kernel/linux/linux-yocto.inc
> +++ b/meta/recipes-kernel/linux/linux-yocto.inc
> @@ -51,6 +51,11 @@ SRC_URI_RISCV = "\
>  SRC_URI:append:riscv32 = "${SRC_URI_RISCV}"
>  SRC_URI:append:riscv64 = "${SRC_URI_RISCV}"
>
> +inherit features_check
> +
> +REQUIRED_TUNE_FEATURES:riscv32 = "rv 32 i m a zicsr zifencei"
> +REQUIRED_TUNE_FEATURES:riscv64 = "rv 64 i m a zicsr zifencei"
> +
>

I don't think we should be enforcing this at this level. The kernel has
always been
responsible for setting the compiler options that it requires.  And we
don't check or
otherwise manipulate that from the build system.

What exactly are you trying to enforce / check here ?

Bruce


>  # A KMACHINE is the mapping of a yocto $MACHINE to what is built
>  # by the kernel. This is typically the branch that should be built,
>  # and it can be specific to the machine or shared
> --
> 2.34.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#218760):
> https://lists.openembedded.org/g/openembedded-core/message/218760
> Mute This Topic: https://lists.openembedded.org/mt/113664657/1050810
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> bruce.ashfield@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Mark Hatle June 16, 2025, 2:07 p.m. UTC | #2
On 6/16/25 6:05 AM, Bruce Ashfield wrote:
> 
> 
> On Sun, Jun 15, 2025 at 10:29 PM Mark Hatle via lists.openembedded.org 
> <http://lists.openembedded.org> 
> <mark.hatle=kernel.crashing.org@lists.openembedded.org 
> <mailto:kernel.crashing.org@lists.openembedded.org>> wrote:
> 
>     From: Mark Hatle <mark.hatle@amd.com <mailto:mark.hatle@amd.com>>
> 
>     Required:
>         rv32ima_zicsr_zifencei
>         rv64ima_zicsr_zifencei
> 
>     See the arch/riscv/Makefile:
> 
>     riscv-march-$(CONFIG_ARCH_RV32I)        := rv32ima
>     riscv-march-$(CONFIG_ARCH_RV64I)        := rv64ima
>     riscv-march-$(CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI) :=
>     $(riscv-march-y)_zicsr_zifencei
> 
>     Signed-off-by: Mark Hatle <mark.hatle@amd.com <mailto:mark.hatle@amd.com>>
>     ---
>       meta/recipes-kernel/linux/linux-yocto.inc | 5 +++++
>       1 file changed, 5 insertions(+)
> 
>     diff --git a/meta/recipes-kernel/linux/linux-yocto.inc
>     b/meta/recipes-kernel/linux/linux-yocto.inc
>     index cdf2583698..80db85fe89 100644
>     --- a/meta/recipes-kernel/linux/linux-yocto.inc
>     +++ b/meta/recipes-kernel/linux/linux-yocto.inc
>     @@ -51,6 +51,11 @@ SRC_URI_RISCV = "\
>       SRC_URI:append:riscv32 = "${SRC_URI_RISCV}"
>       SRC_URI:append:riscv64 = "${SRC_URI_RISCV}"
> 
>     +inherit features_check
>     +
>     +REQUIRED_TUNE_FEATURES:riscv32 = "rv 32 i m a zicsr zifencei"
>     +REQUIRED_TUNE_FEATURES:riscv64 = "rv 64 i m a zicsr zifencei"
>     +
> 
> 
> I don't think we should be enforcing this at this level. The kernel has always been
> responsible for setting the compiler options that it requires.  And we don't 
> check or
> otherwise manipulate that from the build system.
> 
> What exactly are you trying to enforce / check here ?

On risc-v there is a minimum risc-v ISA required by Linux,  rv32ima + zicsr + 
zifencei (or rv64ima).  The risc-v spec allows you to configure your CPU in a 
way that may not meet the minimum kernel requirement(s) (especially on FPGA 
based configurable CPUs.)

Since the arch/riscv/Makefile has a minimum requirement specified in it, I added 
the feature check to prevent a long build and eventual runtime failure.  (Since 
the kernel just sets whatever values it uses, you won't get a compilation 
failure, just a failure of "it doesn't boot".)

(As an FYI, looking at how the kernel is configured and works, I doubt that 
there will be a future change to remove the 'm a zicsr and zifencei' 
requirements, the rv32i and rv64i are the base spec 32-bit and 64-bit ISAs.)

--Mark

> Bruce
> 
>       # A KMACHINE is the mapping of a yocto $MACHINE to what is built
>       # by the kernel. This is typically the branch that should be built,
>       # and it can be specific to the machine or shared
>     -- 
>     2.34.1
> 
> 
>     -=-=-=-=-=-=-=-=-=-=-=-
>     Links: You receive all messages sent to this group.
>     View/Reply Online (#218760):
>     https://lists.openembedded.org/g/openembedded-core/message/218760
>     <https://lists.openembedded.org/g/openembedded-core/message/218760>
>     Mute This Topic: https://lists.openembedded.org/mt/113664657/1050810
>     <https://lists.openembedded.org/mt/113664657/1050810>
>     Group Owner: openembedded-core+owner@lists.openembedded.org
>     <mailto:openembedded-core%2Bowner@lists.openembedded.org>
>     Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
>     <https://lists.openembedded.org/g/openembedded-core/unsub>
>     [bruce.ashfield@gmail.com <mailto:bruce.ashfield@gmail.com>]
>     -=-=-=-=-=-=-=-=-=-=-=-
> 
> 
> 
> -- 
> - Thou shalt not follow the NULL pointer, for chaos and madness await thee at 
> its end
> - "Use the force Harry" - Gandalf, Star Trek II
>
diff mbox series

Patch

diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc
index cdf2583698..80db85fe89 100644
--- a/meta/recipes-kernel/linux/linux-yocto.inc
+++ b/meta/recipes-kernel/linux/linux-yocto.inc
@@ -51,6 +51,11 @@  SRC_URI_RISCV = "\
 SRC_URI:append:riscv32 = "${SRC_URI_RISCV}"
 SRC_URI:append:riscv64 = "${SRC_URI_RISCV}"
 
+inherit features_check
+
+REQUIRED_TUNE_FEATURES:riscv32 = "rv 32 i m a zicsr zifencei"
+REQUIRED_TUNE_FEATURES:riscv64 = "rv 64 i m a zicsr zifencei"
+
 # A KMACHINE is the mapping of a yocto $MACHINE to what is built
 # by the kernel. This is typically the branch that should be built,
 # and it can be specific to the machine or shared