include/uapi/linux/psp-dbc.h

Source file repositories/reference/linux-study-clean/include/uapi/linux/psp-dbc.h

File Facts

System
Linux kernel
Corpus path
include/uapi/linux/psp-dbc.h
Extension
.h
Size
5234 bytes
Lines
148
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

struct dbc_user_nonce {
	__u32	auth_needed;
	__u8	nonce[DBC_NONCE_SIZE];
	__u8	signature[DBC_SIG_SIZE];
} __packed;

/**
 * struct dbc_user_setuid - UID exchange structure (input).
 * @uid:       16 byte value representing software identity
 * @signature: 32 byte signature created by software using a previous nonce
 */
struct dbc_user_setuid {
	__u8	uid[DBC_UID_SIZE];
	__u8	signature[DBC_SIG_SIZE];
} __packed;

/**
 * struct dbc_user_param - Parameter exchange structure (input/output).
 * @msg_index: Message indicating what parameter to set or get (input)
 * @param:     4 byte parameter, units are message specific. (input/output)
 * @signature: 32 byte signature.
 *             - When sending a message this is to be created by software
 *               using a previous nonce (input)
 *             - For interpreting results, this signature is updated by the
 *               PSP to allow software to validate the authenticity of the
 *               results.
 */
struct dbc_user_param {
	__u32	msg_index;
	__u32	param;
	__u8	signature[DBC_SIG_SIZE];
} __packed;

/**
 * Dynamic Boost Control (DBC) IOC
 *
 * possible return codes for all DBC IOCTLs:
 *  0:          success
 *  -EINVAL:    invalid input
 *  -E2BIG:     excess data passed
 *  -EFAULT:    failed to copy to/from userspace
 *  -EBUSY:     mailbox in recovery or in use
 *  -ENODEV:    driver not bound with PSP device
 *  -EACCES:    request isn't authorized
 *  -EINVAL:    invalid parameter
 *  -ETIMEDOUT: request timed out
 *  -EAGAIN:    invalid request for state machine
 *  -ENOENT:    not implemented
 *  -ENFILE:    overflow
 *  -EPERM:     invalid signature
 *  -EIO:       unknown error
 */
#define DBC_IOC_TYPE	'D'

/**
 * DBCIOCNONCE - Fetch a nonce from the PSP for authenticating commands.
 *               If a nonce is fetched without authentication it can only
 *               be utilized for one command.
 *               If a nonce is fetched with authentication it can be used
 *               for multiple requests.
 */
#define DBCIOCNONCE	_IOWR(DBC_IOC_TYPE, 0x1, struct dbc_user_nonce)

/**
 * DBCIOCUID - Set the user ID (UID) of a calling process.
 *             The user ID is 8 bytes long. It must be programmed using a
 *             32 byte signature built using the nonce fetched from
 *             DBCIOCNONCE.
 *             The UID can only be set once until the system is rebooted.
 */
#define DBCIOCUID	_IOW(DBC_IOC_TYPE, 0x2, struct dbc_user_setuid)

/**
 * DBCIOCPARAM - Set or get a parameter from the PSP.
 *               This request will only work after DBCIOCUID has successfully
 *               set the UID of the calling process.
 *               Whether the parameter is set or get is controlled by the
 *               message ID in the request.
 *               This command must be sent using a 32 byte signature built
 *               using the nonce fetched from DBCIOCNONCE.
 *               When the command succeeds, the 32 byte signature will be
 *               updated by the PSP for software to authenticate the results.
 */
#define DBCIOCPARAM	_IOWR(DBC_IOC_TYPE, 0x3, struct dbc_user_param)

/**
 * enum dbc_cmd_msg - Messages utilized by DBCIOCPARAM
 * @PARAM_GET_FMAX_CAP:		Get frequency cap (MHz)
 * @PARAM_SET_FMAX_CAP:		Set frequency cap (MHz)
 * @PARAM_GET_PWR_CAP:		Get socket power cap (mW)

Annotation

Implementation Notes