crypto: ccp - Move direct access to some PSP registers out of TEE

With the PSP mailbox registers supporting more than just TEE, access to
them must be maintained and serialized by the PSP device support. Remove
TEE support direct access and create an interface in the PSP support
where the register access can be controlled/serialized.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Rijo Thomas <Rijo-john.Thomas@amd.com>
Tested-by: Rijo Thomas <Rijo-john.Thomas@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Tom Lendacky
2023-09-07 13:48:42 -05:00
committed by Herbert Xu
parent b58a36008b
commit 949a0c8dd3
6 changed files with 104 additions and 58 deletions

View File

@@ -14,6 +14,8 @@
#include <linux/list.h>
#include <linux/bits.h>
#include <linux/interrupt.h>
#include <linux/mutex.h>
#include <linux/psp.h>
#include "sp-dev.h"
@@ -33,6 +35,7 @@ struct psp_device {
struct sp_device *sp;
void __iomem *io_regs;
struct mutex mailbox_mutex;
psp_irq_handler_t sev_irq_handler;
void *sev_irq_data;
@@ -71,4 +74,19 @@ struct psp_device *psp_get_master_device(void);
#define PSP_SECURITY_HSP_TPM_AVAILABLE BIT(10)
#define PSP_SECURITY_ROM_ARMOR_ENFORCED BIT(11)
/**
* enum psp_cmd - PSP mailbox commands
* @PSP_CMD_TEE_RING_INIT: Initialize TEE ring buffer
* @PSP_CMD_TEE_RING_DESTROY: Destroy TEE ring buffer
* @PSP_CMD_MAX: Maximum command id
*/
enum psp_cmd {
PSP_CMD_TEE_RING_INIT = 1,
PSP_CMD_TEE_RING_DESTROY = 2,
PSP_CMD_MAX = 15,
};
int psp_mailbox_command(struct psp_device *psp, enum psp_cmd cmd, void *cmdbuff,
unsigned int timeout_msecs, unsigned int *cmdresp);
#endif /* __PSP_DEV_H */