From: Andrew Jones <ajones@ventanamicro.com>
To: opensbi@lists.infradead.org
Subject: [PATCH v6 2/7] lib: sbi: Narrow vendor extension range
Date: Mon, 15 May 2023 13:12:35 +0200 [thread overview]
Message-ID: <20230515111240.95059-3-ajones@ventanamicro.com> (raw)
In-Reply-To: <20230515111240.95059-1-ajones@ventanamicro.com>
The vendor extension ID range is large, but at runtime at most
a single ID will be available. Narrow the range in the
register_extensions callback. After narrowing, we no longer
need to check that the extension ID is correct in the other
callbacks, as those callbacks will never be invoked with
anything other than the single ID.
Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
---
lib/sbi/sbi_ecall_vendor.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/lib/sbi/sbi_ecall_vendor.c b/lib/sbi/sbi_ecall_vendor.c
index 126156f79a12..39c58c8b6fd5 100644
--- a/lib/sbi/sbi_ecall_vendor.c
+++ b/lib/sbi/sbi_ecall_vendor.c
@@ -25,8 +25,7 @@ static inline unsigned long sbi_ecall_vendor_id(void)
static int sbi_ecall_vendor_probe(unsigned long extid,
unsigned long *out_val)
{
- if (!sbi_platform_vendor_ext_check(sbi_platform_thishart_ptr()) ||
- extid != sbi_ecall_vendor_id())
+ if (!sbi_platform_vendor_ext_check(sbi_platform_thishart_ptr()))
*out_val = 0;
else
*out_val = 1;
@@ -38,8 +37,7 @@ static int sbi_ecall_vendor_handler(unsigned long extid, unsigned long funcid,
unsigned long *out_val,
struct sbi_trap_info *out_trap)
{
- if (!sbi_platform_vendor_ext_check(sbi_platform_thishart_ptr()) ||
- extid != sbi_ecall_vendor_id())
+ if (!sbi_platform_vendor_ext_check(sbi_platform_thishart_ptr()))
return SBI_ERR_NOT_SUPPORTED;
return sbi_platform_vendor_ext_provider(sbi_platform_thishart_ptr(),
@@ -51,6 +49,11 @@ struct sbi_ecall_extension ecall_vendor;
static int sbi_ecall_vendor_register_extensions(void)
{
+ unsigned long extid = sbi_ecall_vendor_id();
+
+ ecall_vendor.extid_start = extid;
+ ecall_vendor.extid_end = extid;
+
return sbi_ecall_register_extension(&ecall_vendor);
}
--
2.40.0
next prev parent reply other threads:[~2023-05-15 11:12 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-15 11:12 [PATCH v6 0/7] lib: sbi: Ensure SBI extension is available Andrew Jones
2023-05-15 11:12 ` [PATCH v6 1/7] lib: sbi: Introduce register_extensions extension callback Andrew Jones
2023-05-21 15:26 ` Anup Patel
2023-05-15 11:12 ` Andrew Jones [this message]
2023-05-15 13:43 ` [PATCH v6 2/7] lib: sbi: Narrow vendor extension range Anup Patel
2023-05-21 15:26 ` Anup Patel
2023-05-15 11:12 ` [PATCH v6 3/7] lib: sbi: pmu: Remove unnecessary probe function Andrew Jones
2023-05-21 15:26 ` Anup Patel
2023-05-15 11:12 ` [PATCH v6 4/7] lib: sbi: Only register available extensions Andrew Jones
2023-05-21 15:31 ` Anup Patel
2023-05-15 11:12 ` [PATCH v6 5/7] lib: sbi: Optimize probe of srst/susp Andrew Jones
2023-05-21 15:31 ` Anup Patel
2023-05-15 11:12 ` [PATCH v6 6/7] lib: sbi: Remove 0/1 probe implementations Andrew Jones
2023-05-21 15:31 ` Anup Patel
2023-05-15 11:12 ` [PATCH v6 7/7] lib: sbi: Document sbi_ecall_extension members Andrew Jones
2023-05-21 15:32 ` Anup Patel
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=20230515111240.95059-3-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.