kvm-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH] riscv: sbi: Add no target ipi test
@ 2025-03-17 12:08 Andrew Jones
  2025-03-20 14:26 ` Andrew Jones
  2025-03-22 10:49 ` Andrew Jones
  0 siblings, 2 replies; 3+ messages in thread
From: Andrew Jones @ 2025-03-17 12:08 UTC (permalink / raw)
  To: kvm-riscv; +Cc: Anup Patel, Atish Patra, cleger

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@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


-- 
kvm-riscv mailing list
kvm-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kvm-riscv

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [kvm-unit-tests PATCH] riscv: sbi: Add no target ipi test
  2025-03-17 12:08 [kvm-unit-tests PATCH] riscv: sbi: Add no target ipi test Andrew Jones
@ 2025-03-20 14:26 ` Andrew Jones
  2025-03-22 10:49 ` Andrew Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Jones @ 2025-03-20 14:26 UTC (permalink / raw)
  To: kvm-riscv; +Cc: Anup Patel, Atish Patra, cleger

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@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

-- 
kvm-riscv mailing list
kvm-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kvm-riscv

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [kvm-unit-tests PATCH] riscv: sbi: Add no target ipi test
  2025-03-17 12:08 [kvm-unit-tests PATCH] riscv: sbi: Add no target ipi test Andrew Jones
  2025-03-20 14:26 ` Andrew Jones
@ 2025-03-22 10:49 ` Andrew Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Jones @ 2025-03-22 10:49 UTC (permalink / raw)
  To: kvm-riscv; +Cc: Anup Patel, Atish Patra, cleger

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@linux.dev>
> ---
>  riscv/sbi.c | 4 ++++
>  1 file changed, 4 insertions(+)
>

Merged.

Thanks,
drew

-- 
kvm-riscv mailing list
kvm-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kvm-riscv

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-03-22 10:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-17 12:08 [kvm-unit-tests PATCH] riscv: sbi: Add no target ipi test Andrew Jones
2025-03-20 14:26 ` Andrew Jones
2025-03-22 10:49 ` Andrew Jones

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).