On 02.06.2025 11:04, Mykola Kvach wrote:
> @@ -857,8 +860,24 @@ void arch_domain_destroy(struct domain *d)
>      domain_io_free(d);
>  }
>  
> -void arch_domain_shutdown(struct domain *d)
> +int arch_domain_shutdown(struct domain *d)
>  {
> +    switch ( d->shutdown_code )
> +    {
> +    case SHUTDOWN_suspend:
> +#ifdef CONFIG_SYSTEM_SUSPEND
> +        if ( !is_hardware_domain(d) )
> +            break;
> +
> +        return host_system_suspend();
> +#else
> +        break;
> +#endif
> +    default:
> +        break;
> +    }
> +
> +    return 0;
>  }

What's wrong with

int arch_domain_shutdown(struct domain *d)
{
    switch ( d->shutdown_code )
    {
#ifdef CONFIG_SYSTEM_SUSPEND
    case SHUTDOWN_suspend:
        if ( !is_hardware_domain(d) )
            break;

        return host_system_suspend();
#endif

    default:
        break;
    }

    return 0;
}

?

> @@ -1311,13 +1316,13 @@ int domain_shutdown(struct domain *d, u8 reason)
>          v->paused_for_shutdown = 1;
>      }
>  
> -    arch_domain_shutdown(d);
> +    ret = arch_domain_shutdown(d);

If non-zero comes back here, is ...

>      __domain_finalise_shutdown(d);

... this still appropriate to call?

>      spin_unlock(&d->shutdown_lock);
>  
> -    return 0;
> +    return ret;
>  }

Most callers don't care about the return value of this function. That likely
needs to change, even if _for now_ you only alter the SHUTDOWN_suspend case
(and hence some of the callers aren't immediately impacted)?

Jan

Reply via email to