aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto/ccp/sp-pci.c
diff options
context:
space:
mode:
authorBrijesh Singh <brijesh.singh@amd.com>2021-07-28 10:15:21 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-09-18 13:40:09 +0200
commit6cae39f457547623fe1a48370d87cc1f4125fc42 (patch)
treed669cb34d4cb80df8b729df422e30674a688c3b1 /drivers/crypto/ccp/sp-pci.c
parent7509c4cb7c8050177da9ee5e053c0c3d55bb66b7 (diff)
downloadkernel_replicant_linux-6cae39f457547623fe1a48370d87cc1f4125fc42.tar.gz
kernel_replicant_linux-6cae39f457547623fe1a48370d87cc1f4125fc42.tar.bz2
kernel_replicant_linux-6cae39f457547623fe1a48370d87cc1f4125fc42.zip
crypto: ccp - shutdown SEV firmware on kexec
commit 5441a07a127f106c9936e4f9fa1a8a93e3f31828 upstream. The commit 97f9ac3db6612 ("crypto: ccp - Add support for SEV-ES to the PSP driver") added support to allocate Trusted Memory Region (TMR) used during the SEV-ES firmware initialization. The TMR gets locked during the firmware initialization and unlocked during the shutdown. While the TMR is locked, access to it is disallowed. Currently, the CCP driver does not shutdown the firmware during the kexec reboot, leaving the TMR memory locked. Register a callback to shutdown the SEV firmware on the kexec boot. Fixes: 97f9ac3db6612 ("crypto: ccp - Add support for SEV-ES to the PSP driver") Reported-by: Lucas Nussbaum <lucas.nussbaum@inria.fr> Tested-by: Lucas Nussbaum <lucas.nussbaum@inria.fr> Cc: <stable@kernel.org> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Joerg Roedel <jroedel@suse.de> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: David Rientjes <rientjes@google.com> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> Acked-by: Tom Lendacky <thomas.lendacky@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/crypto/ccp/sp-pci.c')
-rw-r--r--drivers/crypto/ccp/sp-pci.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/crypto/ccp/sp-pci.c b/drivers/crypto/ccp/sp-pci.c
index 7d346d842a39..c319e7e3917d 100644
--- a/drivers/crypto/ccp/sp-pci.c
+++ b/drivers/crypto/ccp/sp-pci.c
@@ -241,6 +241,17 @@ e_err:
return ret;
}
+static void sp_pci_shutdown(struct pci_dev *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct sp_device *sp = dev_get_drvdata(dev);
+
+ if (!sp)
+ return;
+
+ sp_destroy(sp);
+}
+
static void sp_pci_remove(struct pci_dev *pdev)
{
struct device *dev = &pdev->dev;
@@ -370,6 +381,7 @@ static struct pci_driver sp_pci_driver = {
.id_table = sp_pci_table,
.probe = sp_pci_probe,
.remove = sp_pci_remove,
+ .shutdown = sp_pci_shutdown,
.driver.pm = &sp_pci_pm_ops,
};