mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-06 22:03:38 -04:00
crypto: ccp - Add support for getting and setting DBC parameters
After software has authenticated a dynamic boost control request, it can fetch and set supported parameters using a selection of messages. Add support for these messages and export the ability to do this to userspace. Acked-by: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
committed by
Herbert Xu
parent
d9408716d2
commit
e2cfe05e92
@@ -45,6 +45,23 @@ struct dbc_user_setuid {
|
||||
__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
|
||||
*
|
||||
@@ -84,4 +101,47 @@ struct dbc_user_setuid {
|
||||
*/
|
||||
#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)
|
||||
* @PARAM_SET_PWR_CAP: Set socket power cap (mW)
|
||||
* @PARAM_GET_GFX_MODE: Get graphics mode (0/1)
|
||||
* @PARAM_SET_GFX_MODE: Set graphics mode (0/1)
|
||||
* @PARAM_GET_CURR_TEMP: Get current temperature (degrees C)
|
||||
* @PARAM_GET_FMAX_MAX: Get maximum allowed value for frequency (MHz)
|
||||
* @PARAM_GET_FMAX_MIN: Get minimum allowed value for frequency (MHz)
|
||||
* @PARAM_GET_SOC_PWR_MAX: Get maximum allowed value for SoC power (mw)
|
||||
* @PARAM_GET_SOC_PWR_MIN: Get minimum allowed value for SoC power (mw)
|
||||
* @PARAM_GET_SOC_PWR_CUR: Get current value for SoC Power (mW)
|
||||
*/
|
||||
enum dbc_cmd_msg {
|
||||
PARAM_GET_FMAX_CAP = 0x3,
|
||||
PARAM_SET_FMAX_CAP = 0x4,
|
||||
PARAM_GET_PWR_CAP = 0x5,
|
||||
PARAM_SET_PWR_CAP = 0x6,
|
||||
PARAM_GET_GFX_MODE = 0x7,
|
||||
PARAM_SET_GFX_MODE = 0x8,
|
||||
PARAM_GET_CURR_TEMP = 0x9,
|
||||
PARAM_GET_FMAX_MAX = 0xA,
|
||||
PARAM_GET_FMAX_MIN = 0xB,
|
||||
PARAM_GET_SOC_PWR_MAX = 0xC,
|
||||
PARAM_GET_SOC_PWR_MIN = 0xD,
|
||||
PARAM_GET_SOC_PWR_CUR = 0xE,
|
||||
};
|
||||
|
||||
#endif /* __PSP_DBC_USER_H__ */
|
||||
|
||||
Reference in New Issue
Block a user