summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/include
diff options
context:
space:
mode:
authorPerry Yuan <perry.yuan@amd.com>2026-02-09 00:42:02 +0800
committerAlex Deucher <alexander.deucher@amd.com>2026-05-11 15:55:55 -0400
commit8ce9c73104e34f1fbb8d7f50468e4a62905331f2 (patch)
treec9b4fb1dd5b9851e9f731239529502b75bacebe7 /drivers/gpu/drm/amd/include
parente486360db8df9d032bfff44b629d25a803a1d21c (diff)
downloadlinux-8ce9c73104e34f1fbb8d7f50468e4a62905331f2.tar.gz
linux-8ce9c73104e34f1fbb8d7f50468e4a62905331f2.zip
drm/amdgpu: add psp interfaces for peak tops limiter driver
Introduce a Peak Tops Limiter (PTL) driver that dynamically caps engine frequency to ensure delivered TOPS never exceeds a defined TOPS_limit. This initial implementation provides core data structures and kernel-space interfaces (set/get, enable/disable) to manage PTL state. PTL performs a firmware handshake to initialize its state and update predefined format types. It supports updating these format types at runtime while user-space tools automatically switch PTL state, and also allows explicitly switching PTL state via newly added commands. Signed-off-by: Perry Yuan <perry.yuan@amd.com> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/include')
-rw-r--r--drivers/gpu/drm/amd/include/amdgpu_ptl.h50
-rw-r--r--drivers/gpu/drm/amd/include/kgd_kfd_interface.h1
2 files changed, 51 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/include/amdgpu_ptl.h b/drivers/gpu/drm/amd/include/amdgpu_ptl.h
new file mode 100644
index 000000000000..17e803f4caf8
--- /dev/null
+++ b/drivers/gpu/drm/amd/include/amdgpu_ptl.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2026 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __AMDGPU_PTL_H__
+#define __AMDGPU_PTL_H__
+
+enum amdgpu_ptl_fmt {
+ AMDGPU_PTL_FMT_I8 = 0,
+ AMDGPU_PTL_FMT_F16 = 1,
+ AMDGPU_PTL_FMT_BF16 = 2,
+ AMDGPU_PTL_FMT_F32 = 3,
+ AMDGPU_PTL_FMT_F64 = 4,
+ AMDGPU_PTL_FMT_F8 = 5,
+ AMDGPU_PTL_FMT_VECTOR = 6,
+ AMDGPU_PTL_FMT_INVALID = 7,
+};
+
+struct amdgpu_ptl {
+ enum amdgpu_ptl_fmt fmt1;
+ enum amdgpu_ptl_fmt fmt2;
+ bool enabled;
+ bool hw_supported;
+ struct mutex mutex;
+};
+
+int amdgpu_ptl_perf_monitor_ctrl(struct amdgpu_device *adev, u32 req_code,
+ u32 *ptl_state,
+ enum amdgpu_ptl_fmt *fmt1,
+ enum amdgpu_ptl_fmt *fmt2);
+
+#endif /* __AMDGPU_PTL_H__ */
diff --git a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
index 9aba8596faa7..6df5afb242ae 100644
--- a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
+++ b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
@@ -33,6 +33,7 @@
#include <linux/dma-fence.h>
#include "amdgpu_irq.h"
#include "amdgpu_gfx.h"
+#include "amdgpu_ptl.h"
struct pci_dev;
struct amdgpu_device;