Skip to content

Commit 76b83f8

Browse files
hanliyangWangYuli
authored andcommitted
crypto: ccp: Implement CSV_PLATFORM_SHUTDOWN ioctl command
hygon inclusion category: feature 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: hanliyang <hanliyang@hygon.cn>
1 parent 17ed0b7 commit 76b83f8

4 files changed

Lines changed: 6 additions & 0 deletions

File tree

drivers/crypto/ccp/hygon/csv-dev.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ static long csv_ioctl(struct file *file, unsigned int ioctl, unsigned long arg)
121121
case CSV_PLATFORM_INIT:
122122
ret = hygon_psp_hooks.__sev_platform_init_locked(&input.error);
123123
break;
124+
case CSV_PLATFORM_SHUTDOWN:
125+
ret = hygon_psp_hooks.__sev_platform_shutdown_locked(&input.error);
126+
break;
124127
default:
125128
/*
126129
* If the command is compatible between CSV and SEV, the

drivers/crypto/ccp/hygon/psp-dev.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ extern struct hygon_psp_hooks_table {
2626
struct mutex *sev_cmd_mutex;
2727
int (*__sev_do_cmd_locked)(int cmd, void *data, int *psp_ret);
2828
int (*__sev_platform_init_locked)(int *error);
29+
int (*__sev_platform_shutdown_locked)(int *error);
2930
long (*sev_ioctl)(struct file *file, unsigned int ioctl, unsigned long arg);
3031
} hygon_psp_hooks;
3132

drivers/crypto/ccp/sev-dev.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,6 +1264,7 @@ static void sev_dev_install_hooks(void)
12641264
hygon_psp_hooks.sev_cmd_mutex = &sev_cmd_mutex;
12651265
hygon_psp_hooks.__sev_do_cmd_locked = __sev_do_cmd_locked;
12661266
hygon_psp_hooks.__sev_platform_init_locked = __sev_platform_init_locked;
1267+
hygon_psp_hooks.__sev_platform_shutdown_locked = __sev_platform_shutdown_locked;
12671268
hygon_psp_hooks.sev_ioctl = sev_ioctl;
12681269

12691270
hygon_psp_hooks.sev_dev_hooks_installed = true;

include/uapi/linux/psp-hygon.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
*/
2323
enum {
2424
CSV_PLATFORM_INIT = 101,
25+
CSV_PLATFORM_SHUTDOWN = 102,
2526
CSV_HGSC_CERT_IMPORT = 201,
2627

2728
CSV_MAX,

0 commit comments

Comments
 (0)