mirror of
https://github.com/torvalds/linux.git
synced 2026-04-28 03:22:27 -04:00
Merge tag 'amd-drm-next-5.14-2021-06-02' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
amd-drm-next-5.14-2021-06-02:
amdgpu:
- GC/MM register access macro clean up for SR-IOV
- Beige Goby updates
- W=1 Fixes
- Aldebaran fixes
- Misc display fixes
- ACPI ATCS/ATIF handling rework
- SR-IOV fixes
- RAS fixes
- 16bpc fixed point format support
- Initial smartshift support
- RV/PCO power tuning fixes for suspend/resume
- More buffer object subclassing work
- Add new INFO query for additional vbios information
- Add new placement for preemptable SG buffers
amdkfd:
- Misc fixes
radeon:
- W=1 Fixes
- Misc cleanups
UAPI:
- Add new INFO query for additional vbios information
Useful for debugging vbios related issues. Proposed umr patch:
https://patchwork.freedesktop.org/patch/433297/
- 16bpc fixed point format support
IGT test:
https://lists.freedesktop.org/archives/igt-dev/2021-May/031507.html
Proposed Vulkan patch:
a25d480207
- Add a new GEM flag which is only used internally in the kernel driver. Userspace
is not allowed to set it.
drm:
- 16bpc fixed point format fourcc
Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210602214009.4553-1-alexander.deucher@amd.com
This commit is contained in:
@@ -1942,7 +1942,7 @@ static int amdgpu_device_attr_create(struct amdgpu_device *adev,
|
||||
|
||||
BUG_ON(!attr);
|
||||
|
||||
attr_update = attr->attr_update ? attr_update : default_attr_update;
|
||||
attr_update = attr->attr_update ? attr->attr_update : default_attr_update;
|
||||
|
||||
ret = attr_update(adev, attr, mask, &attr_states);
|
||||
if (ret) {
|
||||
|
||||
@@ -1176,7 +1176,7 @@ typedef struct {
|
||||
uint16_t LedGpio; //GeneriA GPIO flag used to control the radeon LEDs
|
||||
uint16_t GfxPowerStagesGpio; //Genlk_vsync GPIO flag used to control gfx power stages
|
||||
|
||||
uint32_t SkuReserved[16];
|
||||
uint32_t SkuReserved[63];
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -51,12 +51,6 @@
|
||||
#define CTF_OFFSET_HOTSPOT 5
|
||||
#define CTF_OFFSET_MEM 5
|
||||
|
||||
static const struct smu_temperature_range smu13_thermal_policy[] =
|
||||
{
|
||||
{-273150, 99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000},
|
||||
{ 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000},
|
||||
};
|
||||
|
||||
struct smu_13_0_max_sustainable_clocks {
|
||||
uint32_t display_clock;
|
||||
uint32_t phy_clock;
|
||||
|
||||
@@ -82,7 +82,8 @@ int phm_enable_dynamic_state_management(struct pp_hwmgr *hwmgr)
|
||||
|
||||
/* Skip for suspend/resume case */
|
||||
if (!hwmgr->pp_one_vf && smum_is_dpm_running(hwmgr)
|
||||
&& !amdgpu_passthrough(adev) && adev->in_suspend) {
|
||||
&& !amdgpu_passthrough(adev) && adev->in_suspend
|
||||
&& adev->asic_type != CHIP_RAVEN) {
|
||||
pr_info("dpm has been enabled\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -377,6 +377,27 @@ static int smu10_enable_gfx_off(struct pp_hwmgr *hwmgr)
|
||||
|
||||
static int smu10_enable_dpm_tasks(struct pp_hwmgr *hwmgr)
|
||||
{
|
||||
struct amdgpu_device *adev = hwmgr->adev;
|
||||
struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend);
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (adev->in_suspend) {
|
||||
pr_info("restore the fine grain parameters\n");
|
||||
|
||||
ret = smum_send_msg_to_smc_with_parameter(hwmgr,
|
||||
PPSMC_MSG_SetHardMinGfxClk,
|
||||
smu10_data->gfx_actual_soft_min_freq,
|
||||
NULL);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = smum_send_msg_to_smc_with_parameter(hwmgr,
|
||||
PPSMC_MSG_SetSoftMaxGfxClk,
|
||||
smu10_data->gfx_actual_soft_max_freq,
|
||||
NULL);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -129,10 +129,10 @@ int smu7_fan_ctrl_set_static_mode(struct pp_hwmgr *hwmgr, uint32_t mode)
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset Fan Speed Control to default mode.
|
||||
* @hwmgr: the address of the powerplay hardware manager.
|
||||
* Exception: Should always succeed.
|
||||
*/
|
||||
* smu7_fan_ctrl_set_default_mode - Reset Fan Speed Control to default mode.
|
||||
* @hwmgr: the address of the powerplay hardware manager.
|
||||
* Exception: Should always succeed.
|
||||
*/
|
||||
int smu7_fan_ctrl_set_default_mode(struct pp_hwmgr *hwmgr)
|
||||
{
|
||||
if (!hwmgr->fan_ctrl_is_in_default_mode) {
|
||||
|
||||
@@ -544,7 +544,7 @@ static int vega10_get_socclk_for_voltage_evv(struct pp_hwmgr *hwmgr,
|
||||
|
||||
#define ATOM_VIRTUAL_VOLTAGE_ID0 0xff01
|
||||
/**
|
||||
* Get Leakage VDDC based on leakage ID.
|
||||
* vega10_get_evv_voltages - Get Leakage VDDC based on leakage ID.
|
||||
*
|
||||
* @hwmgr: the address of the powerplay hardware manager.
|
||||
* return: always 0.
|
||||
@@ -600,7 +600,7 @@ static int vega10_get_evv_voltages(struct pp_hwmgr *hwmgr)
|
||||
}
|
||||
|
||||
/**
|
||||
* Change virtual leakage voltage to actual value.
|
||||
* vega10_patch_with_vdd_leakage - Change virtual leakage voltage to actual value.
|
||||
*
|
||||
* @hwmgr: the address of the powerplay hardware manager.
|
||||
* @voltage: pointer to changing voltage
|
||||
@@ -626,7 +626,7 @@ static void vega10_patch_with_vdd_leakage(struct pp_hwmgr *hwmgr,
|
||||
}
|
||||
|
||||
/**
|
||||
* Patch voltage lookup table by EVV leakages.
|
||||
* vega10_patch_lookup_table_with_leakage - Patch voltage lookup table by EVV leakages.
|
||||
*
|
||||
* @hwmgr: the address of the powerplay hardware manager.
|
||||
* @lookup_table: pointer to voltage lookup table
|
||||
@@ -1003,7 +1003,7 @@ static int vega10_setup_asic_task(struct pp_hwmgr *hwmgr)
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove repeated voltage values and create table with unique values.
|
||||
* vega10_trim_voltage_table - Remove repeated voltage values and create table with unique values.
|
||||
*
|
||||
* @hwmgr: the address of the powerplay hardware manager.
|
||||
* @vol_table: the pointer to changing voltage table
|
||||
@@ -1152,7 +1152,7 @@ static void vega10_trim_voltage_table_to_fit_state_table(
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Voltage Tables.
|
||||
* vega10_construct_voltage_tables - Create Voltage Tables.
|
||||
*
|
||||
* @hwmgr: the address of the powerplay hardware manager.
|
||||
* return: always 0
|
||||
@@ -1595,7 +1595,8 @@ static int vega10_populate_smc_link_levels(struct pp_hwmgr *hwmgr)
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates single SMC GFXSCLK structure using the provided engine clock
|
||||
* vega10_populate_single_gfx_level - Populates single SMC GFXSCLK structure
|
||||
* using the provided engine clock
|
||||
*
|
||||
* @hwmgr: the address of the hardware manager
|
||||
* @gfx_clock: the GFX clock to use to populate the structure.
|
||||
@@ -1660,7 +1661,8 @@ static int vega10_populate_single_gfx_level(struct pp_hwmgr *hwmgr,
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates single SMC SOCCLK structure using the provided clock.
|
||||
* vega10_populate_single_soc_level - Populates single SMC SOCCLK structure
|
||||
* using the provided clock.
|
||||
*
|
||||
* @hwmgr: the address of the hardware manager.
|
||||
* @soc_clock: the SOC clock to use to populate the structure.
|
||||
@@ -1710,7 +1712,8 @@ static int vega10_populate_single_soc_level(struct pp_hwmgr *hwmgr,
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates all SMC SCLK levels' structure based on the trimmed allowed dpm engine clock states
|
||||
* vega10_populate_all_graphic_levels - Populates all SMC SCLK levels' structure
|
||||
* based on the trimmed allowed dpm engine clock states
|
||||
*
|
||||
* @hwmgr: the address of the hardware manager
|
||||
*/
|
||||
@@ -1859,7 +1862,8 @@ static int vega10_populate_single_memory_level(struct pp_hwmgr *hwmgr,
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates all SMC MCLK levels' structure based on the trimmed allowed dpm memory clock states.
|
||||
* vega10_populate_all_memory_levels - Populates all SMC MCLK levels' structure
|
||||
* based on the trimmed allowed dpm memory clock states.
|
||||
*
|
||||
* @hwmgr: the address of the hardware manager.
|
||||
* return: PP_Result_OK on success.
|
||||
@@ -2537,7 +2541,7 @@ static void vega10_check_dpm_table_updated(struct pp_hwmgr *hwmgr)
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the SMC table and uploads it
|
||||
* vega10_init_smc_table - Initializes the SMC table and uploads it
|
||||
*
|
||||
* @hwmgr: the address of the powerplay hardware manager.
|
||||
* return: always 0
|
||||
@@ -2919,7 +2923,7 @@ static int vega10_stop_dpm(struct pp_hwmgr *hwmgr, uint32_t bitmap)
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell SMC to enabled the supported DPMs.
|
||||
* vega10_start_dpm - Tell SMC to enabled the supported DPMs.
|
||||
*
|
||||
* @hwmgr: the address of the powerplay hardware manager.
|
||||
* @bitmap: bitmap for the features to enabled.
|
||||
|
||||
@@ -803,7 +803,7 @@ static int vega12_save_default_power_profile(struct pp_hwmgr *hwmgr)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Initializes the SMC table and uploads it
|
||||
* vega12_init_smc_table - Initializes the SMC table and uploads it
|
||||
*
|
||||
* @hwmgr: the address of the powerplay hardware manager.
|
||||
* return: always 0
|
||||
|
||||
@@ -159,7 +159,8 @@ int vega12_thermal_get_temperature(struct pp_hwmgr *hwmgr)
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the requested temperature range for high and low alert signals
|
||||
* vega12_thermal_set_temperature_range - Set the requested temperature range
|
||||
* for high and low alert signals
|
||||
*
|
||||
* @hwmgr: The address of the hardware manager.
|
||||
* @range: Temperature range to be programmed for
|
||||
|
||||
@@ -772,7 +772,7 @@ static int vega20_setup_default_dpm_tables(struct pp_hwmgr *hwmgr)
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the SMC table and uploads it
|
||||
* vega20_init_smc_table - Initializes the SMC table and uploads it
|
||||
*
|
||||
* @hwmgr: the address of the powerplay hardware manager.
|
||||
* return: always 0
|
||||
|
||||
@@ -822,6 +822,52 @@ static int arcturus_print_clk_levels(struct smu_context *smu,
|
||||
now) ? "*" : ""));
|
||||
break;
|
||||
|
||||
case SMU_VCLK:
|
||||
ret = arcturus_get_current_clk_freq_by_table(smu, SMU_VCLK, &now);
|
||||
if (ret) {
|
||||
dev_err(smu->adev->dev, "Attempt to get current vclk Failed!");
|
||||
return ret;
|
||||
}
|
||||
|
||||
single_dpm_table = &(dpm_context->dpm_tables.vclk_table);
|
||||
ret = arcturus_get_clk_table(smu, &clocks, single_dpm_table);
|
||||
if (ret) {
|
||||
dev_err(smu->adev->dev, "Attempt to get vclk levels Failed!");
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (i = 0; i < single_dpm_table->count; i++)
|
||||
size += sprintf(buf + size, "%d: %uMhz %s\n",
|
||||
i, single_dpm_table->dpm_levels[i].value,
|
||||
(clocks.num_levels == 1) ? "*" :
|
||||
(arcturus_freqs_in_same_level(
|
||||
clocks.data[i].clocks_in_khz / 1000,
|
||||
now) ? "*" : ""));
|
||||
break;
|
||||
|
||||
case SMU_DCLK:
|
||||
ret = arcturus_get_current_clk_freq_by_table(smu, SMU_DCLK, &now);
|
||||
if (ret) {
|
||||
dev_err(smu->adev->dev, "Attempt to get current dclk Failed!");
|
||||
return ret;
|
||||
}
|
||||
|
||||
single_dpm_table = &(dpm_context->dpm_tables.dclk_table);
|
||||
ret = arcturus_get_clk_table(smu, &clocks, single_dpm_table);
|
||||
if (ret) {
|
||||
dev_err(smu->adev->dev, "Attempt to get dclk levels Failed!");
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (i = 0; i < single_dpm_table->count; i++)
|
||||
size += sprintf(buf + size, "%d: %uMhz %s\n",
|
||||
i, single_dpm_table->dpm_levels[i].value,
|
||||
(clocks.num_levels == 1) ? "*" :
|
||||
(arcturus_freqs_in_same_level(
|
||||
clocks.data[i].clocks_in_khz / 1000,
|
||||
now) ? "*" : ""));
|
||||
break;
|
||||
|
||||
case SMU_PCIE:
|
||||
gen_speed = smu_v11_0_get_current_pcie_link_speed_level(smu);
|
||||
lane_width = smu_v11_0_get_current_pcie_link_width_level(smu);
|
||||
|
||||
@@ -505,7 +505,7 @@ static int navi10_tables_init(struct smu_context *smu)
|
||||
goto err0_out;
|
||||
smu_table->metrics_time = 0;
|
||||
|
||||
smu_table->gpu_metrics_table_size = sizeof(struct gpu_metrics_v1_1);
|
||||
smu_table->gpu_metrics_table_size = sizeof(struct gpu_metrics_v1_3);
|
||||
smu_table->gpu_metrics_table = kzalloc(smu_table->gpu_metrics_table_size, GFP_KERNEL);
|
||||
if (!smu_table->gpu_metrics_table)
|
||||
goto err1_out;
|
||||
@@ -1273,6 +1273,8 @@ static int navi10_print_clk_levels(struct smu_context *smu,
|
||||
case SMU_MCLK:
|
||||
case SMU_UCLK:
|
||||
case SMU_FCLK:
|
||||
case SMU_VCLK:
|
||||
case SMU_DCLK:
|
||||
case SMU_DCEFCLK:
|
||||
ret = navi10_get_current_clk_freq_by_table(smu, clk_type, &cur_value);
|
||||
if (ret)
|
||||
@@ -2627,8 +2629,8 @@ static ssize_t navi10_get_legacy_gpu_metrics(struct smu_context *smu,
|
||||
void **table)
|
||||
{
|
||||
struct smu_table_context *smu_table = &smu->smu_table;
|
||||
struct gpu_metrics_v1_1 *gpu_metrics =
|
||||
(struct gpu_metrics_v1_1 *)smu_table->gpu_metrics_table;
|
||||
struct gpu_metrics_v1_3 *gpu_metrics =
|
||||
(struct gpu_metrics_v1_3 *)smu_table->gpu_metrics_table;
|
||||
SmuMetrics_legacy_t metrics;
|
||||
int ret = 0;
|
||||
|
||||
@@ -2646,7 +2648,7 @@ static ssize_t navi10_get_legacy_gpu_metrics(struct smu_context *smu,
|
||||
|
||||
mutex_unlock(&smu->metrics_lock);
|
||||
|
||||
smu_cmn_init_soft_gpu_metrics(gpu_metrics, 1, 1);
|
||||
smu_cmn_init_soft_gpu_metrics(gpu_metrics, 1, 3);
|
||||
|
||||
gpu_metrics->temperature_edge = metrics.TemperatureEdge;
|
||||
gpu_metrics->temperature_hotspot = metrics.TemperatureHotspot;
|
||||
@@ -2681,17 +2683,27 @@ static ssize_t navi10_get_legacy_gpu_metrics(struct smu_context *smu,
|
||||
|
||||
gpu_metrics->system_clock_counter = ktime_get_boottime_ns();
|
||||
|
||||
if (metrics.CurrGfxVoltageOffset)
|
||||
gpu_metrics->voltage_gfx =
|
||||
(155000 - 625 * metrics.CurrGfxVoltageOffset) / 100;
|
||||
if (metrics.CurrMemVidOffset)
|
||||
gpu_metrics->voltage_mem =
|
||||
(155000 - 625 * metrics.CurrMemVidOffset) / 100;
|
||||
if (metrics.CurrSocVoltageOffset)
|
||||
gpu_metrics->voltage_soc =
|
||||
(155000 - 625 * metrics.CurrSocVoltageOffset) / 100;
|
||||
|
||||
*table = (void *)gpu_metrics;
|
||||
|
||||
return sizeof(struct gpu_metrics_v1_1);
|
||||
return sizeof(struct gpu_metrics_v1_3);
|
||||
}
|
||||
|
||||
static ssize_t navi10_get_gpu_metrics(struct smu_context *smu,
|
||||
void **table)
|
||||
{
|
||||
struct smu_table_context *smu_table = &smu->smu_table;
|
||||
struct gpu_metrics_v1_1 *gpu_metrics =
|
||||
(struct gpu_metrics_v1_1 *)smu_table->gpu_metrics_table;
|
||||
struct gpu_metrics_v1_3 *gpu_metrics =
|
||||
(struct gpu_metrics_v1_3 *)smu_table->gpu_metrics_table;
|
||||
SmuMetrics_t metrics;
|
||||
int ret = 0;
|
||||
|
||||
@@ -2709,7 +2721,7 @@ static ssize_t navi10_get_gpu_metrics(struct smu_context *smu,
|
||||
|
||||
mutex_unlock(&smu->metrics_lock);
|
||||
|
||||
smu_cmn_init_soft_gpu_metrics(gpu_metrics, 1, 1);
|
||||
smu_cmn_init_soft_gpu_metrics(gpu_metrics, 1, 3);
|
||||
|
||||
gpu_metrics->temperature_edge = metrics.TemperatureEdge;
|
||||
gpu_metrics->temperature_hotspot = metrics.TemperatureHotspot;
|
||||
@@ -2746,17 +2758,27 @@ static ssize_t navi10_get_gpu_metrics(struct smu_context *smu,
|
||||
|
||||
gpu_metrics->system_clock_counter = ktime_get_boottime_ns();
|
||||
|
||||
if (metrics.CurrGfxVoltageOffset)
|
||||
gpu_metrics->voltage_gfx =
|
||||
(155000 - 625 * metrics.CurrGfxVoltageOffset) / 100;
|
||||
if (metrics.CurrMemVidOffset)
|
||||
gpu_metrics->voltage_mem =
|
||||
(155000 - 625 * metrics.CurrMemVidOffset) / 100;
|
||||
if (metrics.CurrSocVoltageOffset)
|
||||
gpu_metrics->voltage_soc =
|
||||
(155000 - 625 * metrics.CurrSocVoltageOffset) / 100;
|
||||
|
||||
*table = (void *)gpu_metrics;
|
||||
|
||||
return sizeof(struct gpu_metrics_v1_1);
|
||||
return sizeof(struct gpu_metrics_v1_3);
|
||||
}
|
||||
|
||||
static ssize_t navi12_get_legacy_gpu_metrics(struct smu_context *smu,
|
||||
void **table)
|
||||
{
|
||||
struct smu_table_context *smu_table = &smu->smu_table;
|
||||
struct gpu_metrics_v1_1 *gpu_metrics =
|
||||
(struct gpu_metrics_v1_1 *)smu_table->gpu_metrics_table;
|
||||
struct gpu_metrics_v1_3 *gpu_metrics =
|
||||
(struct gpu_metrics_v1_3 *)smu_table->gpu_metrics_table;
|
||||
SmuMetrics_NV12_legacy_t metrics;
|
||||
int ret = 0;
|
||||
|
||||
@@ -2774,7 +2796,7 @@ static ssize_t navi12_get_legacy_gpu_metrics(struct smu_context *smu,
|
||||
|
||||
mutex_unlock(&smu->metrics_lock);
|
||||
|
||||
smu_cmn_init_soft_gpu_metrics(gpu_metrics, 1, 1);
|
||||
smu_cmn_init_soft_gpu_metrics(gpu_metrics, 1, 3);
|
||||
|
||||
gpu_metrics->temperature_edge = metrics.TemperatureEdge;
|
||||
gpu_metrics->temperature_hotspot = metrics.TemperatureHotspot;
|
||||
@@ -2814,17 +2836,27 @@ static ssize_t navi12_get_legacy_gpu_metrics(struct smu_context *smu,
|
||||
|
||||
gpu_metrics->system_clock_counter = ktime_get_boottime_ns();
|
||||
|
||||
if (metrics.CurrGfxVoltageOffset)
|
||||
gpu_metrics->voltage_gfx =
|
||||
(155000 - 625 * metrics.CurrGfxVoltageOffset) / 100;
|
||||
if (metrics.CurrMemVidOffset)
|
||||
gpu_metrics->voltage_mem =
|
||||
(155000 - 625 * metrics.CurrMemVidOffset) / 100;
|
||||
if (metrics.CurrSocVoltageOffset)
|
||||
gpu_metrics->voltage_soc =
|
||||
(155000 - 625 * metrics.CurrSocVoltageOffset) / 100;
|
||||
|
||||
*table = (void *)gpu_metrics;
|
||||
|
||||
return sizeof(struct gpu_metrics_v1_1);
|
||||
return sizeof(struct gpu_metrics_v1_3);
|
||||
}
|
||||
|
||||
static ssize_t navi12_get_gpu_metrics(struct smu_context *smu,
|
||||
void **table)
|
||||
{
|
||||
struct smu_table_context *smu_table = &smu->smu_table;
|
||||
struct gpu_metrics_v1_1 *gpu_metrics =
|
||||
(struct gpu_metrics_v1_1 *)smu_table->gpu_metrics_table;
|
||||
struct gpu_metrics_v1_3 *gpu_metrics =
|
||||
(struct gpu_metrics_v1_3 *)smu_table->gpu_metrics_table;
|
||||
SmuMetrics_NV12_t metrics;
|
||||
int ret = 0;
|
||||
|
||||
@@ -2842,7 +2874,7 @@ static ssize_t navi12_get_gpu_metrics(struct smu_context *smu,
|
||||
|
||||
mutex_unlock(&smu->metrics_lock);
|
||||
|
||||
smu_cmn_init_soft_gpu_metrics(gpu_metrics, 1, 1);
|
||||
smu_cmn_init_soft_gpu_metrics(gpu_metrics, 1, 3);
|
||||
|
||||
gpu_metrics->temperature_edge = metrics.TemperatureEdge;
|
||||
gpu_metrics->temperature_hotspot = metrics.TemperatureHotspot;
|
||||
@@ -2884,9 +2916,19 @@ static ssize_t navi12_get_gpu_metrics(struct smu_context *smu,
|
||||
|
||||
gpu_metrics->system_clock_counter = ktime_get_boottime_ns();
|
||||
|
||||
if (metrics.CurrGfxVoltageOffset)
|
||||
gpu_metrics->voltage_gfx =
|
||||
(155000 - 625 * metrics.CurrGfxVoltageOffset) / 100;
|
||||
if (metrics.CurrMemVidOffset)
|
||||
gpu_metrics->voltage_mem =
|
||||
(155000 - 625 * metrics.CurrMemVidOffset) / 100;
|
||||
if (metrics.CurrSocVoltageOffset)
|
||||
gpu_metrics->voltage_soc =
|
||||
(155000 - 625 * metrics.CurrSocVoltageOffset) / 100;
|
||||
|
||||
*table = (void *)gpu_metrics;
|
||||
|
||||
return sizeof(struct gpu_metrics_v1_1);
|
||||
return sizeof(struct gpu_metrics_v1_3);
|
||||
}
|
||||
|
||||
static ssize_t navi1x_get_gpu_metrics(struct smu_context *smu,
|
||||
@@ -2925,6 +2967,8 @@ static ssize_t navi1x_get_gpu_metrics(struct smu_context *smu,
|
||||
|
||||
static int navi10_enable_mgpu_fan_boost(struct smu_context *smu)
|
||||
{
|
||||
struct smu_table_context *table_context = &smu->smu_table;
|
||||
PPTable_t *smc_pptable = table_context->driver_pptable;
|
||||
struct amdgpu_device *adev = smu->adev;
|
||||
uint32_t param = 0;
|
||||
|
||||
@@ -2932,6 +2976,13 @@ static int navi10_enable_mgpu_fan_boost(struct smu_context *smu)
|
||||
if (adev->asic_type == CHIP_NAVI12)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Skip the MGpuFanBoost setting for those ASICs
|
||||
* which do not support it
|
||||
*/
|
||||
if (!smc_pptable->MGpuFanBoostLimitRpm)
|
||||
return 0;
|
||||
|
||||
/* Workaround for WS SKU */
|
||||
if (adev->pdev->device == 0x7312 &&
|
||||
adev->pdev->revision == 0)
|
||||
|
||||
@@ -987,6 +987,10 @@ static int sienna_cichlid_print_clk_levels(struct smu_context *smu,
|
||||
case SMU_MCLK:
|
||||
case SMU_UCLK:
|
||||
case SMU_FCLK:
|
||||
case SMU_VCLK:
|
||||
case SMU_VCLK1:
|
||||
case SMU_DCLK:
|
||||
case SMU_DCLK1:
|
||||
case SMU_DCEFCLK:
|
||||
ret = sienna_cichlid_get_current_clk_freq_by_table(smu, clk_type, &cur_value);
|
||||
if (ret)
|
||||
@@ -3690,6 +3694,16 @@ static ssize_t sienna_cichlid_get_gpu_metrics(struct smu_context *smu,
|
||||
|
||||
static int sienna_cichlid_enable_mgpu_fan_boost(struct smu_context *smu)
|
||||
{
|
||||
struct smu_table_context *table_context = &smu->smu_table;
|
||||
PPTable_t *smc_pptable = table_context->driver_pptable;
|
||||
|
||||
/*
|
||||
* Skip the MGpuFanBoost setting for those ASICs
|
||||
* which do not support it
|
||||
*/
|
||||
if (!smc_pptable->MGpuFanBoostLimitRpm)
|
||||
return 0;
|
||||
|
||||
return smu_cmn_send_smc_msg_with_param(smu,
|
||||
SMU_MSG_SetMGpuFanBoostLimitRpm,
|
||||
0,
|
||||
|
||||
@@ -109,6 +109,8 @@ static struct cmn2asic_mapping renoir_clk_map[SMU_CLK_COUNT] = {
|
||||
CLK_MAP(SOCCLK, CLOCK_SOCCLK),
|
||||
CLK_MAP(UCLK, CLOCK_FCLK),
|
||||
CLK_MAP(MCLK, CLOCK_FCLK),
|
||||
CLK_MAP(VCLK, CLOCK_VCLK),
|
||||
CLK_MAP(DCLK, CLOCK_DCLK),
|
||||
};
|
||||
|
||||
static struct cmn2asic_mapping renoir_table_map[SMU_TABLE_COUNT] = {
|
||||
@@ -202,6 +204,17 @@ static int renoir_get_dpm_clk_limited(struct smu_context *smu, enum smu_clk_type
|
||||
return -EINVAL;
|
||||
*freq = clk_table->FClocks[dpm_level].Freq;
|
||||
break;
|
||||
case SMU_VCLK:
|
||||
if (dpm_level >= NUM_VCN_DPM_LEVELS)
|
||||
return -EINVAL;
|
||||
*freq = clk_table->VClocks[dpm_level].Freq;
|
||||
break;
|
||||
case SMU_DCLK:
|
||||
if (dpm_level >= NUM_VCN_DPM_LEVELS)
|
||||
return -EINVAL;
|
||||
*freq = clk_table->DClocks[dpm_level].Freq;
|
||||
break;
|
||||
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -532,6 +545,14 @@ static int renoir_print_clk_levels(struct smu_context *smu,
|
||||
count = NUM_FCLK_DPM_LEVELS;
|
||||
cur_value = metrics.ClockFrequency[CLOCK_FCLK];
|
||||
break;
|
||||
case SMU_VCLK:
|
||||
count = NUM_VCN_DPM_LEVELS;
|
||||
cur_value = metrics.ClockFrequency[CLOCK_VCLK];
|
||||
break;
|
||||
case SMU_DCLK:
|
||||
count = NUM_VCN_DPM_LEVELS;
|
||||
cur_value = metrics.ClockFrequency[CLOCK_DCLK];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -543,6 +564,8 @@ static int renoir_print_clk_levels(struct smu_context *smu,
|
||||
case SMU_MCLK:
|
||||
case SMU_DCEFCLK:
|
||||
case SMU_FCLK:
|
||||
case SMU_VCLK:
|
||||
case SMU_DCLK:
|
||||
for (i = 0; i < count; i++) {
|
||||
ret = renoir_get_dpm_clk_limited(smu, clk_type, i, &value);
|
||||
if (ret)
|
||||
@@ -730,6 +753,16 @@ static int renoir_get_dpm_clock_table(struct smu_context *smu, struct dpm_clocks
|
||||
clock_table->MemClocks[i].Vol = table->MemClocks[i].Vol;
|
||||
}
|
||||
|
||||
for (i = 0; i < NUM_VCN_DPM_LEVELS; i++) {
|
||||
clock_table->VClocks[i].Freq = table->VClocks[i].Freq;
|
||||
clock_table->VClocks[i].Vol = table->VClocks[i].Vol;
|
||||
}
|
||||
|
||||
for (i = 0; i < NUM_VCN_DPM_LEVELS; i++) {
|
||||
clock_table->DClocks[i].Freq = table->DClocks[i].Freq;
|
||||
clock_table->DClocks[i].Vol = table->DClocks[i].Vol;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,12 @@
|
||||
|
||||
#define smnPCIE_ESM_CTRL 0x111003D0
|
||||
|
||||
static const struct smu_temperature_range smu13_thermal_policy[] =
|
||||
{
|
||||
{-273150, 99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000},
|
||||
{ 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000},
|
||||
};
|
||||
|
||||
static const struct cmn2asic_msg_mapping aldebaran_message_map[SMU_MSG_MAX_COUNT] = {
|
||||
MSG_MAP(TestMessage, PPSMC_MSG_TestMessage, 0),
|
||||
MSG_MAP(GetSmuVersion, PPSMC_MSG_GetSmuVersion, 1),
|
||||
@@ -816,6 +822,52 @@ static int aldebaran_print_clk_levels(struct smu_context *smu,
|
||||
now) ? "*" : ""));
|
||||
break;
|
||||
|
||||
case SMU_VCLK:
|
||||
ret = aldebaran_get_current_clk_freq_by_table(smu, SMU_VCLK, &now);
|
||||
if (ret) {
|
||||
dev_err(smu->adev->dev, "Attempt to get current vclk Failed!");
|
||||
return ret;
|
||||
}
|
||||
|
||||
single_dpm_table = &(dpm_context->dpm_tables.vclk_table);
|
||||
ret = aldebaran_get_clk_table(smu, &clocks, single_dpm_table);
|
||||
if (ret) {
|
||||
dev_err(smu->adev->dev, "Attempt to get vclk levels Failed!");
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (i = 0; i < single_dpm_table->count; i++)
|
||||
size += sprintf(buf + size, "%d: %uMhz %s\n",
|
||||
i, single_dpm_table->dpm_levels[i].value,
|
||||
(clocks.num_levels == 1) ? "*" :
|
||||
(aldebaran_freqs_in_same_level(
|
||||
clocks.data[i].clocks_in_khz / 1000,
|
||||
now) ? "*" : ""));
|
||||
break;
|
||||
|
||||
case SMU_DCLK:
|
||||
ret = aldebaran_get_current_clk_freq_by_table(smu, SMU_DCLK, &now);
|
||||
if (ret) {
|
||||
dev_err(smu->adev->dev, "Attempt to get current dclk Failed!");
|
||||
return ret;
|
||||
}
|
||||
|
||||
single_dpm_table = &(dpm_context->dpm_tables.dclk_table);
|
||||
ret = aldebaran_get_clk_table(smu, &clocks, single_dpm_table);
|
||||
if (ret) {
|
||||
dev_err(smu->adev->dev, "Attempt to get dclk levels Failed!");
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (i = 0; i < single_dpm_table->count; i++)
|
||||
size += sprintf(buf + size, "%d: %uMhz %s\n",
|
||||
i, single_dpm_table->dpm_levels[i].value,
|
||||
(clocks.num_levels == 1) ? "*" :
|
||||
(aldebaran_freqs_in_same_level(
|
||||
clocks.data[i].clocks_in_khz / 1000,
|
||||
now) ? "*" : ""));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1316,10 +1368,13 @@ static int aldebaran_usr_edit_dpm_table(struct smu_context *smu, enum PP_OD_DPM_
|
||||
|
||||
static bool aldebaran_is_dpm_running(struct smu_context *smu)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
uint32_t feature_mask[2];
|
||||
unsigned long feature_enabled;
|
||||
|
||||
ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
|
||||
if (ret)
|
||||
return false;
|
||||
feature_enabled = (unsigned long)((uint64_t)feature_mask[0] |
|
||||
((uint64_t)feature_mask[1] << 32));
|
||||
return !!(feature_enabled & SMC_DPM_FEATURE);
|
||||
@@ -1810,10 +1865,8 @@ static int aldebaran_set_mp1_state(struct smu_context *smu,
|
||||
case PP_MP1_STATE_UNLOAD:
|
||||
return smu_cmn_set_mp1_state(smu, mp1_state);
|
||||
default:
|
||||
return -EINVAL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct pptable_funcs aldebaran_ppt_funcs = {
|
||||
|
||||
@@ -764,6 +764,9 @@ void smu_cmn_init_soft_gpu_metrics(void *table, uint8_t frev, uint8_t crev)
|
||||
case METRICS_VERSION(1, 2):
|
||||
structure_size = sizeof(struct gpu_metrics_v1_2);
|
||||
break;
|
||||
case METRICS_VERSION(1, 3):
|
||||
structure_size = sizeof(struct gpu_metrics_v1_3);
|
||||
break;
|
||||
case METRICS_VERSION(2, 0):
|
||||
structure_size = sizeof(struct gpu_metrics_v2_0);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user