2018-11-29 13:56:06 +08:00
|
|
|
/*
|
|
|
|
* Copyright 2019 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_SMU_H__
|
|
|
|
#define __AMDGPU_SMU_H__
|
|
|
|
|
|
|
|
#include "amdgpu.h"
|
2019-01-11 14:51:24 +08:00
|
|
|
#include "kgd_pp_interface.h"
|
2019-01-11 16:23:36 +08:00
|
|
|
#include "dm_pp_interface.h"
|
2019-05-21 13:07:57 -04:00
|
|
|
#include "dm_pp_smu.h"
|
2019-07-25 09:59:46 +08:00
|
|
|
#include "smu_types.h"
|
2018-11-29 13:56:06 +08:00
|
|
|
|
2019-06-10 21:39:29 +08:00
|
|
|
#define SMU_THERMAL_MINIMUM_ALERT_TEMP 0
|
|
|
|
#define SMU_THERMAL_MAXIMUM_ALERT_TEMP 255
|
|
|
|
#define SMU_TEMPERATURE_UNITS_PER_CENTIGRADES 1000
|
2020-07-23 18:16:53 +08:00
|
|
|
#define SMU_FW_NAME_LEN 0x24
|
2019-06-10 21:39:29 +08:00
|
|
|
|
2019-01-04 17:42:09 +08:00
|
|
|
struct smu_hw_power_state {
|
|
|
|
unsigned int magic;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct smu_power_state;
|
|
|
|
|
|
|
|
enum smu_state_ui_label {
|
|
|
|
SMU_STATE_UI_LABEL_NONE,
|
|
|
|
SMU_STATE_UI_LABEL_BATTERY,
|
|
|
|
SMU_STATE_UI_TABEL_MIDDLE_LOW,
|
|
|
|
SMU_STATE_UI_LABEL_BALLANCED,
|
|
|
|
SMU_STATE_UI_LABEL_MIDDLE_HIGHT,
|
|
|
|
SMU_STATE_UI_LABEL_PERFORMANCE,
|
|
|
|
SMU_STATE_UI_LABEL_BACO,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum smu_state_classification_flag {
|
|
|
|
SMU_STATE_CLASSIFICATION_FLAG_BOOT = 0x0001,
|
|
|
|
SMU_STATE_CLASSIFICATION_FLAG_THERMAL = 0x0002,
|
|
|
|
SMU_STATE_CLASSIFICATIN_FLAG_LIMITED_POWER_SOURCE = 0x0004,
|
|
|
|
SMU_STATE_CLASSIFICATION_FLAG_RESET = 0x0008,
|
|
|
|
SMU_STATE_CLASSIFICATION_FLAG_FORCED = 0x0010,
|
|
|
|
SMU_STATE_CLASSIFICATION_FLAG_USER_3D_PERFORMANCE = 0x0020,
|
|
|
|
SMU_STATE_CLASSIFICATION_FLAG_USER_2D_PERFORMANCE = 0x0040,
|
|
|
|
SMU_STATE_CLASSIFICATION_FLAG_3D_PERFORMANCE = 0x0080,
|
|
|
|
SMU_STATE_CLASSIFICATION_FLAG_AC_OVERDIRVER_TEMPLATE = 0x0100,
|
|
|
|
SMU_STATE_CLASSIFICATION_FLAG_UVD = 0x0200,
|
|
|
|
SMU_STATE_CLASSIFICATION_FLAG_3D_PERFORMANCE_LOW = 0x0400,
|
|
|
|
SMU_STATE_CLASSIFICATION_FLAG_ACPI = 0x0800,
|
|
|
|
SMU_STATE_CLASSIFICATION_FLAG_HD2 = 0x1000,
|
|
|
|
SMU_STATE_CLASSIFICATION_FLAG_UVD_HD = 0x2000,
|
|
|
|
SMU_STATE_CLASSIFICATION_FLAG_UVD_SD = 0x4000,
|
|
|
|
SMU_STATE_CLASSIFICATION_FLAG_USER_DC_PERFORMANCE = 0x8000,
|
|
|
|
SMU_STATE_CLASSIFICATION_FLAG_DC_OVERDIRVER_TEMPLATE = 0x10000,
|
|
|
|
SMU_STATE_CLASSIFICATION_FLAG_BACO = 0x20000,
|
|
|
|
SMU_STATE_CLASSIFICATIN_FLAG_LIMITED_POWER_SOURCE2 = 0x40000,
|
|
|
|
SMU_STATE_CLASSIFICATION_FLAG_ULV = 0x80000,
|
|
|
|
SMU_STATE_CLASSIFICATION_FLAG_UVD_MVC = 0x100000,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct smu_state_classification_block {
|
|
|
|
enum smu_state_ui_label ui_label;
|
|
|
|
enum smu_state_classification_flag flags;
|
|
|
|
int bios_index;
|
|
|
|
bool temporary_state;
|
|
|
|
bool to_be_deleted;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct smu_state_pcie_block {
|
|
|
|
unsigned int lanes;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum smu_refreshrate_source {
|
|
|
|
SMU_REFRESHRATE_SOURCE_EDID,
|
|
|
|
SMU_REFRESHRATE_SOURCE_EXPLICIT
|
|
|
|
};
|
|
|
|
|
|
|
|
struct smu_state_display_block {
|
|
|
|
bool disable_frame_modulation;
|
|
|
|
bool limit_refreshrate;
|
|
|
|
enum smu_refreshrate_source refreshrate_source;
|
|
|
|
int explicit_refreshrate;
|
|
|
|
int edid_refreshrate_index;
|
|
|
|
bool enable_vari_bright;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct smu_state_memroy_block {
|
|
|
|
bool dll_off;
|
|
|
|
uint8_t m3arb;
|
|
|
|
uint8_t unused[3];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct smu_state_software_algorithm_block {
|
|
|
|
bool disable_load_balancing;
|
|
|
|
bool enable_sleep_for_timestamps;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct smu_temperature_range {
|
|
|
|
int min;
|
|
|
|
int max;
|
2019-06-10 21:39:29 +08:00
|
|
|
int edge_emergency_max;
|
|
|
|
int hotspot_min;
|
|
|
|
int hotspot_crit_max;
|
|
|
|
int hotspot_emergency_max;
|
|
|
|
int mem_min;
|
|
|
|
int mem_crit_max;
|
|
|
|
int mem_emergency_max;
|
2020-07-02 15:13:02 +08:00
|
|
|
int software_shutdown_temp;
|
2019-01-04 17:42:09 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct smu_state_validation_block {
|
|
|
|
bool single_display_only;
|
|
|
|
bool disallow_on_dc;
|
|
|
|
uint8_t supported_power_levels;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct smu_uvd_clocks {
|
|
|
|
uint32_t vclk;
|
|
|
|
uint32_t dclk;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Structure to hold a SMU Power State.
|
|
|
|
*/
|
|
|
|
struct smu_power_state {
|
|
|
|
uint32_t id;
|
|
|
|
struct list_head ordered_list;
|
|
|
|
struct list_head all_states_list;
|
|
|
|
|
|
|
|
struct smu_state_classification_block classification;
|
|
|
|
struct smu_state_validation_block validation;
|
|
|
|
struct smu_state_pcie_block pcie;
|
|
|
|
struct smu_state_display_block display;
|
|
|
|
struct smu_state_memroy_block memory;
|
|
|
|
struct smu_state_software_algorithm_block software;
|
|
|
|
struct smu_uvd_clocks uvd_clocks;
|
|
|
|
struct smu_hw_power_state hardware;
|
|
|
|
};
|
|
|
|
|
2019-03-31 15:53:42 +08:00
|
|
|
enum smu_power_src_type
|
|
|
|
{
|
|
|
|
SMU_POWER_SOURCE_AC,
|
|
|
|
SMU_POWER_SOURCE_DC,
|
|
|
|
SMU_POWER_SOURCE_COUNT,
|
|
|
|
};
|
|
|
|
|
2018-12-17 16:47:49 +08:00
|
|
|
enum smu_memory_pool_size
|
|
|
|
{
|
|
|
|
SMU_MEMORY_POOL_SIZE_ZERO = 0,
|
|
|
|
SMU_MEMORY_POOL_SIZE_256_MB = 0x10000000,
|
|
|
|
SMU_MEMORY_POOL_SIZE_512_MB = 0x20000000,
|
|
|
|
SMU_MEMORY_POOL_SIZE_1_GB = 0x40000000,
|
|
|
|
SMU_MEMORY_POOL_SIZE_2_GB = 0x80000000,
|
|
|
|
};
|
|
|
|
|
2018-12-14 17:43:57 +08:00
|
|
|
#define SMU_TABLE_INIT(tables, table_id, s, a, d) \
|
|
|
|
do { \
|
|
|
|
tables[table_id].size = s; \
|
|
|
|
tables[table_id].align = a; \
|
|
|
|
tables[table_id].domain = d; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
struct smu_table {
|
|
|
|
uint64_t size;
|
|
|
|
uint32_t align;
|
|
|
|
uint8_t domain;
|
|
|
|
uint64_t mc_address;
|
|
|
|
void *cpu_addr;
|
|
|
|
struct amdgpu_bo *bo;
|
2018-12-15 15:36:58 +08:00
|
|
|
};
|
2018-12-14 17:43:57 +08:00
|
|
|
|
2019-01-16 14:22:16 +08:00
|
|
|
enum smu_perf_level_designation {
|
|
|
|
PERF_LEVEL_ACTIVITY,
|
|
|
|
PERF_LEVEL_POWER_CONTAINMENT,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct smu_performance_level {
|
|
|
|
uint32_t core_clock;
|
|
|
|
uint32_t memory_clock;
|
|
|
|
uint32_t vddc;
|
|
|
|
uint32_t vddci;
|
|
|
|
uint32_t non_local_mem_freq;
|
|
|
|
uint32_t non_local_mem_width;
|
|
|
|
};
|
|
|
|
|
2019-01-16 14:30:11 +08:00
|
|
|
struct smu_clock_info {
|
|
|
|
uint32_t min_mem_clk;
|
|
|
|
uint32_t max_mem_clk;
|
|
|
|
uint32_t min_eng_clk;
|
|
|
|
uint32_t max_eng_clk;
|
|
|
|
uint32_t min_bus_bandwidth;
|
|
|
|
uint32_t max_bus_bandwidth;
|
|
|
|
};
|
|
|
|
|
2018-12-15 15:36:58 +08:00
|
|
|
struct smu_bios_boot_up_values
|
|
|
|
{
|
|
|
|
uint32_t revision;
|
|
|
|
uint32_t gfxclk;
|
|
|
|
uint32_t uclk;
|
|
|
|
uint32_t socclk;
|
|
|
|
uint32_t dcefclk;
|
2019-01-28 12:04:46 +08:00
|
|
|
uint32_t eclk;
|
|
|
|
uint32_t vclk;
|
|
|
|
uint32_t dclk;
|
2018-12-15 15:36:58 +08:00
|
|
|
uint16_t vddc;
|
|
|
|
uint16_t vddci;
|
|
|
|
uint16_t mvddc;
|
|
|
|
uint16_t vdd_gfx;
|
|
|
|
uint8_t cooling_id;
|
|
|
|
uint32_t pp_table_id;
|
2019-08-16 13:47:01 +08:00
|
|
|
uint32_t format_revision;
|
|
|
|
uint32_t content_revision;
|
|
|
|
uint32_t fclk;
|
2018-12-14 17:43:57 +08:00
|
|
|
};
|
|
|
|
|
2019-03-29 17:52:11 +08:00
|
|
|
enum smu_table_id
|
|
|
|
{
|
|
|
|
SMU_TABLE_PPTABLE = 0,
|
|
|
|
SMU_TABLE_WATERMARKS,
|
2019-07-30 10:50:44 +08:00
|
|
|
SMU_TABLE_CUSTOM_DPM,
|
|
|
|
SMU_TABLE_DPMCLOCKS,
|
2019-03-29 17:52:11 +08:00
|
|
|
SMU_TABLE_AVFS,
|
|
|
|
SMU_TABLE_AVFS_PSM_DEBUG,
|
|
|
|
SMU_TABLE_AVFS_FUSE_OVERRIDE,
|
|
|
|
SMU_TABLE_PMSTATUSLOG,
|
|
|
|
SMU_TABLE_SMU_METRICS,
|
|
|
|
SMU_TABLE_DRIVER_SMU_CONFIG,
|
|
|
|
SMU_TABLE_ACTIVITY_MONITOR_COEFF,
|
|
|
|
SMU_TABLE_OVERDRIVE,
|
|
|
|
SMU_TABLE_I2C_COMMANDS,
|
|
|
|
SMU_TABLE_PACE,
|
|
|
|
SMU_TABLE_COUNT,
|
|
|
|
};
|
|
|
|
|
2018-12-12 20:47:24 +08:00
|
|
|
struct smu_table_context
|
|
|
|
{
|
|
|
|
void *power_play_table;
|
|
|
|
uint32_t power_play_table_size;
|
2019-01-11 15:07:52 +08:00
|
|
|
void *hardcode_pptable;
|
2019-05-17 14:02:15 +08:00
|
|
|
unsigned long metrics_time;
|
|
|
|
void *metrics_table;
|
2019-07-30 11:28:27 +08:00
|
|
|
void *clocks_table;
|
2019-12-31 10:33:19 +08:00
|
|
|
void *watermarks_table;
|
2018-12-15 15:36:58 +08:00
|
|
|
|
2018-12-25 16:34:39 +08:00
|
|
|
void *max_sustainable_clocks;
|
2018-12-15 15:36:58 +08:00
|
|
|
struct smu_bios_boot_up_values boot_values;
|
2018-12-18 22:56:48 +08:00
|
|
|
void *driver_pptable;
|
2020-07-08 11:17:02 +08:00
|
|
|
struct smu_table tables[SMU_TABLE_COUNT];
|
2019-12-31 10:39:34 +08:00
|
|
|
/*
|
|
|
|
* The driver table is just a staging buffer for
|
|
|
|
* uploading/downloading content from the SMU.
|
|
|
|
*
|
|
|
|
* And the table_id for SMU_MSG_TransferTableSmu2Dram/
|
|
|
|
* SMU_MSG_TransferTableDram2Smu instructs SMU
|
|
|
|
* which content driver is interested.
|
|
|
|
*/
|
|
|
|
struct smu_table driver_table;
|
2018-12-17 16:47:49 +08:00
|
|
|
struct smu_table memory_pool;
|
2020-08-26 16:10:29 +08:00
|
|
|
struct smu_table dummy_read_1_table;
|
2019-01-04 16:00:48 +08:00
|
|
|
uint8_t thermal_controller_type;
|
2019-01-08 14:18:02 +08:00
|
|
|
|
2019-01-09 19:11:58 +08:00
|
|
|
void *overdrive_table;
|
2020-01-25 13:04:05 -05:00
|
|
|
void *boot_overdrive_table;
|
2020-07-24 10:42:39 +08:00
|
|
|
|
|
|
|
uint32_t gpu_metrics_table_size;
|
|
|
|
void *gpu_metrics_table;
|
2018-12-12 20:47:24 +08:00
|
|
|
};
|
|
|
|
|
2018-12-17 19:48:59 +08:00
|
|
|
struct smu_dpm_context {
|
|
|
|
uint32_t dpm_context_size;
|
2019-01-11 17:42:47 +08:00
|
|
|
void *dpm_context;
|
|
|
|
void *golden_dpm_context;
|
2019-01-17 17:57:18 +08:00
|
|
|
bool enable_umd_pstate;
|
|
|
|
enum amd_dpm_forced_level dpm_level;
|
|
|
|
enum amd_dpm_forced_level saved_dpm_level;
|
|
|
|
enum amd_dpm_forced_level requested_dpm_level;
|
2019-01-04 17:42:09 +08:00
|
|
|
struct smu_power_state *dpm_request_power_state;
|
|
|
|
struct smu_power_state *dpm_current_power_state;
|
2019-01-17 17:35:58 +08:00
|
|
|
struct mclock_latency_table *mclk_latency_table;
|
2018-12-17 19:48:59 +08:00
|
|
|
};
|
|
|
|
|
2019-04-28 17:43:36 +08:00
|
|
|
struct smu_power_gate {
|
|
|
|
bool uvd_gated;
|
|
|
|
bool vce_gated;
|
2020-08-03 11:15:14 +08:00
|
|
|
atomic_t vcn_gated;
|
|
|
|
atomic_t jpeg_gated;
|
|
|
|
struct mutex vcn_gate_lock;
|
|
|
|
struct mutex jpeg_gate_lock;
|
2019-04-28 17:43:36 +08:00
|
|
|
};
|
|
|
|
|
2018-12-15 10:50:03 +08:00
|
|
|
struct smu_power_context {
|
|
|
|
void *power_context;
|
|
|
|
uint32_t power_context_size;
|
2019-04-28 17:43:36 +08:00
|
|
|
struct smu_power_gate power_gate;
|
2018-12-15 10:50:03 +08:00
|
|
|
};
|
|
|
|
|
2018-12-26 17:36:25 +08:00
|
|
|
|
|
|
|
#define SMU_FEATURE_MAX (64)
|
|
|
|
struct smu_feature
|
|
|
|
{
|
|
|
|
uint32_t feature_num;
|
|
|
|
DECLARE_BITMAP(supported, SMU_FEATURE_MAX);
|
|
|
|
DECLARE_BITMAP(allowed, SMU_FEATURE_MAX);
|
|
|
|
DECLARE_BITMAP(enabled, SMU_FEATURE_MAX);
|
2019-01-24 15:27:02 +08:00
|
|
|
struct mutex mutex;
|
2018-12-26 17:36:25 +08:00
|
|
|
};
|
|
|
|
|
2019-01-17 17:35:58 +08:00
|
|
|
struct smu_clocks {
|
|
|
|
uint32_t engine_clock;
|
|
|
|
uint32_t memory_clock;
|
|
|
|
uint32_t bus_bandwidth;
|
|
|
|
uint32_t engine_clock_in_sr;
|
|
|
|
uint32_t dcef_clock;
|
|
|
|
uint32_t dcef_clock_in_sr;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define MAX_REGULAR_DPM_NUM 16
|
|
|
|
struct mclk_latency_entries {
|
|
|
|
uint32_t frequency;
|
|
|
|
uint32_t latency;
|
|
|
|
};
|
|
|
|
struct mclock_latency_table {
|
|
|
|
uint32_t count;
|
|
|
|
struct mclk_latency_entries entries[MAX_REGULAR_DPM_NUM];
|
|
|
|
};
|
|
|
|
|
2019-09-23 14:56:43 +08:00
|
|
|
enum smu_reset_mode
|
|
|
|
{
|
|
|
|
SMU_RESET_MODE_0,
|
|
|
|
SMU_RESET_MODE_1,
|
|
|
|
SMU_RESET_MODE_2,
|
|
|
|
};
|
|
|
|
|
2019-07-05 15:58:46 -05:00
|
|
|
enum smu_baco_state
|
|
|
|
{
|
|
|
|
SMU_BACO_STATE_ENTER = 0,
|
|
|
|
SMU_BACO_STATE_EXIT,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct smu_baco_context
|
|
|
|
{
|
|
|
|
struct mutex mutex;
|
|
|
|
uint32_t state;
|
|
|
|
bool platform_support;
|
|
|
|
};
|
|
|
|
|
2020-06-10 14:28:20 +08:00
|
|
|
struct pstates_clk_freq {
|
|
|
|
uint32_t min;
|
|
|
|
uint32_t standard;
|
|
|
|
uint32_t peak;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct smu_umd_pstate_table {
|
|
|
|
struct pstates_clk_freq gfxclk_pstate;
|
|
|
|
struct pstates_clk_freq socclk_pstate;
|
|
|
|
struct pstates_clk_freq uclk_pstate;
|
|
|
|
struct pstates_clk_freq vclk_pstate;
|
|
|
|
struct pstates_clk_freq dclk_pstate;
|
|
|
|
};
|
|
|
|
|
2020-07-06 16:11:31 +08:00
|
|
|
struct cmn2asic_msg_mapping {
|
|
|
|
int valid_mapping;
|
|
|
|
int map_to;
|
|
|
|
int valid_in_vf;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cmn2asic_mapping {
|
|
|
|
int valid_mapping;
|
|
|
|
int map_to;
|
|
|
|
};
|
|
|
|
|
2019-01-14 14:37:31 +08:00
|
|
|
#define WORKLOAD_POLICY_MAX 7
|
2018-11-29 13:56:06 +08:00
|
|
|
struct smu_context
|
|
|
|
{
|
|
|
|
struct amdgpu_device *adev;
|
2020-06-01 13:08:56 +08:00
|
|
|
struct amdgpu_irq_src irq_source;
|
2018-11-29 13:56:06 +08:00
|
|
|
|
2018-12-18 20:23:17 +08:00
|
|
|
const struct pptable_funcs *ppt_funcs;
|
2020-07-06 16:11:31 +08:00
|
|
|
const struct cmn2asic_msg_mapping *message_map;
|
|
|
|
const struct cmn2asic_mapping *clock_map;
|
|
|
|
const struct cmn2asic_mapping *feature_map;
|
|
|
|
const struct cmn2asic_mapping *table_map;
|
|
|
|
const struct cmn2asic_mapping *pwr_src_map;
|
|
|
|
const struct cmn2asic_mapping *workload_map;
|
2018-11-29 13:56:06 +08:00
|
|
|
struct mutex mutex;
|
2019-09-26 16:22:13 +08:00
|
|
|
struct mutex sensor_lock;
|
2019-12-17 09:35:01 -05:00
|
|
|
struct mutex metrics_lock;
|
2020-02-26 16:16:14 -07:00
|
|
|
struct mutex message_lock;
|
2018-12-17 16:47:49 +08:00
|
|
|
uint64_t pool_size;
|
2018-12-12 20:47:24 +08:00
|
|
|
|
|
|
|
struct smu_table_context smu_table;
|
2018-12-17 19:48:59 +08:00
|
|
|
struct smu_dpm_context smu_dpm;
|
2018-12-15 10:50:03 +08:00
|
|
|
struct smu_power_context smu_power;
|
2018-12-26 17:36:25 +08:00
|
|
|
struct smu_feature smu_feature;
|
2019-01-17 16:58:57 +08:00
|
|
|
struct amd_pp_display_configuration *display_config;
|
2019-07-05 15:58:46 -05:00
|
|
|
struct smu_baco_context smu_baco;
|
2020-07-02 15:38:53 +08:00
|
|
|
struct smu_temperature_range thermal_range;
|
2019-06-17 13:17:27 -05:00
|
|
|
void *od_settings;
|
2020-02-27 12:44:22 +08:00
|
|
|
#if defined(CONFIG_DEBUG_FS)
|
|
|
|
struct dentry *debugfs_sclk;
|
|
|
|
#endif
|
2018-12-24 19:49:38 +08:00
|
|
|
|
2020-06-10 14:28:20 +08:00
|
|
|
struct smu_umd_pstate_table pstate_table;
|
2018-12-24 19:49:38 +08:00
|
|
|
uint32_t pstate_sclk;
|
|
|
|
uint32_t pstate_mclk;
|
2018-12-25 14:44:25 +08:00
|
|
|
|
2019-01-31 14:11:04 +08:00
|
|
|
bool od_enabled;
|
2020-06-08 16:29:41 +08:00
|
|
|
uint32_t current_power_limit;
|
|
|
|
uint32_t max_power_limit;
|
2019-01-16 14:43:29 +08:00
|
|
|
|
2019-02-20 20:12:22 +08:00
|
|
|
/* soft pptable */
|
|
|
|
uint32_t ppt_offset_bytes;
|
|
|
|
uint32_t ppt_size_bytes;
|
|
|
|
uint8_t *ppt_start_addr;
|
|
|
|
|
2019-01-16 14:43:29 +08:00
|
|
|
bool support_power_containment;
|
2019-01-17 15:25:37 +08:00
|
|
|
bool disable_watermark;
|
|
|
|
|
|
|
|
#define WATERMARKS_EXIST (1 << 0)
|
|
|
|
#define WATERMARKS_LOADED (1 << 1)
|
|
|
|
uint32_t watermarks_bitmap;
|
2019-07-29 17:51:55 +08:00
|
|
|
uint32_t hard_min_uclk_req_from_dal;
|
|
|
|
bool disable_uclk_switch;
|
2019-01-14 14:37:31 +08:00
|
|
|
|
|
|
|
uint32_t workload_mask;
|
|
|
|
uint32_t workload_prority[WORKLOAD_POLICY_MAX];
|
|
|
|
uint32_t workload_setting[WORKLOAD_POLICY_MAX];
|
|
|
|
uint32_t power_profile_mode;
|
|
|
|
uint32_t default_power_profile_mode;
|
2019-05-08 14:38:55 +08:00
|
|
|
bool pm_enabled;
|
2019-09-18 15:11:34 +08:00
|
|
|
bool is_apu;
|
2019-03-11 11:00:48 +08:00
|
|
|
|
2020-04-15 10:57:33 +08:00
|
|
|
uint32_t smc_driver_if_version;
|
|
|
|
uint32_t smc_fw_if_version;
|
|
|
|
uint32_t smc_fw_version;
|
2019-05-13 17:31:03 +08:00
|
|
|
|
2019-11-11 17:15:02 +08:00
|
|
|
bool uploading_custom_pp_table;
|
2020-03-20 12:37:23 -04:00
|
|
|
bool dc_controlled_by_gpio;
|
2020-06-03 11:45:49 +08:00
|
|
|
|
|
|
|
struct work_struct throttling_logging_work;
|
2020-07-23 23:09:57 -04:00
|
|
|
atomic64_t throttle_int_counter;
|
2020-10-01 09:03:37 -04:00
|
|
|
struct work_struct interrupt_work;
|
2020-08-26 23:22:24 -04:00
|
|
|
|
|
|
|
unsigned fan_max_rpm;
|
|
|
|
unsigned manual_fan_speed_rpm;
|
2018-11-29 13:56:06 +08:00
|
|
|
};
|
|
|
|
|
2019-10-11 13:48:24 -04:00
|
|
|
struct i2c_adapter;
|
|
|
|
|
2018-12-18 20:23:17 +08:00
|
|
|
struct pptable_funcs {
|
2019-09-05 12:22:42 +08:00
|
|
|
int (*run_btc)(struct smu_context *smu);
|
2019-03-19 17:20:09 +08:00
|
|
|
int (*get_allowed_feature_mask)(struct smu_context *smu, uint32_t *feature_mask, uint32_t num);
|
2019-01-04 17:42:09 +08:00
|
|
|
enum amd_pm_state_type (*get_current_power_state)(struct smu_context *smu);
|
2018-12-20 20:31:55 +08:00
|
|
|
int (*set_default_dpm_table)(struct smu_context *smu);
|
2019-01-04 17:42:09 +08:00
|
|
|
int (*set_power_state)(struct smu_context *smu);
|
2018-12-24 19:49:38 +08:00
|
|
|
int (*populate_umd_state_clk)(struct smu_context *smu);
|
2019-04-18 15:06:34 +08:00
|
|
|
int (*print_clk_levels)(struct smu_context *smu, enum smu_clk_type clk_type, char *buf);
|
2019-04-19 10:31:18 +08:00
|
|
|
int (*force_clk_levels)(struct smu_context *smu, enum smu_clk_type clk_type, uint32_t mask);
|
2019-01-21 14:58:38 +08:00
|
|
|
int (*od_edit_dpm_table)(struct smu_context *smu,
|
|
|
|
enum PP_OD_DPM_TABLE_COMMAND type,
|
|
|
|
long *input, uint32_t size);
|
2019-01-14 11:55:45 +08:00
|
|
|
int (*get_clock_by_type_with_latency)(struct smu_context *smu,
|
2019-04-19 14:05:58 +08:00
|
|
|
enum smu_clk_type clk_type,
|
2019-01-14 11:55:45 +08:00
|
|
|
struct
|
|
|
|
pp_clock_levels_with_latency
|
|
|
|
*clocks);
|
2019-01-14 14:37:31 +08:00
|
|
|
int (*get_power_profile_mode)(struct smu_context *smu, char *buf);
|
|
|
|
int (*set_power_profile_mode)(struct smu_context *smu, long *input, uint32_t size);
|
2020-06-05 18:28:58 +08:00
|
|
|
int (*dpm_set_vcn_enable)(struct smu_context *smu, bool enable);
|
2019-11-08 13:54:33 -05:00
|
|
|
int (*dpm_set_jpeg_enable)(struct smu_context *smu, bool enable);
|
2019-03-05 14:16:12 +08:00
|
|
|
int (*read_sensor)(struct smu_context *smu, enum amd_pp_sensors sensor,
|
|
|
|
void *data, uint32_t *size);
|
2019-01-24 19:53:40 +08:00
|
|
|
int (*pre_display_config_changed)(struct smu_context *smu);
|
|
|
|
int (*display_config_changed)(struct smu_context *smu);
|
|
|
|
int (*apply_clocks_adjust_rules)(struct smu_context *smu);
|
2019-12-16 15:05:22 -05:00
|
|
|
int (*notify_smc_display_config)(struct smu_context *smu);
|
2019-03-05 15:42:16 +08:00
|
|
|
bool (*is_dpm_running)(struct smu_context *smu);
|
2019-07-18 15:25:04 -05:00
|
|
|
int (*get_fan_speed_rpm)(struct smu_context *smu, uint32_t *speed);
|
2020-07-07 15:52:39 +08:00
|
|
|
int (*set_watermarks_table)(struct smu_context *smu,
|
2020-09-03 15:02:37 +08:00
|
|
|
struct pp_smu_wm_range_sets *clock_ranges);
|
2019-06-10 21:39:29 +08:00
|
|
|
int (*get_thermal_temperature_range)(struct smu_context *smu, struct smu_temperature_range *range);
|
2019-05-21 15:02:23 -04:00
|
|
|
int (*get_uclk_dpm_states)(struct smu_context *smu, uint32_t *clocks_in_khz, uint32_t *num_states);
|
2020-05-29 14:07:41 +08:00
|
|
|
int (*set_default_od_settings)(struct smu_context *smu);
|
2019-07-19 11:39:21 +08:00
|
|
|
int (*set_performance_level)(struct smu_context *smu, enum amd_dpm_forced_level level);
|
2019-07-29 17:51:55 +08:00
|
|
|
int (*display_disable_memory_clock_switch)(struct smu_context *smu, bool disable_memory_clock_switch);
|
2019-07-30 22:50:14 -05:00
|
|
|
void (*dump_pptable)(struct smu_context *smu);
|
2020-06-08 16:41:16 +08:00
|
|
|
int (*get_power_limit)(struct smu_context *smu);
|
2019-10-10 11:40:37 +08:00
|
|
|
int (*set_df_cstate)(struct smu_context *smu, enum pp_df_cstate state);
|
2020-05-13 17:45:06 +08:00
|
|
|
int (*allow_xgmi_power_down)(struct smu_context *smu, bool en);
|
2019-10-11 17:51:34 +08:00
|
|
|
int (*update_pcie_parameters)(struct smu_context *smu, uint32_t pcie_gen_cap, uint32_t pcie_width_cap);
|
2020-07-17 09:40:19 -04:00
|
|
|
int (*i2c_init)(struct smu_context *smu, struct i2c_adapter *control);
|
|
|
|
void (*i2c_fini)(struct smu_context *smu, struct i2c_adapter *control);
|
2020-04-27 09:28:04 -04:00
|
|
|
void (*get_unique_id)(struct smu_context *smu);
|
2019-09-18 09:53:30 -04:00
|
|
|
int (*get_dpm_clock_table)(struct smu_context *smu, struct dpm_clocks *clock_table);
|
2018-11-29 13:56:06 +08:00
|
|
|
int (*init_microcode)(struct smu_context *smu);
|
2019-10-17 19:59:29 +08:00
|
|
|
int (*load_microcode)(struct smu_context *smu);
|
2020-06-01 14:03:57 +08:00
|
|
|
void (*fini_microcode)(struct smu_context *smu);
|
2018-12-04 17:42:08 +08:00
|
|
|
int (*init_smc_tables)(struct smu_context *smu);
|
2018-12-14 17:43:57 +08:00
|
|
|
int (*fini_smc_tables)(struct smu_context *smu);
|
2018-12-04 18:13:19 +08:00
|
|
|
int (*init_power)(struct smu_context *smu);
|
2018-12-15 10:50:03 +08:00
|
|
|
int (*fini_power)(struct smu_context *smu);
|
2018-12-02 18:25:00 +08:00
|
|
|
int (*check_fw_status)(struct smu_context *smu);
|
2019-06-21 10:49:22 -05:00
|
|
|
int (*setup_pptable)(struct smu_context *smu);
|
2018-12-04 18:24:58 +08:00
|
|
|
int (*get_vbios_bootup_values)(struct smu_context *smu);
|
2018-12-04 21:51:23 +08:00
|
|
|
int (*check_fw_version)(struct smu_context *smu);
|
2019-08-09 10:34:40 -05:00
|
|
|
int (*powergate_sdma)(struct smu_context *smu, bool gate);
|
2019-07-16 17:21:17 +08:00
|
|
|
int (*set_gfx_cgpg)(struct smu_context *smu, bool enable);
|
2018-12-04 21:57:05 +08:00
|
|
|
int (*write_pptable)(struct smu_context *smu);
|
2019-12-31 10:39:34 +08:00
|
|
|
int (*set_driver_table_location)(struct smu_context *smu);
|
2018-12-04 22:04:24 +08:00
|
|
|
int (*set_tool_table_location)(struct smu_context *smu);
|
2018-12-05 11:45:34 +08:00
|
|
|
int (*notify_memory_pool_location)(struct smu_context *smu);
|
2019-01-10 23:58:08 +08:00
|
|
|
int (*system_features_control)(struct smu_context *smu, bool en);
|
2019-12-02 15:04:35 +08:00
|
|
|
int (*send_smc_msg_with_param)(struct smu_context *smu,
|
2020-02-26 16:16:12 -07:00
|
|
|
enum smu_message_type msg, uint32_t param, uint32_t *read_arg);
|
2020-07-08 12:11:59 +08:00
|
|
|
int (*send_smc_msg)(struct smu_context *smu,
|
|
|
|
enum smu_message_type msg,
|
|
|
|
uint32_t *read_arg);
|
2019-05-29 23:30:32 -05:00
|
|
|
int (*init_display_count)(struct smu_context *smu, uint32_t count);
|
2018-12-26 17:36:25 +08:00
|
|
|
int (*set_allowed_mask)(struct smu_context *smu);
|
|
|
|
int (*get_enabled_mask)(struct smu_context *smu, uint32_t *feature_mask, uint32_t num);
|
2020-07-07 11:10:39 +08:00
|
|
|
int (*feature_is_enabled)(struct smu_context *smu, enum smu_feature_mask mask);
|
2020-07-07 11:41:29 +08:00
|
|
|
int (*disable_all_features_with_exception)(struct smu_context *smu, enum smu_feature_mask mask);
|
2018-12-26 16:14:55 +08:00
|
|
|
int (*notify_display_change)(struct smu_context *smu);
|
2019-01-22 17:56:16 +08:00
|
|
|
int (*set_power_limit)(struct smu_context *smu, uint32_t n);
|
2018-12-25 16:34:39 +08:00
|
|
|
int (*init_max_sustainable_clocks)(struct smu_context *smu);
|
2020-05-26 17:06:04 +08:00
|
|
|
int (*enable_thermal_alert)(struct smu_context *smu);
|
|
|
|
int (*disable_thermal_alert)(struct smu_context *smu);
|
2020-06-08 19:31:03 +08:00
|
|
|
int (*set_min_dcef_deep_sleep)(struct smu_context *smu, uint32_t clk);
|
2019-01-14 15:24:59 +08:00
|
|
|
int (*display_clock_voltage_request)(struct smu_context *smu, struct
|
|
|
|
pp_display_clock_request
|
|
|
|
*clock_req);
|
2019-01-24 18:39:04 +08:00
|
|
|
uint32_t (*get_fan_control_mode)(struct smu_context *smu);
|
2019-01-25 16:21:27 +08:00
|
|
|
int (*set_fan_control_mode)(struct smu_context *smu, uint32_t mode);
|
2019-01-25 17:45:24 +08:00
|
|
|
int (*set_fan_speed_rpm)(struct smu_context *smu, uint32_t speed);
|
2019-04-11 11:01:07 -04:00
|
|
|
int (*set_xgmi_pstate)(struct smu_context *smu, uint32_t pstate);
|
2019-03-27 11:46:31 +08:00
|
|
|
int (*gfx_off_control)(struct smu_context *smu, bool enable);
|
2020-07-07 18:52:18 +08:00
|
|
|
uint32_t (*get_gfx_off_status)(struct smu_context *smu);
|
2019-05-30 18:00:22 +08:00
|
|
|
int (*register_irq_handler)(struct smu_context *smu);
|
2019-05-21 15:38:59 -04:00
|
|
|
int (*set_azalia_d3_pme)(struct smu_context *smu);
|
2019-05-21 13:07:57 -04:00
|
|
|
int (*get_max_sustainable_clocks_by_dc)(struct smu_context *smu, struct pp_smu_nv_clock_table *max_clocks);
|
2019-07-05 15:58:46 -05:00
|
|
|
bool (*baco_is_support)(struct smu_context *smu);
|
|
|
|
enum smu_baco_state (*baco_get_state)(struct smu_context *smu);
|
|
|
|
int (*baco_set_state)(struct smu_context *smu, enum smu_baco_state state);
|
2019-10-28 15:20:03 -04:00
|
|
|
int (*baco_enter)(struct smu_context *smu);
|
|
|
|
int (*baco_exit)(struct smu_context *smu);
|
2020-07-10 17:39:24 +08:00
|
|
|
bool (*mode1_reset_is_support)(struct smu_context *smu);
|
|
|
|
int (*mode1_reset)(struct smu_context *smu);
|
2019-09-23 14:56:43 +08:00
|
|
|
int (*mode2_reset)(struct smu_context *smu);
|
2019-08-15 16:53:08 +08:00
|
|
|
int (*get_dpm_ultimate_freq)(struct smu_context *smu, enum smu_clk_type clk_type, uint32_t *min, uint32_t *max);
|
2019-09-24 14:40:09 +08:00
|
|
|
int (*set_soft_freq_limited_range)(struct smu_context *smu, enum smu_clk_type clk_type, uint32_t min, uint32_t max);
|
2020-03-20 14:03:25 -04:00
|
|
|
int (*set_power_source)(struct smu_context *smu, enum smu_power_src_type power_src);
|
2020-05-21 12:36:44 +08:00
|
|
|
void (*log_thermal_throttling_event)(struct smu_context *smu);
|
2020-07-07 14:06:40 +08:00
|
|
|
size_t (*get_pp_feature_mask)(struct smu_context *smu, char *buf);
|
|
|
|
int (*set_pp_feature_mask)(struct smu_context *smu, uint64_t new_mask);
|
2020-07-23 18:03:35 +08:00
|
|
|
ssize_t (*get_gpu_metrics)(struct smu_context *smu, void **table);
|
2020-08-12 12:08:56 +08:00
|
|
|
int (*enable_mgpu_fan_boost)(struct smu_context *smu);
|
2020-08-17 14:52:06 +08:00
|
|
|
int (*gfx_ulv_control)(struct smu_context *smu, bool enablement);
|
2020-08-17 15:52:42 +08:00
|
|
|
int (*deep_sleep_control)(struct smu_context *smu, bool enablement);
|
2020-08-26 23:22:24 -04:00
|
|
|
int (*get_fan_parameters)(struct smu_context *smu);
|
2020-09-01 10:23:34 +08:00
|
|
|
int (*post_init)(struct smu_context *smu);
|
2020-10-01 09:03:37 -04:00
|
|
|
void (*interrupt_work)(struct smu_context *smu);
|
2018-11-29 13:56:06 +08:00
|
|
|
};
|
|
|
|
|
2020-06-02 17:48:11 +08:00
|
|
|
typedef enum {
|
|
|
|
METRICS_CURR_GFXCLK,
|
|
|
|
METRICS_CURR_SOCCLK,
|
|
|
|
METRICS_CURR_UCLK,
|
|
|
|
METRICS_CURR_VCLK,
|
2020-06-04 18:28:34 +08:00
|
|
|
METRICS_CURR_VCLK1,
|
2020-06-02 17:48:11 +08:00
|
|
|
METRICS_CURR_DCLK,
|
2020-06-04 18:28:34 +08:00
|
|
|
METRICS_CURR_DCLK1,
|
2020-06-02 17:48:11 +08:00
|
|
|
METRICS_CURR_FCLK,
|
2020-06-04 15:37:22 +08:00
|
|
|
METRICS_CURR_DCEFCLK,
|
2020-06-02 17:48:11 +08:00
|
|
|
METRICS_AVERAGE_GFXCLK,
|
|
|
|
METRICS_AVERAGE_SOCCLK,
|
2020-06-04 18:28:34 +08:00
|
|
|
METRICS_AVERAGE_FCLK,
|
2020-06-02 17:48:11 +08:00
|
|
|
METRICS_AVERAGE_UCLK,
|
|
|
|
METRICS_AVERAGE_VCLK,
|
|
|
|
METRICS_AVERAGE_DCLK,
|
|
|
|
METRICS_AVERAGE_GFXACTIVITY,
|
|
|
|
METRICS_AVERAGE_MEMACTIVITY,
|
|
|
|
METRICS_AVERAGE_VCNACTIVITY,
|
|
|
|
METRICS_AVERAGE_SOCKETPOWER,
|
|
|
|
METRICS_TEMPERATURE_EDGE,
|
|
|
|
METRICS_TEMPERATURE_HOTSPOT,
|
|
|
|
METRICS_TEMPERATURE_MEM,
|
|
|
|
METRICS_TEMPERATURE_VRGFX,
|
|
|
|
METRICS_TEMPERATURE_VRSOC,
|
|
|
|
METRICS_TEMPERATURE_VRMEM,
|
|
|
|
METRICS_THROTTLER_STATUS,
|
|
|
|
METRICS_CURR_FANSPEED,
|
|
|
|
} MetricsMember_t;
|
|
|
|
|
2020-07-06 16:11:31 +08:00
|
|
|
enum smu_cmn2asic_mapping_type {
|
|
|
|
CMN2ASIC_MAPPING_MSG,
|
|
|
|
CMN2ASIC_MAPPING_CLK,
|
|
|
|
CMN2ASIC_MAPPING_FEATURE,
|
|
|
|
CMN2ASIC_MAPPING_TABLE,
|
|
|
|
CMN2ASIC_MAPPING_PWR,
|
|
|
|
CMN2ASIC_MAPPING_WORKLOAD,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define MSG_MAP(msg, index, valid_in_vf) \
|
|
|
|
[SMU_MSG_##msg] = {1, (index), (valid_in_vf)}
|
|
|
|
|
|
|
|
#define CLK_MAP(clk, index) \
|
|
|
|
[SMU_##clk] = {1, (index)}
|
|
|
|
|
|
|
|
#define FEA_MAP(fea) \
|
|
|
|
[SMU_FEATURE_##fea##_BIT] = {1, FEATURE_##fea##_BIT}
|
|
|
|
|
|
|
|
#define TAB_MAP(tab) \
|
|
|
|
[SMU_TABLE_##tab] = {1, TABLE_##tab}
|
|
|
|
|
|
|
|
#define TAB_MAP_VALID(tab) \
|
|
|
|
[SMU_TABLE_##tab] = {1, TABLE_##tab}
|
|
|
|
|
|
|
|
#define TAB_MAP_INVALID(tab) \
|
|
|
|
[SMU_TABLE_##tab] = {0, TABLE_##tab}
|
|
|
|
|
|
|
|
#define PWR_MAP(tab) \
|
|
|
|
[SMU_POWER_SOURCE_##tab] = {1, POWER_SOURCE_##tab}
|
|
|
|
|
|
|
|
#define WORKLOAD_MAP(profile, workload) \
|
|
|
|
[profile] = {1, (workload)}
|
|
|
|
|
2020-07-08 12:45:00 +08:00
|
|
|
#if !defined(SWSMU_CODE_LAYER_L2) && !defined(SWSMU_CODE_LAYER_L3) && !defined(SWSMU_CODE_LAYER_L4)
|
2019-10-16 14:43:07 +08:00
|
|
|
int smu_load_microcode(struct smu_context *smu);
|
|
|
|
|
|
|
|
int smu_check_fw_status(struct smu_context *smu);
|
|
|
|
|
|
|
|
int smu_set_gfx_cgpg(struct smu_context *smu, bool enabled);
|
|
|
|
|
2019-10-17 14:15:41 +08:00
|
|
|
int smu_set_fan_speed_rpm(struct smu_context *smu, uint32_t speed);
|
2019-10-16 14:43:07 +08:00
|
|
|
|
|
|
|
int smu_get_power_limit(struct smu_context *smu,
|
|
|
|
uint32_t *limit,
|
2020-06-08 17:04:04 +08:00
|
|
|
bool max_setting);
|
2019-10-16 14:43:07 +08:00
|
|
|
|
|
|
|
int smu_set_power_limit(struct smu_context *smu, uint32_t limit);
|
|
|
|
int smu_print_clk_levels(struct smu_context *smu, enum smu_clk_type clk_type, char *buf);
|
|
|
|
|
|
|
|
int smu_od_edit_dpm_table(struct smu_context *smu,
|
|
|
|
enum PP_OD_DPM_TABLE_COMMAND type,
|
|
|
|
long *input, uint32_t size);
|
|
|
|
|
|
|
|
int smu_read_sensor(struct smu_context *smu,
|
|
|
|
enum amd_pp_sensors sensor,
|
|
|
|
void *data, uint32_t *size);
|
|
|
|
int smu_get_power_profile_mode(struct smu_context *smu, char *buf);
|
|
|
|
|
|
|
|
int smu_set_power_profile_mode(struct smu_context *smu,
|
|
|
|
long *param,
|
|
|
|
uint32_t param_size,
|
|
|
|
bool lock_needed);
|
|
|
|
int smu_get_fan_control_mode(struct smu_context *smu);
|
|
|
|
int smu_set_fan_control_mode(struct smu_context *smu, int value);
|
|
|
|
int smu_get_fan_speed_percent(struct smu_context *smu, uint32_t *speed);
|
|
|
|
int smu_set_fan_speed_percent(struct smu_context *smu, uint32_t speed);
|
|
|
|
int smu_get_fan_speed_rpm(struct smu_context *smu, uint32_t *speed);
|
2018-11-29 13:56:06 +08:00
|
|
|
|
2019-10-16 14:43:07 +08:00
|
|
|
int smu_set_deep_sleep_dcefclk(struct smu_context *smu, int clk);
|
|
|
|
|
|
|
|
int smu_get_clock_by_type_with_latency(struct smu_context *smu,
|
|
|
|
enum smu_clk_type clk_type,
|
|
|
|
struct pp_clock_levels_with_latency *clocks);
|
|
|
|
|
|
|
|
int smu_display_clock_voltage_request(struct smu_context *smu,
|
|
|
|
struct pp_display_clock_request *clock_req);
|
|
|
|
int smu_display_disable_memory_clock_switch(struct smu_context *smu, bool disable_memory_clock_switch);
|
|
|
|
|
|
|
|
int smu_set_xgmi_pstate(struct smu_context *smu,
|
|
|
|
uint32_t pstate);
|
|
|
|
|
|
|
|
int smu_set_azalia_d3_pme(struct smu_context *smu);
|
|
|
|
|
|
|
|
bool smu_baco_is_support(struct smu_context *smu);
|
|
|
|
|
|
|
|
int smu_baco_get_state(struct smu_context *smu, enum smu_baco_state *state);
|
|
|
|
|
2019-10-28 15:20:03 -04:00
|
|
|
int smu_baco_enter(struct smu_context *smu);
|
|
|
|
int smu_baco_exit(struct smu_context *smu);
|
2019-10-16 14:43:07 +08:00
|
|
|
|
2020-07-10 17:39:24 +08:00
|
|
|
bool smu_mode1_reset_is_support(struct smu_context *smu);
|
|
|
|
int smu_mode1_reset(struct smu_context *smu);
|
2019-10-16 14:43:07 +08:00
|
|
|
int smu_mode2_reset(struct smu_context *smu);
|
2019-10-11 17:51:34 +08:00
|
|
|
|
2018-11-29 13:56:06 +08:00
|
|
|
extern const struct amd_ip_funcs smu_ip_funcs;
|
|
|
|
|
2018-11-29 14:01:47 +08:00
|
|
|
extern const struct amdgpu_ip_block_version smu_v11_0_ip_block;
|
2019-07-24 14:00:01 -05:00
|
|
|
extern const struct amdgpu_ip_block_version smu_v12_0_ip_block;
|
|
|
|
|
2019-01-10 12:33:23 +08:00
|
|
|
bool is_support_sw_smu(struct amdgpu_device *adev);
|
2019-01-11 15:07:52 +08:00
|
|
|
int smu_reset(struct smu_context *smu);
|
|
|
|
int smu_sys_get_pp_table(struct smu_context *smu, void **table);
|
|
|
|
int smu_sys_set_pp_table(struct smu_context *smu, void *buf, size_t size);
|
2019-01-17 13:15:48 +08:00
|
|
|
int smu_get_power_num_states(struct smu_context *smu, struct pp_states_info *state_info);
|
2019-01-17 13:29:06 +08:00
|
|
|
enum amd_pm_state_type smu_get_current_power_state(struct smu_context *smu);
|
2019-09-18 09:53:30 -04:00
|
|
|
int smu_write_watermarks_table(struct smu_context *smu);
|
|
|
|
int smu_set_watermarks_for_clock_ranges(
|
|
|
|
struct smu_context *smu,
|
2020-09-03 15:02:37 +08:00
|
|
|
struct pp_smu_wm_range_sets *clock_ranges);
|
2019-01-07 15:34:09 +08:00
|
|
|
|
2019-01-11 16:23:36 +08:00
|
|
|
/* smu to display interface */
|
|
|
|
extern int smu_display_configuration_change(struct smu_context *smu, const
|
|
|
|
struct amd_pp_display_configuration
|
|
|
|
*display_config);
|
2019-01-25 15:10:13 +08:00
|
|
|
extern int smu_dpm_set_power_gate(struct smu_context *smu,uint32_t block_type, bool gate);
|
2019-01-24 19:53:40 +08:00
|
|
|
extern int smu_handle_task(struct smu_context *smu,
|
|
|
|
enum amd_dpm_forced_level level,
|
2019-10-16 14:43:07 +08:00
|
|
|
enum amd_pp_task task_id,
|
|
|
|
bool lock_needed);
|
2019-07-31 10:34:36 +08:00
|
|
|
int smu_switch_power_profile(struct smu_context *smu,
|
|
|
|
enum PP_SMC_POWER_PROFILE type,
|
|
|
|
bool en);
|
2019-04-18 18:46:04 +08:00
|
|
|
int smu_get_dpm_freq_range(struct smu_context *smu, enum smu_clk_type clk_type,
|
2020-06-09 16:16:56 +08:00
|
|
|
uint32_t *min, uint32_t *max);
|
2019-04-19 10:19:28 +08:00
|
|
|
int smu_set_soft_freq_range(struct smu_context *smu, enum smu_clk_type clk_type,
|
2020-06-09 14:57:06 +08:00
|
|
|
uint32_t min, uint32_t max);
|
2019-05-15 12:59:58 +08:00
|
|
|
enum amd_dpm_forced_level smu_get_performance_level(struct smu_context *smu);
|
|
|
|
int smu_force_performance_level(struct smu_context *smu, enum amd_dpm_forced_level level);
|
2019-05-29 23:30:32 -05:00
|
|
|
int smu_set_display_count(struct smu_context *smu, uint32_t count);
|
2020-03-20 13:03:12 -04:00
|
|
|
int smu_set_ac_dc(struct smu_context *smu);
|
2019-07-25 11:47:44 +08:00
|
|
|
size_t smu_sys_get_pp_feature_mask(struct smu_context *smu, char *buf);
|
|
|
|
int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t new_mask);
|
2019-08-30 17:30:46 +08:00
|
|
|
int smu_force_clk_levels(struct smu_context *smu,
|
|
|
|
enum smu_clk_type clk_type,
|
2020-07-02 12:42:06 +08:00
|
|
|
uint32_t mask);
|
2019-09-11 19:35:45 +08:00
|
|
|
int smu_set_mp1_state(struct smu_context *smu,
|
|
|
|
enum pp_mp1_state mp1_state);
|
2019-10-10 11:40:37 +08:00
|
|
|
int smu_set_df_cstate(struct smu_context *smu,
|
|
|
|
enum pp_df_cstate state);
|
2020-05-13 17:45:06 +08:00
|
|
|
int smu_allow_xgmi_power_down(struct smu_context *smu, bool en);
|
2019-05-29 23:30:32 -05:00
|
|
|
|
2019-10-16 14:43:07 +08:00
|
|
|
int smu_get_max_sustainable_clocks_by_dc(struct smu_context *smu,
|
|
|
|
struct pp_smu_nv_clock_table *max_clocks);
|
|
|
|
|
|
|
|
int smu_get_uclk_dpm_states(struct smu_context *smu,
|
|
|
|
unsigned int *clock_values_in_khz,
|
|
|
|
unsigned int *num_states);
|
|
|
|
|
|
|
|
int smu_get_dpm_clock_table(struct smu_context *smu,
|
|
|
|
struct dpm_clocks *clock_table);
|
|
|
|
|
2020-07-07 18:52:18 +08:00
|
|
|
int smu_get_status_gfxoff(struct amdgpu_device *adev, uint32_t *value);
|
|
|
|
|
2020-07-23 18:03:35 +08:00
|
|
|
ssize_t smu_sys_get_gpu_metrics(struct smu_context *smu, void **table);
|
|
|
|
|
2020-08-12 12:08:56 +08:00
|
|
|
int smu_enable_mgpu_fan_boost(struct smu_context *smu);
|
|
|
|
|
2018-11-29 13:56:06 +08:00
|
|
|
#endif
|
2020-07-08 12:45:00 +08:00
|
|
|
#endif
|