crypto: ccp: Add Platform Security Processor (PSP) device support
The Platform Security Processor (PSP) is part of the AMD Secure Processor (AMD-SP) functionality. The PSP is a dedicated processor that provides support for key management commands in Secure Encrypted Virtualization (SEV) mode, along with software-based Trusted Execution Environment (TEE) to enable third-party trusted applications. Note that the key management functionality provided by the SEV firmware can be used outside of the kvm-amd driver hence it doesn't need to depend on CONFIG_KVM_AMD. Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: "Radim Krčmář" <rkrcmar@redhat.com> Cc: Borislav Petkov <bp@suse.de> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Gary Hook <gary.hook@amd.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: linux-crypto@vger.kernel.org Cc: kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Improvements-by: Borislav Petkov <bp@suse.de> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> Reviewed-by: Borislav Petkov <bp@suse.de>
This commit is contained in:
@@ -198,6 +198,8 @@ int sp_init(struct sp_device *sp)
|
||||
if (sp->dev_vdata->ccp_vdata)
|
||||
ccp_dev_init(sp);
|
||||
|
||||
if (sp->dev_vdata->psp_vdata)
|
||||
psp_dev_init(sp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -206,6 +208,9 @@ void sp_destroy(struct sp_device *sp)
|
||||
if (sp->dev_vdata->ccp_vdata)
|
||||
ccp_dev_destroy(sp);
|
||||
|
||||
if (sp->dev_vdata->psp_vdata)
|
||||
psp_dev_destroy(sp);
|
||||
|
||||
sp_del_device(sp);
|
||||
}
|
||||
|
||||
@@ -237,6 +242,27 @@ int sp_resume(struct sp_device *sp)
|
||||
}
|
||||
#endif
|
||||
|
||||
struct sp_device *sp_get_psp_master_device(void)
|
||||
{
|
||||
struct sp_device *i, *ret = NULL;
|
||||
unsigned long flags;
|
||||
|
||||
write_lock_irqsave(&sp_unit_lock, flags);
|
||||
if (list_empty(&sp_units))
|
||||
goto unlock;
|
||||
|
||||
list_for_each_entry(i, &sp_units, entry) {
|
||||
if (i->psp_data)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i->get_psp_master_device)
|
||||
ret = i->get_psp_master_device();
|
||||
unlock:
|
||||
write_unlock_irqrestore(&sp_unit_lock, flags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __init sp_mod_init(void)
|
||||
{
|
||||
#ifdef CONFIG_X86
|
||||
|
Reference in New Issue
Block a user