From: Nicholas Piggin <npiggin@gmail.com>
To: Ilya Mamay <mmamayka01@gmail.com>
Cc: opensbi@lists.infradead.org,
Himanshu Chauhan <hchauhan@ventanamicro.com>
Subject: Re: [PATCH 01/18] dbtr: Add consistent range checks to trigger ecalls
Date: Fri, 24 Apr 2026 11:37:01 +1000 [thread overview]
Message-ID: <aerC4Qj7lMSkmIFK@lima-default> (raw)
In-Reply-To: <20260320124646.zd4cblhvoisk7flb@imamay-pc>
On Fri, Mar 20, 2026 at 03:46:46PM +0300, Ilya Mamay wrote:
> Hi, Nicholas
> This is a significant improvement over the previous version!
>
> I have a few comments below, though they may be off the mark since they're
> based on my own reading of the SBI and Sdtrig specifications.
Hey Ilya, thanks for the review, sorry to take a while to get back to it
I was on vacation for a few weeks.
> On Fri, Mar 13, 2026 at 03:19:30PM +1000, Nicholas Piggin wrote:
> > @@ -594,6 +597,9 @@ int sbi_dbtr_install_trig(unsigned long smode,
> > if (!hs)
> > return SBI_ERR_FAILED;
> >
> > + if (trig_count >= hs->total_trigs)
> > + return SBI_ERR_BAD_RANGE;
>
> According to the SBI specification (section 19.4):
> - "The sbiret.value is set to zero upon success or if shared memory is
> disabled". I interpret this to mean that sbi_dbtr_install_trig must return a
> trigger index along with an SBI_ERR_BAD_RANGE error.
>
> - "sbiret.value is set to the array index i of the failing
> trigger configuration". In this case, sbiret.value should be hs->total_trigs,
> because that is the index of the first failing trigger configuration.
>
> Same comment applies to sbi_dbtr_update_trig.
Shapr observation. I think it may be technically ambiguous, but I felt
the intention was the other way. That is, bad range is not any
particular trigger failing, but an overall error before we get to
individual trigger processing.
sbi_debug_read_triggers() can return SBI_ERR_BAD_RANGE too for example,
and that could not point to a bad trigger.
I would prefer to leave as is unless there is strong opinion or
requirement for now, since that is leaving existing behaviour unchanged.
Thanks,
Nick
--
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
next prev parent reply other threads:[~2026-04-24 1:37 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-13 5:19 [PATCH 00/18] dbtr: Fixes and heterogeneous trigger types Nicholas Piggin
2026-03-13 5:19 ` [PATCH 01/18] dbtr: Add consistent range checks to trigger ecalls Nicholas Piggin
2026-03-20 12:46 ` Ilya Mamay
2026-04-24 1:37 ` Nicholas Piggin [this message]
2026-04-07 5:22 ` Himanshu Chauhan
2026-03-13 5:19 ` [PATCH 02/18] dbtr: Trigger update should set sbiret.value on failure Nicholas Piggin
2026-05-04 15:00 ` Himanshu Chauhan
2026-03-13 5:19 ` [PATCH 03/18] dbtr: Fix endian conversion in trigger install handler Nicholas Piggin
2026-05-04 15:03 ` Himanshu Chauhan
2026-03-13 5:19 ` [PATCH 04/18] dbtr: Return correct error on install not supported Nicholas Piggin
2026-05-04 15:10 ` Himanshu Chauhan
2026-03-13 5:19 ` [PATCH 05/18] dbtr: Do not support chain bit Nicholas Piggin
2026-05-04 15:15 ` Himanshu Chauhan
2026-05-26 4:35 ` Nicholas Piggin
2026-03-13 5:19 ` [PATCH 06/18] dbtr: Improve trigger update error checking Nicholas Piggin
2026-05-04 15:23 ` Himanshu Chauhan
2026-05-26 4:38 ` Nicholas Piggin
2026-03-13 5:19 ` [PATCH 07/18] dbtr: Check for invalid and unsupported triggers in update Nicholas Piggin
2026-03-13 5:19 ` [PATCH 08/18] dbtr: Improve error handling for trigger enable, disable, uninstall Nicholas Piggin
2026-03-13 5:19 ` [PATCH 09/18] dbtr: Read triggers should not read HW trigger if not mapped Nicholas Piggin
2026-03-13 5:19 ` [PATCH 10/18] dbtr: Avoid crash in sbi_debug_read_triggers Nicholas Piggin
2026-03-13 5:19 ` [PATCH 11/18] dbtr: Succeed operations with no triggers in mask Nicholas Piggin
2026-03-13 5:19 ` [PATCH 12/18] dbtr: Move hardware trigger probing to a function Nicholas Piggin
2026-03-13 5:19 ` [PATCH 13/18] dbtr: Rework install and update error handling Nicholas Piggin
2026-03-13 5:19 ` [PATCH 14/18] dbtr: Decouple dbtr trigger index from hardware trigger number Nicholas Piggin
2026-03-13 5:19 ` [PATCH 15/18] dbtr: Move trigger feature support test into a function Nicholas Piggin
2026-03-13 5:19 ` [PATCH 16/18] dbtr: Heterogeneous trigger type support Nicholas Piggin
2026-03-13 5:19 ` [PATCH 17/18] dbtr: Heterogeneous access type matching for mcontrol triggers Nicholas Piggin
2026-03-13 5:19 ` [PATCH 18/18] dbtr: Work around specification bug in range checks Nicholas Piggin
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=aerC4Qj7lMSkmIFK@lima-default \
--to=npiggin@gmail.com \
--cc=hchauhan@ventanamicro.com \
--cc=mmamayka01@gmail.com \
--cc=opensbi@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox