All of lore.kernel.org
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: "Clément Léger" <cleger@rivosinc.com>
Cc: linux-riscv@lists.infradead.org,
	Conor Dooley <conor.dooley@microchip.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Andy Chiu <andybnac@gmail.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC v1 2/5] RISC-V: add f & d extension validation checks
Date: Thu, 3 Oct 2024 11:57:08 +0100	[thread overview]
Message-ID: <20241003-flagship-agreeably-5df992b50618@spud> (raw)
In-Reply-To: <6b735be2-93d2-4cc2-b690-438f6e71cf0b@rivosinc.com>


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

On Thu, Oct 03, 2024 at 09:49:51AM +0200, Clément Léger wrote:
> 
> 
> On 02/10/2024 18:10, Conor Dooley wrote:
> > From: Conor Dooley <conor.dooley@microchip.com>
> > 
> > Using Clement's new validation callbacks, support checking that
> > dependencies have been satisfied for the floating point extensions.
> > 
> > The check for "d" might be slightly confusingly shorter than that of "f",
> > despite "d" depending on "f". This is because the requirement that a
> > hart supporting double precision must also support single precision,
> > should be validated by dt-bindings etc, not the kernel but lack of
> > support for single precision only is a limitation of the kernel.
> > 
> > Since vector will now be disabled proactively, there's no need to clear
> > the bit in elf_hwcap in riscv_fill_hwcap() any longer.
> > 
> > Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
> > ---
> >  arch/riscv/kernel/cpufeature.c | 36 +++++++++++++++++++++++-----------
> >  1 file changed, 25 insertions(+), 11 deletions(-)
> > 
> > diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c
> > index 84a2ad2581cb0..b8a22ee76c2ef 100644
> > --- a/arch/riscv/kernel/cpufeature.c
> > +++ b/arch/riscv/kernel/cpufeature.c
> > @@ -101,6 +101,29 @@ static int riscv_ext_zicboz_validate(const struct riscv_isa_ext_data *data,
> >  	return 0;
> >  }
> >  
> > +static int riscv_ext_f_validate(const struct riscv_isa_ext_data *data,
> > +				const unsigned long *isa_bitmap)
> > +{
> > +	if (!__riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_d)) {
> > +		pr_warn_once("This kernel does not support systems with F but not D\n");
> > +		return -EINVAL;
> > +	}
> > +
> > +	if (IS_ENABLED(CONFIG_FPU))
> > +		return -EINVAL;
> 
> Shouldn't this be !IS_ENABLED(CONFIG_FPU)) ? I mean, if the f extension
> is enabled but not CONFIG_FPU, then disable it.

Of course. I wonder how my userspace didn't blow up.

[-- 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

WARNING: multiple messages have this Message-ID (diff)
From: Conor Dooley <conor@kernel.org>
To: "Clément Léger" <cleger@rivosinc.com>
Cc: linux-riscv@lists.infradead.org,
	Conor Dooley <conor.dooley@microchip.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Andy Chiu <andybnac@gmail.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC v1 2/5] RISC-V: add f & d extension validation checks
Date: Thu, 3 Oct 2024 11:57:08 +0100	[thread overview]
Message-ID: <20241003-flagship-agreeably-5df992b50618@spud> (raw)
In-Reply-To: <6b735be2-93d2-4cc2-b690-438f6e71cf0b@rivosinc.com>

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

