Re: [PATCH v2 2/2] crypto/ccp: Skip SNP_INIT if preparation fails
From: Nikunj A. Dadhania
Date: Wed Apr 08 2026 - 02:01:44 EST
On 4/7/2026 11:17 PM, Tycho Andersen wrote:
> From: "Tycho Andersen (AMD)" <tycho@xxxxxxxxxx>
>
> During SNP_INIT, the firmware checks to see that the SNP enable bit is set
> on all CPUs. If snp_prepare() failed because not all CPUs were online,
> SNP_INIT will fail, so skip it.
>
> Signed-off-by: Tycho Andersen (AMD) <tycho@xxxxxxxxxx>
Reviewed-by: Nikunj A Dadhania <nikunj@xxxxxxx>
> ---
> drivers/crypto/ccp/sev-dev.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
> index 939fa8aa155c..854263cbb256 100644
> --- a/drivers/crypto/ccp/sev-dev.c
> +++ b/drivers/crypto/ccp/sev-dev.c
> @@ -1374,7 +1374,9 @@ static int __sev_snp_init_locked(int *error, unsigned int max_snp_asid)
> return -EOPNOTSUPP;
> }
>
> - snp_prepare();
> + rc = snp_prepare();
> + if (rc < 0)
> + return rc;
>
> /*
> * Starting in SNP firmware v1.52, the SNP_INIT_EX command takes a list