[RFC 0/6] Deprecate riscv,isa DT property?

Conor Dooley conor at kernel.org
Fri May 12 16:52:58 PDT 2023


On Fri, May 12, 2023 at 04:20:43PM -0700, Atish Patra wrote:
> On Fri, May 12, 2023 at 3:05 PM Conor Dooley <conor at kernel.org> wrote:
> >
> > +CC Greg, Mark, Krste, Philipp, Andrew,
> >
> > (this is LKML now, no top posting or html replies)
> >
> > On Fri, May 12, 2023 at 08:40:10PM +0100, Conor Dooley wrote:
> > > On Fri, May 12, 2023 at 11:01:09AM -0700, Palmer Dabbelt wrote:
> > > > On Thu, 11 May 2023 15:38:10 PDT (-0700), Conor Dooley wrote:
> > > > > On Thu, May 11, 2023 at 03:34:24PM -0700, Atish Patra wrote:
> > > > > > On Thu, May 11, 2023 at 2:47 PM Conor Dooley <conor at kernel.org> wrote:
> > > > > > > On Thu, May 11, 2023 at 02:27:44PM -0700, Atish Patra wrote:
> > > > >
> > > > > > > That's more than last year at this point, and nothing has changed in the
> > > > > > > documentation! Talk's cheap, ehh?
> > > > > > >
> > > > > >
> > > > > > Yup. I will poke RVI folks to check if it still is the plan or changed !!
> > > > >
> > > > > Sounds good, thanks!
> > >
> > > There has been some movement on that front, shall see where it goes
> > > :upsidedown_smile:
> >
> > There's been some off-list discussion prompted by Atish with some of the
> > RVI spec folk, from which the upshot __appears__ to be an understanding
> > that using version numbering to indicate removal of ISA features is a bad
> > idea.
> > I'm hoping that this results in the enshrinement of this in the ISA
> > specs, so that we have something concrete to point to as the basis for
> > not needing to handle version numbering.
> > Certainly that'd be great for ACPI and remove concerns there.
> >
> > > > > > We will likely have a vendor specific string parsing logic.
> > > > >
> > > > > Complicating the parsing logic is the exact sort of crap that I want
> > > > > to avoid.
> > > >
> > > > Ya, I think we're reallly overcomplicating things with the ISA strings.
> > > > Let's just deprecate them and move to something that doesn't need all the
> > > > bespoke string parsing.
> > >
> > > Versioning aside, although that removes a large part of the motivation,
> > > the interface becomes quite nice:
> > > of_property_present(node, "riscv,isa-extension-zicbom")
> >
> > My current feeling is that, rather than introducing a key-value type of
> > property, adding boolean properties for extensions is the way to go
> > here. The "riscv,isa" part of the DT ABI pre-dates even the ratification
> 
> The only problem with boolean properties is you lose the ability to
> add extra information
> about an ISA extension in case we require it. One of the examples is
> CMO extensions.
> The current riscv,isa string parsing scheme that doesn't have
> infrastructure to do that either.

I think that is a different problem entirely. Every extension has
totally different requirements for what information needs to be passed
via DT/ACPI to the kernel (or onwards to userspace).
I'm not sure whether creating child nodes for these things makes sense,
rather than the current scheme of having "riscv,cbom-block-size" etc.
Both are much of a muchness to me, and we have already set out on the
path of inserting these properties at the cpu node level.
I don't see all that much benefit of deviating from that course ¯\_(ツ)_/¯

However, if you consider it a *presence* test, rather than specifically
a boolean property, the probing strategy remains the same for both
cases, and it is in the enablement stage that that aspect comes into
play.
For the sake of this discussion, the probing/detection strategy is what
I think is important to consider, IOW do we replace "riscv,isa" at all,
and whether it is a child node or boolean property is an implementation
detail.
By removing the value, I meant removing the extension version, since
that will no longer be needed.

> We had some related discussions in the past about how to extend the
> key-value pair to include
> that value.
> 
> https://lore.kernel.org/lkml/CAOnJCUKgt1+SVXTBmGChJf74JrsqeqACXbjQAXnhFALkXhPFew@mail.gmail.com/

Yeah, I had done some looking back at the previous lots of changes for
these things while trying to redo the comments on the existing parser.
I do dislike that scheme, with the

| mmu {
| 	riscv,isa-ext-foo;
| };

way of doing things, as the different node types need to be individually
probed for.
In a scheme where the riscv,isa-ext-foo properties are moved up to the
cpu node, possibly as child nodes containing extension specific
properties, doing presence detection is uniform across extension types:

| for (int k = 0; k < ARRAY_SIZE(riscv_isa_extensions) - 1; k++) {
| 	const char *tmp;
| 
| 	/*
| 	 * I need to double check that of_property_present() works for
| 	 * children and "regular" properties.
| 	 */
| 	ret = of_property_present(node, riscv_isa_extensions[k].prop_name);
| 
| 	if (ret && riscv_isa_extension_check(riscv_isa_extensions[k].key)) {
| 		if (!riscv_isa_extensions[k].multi_letter)
| 			this_hwcap |= isa2hwcap[riscv_isa_extensions[k].key];
| 
| 		set_bit(riscv_isa_extensions[k].key, this_isa);
| 	}
| }

LMK if I missed another proposal in those threads (they mostly seemed
focused on /proc/cpuinfo), but the lack of a unified probe/detection
mechanism in the scheme I did see suggested put me off.

Thanks,
Conor.

> > of the base extensions (and thus the removal of some features...).
> > Starting again with a new property would allow us to define extensions
> > as per their ratified state, rather than the intermediate & incompatible
> > states that we have currently got with "riscv,isa".
> > Such a model does rely on the strengthening of the wording in the
> > specification.
> >
> > This had the advantage of being, as I mention above, even easier to
> > parse in software than the key-value pair business - but also is
> > trivially implemented in a dt-binding. What I have been trying to do
> > with the validation of the key-value stuff does not appear to be readily
> > doable!
> >
> > (Another drawback that has come to mind is that we have no way to
> > validate whether mutually exclusive extensions have been added with
> > "riscv,isa")
> >
> > > That also gives us the ability to define what supported vendor
> > > extensions actually mean in a dt-binding, which to me is a big win in
> > > terms of the aforementioned "wild west".
> >
> > Vendor extensions etc are oft quoted as one of the strengths of RISC-V,
> > and my feeling is that "riscv,isa" is not a mechanism where we can
> > easily handle meanings - especially for vendor stuff where there is
> > otherwise no centralised location for _xfoo -> feature mappings.

-------------- 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/20230513/ffb5ad97/attachment.sig>


More information about the linux-riscv mailing list