AMDGPU SOCs supports dynamic workload based power profiles, which can provide fine-tuned performance for a particular type of workload. This patch series adds an interface to set/reset these power profiles based on the workload type hints. A user can set a hint of workload type being submistted to GPU, and the driver can dynamically switch the power profiles which is best suited to this kind of workload. Currently supported workload profiles are: "None", "3D", "Video", "VR", "Compute" V2: This version addresses the review comment from Christian about chaning the design to set workload mode in a more dynamic method than during the context creation. V3: Addressed review comment from Christian, Removed the get_workload() calls from UAPI, keeping only the set_workload() call. Shashank Sharma (5): drm/amdgpu: add UAPI for workload hints to ctx ioctl drm/amdgpu: add new functions to set GPU power profile drm/amdgpu: set GPU workload via ctx IOCTL drm/amdgpu: switch GPU workload profile drm/amdgpu: switch workload context to/from compute drivers/gpu/drm/amd/amdgpu/Makefile | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 14 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 42 ++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h | 1 + .../gpu/drm/amd/amdgpu/amdgpu_ctx_workload.c | 93 +++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 15 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 3 + .../gpu/drm/amd/include/amdgpu_ctx_workload.h | 54 +++++++++++ drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h | 5 + include/uapi/drm/amdgpu_drm.h | 17 ++++ 12 files changed, 243 insertions(+), 6 deletions(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx_workload.c create mode 100644 drivers/gpu/drm/amd/include/amdgpu_ctx_workload.h -- 2.34.1