[kvm-unit-tests PATCH 08/10] riscv: sbi: Probe/skip SUSP

Clément Léger cleger at rivosinc.com
Tue Feb 25 07:16:45 PST 2025



On 21/02/2025 16:55, Andrew Jones wrote:
> Cleanly skip testing suspend when the SUSP extension isn't available.
> 
> Signed-off-by: Andrew Jones <andrew.jones at linux.dev>
> ---
>  riscv/sbi.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/riscv/sbi.c b/riscv/sbi.c
> index a0a8331b04bd..e5f6e1c72ae6 100644
> --- a/riscv/sbi.c
> +++ b/riscv/sbi.c
> @@ -1452,6 +1452,12 @@ static void check_susp(void)
>  
>  	report_prefix_push("susp");
>  
> +	if (!sbi_probe(SBI_EXT_SUSP)) {
> +		report_skip("SUSP extension not available");
> +		report_prefix_pop();
> +		return;
> +	}
> +
>  	timer_setup(susp_timer);
>  	local_irq_enable();
>  	timer_start(SBI_SUSP_TIMER_DURATION_US);
> @@ -1479,7 +1485,7 @@ static void check_susp(void)
>  			local_irq_enable();
>  
>  			if (!params.returns && ret.error == SBI_ERR_NOT_SUPPORTED) {
> -				report_skip("SUSP not supported?");
> +				report_fail("probing claims support, but it's not?");
>  				report_prefix_pop();
>  				goto out;
>  			} else if (!params.returns) {

Hi Andrew,

Looks good to me,

Reviewed-by: Clément Léger <cleger at rivosinc.com>

Thanks,

Clément



More information about the kvm-riscv mailing list