drm/amdgpu/pm: add capped/uncapped power profile modes
authorPerry Yuan <perry.yuan@amd.com>
Thu, 16 Feb 2023 09:18:20 +0000 (17:18 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 7 Mar 2023 19:22:39 +0000 (14:22 -0500)
Capped and uncapped workload types switching are supported on Vangogh,
User can switch the power profile and check current type with below commands.

1) switch to capped mode:
`# echo 8 > /sys/class/drm/card0/device/pp_power_profile_mode`

2) switch to uncapped mode:
`# echo 9 > /sys/class/drm/card0/device/pp_power_profile_mode`

3) check current mode:
$ cat /sys/class/drm/card0/device/pp_power_profile_mode
 1 3D_FULL_SCREEN
 3          VIDEO
 4             VR
 5        COMPUTE
 6         CUSTOM
 8         CAPPED
 9       UNCAPPED*

Acked-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Perry Yuan <perry.yuan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/include/kgd_pp_interface.h
drivers/gpu/drm/amd/pm/amdgpu_pm.c
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c

index 94058b6c3b8bcb7b9ae63f36a9fd0f9d4df0b8d1..86b6b0c9fb02acbcebca7f040863c436db7fe701 100644 (file)
@@ -160,6 +160,8 @@ enum PP_SMC_POWER_PROFILE {
        PP_SMC_POWER_PROFILE_COMPUTE      = 0x5,
        PP_SMC_POWER_PROFILE_CUSTOM       = 0x6,
        PP_SMC_POWER_PROFILE_WINDOW3D     = 0x7,
+       PP_SMC_POWER_PROFILE_CAPPED       = 0x8,
+       PP_SMC_POWER_PROFILE_UNCAPPED     = 0x9,
        PP_SMC_POWER_PROFILE_COUNT,
 };
 
index 0ffe351c1a1d89513383a7bc490690812cddb762..d75a67cfe5230bcc5f232850c5032104c9abeedd 100644 (file)
@@ -91,6 +91,8 @@ const char * const amdgpu_pp_profile_name[] = {
        "COMPUTE",
        "CUSTOM",
        "WINDOW_3D",
+       "CAPPED",
+       "UNCAPPED",
 };
 
 /**
index d5abafc5a68201fc9e329b2b7c1e45da4c6c869e..3ecb900e6ecdccf814c219431be45095e9524a0a 100644 (file)
@@ -478,13 +478,13 @@ int smu_cmn_to_asic_specific_index(struct smu_context *smu,
                return mapping.map_to;
 
        case CMN2ASIC_MAPPING_WORKLOAD:
-               if (index > PP_SMC_POWER_PROFILE_WINDOW3D ||
+               if (index >= PP_SMC_POWER_PROFILE_COUNT ||
                    !smu->workload_map)
                        return -EINVAL;
 
                mapping = smu->workload_map[index];
                if (!mapping.valid_mapping)
-                       return -EINVAL;
+                       return -ENOTSUPP;
 
                return mapping.map_to;