[PATCH] riscv: hwprobe: require both F and D extensions for RISCV_HWPROBE_IMA_FD
Conor Dooley
conor at kernel.org
Tue Aug 18 02:45:34 PDT 2026
On Mon, Aug 17, 2026 at 03:15:07PM -0600, Ivy Lopez wrote:
> On Mon, Aug 17, 2026 at 03:14:36PM +0100, Conor Dooley wrote:
> > The kernel never supports F without D, so this cannot occur.
> > riscv_isa_extension_available(NULL, f) always returns false if D is not
> > also present.
> >
> > If anything, the code in has_fpu() should be changed to only check D and
> > not F to match expectations elsewhere, or F and D for the same reason.
>
> Ah ok, thanks for the clarification.. I hadn't realized F-without-D is
> already structurally impossible here, so this patch doesn't change
> actual behavior.
>
> Would you prefer a v2 that fixes has_fpu() instead (checking D only,
> or F && D, whichever matches the intended semantics elsewhere), or
> would you rather I just drop this patch since RISCV_HWPROBE_IMA_FD already
> behaves correctly in practice?
>
> Happy to send whichever you'd find useful!
I think I would rather see has_fpu() get changed. I think checking
either D only (ideally with a comment explaining why that's correct to
do) or checking both are equally valid, which to do is up to you.
I don't think there's really any other equivalents to this has_fpu()
code because anything that would do it just calls has_fpu() instead!
The closest thing to it that I found is code in cpufeature.c that only
checks D (with comments), but that code is part of the wider extension
parsing logic that where the block on F without D happens in the first
place, so it may not be the best example.
In the future, when replying, please try to keep more than just one mail
of context, to make it easier for people to follow the conversation if
this is the only mail they read or if they forgot exactly what was going
on in the previous ones.
Cheers,
Conor.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-riscv/attachments/20260818/c821d8d0/attachment.sig>
More information about the linux-riscv
mailing list