summaryrefslogtreecommitdiff
path: root/include/linux/psp-sev.h
diff options
context:
space:
mode:
authorBrijesh Singh <brijesh.singh@amd.com>2024-01-26 07:11:14 +0300
committerBorislav Petkov (AMD) <bp@alien8.de>2024-01-29 22:34:18 +0300
commit18085ac2f2fbf56aee9cbf5846740150e394f4f4 (patch)
treebfdee2334ad5d7b2e32aba62cd9dc63a754a76ba /include/linux/psp-sev.h
parent1ca5614b84eed5904f65f143e0e7aaab0ac4c6b2 (diff)
downloadlinux-18085ac2f2fbf56aee9cbf5846740150e394f4f4.tar.xz
crypto: ccp: Provide an API to issue SEV and SNP commands
Export sev_do_cmd() as a generic API for the hypervisor to issue commands to manage an SEV or an SNP guest. The commands for SEV and SNP are defined in the SEV and SEV-SNP firmware specifications. Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> Signed-off-by: Ashish Kalra <ashish.kalra@amd.com> Signed-off-by: Michael Roth <michael.roth@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/20240126041126.1927228-15-michael.roth@amd.com
Diffstat (limited to 'include/linux/psp-sev.h')
-rw-r--r--include/linux/psp-sev.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/psp-sev.h b/include/linux/psp-sev.h
index ef3b91797a8b..bcf9ceda030f 100644
--- a/include/linux/psp-sev.h
+++ b/include/linux/psp-sev.h
@@ -915,6 +915,22 @@ int sev_guest_df_flush(int *error);
*/
int sev_guest_decommission(struct sev_data_decommission *data, int *error);
+/**
+ * sev_do_cmd - issue an SEV or an SEV-SNP command
+ *
+ * @cmd: SEV or SEV-SNP firmware command to issue
+ * @data: arguments for firmware command
+ * @psp_ret: SEV command return code
+ *
+ * Returns:
+ * 0 if the SEV device successfully processed the command
+ * -%ENODEV if the PSP device is not available
+ * -%ENOTSUPP if PSP device does not support SEV
+ * -%ETIMEDOUT if the SEV command timed out
+ * -%EIO if PSP device returned a non-zero return code
+ */
+int sev_do_cmd(int cmd, void *data, int *psp_ret);
+
void *psp_copy_user_blob(u64 uaddr, u32 len);
#else /* !CONFIG_CRYPTO_DEV_SP_PSP */
@@ -931,6 +947,9 @@ static inline int
sev_guest_decommission(struct sev_data_decommission *data, int *error) { return -ENODEV; }
static inline int
+sev_do_cmd(int cmd, void *data, int *psp_ret) { return -ENODEV; }
+
+static inline int
sev_guest_activate(struct sev_data_activate *data, int *error) { return -ENODEV; }
static inline int sev_guest_df_flush(int *error) { return -ENODEV; }