On Thu, Oct 03, 2024 at 09:49:51AM +0200, Clément Léger wrote:
> 
> 
> On 02/10/2024 18:10, Conor Dooley wrote:
> > From: Conor Dooley <conor.dooley@microchip.com>
> > 
> > Using Clement's new validation callbacks, support checking that
> > dependencies have been satisfied for the floating point extensions.
> > 
> > The check for "d" might be slightly confusingly shorter than that of "f",
> > despite "d" depending on "f". This is because the requirement that a
> > hart supporting double precision must also support single precision,
> > should be validated by dt-bindings etc, not the kernel but lack of
> > support for single precision only is a limitation of the kernel.
> > 
> > Since vector will now be disabled proactively, there's no need to clear
> > the bit in elf_hwcap in riscv_fill_hwcap() any longer.
> > 
> > Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
> > ---
> >  arch/riscv/kernel/cpufeature.c | 36 +++++++++++++++++++++++-----------
> >  1 file changed, 25 insertions(+), 11 deletions(-)
> > 
> > diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c
> > index 84a2ad2581cb0..b8a22ee76c2ef 100644
> > --- a/arch/riscv/kernel/cpufeature.c
> > +++ b/arch/riscv/kernel/cpufeature.c
> > @@ -101,6 +101,29 @@ static int riscv_ext_zicboz_validate(const struct riscv_isa_ext_data *data,
> >  	return 0;
> >  }
> >  
> > +static int riscv_ext_f_validate(const struct riscv_isa_ext_data *data,
> > +				const unsigned long *isa_bitmap)
> > +{
> > +	if (!__riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_d)) {
> > +		pr_warn_once("This kernel does not support systems with F but not D\n");
> > +		return -EINVAL;
> > +	}
> > +
> > +	if (IS_ENABLED(CONFIG_FPU))
> > +		return -EINVAL;
> 
> Shouldn't this be !IS_ENABLED(CONFIG_FPU)) ? I mean, if the f extension
> is enabled but not CONFIG_FPU, then disable it.

Of course. I wonder how my userspace didn't blow up.

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

  reply	other threads:[~2024-10-03 10:57 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-02 16:10 [RFC v1 0/5] Add some validation for vector, vector crypto and fp stuff Conor Dooley
2024-10-02 16:10 ` Conor Dooley
2024-10-02 16:10 ` [RFC v1 1/5] RISC-V: add vector crypto extension validation checks Conor Dooley
2024-10-02 16:10   ` Conor Dooley
2024-10-02 16:10 ` [RFC v1 2/5] RISC-V: add f & d " Conor Dooley
2024-10-02 16:10   ` Conor Dooley
2024-10-03  7:49   ` Clément Léger
2024-10-03  7:49     ` Clément Léger
2024-10-03 10:57     ` Conor Dooley [this message]
2024-10-03 10:57       ` Conor Dooley
2024-10-02 16:10 ` [RFC v1 3/5] dt-bindings: riscv: d requires f Conor Dooley
2024-10-02 16:10   ` Conor Dooley
2024-10-03  7:46   ` Clément Léger
2024-10-03  7:46     ` Clément Léger
2024-10-03  9:50   ` Krzysztof Kozlowski
2024-10-03  9:50     ` Krzysztof Kozlowski
2024-10-02 16:10 ` [RFC v1 4/5] dt-bindings: riscv: add vector sub-extension dependencies Conor Dooley
2024-10-02 16:10   ` Conor Dooley
2024-10-03  7:52   ` Clément Léger
2024-10-03  7:52     ` Clément Léger
2024-10-03  9:52   ` Krzysztof Kozlowski
2024-10-03  9:52     ` Krzysztof Kozlowski
2024-10-02 16:10 ` [RFC v1 5/5] dt-bindings: riscv: document vector crypto requirements Conor Dooley
2024-10-02 16:10   ` Conor Dooley
2024-10-03  7:59   ` Clément Léger
2024-10-03  7:59     ` Clément Léger
2024-10-03 11:05     ` Conor Dooley
2024-10-03 11:05       ` Conor Dooley
2024-10-03 11:36       ` Clément Léger
2024-10-03 11:36         ` Clément Léger
2024-10-03  9:52   ` Krzysztof Kozlowski
2024-10-03  9:52     ` Krzysztof Kozlowski

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=20241003-flagship-agreeably-5df992b50618@spud \
    --to=conor@kernel.org \
    --cc=andybnac@gmail.com \
    --cc=cleger@rivosinc.com \
    --cc=conor.dooley@microchip.com \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=robh@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.