From: niuyongwen <niuyongwen(a)hygon.cn>
HYGON's fTPM and TDM need to send commands to PSP to complete
the firmware function. In order to be compatible with the
original kernel code, The command of psp_do_cmd is added to
send the command from x86 to PSP. The interface is
currently used for fTPM and TDM of HYGON.
Change-Id: I47b01f10e67ea77cf31c7b021532728f1c3f1323
Signed-off-by: niuyongwen <niuyongwen(a)hygon.cn>
---
drivers/crypto/ccp/psp-dev.c | 6 ++++++
include/linux/psp-sev.h | 4 ++++
2 files changed, 10 insertions(+)
diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c
index 1603dc8d2d75..cf65991723c4 100644
--- a/drivers/crypto/ccp/psp-dev.c
+++ b/drivers/crypto/ccp/psp-dev.c
@@ -216,6 +216,12 @@ static int sev_do_cmd(int cmd, void *data, int *psp_ret)
return rc;
}
+int psp_do_cmd(int cmd, void *data, int *psp_ret)
+{
+ return sev_do_cmd(cmd, data, psp_ret);
+}
+EXPORT_SYMBOL_GPL(psp_do_cmd);
+
static int __sev_platform_init_locked(int *error)
{
struct psp_device *psp = psp_master;
diff --git a/include/linux/psp-sev.h b/include/linux/psp-sev.h
index 827c601841c4..6a5854ac5e93 100644
--- a/include/linux/psp-sev.h
+++ b/include/linux/psp-sev.h
@@ -487,6 +487,8 @@ struct sev_data_dbg {
#ifdef CONFIG_CRYPTO_DEV_SP_PSP
+int psp_do_cmd(int cmd, void *data, int *psp_ret);
+
/**
* sev_platform_init - perform SEV INIT command
*
@@ -603,6 +605,8 @@ void *psp_copy_user_blob(u64 __user uaddr, u32 len);
#else /* !CONFIG_CRYPTO_DEV_SP_PSP */
+static inline int psp_do_cmd(int cmd, void *data, int *psp_ret) { return -ENODEV; }
+
static inline int
sev_platform_status(struct sev_user_data_status *status, int *error) { return -ENODEV; }
--
2.17.1