@@ -1375,6 +1375,21 @@ int sev_platform_init(struct sev_platform_init_args *args)
}
EXPORT_SYMBOL_GPL(sev_platform_init);
+int sev_snp_platform_init(struct sev_platform_init_args *args)
+{
+ int rc;
+
+ if (!psp_master || !psp_master->sev_data)
+ return -ENODEV;
+
+ mutex_lock(&sev_cmd_mutex);
+ rc = __sev_snp_init_locked(&args->error);
+ mutex_unlock(&sev_cmd_mutex);
+
+ return rc;
+}
+EXPORT_SYMBOL_GPL(sev_snp_platform_init);
+
static int __sev_platform_shutdown_locked(int *error)
{
struct psp_device *psp = psp_master;
@@ -828,6 +828,21 @@ struct sev_data_snp_commit {
*/
int sev_platform_init(struct sev_platform_init_args *args);
+/**
+ * sev_snp_platform_init - perform SNP INIT command
+ *
+ * @args: struct sev_platform_init_args to pass in arguments
+ *
+ * Returns:
+ * 0 if the SEV successfully processed the command
+ * -%ENODEV if the SNP support is not enabled
+ * -%ENOMEM if the SNP range list allocation failed
+ * -%E2BIG if the HV_Fixed list is too big
+ * -%ETIMEDOUT if the SEV command timed out
+ * -%EIO if the SEV returned a non-zero return code
+ */
+int sev_snp_platform_init(struct sev_platform_init_args *args);
+
/**
* sev_platform_status - perform SEV PLATFORM_STATUS command
*
@@ -955,6 +970,8 @@ sev_platform_status(struct sev_user_data_status *status, int *error) { return -E
static inline int sev_platform_init(struct sev_platform_init_args *args) { return -ENODEV; }
+static inline int sev_snp_platform_init(struct sev_platform_init_args *args) { return -ENODEV; }
+
static inline int
sev_guest_deactivate(struct sev_data_deactivate *data, int *error) { return -ENODEV; }