Commit f5f79d11 authored by hanliyang's avatar hanliyang
Browse files

crypto: ccp: Implement CSV_PLATFORM_INIT ioctl command

hygon inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I98VXP


CVE: NA

---------------------------

The CSV_PLATFORM_INIT command can be used by the platform owner to
switch platform from PSTATE.UNINIT to PSTATE.INIT.

In the upcoming patches, we'll support DOWNLOAD_FIRMWARE at userspace.
Due to DOWNLOAD_FIRMWARE can only performed when platform is in the
PSTATE.UNINIT, we need invoke PLATFORM_INIT following DOWNLOAD_FIRMWARE
to switch platform back to PSTATE.INIT.

Signed-off-by: default avatarhanliyang <hanliyang@hygon.cn>
parent 0637deeb
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -117,6 +117,9 @@ static long csv_ioctl(struct file *file, unsigned int ioctl, unsigned long arg)
	case CSV_HGSC_CERT_IMPORT:
		ret = csv_ioctl_do_hgsc_import(&input);
		break;
	case CSV_PLATFORM_INIT:
		ret = hygon_psp_hooks.__sev_platform_init_locked(&input.error);
		break;
	default:
		/*
		 * If the command is compatible between CSV and SEV, the
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ extern struct hygon_psp_hooks_table {
	bool sev_dev_hooks_installed;
	struct mutex *sev_cmd_mutex;
	int (*__sev_do_cmd_locked)(int cmd, void *data, int *psp_ret);
	int (*__sev_platform_init_locked)(int *error);
	long (*sev_ioctl)(struct file *file, unsigned int ioctl, unsigned long arg);
} hygon_psp_hooks;

+1 −0
Original line number Diff line number Diff line
@@ -1263,6 +1263,7 @@ static void sev_dev_install_hooks(void)
{
	hygon_psp_hooks.sev_cmd_mutex = &sev_cmd_mutex;
	hygon_psp_hooks.__sev_do_cmd_locked = __sev_do_cmd_locked;
	hygon_psp_hooks.__sev_platform_init_locked = __sev_platform_init_locked;
	hygon_psp_hooks.sev_ioctl = sev_ioctl;

	hygon_psp_hooks.sev_dev_hooks_installed = true;
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
 * CSV guest/platform commands
 */
enum {
	CSV_PLATFORM_INIT = 101,
	CSV_HGSC_CERT_IMPORT = 201,

	CSV_MAX,