Commit bdea62e9 authored by hanliyang's avatar hanliyang
Browse files

crypto: ccp: Implement CSV_PLATFORM_SHUTDOWN ioctl command

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


CVE: NA

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

The CSV_PLATFORM_SHUTDOWN command can be used by the platform owner to
switch platform to PSTATE.UNINIT.

The DOWNLOAD_FIRMWARE API can only performed when platform is in the
PSTATE.UNINIT. In order to support DOWNLOAD_FIRMWARE at userspace, we
need invoke PLATFORM_SHUTDOWN before that.

Signed-off-by: default avatarhanliyang <hanliyang@hygon.cn>
parent f5f79d11
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -120,6 +120,9 @@ static long csv_ioctl(struct file *file, unsigned int ioctl, unsigned long arg)
	case CSV_PLATFORM_INIT:
		ret = hygon_psp_hooks.__sev_platform_init_locked(&input.error);
		break;
	case CSV_PLATFORM_SHUTDOWN:
		ret = hygon_psp_hooks.__sev_platform_shutdown_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
@@ -26,6 +26,7 @@ extern struct hygon_psp_hooks_table {
	struct mutex *sev_cmd_mutex;
	int (*__sev_do_cmd_locked)(int cmd, void *data, int *psp_ret);
	int (*__sev_platform_init_locked)(int *error);
	int (*__sev_platform_shutdown_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
@@ -1264,6 +1264,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_platform_shutdown_locked = __sev_platform_shutdown_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
@@ -22,6 +22,7 @@
 */
enum {
	CSV_PLATFORM_INIT = 101,
	CSV_PLATFORM_SHUTDOWN = 102,
	CSV_HGSC_CERT_IMPORT = 201,

	CSV_MAX,