From: Andrew Jones <andrew.jones@linux.dev>
To: kvm-riscv@lists.infradead.org, kvm@vger.kernel.org
Cc: cleger@rivosinc.com, atishp@rivosinc.com, akshaybehl231@gmail.com
Subject: [kvm-unit-tests PATCH 3/3] riscv: sbi: Use kfail for known opensbi failures
Date: Fri, 21 Mar 2025 17:54:07 +0100 [thread overview]
Message-ID: <20250321165403.57859-8-andrew.jones@linux.dev> (raw)
In-Reply-To: <20250321165403.57859-5-andrew.jones@linux.dev>
Use kfail for the opensbi s/SBI_ERR_DENIED/SBI_ERR_DENIED_LOCKED/
change. We expect it to be fixed in 1.7, so only kfail for opensbi
which has a version less than that. Also change the other uses of
kfail to only kfail for opensbi versions less than 1.7.
Signed-off-by: Andrew Jones <andrew.jones@linux.dev>
---
riscv/sbi-fwft.c | 20 +++++++++++++-------
riscv/sbi.c | 6 ++++--
2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/riscv/sbi-fwft.c b/riscv/sbi-fwft.c
index 3d225997c0ec..c52fbd6e77a6 100644
--- a/riscv/sbi-fwft.c
+++ b/riscv/sbi-fwft.c
@@ -83,19 +83,21 @@ static void fwft_feature_lock_test_values(uint32_t feature, size_t nr_values,
report_prefix_push("locked");
+ bool kfail = __sbi_get_imp_id() == SBI_IMPL_OPENSBI &&
+ __sbi_get_imp_version() < sbi_impl_opensbi_mk_version(1, 7);
+
for (int i = 0; i < nr_values; ++i) {
ret = fwft_set(feature, test_values[i], 0);
- sbiret_report_error(&ret, SBI_ERR_DENIED_LOCKED,
- "Set to %lu without lock flag", test_values[i]);
+ sbiret_kfail_error(kfail, &ret, SBI_ERR_DENIED_LOCKED,
+ "Set to %lu without lock flag", test_values[i]);
ret = fwft_set(feature, test_values[i], SBI_FWFT_SET_FLAG_LOCK);
- sbiret_report_error(&ret, SBI_ERR_DENIED_LOCKED,
- "Set to %lu with lock flag", test_values[i]);
+ sbiret_kfail_error(kfail, &ret, SBI_ERR_DENIED_LOCKED,
+ "Set to %lu with lock flag", test_values[i]);
}
ret = fwft_get(feature);
- sbiret_report(&ret, SBI_SUCCESS, locked_value,
- "Get value %lu", locked_value);
+ sbiret_report(&ret, SBI_SUCCESS, locked_value, "Get value %lu", locked_value);
report_prefix_pop();
}
@@ -103,6 +105,7 @@ static void fwft_feature_lock_test_values(uint32_t feature, size_t nr_values,
static void fwft_feature_lock_test(uint32_t feature, unsigned long locked_value)
{
unsigned long values[] = {0, 1};
+
fwft_feature_lock_test_values(feature, 2, values, locked_value);
}
@@ -317,7 +320,10 @@ static void fwft_check_pte_ad_hw_updating(void)
report(ret.value == 0 || ret.value == 1, "first get value is 0/1");
enabled = ret.value;
- report_kfail(true, !enabled, "resets to 0");
+
+ bool kfail = __sbi_get_imp_id() == SBI_IMPL_OPENSBI &&
+ __sbi_get_imp_version() < sbi_impl_opensbi_mk_version(1, 7);
+ report_kfail(kfail, !enabled, "resets to 0");
install_exception_handler(EXC_LOAD_PAGE_FAULT, adue_read_handler);
install_exception_handler(EXC_STORE_PAGE_FAULT, adue_write_handler);
diff --git a/riscv/sbi.c b/riscv/sbi.c
index 83bc55125d46..edb1a6bef1ac 100644
--- a/riscv/sbi.c
+++ b/riscv/sbi.c
@@ -515,10 +515,12 @@ end_two:
sbiret_report_error(&ret, SBI_SUCCESS, "no targets, hart_mask_base is 1");
/* Try the next higher hartid than the max */
+ bool kfail = __sbi_get_imp_id() == SBI_IMPL_OPENSBI &&
+ __sbi_get_imp_version() < sbi_impl_opensbi_mk_version(1, 7);
ret = sbi_send_ipi(2, max_hartid);
- report_kfail(true, ret.error == SBI_ERR_INVALID_PARAM, "hart_mask got expected error (%ld)", ret.error);
+ sbiret_kfail_error(kfail, &ret, SBI_ERR_INVALID_PARAM, "hart_mask");
ret = sbi_send_ipi(1, max_hartid + 1);
- report_kfail(true, ret.error == SBI_ERR_INVALID_PARAM, "hart_mask_base got expected error (%ld)", ret.error);
+ sbiret_kfail_error(kfail, &ret, SBI_ERR_INVALID_PARAM, "hart_mask_base");
report_prefix_pop();
--
2.48.1
--
kvm-riscv mailing list
kvm-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kvm-riscv
next prev parent reply other threads:[~2025-03-21 16:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-21 16:54 [kvm-unit-tests PATCH 0/3] riscv: sbi: Ensure we can pass with any opensbi Andrew Jones
2025-03-21 16:54 ` [kvm-unit-tests PATCH 1/3] lib/riscv: Also provide sbiret impl functions Andrew Jones
2025-03-21 20:15 ` Clément Léger
2025-03-21 16:54 ` [kvm-unit-tests PATCH 2/3] riscv: sbi: Add kfail versions of sbiret_report functions Andrew Jones
2025-03-21 20:17 ` Clément Léger
2025-03-21 16:54 ` Andrew Jones [this message]
2025-03-21 20:22 ` [kvm-unit-tests PATCH 3/3] riscv: sbi: Use kfail for known opensbi failures Clément Léger
2025-03-22 7:38 ` Andrew Jones
2025-03-22 10:47 ` [kvm-unit-tests PATCH 0/3] riscv: sbi: Ensure we can pass with any opensbi 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=20250321165403.57859-8-andrew.jones@linux.dev \
--to=andrew.jones@linux.dev \
--cc=akshaybehl231@gmail.com \
--cc=atishp@rivosinc.com \
--cc=cleger@rivosinc.com \
--cc=kvm-riscv@lists.infradead.org \
--cc=kvm@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).