summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/pm/swsmu/inc
diff options
context:
space:
mode:
authorLijo Lazar <lijo.lazar@amd.com>2024-02-21 14:54:49 +0530
committerAlex Deucher <alexander.deucher@amd.com>2024-05-17 17:40:38 -0400
commit4d154b1ca580fd724f384a7042a5f24611809476 (patch)
tree8a8f6049fb08906819b2ab95c771d0c0a1cd3d31 /drivers/gpu/drm/amd/pm/swsmu/inc
parentf6bce954f432c556659a57be9e18fecdc575affb (diff)
drm/amd/pm: Add support for DPM policies
Add support to set/get information about different DPM policies. The support is only available on SOCs which use swsmu architecture. A DPM policy type may be defined with different levels. For example, a policy may be defined to select Pstate preference and then later a pstate preference may be chosen. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Asad Kamal <asad.kamal@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/pm/swsmu/inc')
-rw-r--r--drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
index 0917dec8efe3..a35ffe5d2021 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
+++ b/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
@@ -362,6 +362,27 @@ struct smu_table_context {
void *gpu_metrics_table;
};
+struct smu_context;
+struct smu_dpm_policy;
+
+struct smu_dpm_policy_desc {
+ const char *name;
+ char *(*get_desc)(struct smu_dpm_policy *dpm_policy, int level);
+};
+
+struct smu_dpm_policy {
+ struct smu_dpm_policy_desc *desc;
+ enum pp_pm_policy policy_type;
+ unsigned long level_mask;
+ int current_level;
+ int (*set_policy)(struct smu_context *ctxt, int level);
+};
+
+struct smu_dpm_policy_ctxt {
+ struct smu_dpm_policy policies[PP_PM_POLICY_NUM];
+ unsigned long policy_mask;
+};
+
struct smu_dpm_context {
uint32_t dpm_context_size;
void *dpm_context;
@@ -372,6 +393,7 @@ struct smu_dpm_context {
struct smu_power_state *dpm_request_power_state;
struct smu_power_state *dpm_current_power_state;
struct mclock_latency_table *mclk_latency_table;
+ struct smu_dpm_policy_ctxt *dpm_policies;
};
struct smu_power_gate {
@@ -1551,6 +1573,11 @@ typedef struct {
uint32_t MmHubPadding[8];
} WifiBandEntryTable_t;
+#define STR_SOC_PSTATE_POLICY "soc_pstate"
+
+struct smu_dpm_policy *smu_get_pm_policy(struct smu_context *smu,
+ enum pp_pm_policy p_type);
+
#if !defined(SWSMU_CODE_LAYER_L2) && !defined(SWSMU_CODE_LAYER_L3) && !defined(SWSMU_CODE_LAYER_L4)
int smu_get_power_limit(void *handle,
uint32_t *limit,
@@ -1598,5 +1625,10 @@ void amdgpu_smu_stb_debug_fs_init(struct amdgpu_device *adev);
int smu_send_hbm_bad_pages_num(struct smu_context *smu, uint32_t size);
int smu_send_hbm_bad_channel_flag(struct smu_context *smu, uint32_t size);
int smu_send_rma_reason(struct smu_context *smu);
+int smu_set_pm_policy(struct smu_context *smu, enum pp_pm_policy p_type,
+ int level);
+ssize_t smu_get_pm_policy_info(struct smu_context *smu,
+ enum pp_pm_policy p_type, char *sysbuf);
+
#endif
#endif