crypto: ccp - Reset TMR size at SNP Shutdown
authorAshish Kalra <ashish.kalra@amd.com>
Mon, 24 Mar 2025 21:14:47 +0000 (21:14 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 7 Apr 2025 05:22:26 +0000 (13:22 +0800)
Implicit SNP initialization as part of some SNP ioctls modify TMR size
to be SNP compliant which followed by SNP shutdown will leave the
TMR size modified and then subsequently cause SEV only initialization
to fail, hence, reset TMR size to default at SNP Shutdown.

Acked-by: Dionna Glaze <dionnaglaze@google.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/ccp/sev-dev.c

index 5bd3df37737012a17c1bf6b65d53c3ec25ece406..08a6160f0072ef375c3085e7e749a6bafb90c745 100644 (file)
@@ -1778,6 +1778,9 @@ static int __sev_snp_shutdown_locked(int *error, bool panic)
        sev->snp_initialized = false;
        dev_dbg(sev->dev, "SEV-SNP firmware shutdown\n");
 
+       /* Reset TMR size back to default */
+       sev_es_tmr_size = SEV_TMR_SIZE;
+
        return ret;
 }