Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: Conor Dooley <conor@kernel.org>, Rob Herring <robh@kernel.org>
Cc: Alex Elder <elder@riscstar.com>,
	Guodong Xu <guodong@riscstar.com>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>, Yixun Lan <dlan@gentoo.org>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Samuel Holland <samuel.holland@sifive.com>,
	Anup Patel <anup@brainfault.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	Lubomir Rintel <lkundrak@v3.sk>, Yangyu Chen <cyy@cyyself.name>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Kevin Meng Zhang <zhangmeng.kevin@linux.spacemit.com>,
	Andrew Jones <ajones@ventanamicro.com>,
	devicetree@vger.kernel.org, linux-riscv@lists.infradead.org,
	linux-kernel@vger.kernel.org, spacemit@lists.linux.dev,
	linux-serial@vger.kernel.org
Subject: Re: [PATCH v2 11/13] dt-bindings: riscv: Add Supm extension description
Date: Tue, 30 Dec 2025 21:41:56 +0100	[thread overview]
Message-ID: <05B0AE03-E7B1-4DCD-88D0-DCB9053F30BA@gmx.de> (raw)
In-Reply-To: <20251230-budding-dimple-c34636b0ca4d@spud>

Am 30. Dezember 2025 18:37:25 MEZ schrieb Conor Dooley <conor@kernel.org>:
>On Tue, Dec 30, 2025 at 09:21:56AM -0600, Rob Herring wrote:
>> On Mon, Dec 29, 2025 at 9:14 PM Alex Elder <elder@riscstar.com> wrote:
>> >
>> > On 12/29/25 8:13 PM, Rob Herring wrote:
>> > > On Fri, Dec 26, 2025 at 03:28:47PM -0600, Alex Elder wrote:
>> > >> On 12/22/25 7:04 AM, Guodong Xu wrote:
>> > >>> Add description for the Supm extension. Supm indicates support for pointer
>> > >>> masking in user mode. Supm is mandatory for RVA23S64.
>> > >>>
>> > >>> The Supm extension is ratified in commit d70011dde6c2 ("Update to ratified
>> > >>> state") of riscv-j-extension.
>> > >>>
>> > >>> Supm depends on either Smnpm or Ssnpm, so add a schema check to enforce
>> > >>> this dependency.
>> > >>
>> > >> I have the same general question on this, about whether it's really
>> > >> necessary for the DT binding to enforce these requirements.  The
>> > >> RISC-V specifications are what truly defines their meaning, so I
>> > >> don't really see why the DT framework should need to enforce them.
>> > >> (That said, I'm sure there are other cases where DT enforces things
>> > >> it shouldn't have to.)
>> > >
>> > > Does the specification have some way to check it? What happens if a DT
>> > > is wrong? Are you going to require a DT update to make things right? Or
>> > > the kernel has to work-around the error? Neither is great. So having
>> > > this as a schema makes sense to prevent either scenario.
>> >
>> > I'm really glad you weighed in.  I actually have several questions
>> > related to RISC-V extensions and DT.  But for now I'll focus on
>> > just this...
>> >
>> > To answer your first question, I'm not sure how the specification
>> > is "checked", or what "it" is that you're asking about for that
>> > matter.  Also I think we have to be clear about what "wrong" means.
>> >
>> > RISC-V is defined by a (large and growing) set of specifications
>> > that are developed through a well-defined process.  When a spec
>> > is *ratified* it is committed, and it won't be changed.  These
>> > specifications are ultimately *the* definition of RISC-V
>> > compliance.
>> >
>> > I assumed the "wrong" you're talking about is a DTS/DTB that has
>> > been committed but somehow does not match what a RISC-V spec
>> > says, but I might be mistaken.
>> 
>> That's correct.
>> 
>> > Anyway, we can flip that around and have a similar problem:  What
>> > if we define the DT binding in such a way that it doesn't match
>> > the RISC-V spec?  The (ratified) RISC-V spec is right.
>> 
>> Sure. Any time there is more than 1 source of truth, they could be
>> mismatched. But it is 1 spec and 1 schema to compare, not N DTS files.
>> Checking the schema matches the spec is much easier than reviewing
>> every new DTS file.
>
>The objective is not to define things with divergent meanings anyway,
>only to say "this string is exactly this version of this extension",
>so that if some other version of an extension comes along we have a way
>to differentiate. We didn't before and that became problematic for both
>standard extensions and vendor specific stuff. You'll note we don't look
>to define anything ourselves, just cite the spec that provides the
>definitions.
>
>> The only true fix is to make the spec machine readable.
>> 
>> > My thought was that we should have software do the verification,
>> > and recommend the software (e.g. arch/riscv/kernel/cpufeature.c
>> > in Linux) be updated to verify things before committing to a
>> > DT binding.
>> 
>> That moves validation from build time to run time. How is that better?
>> And what about other OSs?
>> 
>> I'm very much of the opinion that it is not the kernel's job to
>> validate the DT. It obviously has not done a very good job given
>> issues we find with schemas. It's fine to have some checks in this
>> case if the kernel can't function (or use/enable the extension)
>> without the dependent extensions, but there are lots of classes of
>> errors the kernel doesn't need to care about.
>
>By and large what's in cpufeature.c is there to turn extensions off
>based on kconfig choices (vector support enabled etc) or kernel design
>decisions (kernel requiring both d and f extensions for fpu support). I

Should supm be handled in the same way? Add it to the device-tree of RVA23U64 devices. If a kernel does not support pointer masking in user space, hide the extension in cpufeature.c.

Best regards

Heinrich

>don't think there's anything there that doesn't assume that the
>devicetree is correct. For my money, it's much simpler to describe
>dependencies in a binding than add more code to the kernel that tries to
>figure out dependencies at runtime.
>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2025-12-30 20:42 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-22 13:04 [PATCH v2 00/13] riscv: spacemit: Add SpacemiT K3 SoC and K3 Pico-ITX board Guodong Xu
2025-12-22 13:04 ` [PATCH v2 01/13] dt-bindings: riscv: add SpacemiT X100 CPU compatible Guodong Xu
2025-12-23 13:48   ` Krzysztof Kozlowski
2025-12-22 13:04 ` [PATCH v2 02/13] dt-bindings: timer: add SpacemiT K3 CLINT Guodong Xu
2025-12-22 13:04 ` [PATCH v2 03/13] dt-bindings: interrupt-controller: add SpacemiT K3 APLIC Guodong Xu
2025-12-22 13:04 ` [PATCH v2 04/13] dt-bindings: interrupt-controller: add SpacemiT K3 IMSIC Guodong Xu
2025-12-23 13:47   ` Krzysztof Kozlowski
2025-12-22 13:04 ` [PATCH v2 05/13] dt-bindings: serial: 8250: add SpacemiT K3 UART compatible Guodong Xu
2025-12-22 13:04 ` [PATCH v2 06/13] dt-bindings: riscv: spacemit: add K3 and Pico-ITX board bindings Guodong Xu
2025-12-22 13:04 ` [PATCH v2 07/13] dt-bindings: riscv: Add B ISA extension description Guodong Xu
2025-12-22 21:17   ` Conor Dooley
2025-12-23  6:51     ` Guodong Xu
2025-12-24 23:53       ` Conor Dooley
2025-12-26 21:28       ` Alex Elder
2025-12-28  2:51         ` Guodong Xu
2025-12-28 23:50           ` Alex Elder
2025-12-29  1:08             ` Guodong Xu
2025-12-29  1:26               ` Alex Elder
2025-12-30 17:09         ` Conor Dooley
2025-12-30 17:29           ` Alex Elder
2025-12-30 17:46             ` Conor Dooley
2025-12-30 18:06               ` Alex Elder
2025-12-30 19:21                 ` Conor Dooley
2025-12-22 13:04 ` [PATCH v2 08/13] dt-bindings: riscv: Add descriptions for Za64rs, Ziccamoa, Ziccif, and Zicclsm Guodong Xu
2025-12-26 21:28   ` Alex Elder
2025-12-28  4:10     ` Guodong Xu
2025-12-28 23:50       ` Alex Elder
2025-12-30  0:56         ` Guodong Xu
2025-12-22 13:04 ` [PATCH v2 09/13] dt-bindings: riscv: Add Ssccptr, Sscounterenw, Sstvala, Sstvecd, Ssu64xl Guodong Xu
2025-12-26 21:28   ` Alex Elder
2025-12-28 12:31     ` Guodong Xu
2025-12-28 23:50       ` Alex Elder
2025-12-22 13:04 ` [PATCH v2 10/13] dt-bindings: riscv: Add Sha and its comprised extensions Guodong Xu
2025-12-26 21:28   ` Alex Elder
2025-12-28 12:43     ` Guodong Xu
2025-12-28 23:50       ` Alex Elder
2025-12-22 13:04 ` [PATCH v2 11/13] dt-bindings: riscv: Add Supm extension description Guodong Xu
2025-12-22 20:57   ` Conor Dooley
2025-12-26 21:28   ` Alex Elder
2025-12-30  2:13     ` Rob Herring
2025-12-30  3:14       ` Alex Elder
2025-12-30 15:21         ` Rob Herring
2025-12-30 17:37           ` Conor Dooley
2025-12-30 20:41             ` Heinrich Schuchardt [this message]
2026-01-01  0:08               ` Conor Dooley
2026-01-08 19:45                 ` Samuel Holland
2025-12-30 18:01           ` Alex Elder
2025-12-30 17:22       ` Conor Dooley
2025-12-30 18:06         ` Alex Elder
2025-12-22 13:04 ` [PATCH v2 12/13] riscv: dts: spacemit: add initial device tree of SpacemiT K3 SoC Guodong Xu
2025-12-22 13:04 ` [PATCH v2 13/13] riscv: dts: spacemit: add SpacemiT K3 Pico-ITX board device tree Guodong Xu

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=05B0AE03-E7B1-4DCD-88D0-DCB9053F30BA@gmx.de \
    --to=xypron.glpk@gmx.de \
    --cc=ajones@ventanamicro.com \
    --cc=alex@ghiti.fr \
    --cc=anup@brainfault.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=conor+dt@kernel.org \
    --cc=conor@kernel.org \
    --cc=cyy@cyyself.name \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlan@gentoo.org \
    --cc=elder@riscstar.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=guodong@riscstar.com \
    --cc=jirislaby@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=lkundrak@v3.sk \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=pjw@kernel.org \
    --cc=robh@kernel.org \
    --cc=samuel.holland@sifive.com \
    --cc=spacemit@lists.linux.dev \
    --cc=tglx@linutronix.de \
    --cc=zhangmeng.kevin@linux.spacemit.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox