From: Andrew Jones <ajones@ventanamicro.com>
To: opensbi@lists.infradead.org
Subject: [PATCH v4 1/3] lib: sbi: Don't register unavailable single ID extensions
Date: Thu, 11 May 2023 18:11:02 +0200 [thread overview]
Message-ID: <20230511161104.115168-2-ajones@ventanamicro.com> (raw)
In-Reply-To: <20230511161104.115168-1-ajones@ventanamicro.com>
When an extension provides a probe callback we can check it at
init time to see if we should register the extension at all.
However, this is only possible for single ID extensions since
attempting to probe all IDs of a potentially very large range
doesn't make sense.
Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
---
lib/sbi/sbi_ecall.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/lib/sbi/sbi_ecall.c b/lib/sbi/sbi_ecall.c
index 76a1ae9ab733..5a301fb7d403 100644
--- a/lib/sbi/sbi_ecall.c
+++ b/lib/sbi/sbi_ecall.c
@@ -148,15 +148,18 @@ int sbi_ecall_handler(struct sbi_trap_regs *regs)
int sbi_ecall_init(void)
{
- int ret;
struct sbi_ecall_extension *ext;
- unsigned long i;
+ unsigned long out_val, i;
+ int ret;
for (i = 0; i < sbi_ecall_exts_size; i++) {
ext = sbi_ecall_exts[i];
- ret = sbi_ecall_register_extension(ext);
- if (ret)
- return ret;
+ if (ext->extid_start != ext->extid_end || !ext->probe ||
+ (!ext->probe(ext->extid_end, &out_val) && out_val)) {
+ ret = sbi_ecall_register_extension(ext);
+ if (ret)
+ return ret;
+ }
}
return 0;
--
2.40.0
next prev parent reply other threads:[~2023-05-11 16:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-11 16:11 [PATCH v4 0/3] lib: sbi: Ensure SBI extension is available Andrew Jones
2023-05-11 16:11 ` Andrew Jones [this message]
2023-05-11 16:11 ` [PATCH v4 2/3] lib: sbi: Introduce register_extensions extension callback Andrew Jones
2023-05-12 14:25 ` Anup Patel
2023-05-12 15:06 ` Andrew Jones
2023-05-12 16:47 ` Anup Patel
2023-05-15 6:01 ` Andrew Jones
2023-05-11 16:11 ` [PATCH v4 3/3] lib: sbi: Apply register_extensions to vendor extensions Andrew Jones
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=20230511161104.115168-2-ajones@ventanamicro.com \
--to=ajones@ventanamicro.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