aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto
diff options
context:
space:
mode:
authorSingh, Brijesh <brijesh.singh@amd.com>2019-01-30 15:57:52 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2019-02-08 02:29:48 -0500
commitf8903b3ead5191d450f21c7388ddc245f76cec0f (patch)
treeebb558ad9faf526d90356641fbd5a80931632e05 /drivers/crypto
parente3d90e52ea5fe58d39297df1c825db6e131fb04f (diff)
crypto: ccp - fix the SEV probe in kexec boot path
A kexec reboot may leave the firmware in INIT or WORKING state. Currently, we issue PLATFORM_INIT command during the probe without checking the current state. The PLATFORM_INIT command fails if the FW is already in INIT state. Lets check the current state, if FW is not in UNINIT state then transition it to UNINIT before initializing or upgrading the FW. Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Gary Hook <gary.hook@amd.com> Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/ccp/psp-dev.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c
index 66566547feff..638f138debd7 100644
--- a/drivers/crypto/ccp/psp-dev.c
+++ b/drivers/crypto/ccp/psp-dev.c
@@ -437,6 +437,7 @@ static int sev_get_api_version(void)
437 psp_master->api_major = status->api_major; 437 psp_master->api_major = status->api_major;
438 psp_master->api_minor = status->api_minor; 438 psp_master->api_minor = status->api_minor;
439 psp_master->build = status->build; 439 psp_master->build = status->build;
440 psp_master->sev_state = status->state;
440 441
441 return 0; 442 return 0;
442} 443}
@@ -964,6 +965,21 @@ void psp_pci_init(void)
964 if (sev_get_api_version()) 965 if (sev_get_api_version())
965 goto err; 966 goto err;
966 967
968 /*
969 * If platform is not in UNINIT state then firmware upgrade and/or
970 * platform INIT command will fail. These command require UNINIT state.
971 *
972 * In a normal boot we should never run into case where the firmware
973 * is not in UNINIT state on boot. But in case of kexec boot, a reboot
974 * may not go through a typical shutdown sequence and may leave the
975 * firmware in INIT or WORKING state.
976 */
977
978 if (psp_master->sev_state != SEV_STATE_UNINIT) {
979 sev_platform_shutdown(NULL);
980 psp_master->sev_state = SEV_STATE_UNINIT;
981 }
982
967 if (SEV_VERSION_GREATER_OR_EQUAL(0, 15) && 983 if (SEV_VERSION_GREATER_OR_EQUAL(0, 15) &&
968 sev_update_firmware(psp_master->dev) == 0) 984 sev_update_firmware(psp_master->dev) == 0)
969 sev_get_api_version(); 985 sev_get_api_version();