History

crypto: ccp - Add support for fetching a nonce for dynamic boost control

Dynamic Boost Control is a feature offered on AMD client platforms that allows software to request and set power or frequency limits. Only software that has authenticated with the PSP can retrieve or set these limits. Create a character device and ioctl for fetching the nonce. This ioctl supports optionally passing authentication information which will influence how many calls the nonce is valid for.

Mario Limonciello committed 3 years ago

Commit c04cf9e1 parent b8440d59 files · +321 −1Browse files

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

Unified · Split

include/uapi/linux/psp-dbc.h+67−0
@@ -0,0 +1,67 @@
1+/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
2+/*
3+ * Userspace interface for AMD Dynamic Boost Control (DBC)
4+ *
5+ * Copyright (C) 2023 Advanced Micro Devices, Inc.
6+ *
7+ * Author: Mario Limonciello <mario.limonciello@amd.com>
8+ */
9+
10+#ifndef __PSP_DBC_USER_H__
11+#define __PSP_DBC_USER_H__
12+
13+#include <linux/types.h>
14+
15+/**
16+ * DOC: AMD Dynamic Boost Control (DBC) interface
17+ */
18+
19+#define DBC_NONCE_SIZE 16
20+#define DBC_SIG_SIZE 32
21+
22+/**
23+ * struct dbc_user_nonce - Nonce exchange structure (input/output).
24+ * @auth_needed: Whether the PSP should authenticate this request (input).
25+ * 0: no authentication, PSP will return single use nonce.
26+ * 1: authentication: PSP will return multi-use nonce.
27+ * @nonce: 8 byte value used for future authentication (output).
28+ * @signature: Optional 32 byte signature created by software using a
29+ * previous nonce (input).
30+ */
31+struct dbc_user_nonce {
32+ __u32 auth_needed;
33+ __u8 nonce[DBC_NONCE_SIZE];
34+ __u8 signature[DBC_SIG_SIZE];
35+} __packed;
36+
37+/**
38+ * Dynamic Boost Control (DBC) IOC
39+ *
40+ * possible return codes for all DBC IOCTLs:
41+ * 0: success
42+ * -EINVAL: invalid input
43+ * -E2BIG: excess data passed
44+ * -EFAULT: failed to copy to/from userspace
45+ * -EBUSY: mailbox in recovery or in use
46+ * -ENODEV: driver not bound with PSP device
47+ * -EACCES: request isn't authorized
48+ * -EINVAL: invalid parameter
49+ * -ETIMEDOUT: request timed out
50+ * -EAGAIN: invalid request for state machine
51+ * -ENOENT: not implemented
52+ * -ENFILE: overflow
53+ * -EPERM: invalid signature
54+ * -EIO: unknown error
55+ */
56+#define DBC_IOC_TYPE 'D'
57+
58+/**
59+ * DBCIOCNONCE - Fetch a nonce from the PSP for authenticating commands.
60+ * If a nonce is fetched without authentication it can only
61+ * be utilized for one command.
62+ * If a nonce is fetched with authentication it can be used
63+ * for multiple requests.
64+ */
65+#define DBCIOCNONCE _IOWR(DBC_IOC_TYPE, 0x1, struct dbc_user_nonce)
66+
67+#endif /* __PSP_DBC_USER_H__ */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t