Re: [PATCH v3] riscv: hwprobe: fix has_fpu() to require D extension only

Conor Dooley <[email protected]>
Newsgroups org.infradead.lists.linux-riscv,org.kernel.vger.linux-kernel
Message-ID <20260826-coherent-foe-41863a83bc80@spud>
On Wed, Aug 26, 2026 at 07:53:05AM +0200, Andreas Schwab wrote:
> On Aug 25 2026, Ivy Lopez wrote:
> 
> > The kernel never supports F without D, since D depends on F. As such,
>                             D without F

|The kernel never supports F without D, since D depends on F. As such,
|has_fpu() checking either extension with '||' is incorrect: it
|reports FPU support when only F is present, which is not sufficient
|for D-dependent state save/restore, and weakens
|RISCV_HWPROBE_IMA_FD semantics to "F or D" instead of "F and D".

Thinking about it, this whole thing really is not right.

> The kernel never supports F without D

This is actually correct, the kernel itself doesn't support doing this.

> since D depends on F

But this is not the rationale, the rationale is simplicity of
implementation etc.

> As such,
> has_fpu() checking either extension with '||' is incorrect: it
> reports FPU support when only F is present, which is not sufficient

And this cannot happen, because the kernel will not enable F support if D
is not present, it clears the relevant flag during devicetree/acpi
parsing.

> for D-dependent state save/restore, and weakens
> RISCV_HWPROBE_IMA_FD semantics to "F or D" instead of "F and D".

The reason I would cite for changing the is matching the expectations
set elsewhere in the kernel, rather than impact on userspace or
behaviour, since F without D is not possible so there's no potential
impact here at all.

Cheers,
Conor.

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCao6srAAKCRB4tDGHoIJi
0iABAQC7qU1KJAa0TNawlU7Zt7hFd/iodzc7RI1QT19YcqvKtwEAsG8sUebC6w8O
0RcbM2eEtgPYhDRzz9r4+C78M/8psQE=
=9uBQ
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.