summaryrefslogtreecommitdiff
path: root/drivers/crypto/ccp/dbc.h
diff options
context:
space:
mode:
authorMario Limonciello <mario.limonciello@amd.com>2023-06-23 08:49:55 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2023-07-20 22:14:21 +1200
commitc04cf9e14f109ebcc425c1efd2c01294c52a4d62 (patch)
tree68c437a1d73a6de139e7024d2abc589ef59a53ae /drivers/crypto/ccp/dbc.h
parentb8440d55f7d4ad2b669902301c87c482faf9a8f4 (diff)
downloadlwn-c04cf9e14f109ebcc425c1efd2c01294c52a4d62.tar.gz
lwn-c04cf9e14f109ebcc425c1efd2c01294c52a4d62.zip
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. 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>
Diffstat (limited to 'drivers/crypto/ccp/dbc.h')
-rw-r--r--drivers/crypto/ccp/dbc.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/drivers/crypto/ccp/dbc.h b/drivers/crypto/ccp/dbc.h
new file mode 100644
index 000000000000..1c3a0a078d15
--- /dev/null
+++ b/drivers/crypto/ccp/dbc.h
@@ -0,0 +1,44 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * AMD Platform Security Processor (PSP) Dynamic Boost Control support
+ *
+ * Copyright (C) 2023 Advanced Micro Devices, Inc.
+ *
+ * Author: Mario Limonciello <mario.limonciello@amd.com>
+ */
+
+#ifndef __DBC_H__
+#define __DBC_H__
+
+#include <uapi/linux/psp-dbc.h>
+
+#include <linux/device.h>
+#include <linux/miscdevice.h>
+#include <linux/psp-platform-access.h>
+
+#include "psp-dev.h"
+
+struct psp_dbc_device {
+ struct device *dev;
+
+ union dbc_buffer *mbox;
+
+ struct mutex ioctl_mutex;
+
+ struct miscdevice char_dev;
+};
+
+struct dbc_nonce {
+ struct psp_req_buffer_hdr header;
+ struct dbc_user_nonce user;
+} __packed;
+
+union dbc_buffer {
+ struct psp_request req;
+ struct dbc_nonce dbc_nonce;
+};
+
+void dbc_dev_destroy(struct psp_device *psp);
+int dbc_dev_init(struct psp_device *psp);
+
+#endif /* __DBC_H */