[kvm-unit-tests PATCH] riscv: sbi: Add no target ipi test
Andrew Jones
andrew.jones at linux.dev
Thu Mar 20 07:26:01 PDT 2025
On Mon, Mar 17, 2025 at 01:08:15PM +0100, Andrew Jones wrote:
> While an hmask of zero without an hbase of -1 (which would mean
> broadcast) is pointless, since nothing is targeted, the spec
> doesn't say it should return an error. Maybe it should? Anyway,
> for now, just confirm that it "works".
>
> Signed-off-by: Andrew Jones <andrew.jones at linux.dev>
> ---
> riscv/sbi.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/riscv/sbi.c b/riscv/sbi.c
> index 219f7187acf3..16d918d00848 100644
> --- a/riscv/sbi.c
> +++ b/riscv/sbi.c
> @@ -507,6 +507,10 @@ end_two:
> max_hartid = cpus[cpu].hartid;
> }
>
> + /* Test no targets */
> + ret = sbi_send_ipi(0, 0);
> + sbiret_report_error(&ret, SBI_SUCCESS, "no targets");
> +
> /* Try the next higher hartid than the max */
> ret = sbi_send_ipi(2, max_hartid);
> report_kfail(true, ret.error == SBI_ERR_INVALID_PARAM, "hart_mask got expected error (%ld)", ret.error);
> --
> 2.48.1
>
Applied to riscv/sbi[1] with the test below added too just to make sure
that a nonzero hbase with a zero hmask doesn't break things.
Thanks,
drew
ret = sbi_send_ipi(0, 1);
sbiret_report_error(&ret, SBI_SUCCESS, "no targets, hart_mask_base is 1");
[1] https://gitlab.com/jones-drew/kvm-unit-tests/-/commits/riscv/sbi
More information about the kvm-riscv
mailing list