History

crypto: ccp - Add AMD Seamless Firmware Servicing (SFS) driver

AMD Seamless Firmware Servicing (SFS) is a secure method to allow non-persistent updates to running firmware and settings without requiring BIOS reflash and/or system reset. SFS does not address anything that runs on the x86 processors and it can be used to update ASP firmware, modules, register settings and update firmware for other microprocessors like TMPM, etc. SFS driver support adds ioctl support to communicate the SFS commands to the ASP/PSP by using the TEE mailbox interface. The Seamless Firmware Servicing (SFS) driver is added as a PSP sub-device. For detailed information, please look at the SFS specifications: https://www.amd.com/content/dam/amd/en/documents/epyc-technical-docs/specifications/58604.pdf

Ashish Kalra committed 1 year ago

Commit 648dbcc1 parent e09701d7 files · +476 −2Browse files

Showing the changes to include/uapi (1 of 7 files). Show all

Unified · Split

include/uapi/linux/psp-sfs.h+87−0
@@ -0,0 +1,87 @@
1/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
2/*
3 * Userspace interface for AMD Seamless Firmware Servicing (SFS)
4 *
5 * Copyright (C) 2025 Advanced Micro Devices, Inc.
6 *
7 * Author: Ashish Kalra <ashish.kalra@amd.com>
8 */
9
10#ifndef __PSP_SFS_USER_H__
11#define __PSP_SFS_USER_H__
12
13#include <linux/types.h>
14
15/**
16 * SFS: AMD Seamless Firmware Support (SFS) interface
17 */
18
19#define PAYLOAD_NAME_SIZE 64
20#define TEE_EXT_CMD_BUFFER_SIZE 4096
21
22/**
23 * struct sfs_user_get_fw_versions - get current level of base firmware (output).
24 * @blob: current level of base firmware for ASP and patch levels (input/output).
25 * @sfs_status: 32-bit SFS status value (output).
26 * @sfs_extended_status: 32-bit SFS extended status value (output).
27 */
28struct sfs_user_get_fw_versions {
29 __u8 blob[TEE_EXT_CMD_BUFFER_SIZE];
30 __u32 sfs_status;
31 __u32 sfs_extended_status;
32} __packed;
33
34/**
35 * struct sfs_user_update_package - update SFS package (input).
36 * @payload_name: name of SFS package to load, verify and execute (input).
37 * @sfs_status: 32-bit SFS status value (output).
38 * @sfs_extended_status: 32-bit SFS extended status value (output).
39 */
40struct sfs_user_update_package {
41 char payload_name[PAYLOAD_NAME_SIZE];
42 __u32 sfs_status;
43 __u32 sfs_extended_status;
44} __packed;
45
46/**
47 * Seamless Firmware Support (SFS) IOC
48 *
49 * possible return codes for all SFS IOCTLs:
50 * 0: success
51 * -EINVAL: invalid input
52 * -E2BIG: excess data passed
53 * -EFAULT: failed to copy to/from userspace
54 * -EBUSY: mailbox in recovery or in use
55 * -ENODEV: driver not bound with PSP device
56 * -EACCES: request isn't authorized
57 * -EINVAL: invalid parameter
58 * -ETIMEDOUT: request timed out
59 * -EAGAIN: invalid request for state machine
60 * -ENOENT: not implemented
61 * -ENFILE: overflow
62 * -EPERM: invalid signature
63 * -EIO: PSP I/O error
64 */
65#define SFS_IOC_TYPE 'S'
66
67/**
68 * SFSIOCFWVERS - returns blob containing FW versions
69 * ASP provides the current level of Base Firmware for the ASP
70 * and the other microprocessors as well as current patch
71 * level(s).
72 */
73#define SFSIOCFWVERS _IOWR(SFS_IOC_TYPE, 0x1, struct sfs_user_get_fw_versions)
74
75/**
76 * SFSIOCUPDATEPKG - updates package/payload
77 * ASP loads, verifies and executes the SFS package.
78 * By default, the SFS package/payload is loaded from
79 * /lib/firmware/amd, but alternative firmware loading
80 * path can be specified using kernel parameter
81 * firmware_class.path or the firmware loading path
82 * can be customized using sysfs file:
83 * /sys/module/firmware_class/parameters/path.
84 */
85#define SFSIOCUPDATEPKG _IOWR(SFS_IOC_TYPE, 0x2, struct sfs_user_update_package)
86
87#endif /* __PSP_SFS_USER_H__ */