platform/kernel/linux-rpi.git
5 years agodrm/amd/powerplay: implement sysfs of amdgpu_get_busy_percent for smu11
Kevin Wang [Fri, 11 Jan 2019 06:51:24 +0000 (14:51 +0800)]
drm/amd/powerplay: implement sysfs of amdgpu_get_busy_percent for smu11

add interface amdgpu_get_busy_percent for smu11

v2: convert data pointer type to uint32_t *.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement is_support_sw_smu function for new smu
Kevin Wang [Thu, 10 Jan 2019 04:33:23 +0000 (12:33 +0800)]
drm/amd/powerplay: implement is_support_sw_smu function for new smu

add this helper to check new sw-smu support.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement smu update table function
Kevin Wang [Mon, 7 Jan 2019 07:34:09 +0000 (15:34 +0800)]
drm/amd/powerplay: implement smu update table function

sometime, the driver need changed table data between driver and smu.
this function can help update table data

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to start thermal control
Likun Gao [Fri, 4 Jan 2019 08:00:48 +0000 (16:00 +0800)]
drm/amd/powerplay: add function to start thermal control

Add function to start thermal control for smu11 when smu hw_init.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to set fan table to control thermal
Likun Gao [Fri, 4 Jan 2019 07:40:53 +0000 (15:40 +0800)]
drm/amd/powerplay: add function to set fan table to control thermal

Add function of smu_v11_0_set_thermal_fan_table to set fan table for
smu11.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to enable thermal alert
Likun Gao [Fri, 4 Jan 2019 06:36:35 +0000 (14:36 +0800)]
drm/amd/powerplay: add function to enable thermal alert

Add function to enable thermal alerts on thermal control for smu11.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to set thermal range
Likun Gao [Fri, 4 Jan 2019 06:13:09 +0000 (14:13 +0800)]
drm/amd/powerplay: add function to set thermal range

Add the function to set the correct min and max thermal value for smu11

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to get thermal range
Likun Gao [Fri, 4 Jan 2019 08:23:23 +0000 (16:23 +0800)]
drm/amd/powerplay: add function to get thermal range

Add the function to get the min and max thermal value for vega20 with
smu11 architecture.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add get_max_sustainable_clock function
Huang Rui [Tue, 25 Dec 2018 08:34:39 +0000 (16:34 +0800)]
drm/amd/powerplay: add get_max_sustainable_clock function

This patch adds get_max_sustainable_clock function for smu11.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: print clock levels for smu11 (v2)
Likun Gao [Tue, 15 Jan 2019 02:56:55 +0000 (10:56 +0800)]
drm/amd/powerplay: print clock levels for smu11 (v2)

Add function to print current levels for smu11.

v2: expose get_current_clk_freq for smu v11. (Kevin)

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement get_current_clk_freq for smu11
Kevin Wang [Tue, 15 Jan 2019 02:54:45 +0000 (10:54 +0800)]
drm/amd/powerplay: implement get_current_clk_freq for smu11

This patch implements get_current_clk_freq for smu11 future use.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to get power limit for smu11 (v2)
Likun Gao [Tue, 25 Dec 2018 06:44:25 +0000 (14:44 +0800)]
drm/amd/powerplay: add function to get power limit for smu11 (v2)

Add smu_v11_0_get_power_limit function to get power limit vaule.

v2: update "set" to "get", it only implements "get" behavior. (Alex)

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to populate umd state clk.
Likun Gao [Mon, 24 Dec 2018 11:49:38 +0000 (19:49 +0800)]
drm/amd/powerplay: add function to populate umd state clk.

Add vega20_populate_umd_state_clk function to set pstate_sclk and pstate_mclk.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: set defalut dpm table for smu
Likun Gao [Thu, 20 Dec 2018 12:31:55 +0000 (20:31 +0800)]
drm/amd/powerplay: set defalut dpm table for smu

Add smu_set_default_dpm_table function to set dpm table for smu11.
Modified the sequence to populate smc pptable, as it should be done after
related dpm feature is enabled.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement smu_notify_display_change function for smu11
Kevin Wang [Wed, 26 Dec 2018 08:14:55 +0000 (16:14 +0800)]
drm/amd/powerplay: implement smu_notify_display_change function for smu11

add smu_notify_display_change function to send msg to smc to notify
display is changed.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement feature get&set functions
Kevin Wang [Wed, 26 Dec 2018 08:13:09 +0000 (16:13 +0800)]
drm/amd/powerplay: implement feature get&set functions

add smu feature operation function helper to deal with smu feature
bitmap.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement smu feature functions
Kevin Wang [Wed, 26 Dec 2018 09:36:25 +0000 (17:36 +0800)]
drm/amd/powerplay: implement smu feature functions

each ip will support different smu feature,
the driver use bitmap to management this feature.

bitmap:
-allowed: sw driver to enable & disable some feature when driver init.
-suppored: the feature is supproed.
-enabled: the feature is enabled.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <Ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement smu_run_afll_btc function
Kevin Wang [Mon, 24 Dec 2018 10:17:15 +0000 (18:17 +0800)]
drm/amd/powerplay: implement smu_run_afll_btc function

Add smu_run_afll_btc function to send msg to smc to start run afll btc.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement smu_init_display for smu11
Kevin Wang [Mon, 24 Dec 2018 07:02:50 +0000 (15:02 +0800)]
drm/amd/powerplay: implement smu_init_display for smu11

Add smu_init_display function to send msg to smc to init display.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: Change the allocate method of dpm context for smu11.
Likun Gao [Wed, 26 Dec 2018 03:07:57 +0000 (11:07 +0800)]
drm/amd/powerplay: Change the allocate method of dpm context for smu11.

Change the allocate method of dpm context as dpm_table is different bewteen
vega20 and smu11.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: expose the function of smu read argument
Likun Gao [Thu, 20 Dec 2018 12:09:00 +0000 (20:09 +0800)]
drm/amd/powerplay: expose the function of smu read argument

Expose the function of smu_read_smc_arg to get argument value from SMU11.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add append_powerplay_table function
Huang Rui [Thu, 20 Dec 2018 15:06:08 +0000 (23:06 +0800)]
drm/amd/powerplay: add append_powerplay_table function

It needs to add append_powerplay_table function to program the smc_dpm_table for
PPTable_t.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: replace SMU_MSG_XXX with PPSMC_MSG_XXX message index for smu11...
Kevin Wang [Wed, 19 Dec 2018 08:27:55 +0000 (16:27 +0800)]
drm/amd/powerplay: replace SMU_MSG_XXX with PPSMC_MSG_XXX message index for smu11 (v2)

This patch is to setup a common SMU_MSGs for smu11. We can support common MSG
definitions for each asics under smu11.

v2: move smu_v11_0_ppsmc.h to xxx_ppt.c level, because it depends on specific
asic.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: use virtual msg index to replace asic-related msg index
Kevin Wang [Wed, 19 Dec 2018 08:23:23 +0000 (16:23 +0800)]
drm/amd/powerplay: use virtual msg index to replace asic-related msg index

Using virtual msg index is able to support all ASIC specific message values on
one smu upper layer.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement smu vega20_message_map for vega20
Kevin Wang [Wed, 19 Dec 2018 07:46:24 +0000 (15:46 +0800)]
drm/amd/powerplay: implement smu vega20_message_map for vega20

This patch implements smu vega20_message_map to map the PPSMC messages from
smu11 to specific asic.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add enum smu_msg_type to header
Kevin Wang [Wed, 19 Dec 2018 07:12:10 +0000 (15:12 +0800)]
drm/amd/powerplay: add enum smu_msg_type to header

each asic with different message index,
add this header to help top level smu code to send message.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to set tool table location for smu11 (v2)
Likun Gao [Wed, 12 Dec 2018 11:42:53 +0000 (19:42 +0800)]
drm/amd/powerplay: add function to set tool table location for smu11 (v2)

Add smu_v11_0_set_tool_table_location function for smu11.

v2: fix the missed TABLE_PMSTATUSLOG bo creation which caused AGM hung. (Ray)

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to set min dcef deep sleep for smu11 (v2)
Likun Gao [Wed, 12 Dec 2018 11:31:31 +0000 (19:31 +0800)]
drm/amd/powerplay: add function to set min dcef deep sleep for smu11 (v2)

Add smu_v11_0_set_min_dcef_deep_sleep function for smu11.

v2: fix coding error about set_min_dcef_deep_sleep (Kevin)

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to write pptable for smu11 (v2)
Likun Gao [Thu, 13 Dec 2018 11:22:30 +0000 (19:22 +0800)]
drm/amd/powerplay: add function to write pptable for smu11 (v2)

Add smu_v11_0_write_pptable and smu_v11_0_copy_table_to_smc function for smu11.

v2: fix the build warning. (Ray)

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to populate smc pptable for smu11
Likun Gao [Thu, 13 Dec 2018 02:31:14 +0000 (10:31 +0800)]
drm/amd/powerplay: add function to populate smc pptable for smu11

Add smu_v11_0_populate_smc_pptable function for smu11.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: update hw fini function to relase some memory
Likun Gao [Mon, 17 Dec 2018 12:59:42 +0000 (20:59 +0800)]
drm/amd/powerplay: update hw fini function to relase some memory

Release memory of table_context->driver_pptable and
table_context->ppt_information when smu hw fini.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to check pptable for smu11
Likun Gao [Fri, 14 Dec 2018 08:18:21 +0000 (16:18 +0800)]
drm/amd/powerplay: add function to check pptable for smu11

Add smu_v11_0_check_pptable function for smu11.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to parse pptable for smu11
Likun Gao [Tue, 18 Dec 2018 14:56:48 +0000 (22:56 +0800)]
drm/amd/powerplay: add function to parse pptable for smu11

Add smu_v11_0_parse_pptable function for smu11.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add vega20 pptable function file
Huang Rui [Tue, 18 Dec 2018 12:23:17 +0000 (20:23 +0800)]
drm/amd/powerplay: add vega20 pptable function file

This patch adds the vega20_ppt.c to support ATOM_Vega20_POWERPLAYTABLE format
for vega20 on smu11. It will be used to implement to asic specific pptable
helpers.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement notify_memory_pool_location function for smu11
Kevin Wang [Tue, 18 Dec 2018 06:06:09 +0000 (14:06 +0800)]
drm/amd/powerplay: implement notify_memory_pool_location function for smu11

This patch implements the notify_memory_pool_location function to send memory
address to smc for dram logging.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement smu_alloc[free]_memory pool function
Kevin Wang [Mon, 17 Dec 2018 08:47:49 +0000 (16:47 +0800)]
drm/amd/powerplay: implement smu_alloc[free]_memory pool function

This patch implements smu_alloc[free]_memory pool function to reserve the memory
pool bo.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement get_clk_info_from_vbios function for smu11 (v2)
Huang Rui [Mon, 17 Dec 2018 06:56:40 +0000 (14:56 +0800)]
drm/amd/powerplay: implement get_clk_info_from_vbios function for smu11 (v2)

This patch implements the get_clk_info_from_vbios function for smu11.
We can do execute_vbios_cmd_table to fetch the clk value from vbios.

v2: use the proper cpu_to_le[32|16]() and le[32|16]_to_cpu() macros to handle
endianness. (Alex)

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement get_vbios_bootup_values function for smu11 (v2)
Huang Rui [Mon, 17 Dec 2018 02:25:30 +0000 (10:25 +0800)]
drm/amd/powerplay: implement get_vbios_bootup_values function for smu11 (v2)

This patch implements get_vbios_bootup_values function for smu11 to fetach
firmwareinfo member from atombios.

v2: use switch statement based on the content revision (Alex)

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add data structure of bootup values
Huang Rui [Sat, 15 Dec 2018 07:36:58 +0000 (15:36 +0800)]
drm/amd/powerplay: add data structure of bootup values

This patch adds data structures for bootup values.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: update pptable header for smu11
Huang Rui [Sat, 15 Dec 2018 06:30:07 +0000 (14:30 +0800)]
drm/amd/powerplay: update pptable header for smu11

This patch updates pptable header for smu v11.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: remove header of smu_v11_0_pptable
Kevin Wang [Tue, 18 Dec 2018 02:58:17 +0000 (10:58 +0800)]
drm/amd/powerplay: remove header of smu_v11_0_pptable

different ASICs have different pptables, so the header will move
to asic source code to implement.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <Ray.Huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement smu_init(fini)_fb_allocations function
Kevin Wang [Fri, 14 Dec 2018 10:34:20 +0000 (18:34 +0800)]
drm/amd/powerplay: implement smu_init(fini)_fb_allocations function

This patch implements smu_init_fb_allocations/smu_fini_fb_allocations function
for smu to reserve the BOs for smc tables.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement smu_init[fini]_power function for smu11
Kevin Wang [Sat, 15 Dec 2018 02:50:03 +0000 (10:50 +0800)]
drm/amd/powerplay: implement smu_init[fini]_power function for smu11

This patch implements smu_init[fini]_power function for smu v11.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement smu dpm context functions for smu11
Kevin Wang [Mon, 17 Dec 2018 11:48:59 +0000 (19:48 +0800)]
drm/amd/powerplay: implement smu dpm context functions for smu11

This patch implements smu dpm context functions for smu v11.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement smu_init[fini]_smc_tables for smu11
Kevin Wang [Fri, 14 Dec 2018 09:43:57 +0000 (17:43 +0800)]
drm/amd/powerplay: implement smu_init[fini]_smc_tables for smu11

Each SMU IP may have a different number of SMU tables, so these tables
are allocated using dynamic memory

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement read_pptable_from_vbios function for smu11
Huang Rui [Fri, 14 Dec 2018 09:47:20 +0000 (17:47 +0800)]
drm/amd/powerplay: implement read_pptable_from_vbios function for smu11

This patch implements the function of read_pptable_from_vbios for smu11.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: move get_index_into_master_table macro into atomfirmware header
Huang Rui [Fri, 14 Dec 2018 09:09:08 +0000 (17:09 +0800)]
drm/amdgpu: move get_index_into_master_table macro into atomfirmware header

This patchs move get_index_into_master_table macro into atomfirmware header for
future use on smu.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add get atom data table helper
Huang Rui [Wed, 12 Dec 2018 13:06:59 +0000 (21:06 +0800)]
drm/amd/powerplay: add get atom data table helper

This patch adds get atom data table helper for smu future use.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add smu table context structure
Huang Rui [Wed, 12 Dec 2018 12:47:24 +0000 (20:47 +0800)]
drm/amd/powerplay: add smu table context structure

This patch adds smu table context.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: update new members in atomfirmware
Huang Rui [Wed, 12 Dec 2018 12:37:22 +0000 (20:37 +0800)]
drm/amdgpu: update new members in atomfirmware

This patch updates new members for fields to meet new atomfirmware header.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: update atomfirmware header for smu11
Huang Rui [Mon, 21 Jan 2019 06:06:52 +0000 (14:06 +0800)]
drm/amdgpu: update atomfirmware header for smu11

This patch updates atomfirmware header on smu11 for future use.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add pptable header for smu11
Huang Rui [Wed, 12 Dec 2018 11:55:30 +0000 (19:55 +0800)]
drm/amd/powerplay: add pptable header for smu11

This patch adds the pptable header for smu11.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement check_fw_version function for smu11
Kevin Wang [Wed, 12 Dec 2018 03:21:16 +0000 (11:21 +0800)]
drm/amd/powerplay: implement check_fw_version function for smu11

Add function of check firmware version for smu11

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement check_fw_status function for smu11
Kevin Wang [Mon, 10 Dec 2018 05:31:56 +0000 (13:31 +0800)]
drm/amd/powerplay: implement check_fw_status function for smu11

Add function of check firmware status funtions for smu11

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement smu send message functions for smu11 (v3)
Kevin Wang [Tue, 11 Dec 2018 09:16:10 +0000 (17:16 +0800)]
drm/amd/powerplay: implement smu send message functions for smu11 (v3)

Add function of smu send message for smu11

v2: fix the missing ) in define of smu_send_smc_msg_with_param
v3: Use adev usec timeout for smu as well, the origin time 10 us is not enough. (Ray)

Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add new ppsmc header for smu11 (v2)
Huang Rui [Tue, 11 Dec 2018 07:42:12 +0000 (15:42 +0800)]
drm/amd/powerplay: add new ppsmc header for smu11 (v2)

This header will be used for smc message handling.

v2: add a license to the top of the header file (Alex)

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: init microcode for smu11
Likun Gao [Thu, 6 Dec 2018 05:44:29 +0000 (13:44 +0800)]
drm/amd/powerplay: init microcode for smu11

Add function of init mircrocode for smu11.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: enable new smu ip block for vega20
Huang Rui [Thu, 29 Nov 2018 10:46:54 +0000 (18:46 +0800)]
drm/amdgpu: enable new smu ip block for vega20

Switch to new smu ip block since vega20.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add resume sequence placeholder for smu ip block
Huang Rui [Wed, 5 Dec 2018 04:01:09 +0000 (12:01 +0800)]
drm/amd/powerplay: add resume sequence placeholder for smu ip block

This patch adds resume sequence placeholder for smu ip block.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interfaces for smu resume
Huang Rui [Thu, 10 Jan 2019 15:58:08 +0000 (23:58 +0800)]
drm/amd/powerplay: add interfaces for smu resume

SMU resume needs three more interfaces such as write_watermarks_table,
set_last_dcef_min_deep_sleep_clk, and system_features_control.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interface to notify memory pool location (v2)
Huang Rui [Wed, 5 Dec 2018 03:45:34 +0000 (11:45 +0800)]
drm/amd/powerplay: add interface to notify memory pool location (v2)

This patch adds interface to notify memory pool location for smu.
It's to use msg SetSystemVirtualDramAddr and DramLogSetDramAddr can notify pool
location.

v2: add detailed info to describe this function

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interface to allocate memory pool (v2)
Huang Rui [Wed, 5 Dec 2018 03:41:33 +0000 (11:41 +0800)]
drm/amd/powerplay: add interface to allocate memory pool (v2)

This patch adds interface to allocate memory pool for smu.
This memory pool will be used for SMC use and msg SetSystemVirtualDramAddr and
DramLogSetDramAddr can notify it changed.

v2: add detailed info to describe this function

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interface to set tool table location (v2)
Huang Rui [Tue, 4 Dec 2018 14:04:24 +0000 (22:04 +0800)]
drm/amd/powerplay: add interface to set tool table location (v2)

This patch adds interface to set tool table location for smu.
Set PMSTATUSLOG table bo address with SetToolsDramAddr MSG for tools.

v2: add detailed info to describe this function

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interface to set min dcef deep sleep (v2)
Huang Rui [Tue, 4 Dec 2018 14:00:22 +0000 (22:00 +0800)]
drm/amd/powerplay: add interface to set min dcef deep sleep (v2)

This patch adds interface to set min dcef deep sleep for smu.
It's to set min deep sleep dce fclk with bootup value from vbios via
SetMinDeepSleepDcefclk MSG.

v2: add detailed info to describe this function

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interface to write pptable (v2)
Huang Rui [Tue, 4 Dec 2018 13:57:05 +0000 (21:57 +0800)]
drm/amd/powerplay: add interface to write pptable (v2)

This patch adds interface to write pptable for smu.
It's to copy pptable bo in the vram to smc with SMU MSGs such as
SetDriverDramAddr and TransferTableDram2Smu.

v2: add detailed info to describe this function

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interface to check fw version (v2)
Huang Rui [Tue, 4 Dec 2018 13:51:23 +0000 (21:51 +0800)]
drm/amd/powerplay: add interface to check fw version (v2)

This patch adds interface to check fw version for smu.
It's to send msg GetDriverIfVersion to check if the return value is equal with
DRIVER_IF_VERSION of smc header.

v2: add detailed info to describe this function

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interface to populate smc pptable (v2)
Huang Rui [Tue, 4 Dec 2018 13:42:41 +0000 (21:42 +0800)]
drm/amd/powerplay: add interface to populate smc pptable (v2)

This patch adds interface to populate smc pptable for smu.
It's to set initialized values (get from vbios) to dpm tables context such as
gfxclk, memclk, dcefclk, and etc. And enable the DPM feature for each type of
clks.

v2: add detailed info to describe this function

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interface to parse pptable (v2)
Huang Rui [Tue, 4 Dec 2018 13:34:43 +0000 (21:34 +0800)]
drm/amd/powerplay: add interface to parse pptable (v2)

This patch adds interface to parse pptable for smu.
It's to parse pptable format and fill PPTable_t smc_pptable to smu_table_context
structure. And read the smc_dpm_table from vbios, then fill it into smc_pptable.

v2: add detailed info to describe this function

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interface to init fb allocations (v2)
Huang Rui [Tue, 4 Dec 2018 10:54:50 +0000 (18:54 +0800)]
drm/amd/powerplay: add interface to init fb allocations (v2)

This patch adds interface to init fb allocations for smu.
It's to allocate vram bos to store smc table contents.

v2: add detailed info to describe this function

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interface to check pptable (v2)
Huang Rui [Tue, 4 Dec 2018 10:41:58 +0000 (18:41 +0800)]
drm/amd/powerplay: add interface to check pptable (v2)

This patch adds interface to check pptable function for smu.
It's to check if the format_revision in vbios is up to pptable header version,
and the structure size is not 0.

v2: add detailed info to describe this function

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interface to get vbios bootup values (v2)
Huang Rui [Tue, 4 Dec 2018 10:24:58 +0000 (18:24 +0800)]
drm/amd/powerplay: add interface to get vbios bootup values (v2)

This patch adds interface to get vbios bootup values for smu.
It's to get boot_values from vbios to set revision, gfxclk, and etc.

v2: add detailed info to describe this function.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interface to init power (v2)
Huang Rui [Tue, 4 Dec 2018 10:13:19 +0000 (18:13 +0800)]
drm/amd/powerplay: add interface to init power (v2)

This patch adds interface to init power function for smu.
It's to create smu_power_context structure, and allocate smu_dpm_context and
context size to fill the smu_power_context data.

v2: add detailed info to describe this function

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interface to init smc tables (v2)
Huang Rui [Tue, 4 Dec 2018 09:42:08 +0000 (17:42 +0800)]
drm/amd/powerplay: add interface to init smc tables (v2)

This patch adds interface to init smc tables for smu. It is to create smu_table
structure, and init smc tables such as TABLE_PPTABLE, TABLE_WATERMARKS,
TABLE_SMU_METRICS, and etc.

v2: add detailed info to describe this function

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add placeholder of smu_initialize_pptable
Huang Rui [Tue, 4 Dec 2018 09:27:10 +0000 (17:27 +0800)]
drm/amd/powerplay: add placeholder of smu_initialize_pptable

This patch adds placeholder of smu_initialize_pptable for smu.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interface to read pptable from vbios
Huang Rui [Tue, 4 Dec 2018 09:14:41 +0000 (17:14 +0800)]
drm/amd/powerplay: add interface to read pptable from vbios

This patch adds interface to read pptable from vbios for smu.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add fw load checking interface
Huang Rui [Sun, 2 Dec 2018 10:25:00 +0000 (18:25 +0800)]
drm/amd/powerplay: add fw load checking interface

This patch adds fw load checking interface for smu.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add firmware loading interface
Huang Rui [Sun, 2 Dec 2018 10:12:10 +0000 (18:12 +0800)]
drm/amd/powerplay: add firmware loading interface

This patch adds firmware loading interface for smu.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add smu11 sub block for SMU IP
Huang Rui [Thu, 29 Nov 2018 06:01:47 +0000 (14:01 +0800)]
drm/amd/powerplay: add smu11 sub block for SMU IP

This patch add smu11 sub ip block skeleton as placeholder

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add new smu ip block
Huang Rui [Thu, 29 Nov 2018 05:56:06 +0000 (13:56 +0800)]
drm/amd/powerplay: add new smu ip block

This patch add amdgpu_smu ip block skeleton as placeholder.
We plan use new smu ip block from Vega20.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: remove set but not used variable 'vbi_time_out'
YueHaibing [Tue, 26 Feb 2019 05:48:28 +0000 (05:48 +0000)]
drm/amdgpu: remove set but not used variable 'vbi_time_out'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/gpu/drm/amd/amdgpu/si_dpm.c: In function 'si_program_response_times':
drivers/gpu/drm/amd/amdgpu/si_dpm.c:4101:29: warning:
 variable 'backbias_response_time' set but not used [-Wunused-but-set-variable]

It's never used since introduction in 841686df9f7d ("drm/amdgpu: add SI DPM
support (v4)"), so can be removed

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: remove set but not used variables 'vm, bo'
YueHaibing [Wed, 20 Feb 2019 03:31:50 +0000 (03:31 +0000)]
drm/amdgpu: remove set but not used variables 'vm, bo'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c: In function 'update_gpuvm_pte':
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c:840:20: warning:
 variable 'bo' set but not used [-Wunused-but-set-variable]

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c:838:20: warning:
 variable 'vm' set but not used [-Wunused-but-set-variable]

They're never used since introduction in a46a2cd103a8 ("drm/amdgpu: Add GPUVM
memory management functions for KFD")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/ttm: remove set but not used variable 'bdev'
YueHaibing [Mon, 18 Feb 2019 13:59:35 +0000 (13:59 +0000)]
drm/ttm: remove set but not used variable 'bdev'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/gpu/drm/ttm/ttm_execbuf_util.c: In function 'ttm_eu_fence_buffer_objects':
drivers/gpu/drm/ttm/ttm_execbuf_util.c:191:24: warning:
 variable 'bdev' set but not used [-Wunused-but-set-variable]

It's not used any more and can be removed.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Set VM_L2_CNTL.PDE_FAULT_CLASSIFICATION to 0
Yong Zhao [Mon, 25 Feb 2019 22:50:43 +0000 (17:50 -0500)]
drm/amdgpu: Set VM_L2_CNTL.PDE_FAULT_CLASSIFICATION to 0

This is recommended by HW designers. Previously when it was set to 1,
the PDE walk error in VM fault will be treated as
PERMISSION_OR_INVALID_PAGE_FAULT rather than usually expected OTHER_FAULT.
As a result, the retry control in VM_CONTEXT*_CNTL will change accordingly.

The above behavior is kind of abnormal. Furthermore, the
PDE_FAULT_CLASSIFICATION == 1 feature was targeted for very old ASICs
and it never made it way to production. Therefore, we should set it to 0.

Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Eliminate the set_pde_pte function pointer in amdgpu_gmc_funcs
Yong Zhao [Mon, 25 Feb 2019 17:56:53 +0000 (12:56 -0500)]
drm/amdgpu: Eliminate the set_pde_pte function pointer in amdgpu_gmc_funcs

All the gmc_*_set_pde_pte functions are the same across different ASICs,
so we can eliminate the set_pde_pte function pointer and instead use a
generic function.

Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/ttm: Account for kernel allocations in kernel zone only
Felix Kuehling [Fri, 22 Feb 2019 19:44:41 +0000 (14:44 -0500)]
drm/ttm: Account for kernel allocations in kernel zone only

Don't account for them in other zones such as dma32. The kernel page
allocator has its own heuristics to avoid exhausting special zones
for regular kernel allocations.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm: Use the same mmap-range offset and size for GEM and TTM
Thomas Zimmermann [Thu, 7 Feb 2019 08:59:31 +0000 (09:59 +0100)]
drm: Use the same mmap-range offset and size for GEM and TTM

GEM defines DRM_FILE_PAGE_OFFSET_{START,SIZE} constants for the
mmap-able range of addresses. TTM can use them as well.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Christian König <christian.koenig@amd.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/ttm: Quick-test mmap offset in ttm_bo_mmap()
Thomas Zimmermann [Thu, 7 Feb 2019 08:59:30 +0000 (09:59 +0100)]
drm/ttm: Quick-test mmap offset in ttm_bo_mmap()

A BO's address has to be at least the minimum offset. Sharing this
test in ttm_bo_mmap() removes code from drivers. A full buffer-address
validation is still done within drm_vma_offset_lockup_locked().

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Christian König <christian.koenig@amd.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/ttm: Remove file_page_offset parameter from ttm_bo_device_init()
Thomas Zimmermann [Thu, 7 Feb 2019 08:59:29 +0000 (09:59 +0100)]
drm/ttm: Remove file_page_offset parameter from ttm_bo_device_init()

The parameter file_page_offset is a constant shared by all drivers. Just
replace it with the constant itself.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Christian König <christian.koenig@amd.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/ttm: Define a single DRM_FILE_PAGE_OFFSET constant
Thomas Zimmermann [Thu, 7 Feb 2019 08:59:28 +0000 (09:59 +0100)]
drm/ttm: Define a single DRM_FILE_PAGE_OFFSET constant

Most TTM drivers define the constant DRM_FILE_PAGE_OFFSET of the same
value. The only exception is vboxvideo, which is being converted to the
new offset by this patch. Unifying the constants in a single place
simplifies the driver code.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Christian König <christian.koenig@amd.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agostaging/vboxvideo: Use same BO mmap offset as other drivers
Thomas Zimmermann [Thu, 7 Feb 2019 08:59:27 +0000 (09:59 +0100)]
staging/vboxvideo: Use same BO mmap offset as other drivers

The vboxvideo driver mmaps BOs at 0x10000000 or higher. Changing the
offset to 0x100000000 aligns the driver with all other DRM drivers.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: fix HMM config dependency issue
Philip Yang [Thu, 21 Feb 2019 17:39:21 +0000 (12:39 -0500)]
drm/amdgpu: fix HMM config dependency issue

Only select HMM_MIRROR will get kernel config dependency warnings
if CONFIG_HMM is missing in the config. Add depends on HMM will
solve the issue.

Add conditional compilation to fix compilation errors if HMM_MIRROR
is not enabled as HMM config is not enabled.

Remove unused function amdgpu_ttm_tt_mark_user_pages.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: replace get_user_pages with HMM mirror helpers
Philip Yang [Thu, 13 Dec 2018 20:35:28 +0000 (15:35 -0500)]
drm/amdgpu: replace get_user_pages with HMM mirror helpers

Use HMM helper function hmm_vma_fault() to get physical pages backing
userptr and start CPU page table update track of those pages. Then use
hmm_vma_range_done() to check if those pages are updated before
amdgpu_cs_submit for gfx or before user queues are resumed for kfd.

If userptr pages are updated, for gfx, amdgpu_cs_ioctl will restart
from scratch, for kfd, restore worker is rescheduled to retry.

HMM simplify the CPU page table concurrent update check, so remove
guptasklock, mmu_invalidations, last_set_pages fields from
amdgpu_ttm_tt struct.

HMM does not pin the page (increase page ref count), so remove related
operations like release_pages(), put_page(), mark_page_dirty().

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: avoid HMM change cause circular lock
Philip Yang [Wed, 5 Dec 2018 19:03:43 +0000 (14:03 -0500)]
drm/amdkfd: avoid HMM change cause circular lock

There is circular lock between gfx and kfd path with HMM change:
lock(dqm) -> bo::reserve -> amdgpu_mn_lock

To avoid this, move init/unint_mqd() out of lock(dqm), to remove nested
locking between mmap_sem and bo::reserve. The locking order
is: bo::reserve -> amdgpu_mn_lock(p->mn)

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: use HMM callback to replace mmu notifier
Philip Yang [Mon, 23 Jul 2018 21:45:46 +0000 (17:45 -0400)]
drm/amdgpu: use HMM callback to replace mmu notifier

Replace our MMU notifier with hmm_mirror_ops.sync_cpu_device_pagetables
callback. Enable CONFIG_HMM and CONFIG_HMM_MIRROR as a dependency in
DRM_AMDGPU_USERPTR Kconfig.

It supports both KFD userptr and gfx userptr paths.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: use BACO on vega12 if platform supports it
Alex Deucher [Mon, 11 Feb 2019 02:50:53 +0000 (21:50 -0500)]
drm/amdgpu: use BACO on vega12 if platform supports it

Use BACO for reset of the platform supports it.

Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/powerplay: split out common smu9 BACO code
Alex Deucher [Fri, 15 Feb 2019 22:34:48 +0000 (17:34 -0500)]
drm/amdgpu/powerplay: split out common smu9 BACO code

Several of the BACO functions are common across smu9-based
asics.  Split the common code out.

Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/powerplay: add BACO support for vega12
Alex Deucher [Mon, 11 Feb 2019 02:46:59 +0000 (21:46 -0500)]
drm/amdgpu/powerplay: add BACO support for vega12

This implements BACO (Bus Active, Chip Off) support
for vega12.

Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: 3.2.19
Mark McGarrity [Fri, 8 Feb 2019 18:21:06 +0000 (13:21 -0500)]
drm/amd/display: 3.2.19

Signed-off-by: Mark McGarrity <mark.mcgarrity@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Add ability to override bounding box in DC construct
Jun Lei [Thu, 7 Feb 2019 23:54:35 +0000 (18:54 -0500)]
drm/amd/display: Add ability to override bounding box in DC construct

Add a dc_bounding_box_overrides struct to define bb overrides. It is
loaded in during DC init.

Signed-off-by: Jun Lei <Jun.Lei@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Make stream commits call into DC only once
David Francis [Fri, 1 Mar 2019 23:22:07 +0000 (18:22 -0500)]
drm/amd/display: Make stream commits call into DC only once

[Why]
dc_commit_updates_for_stream is called twice per stream: once
with the flip data and once will all other data. This causes
problems when these DC calls have different numbers of planes

For example, a commit with a pageflip on plane A and a
non-pageflip change on plane B will first call
into DC with just plane A, causing plane B to be
disabled. Then it will call into DC with both planes,
re-enabling plane B

[How]
Merge flip and full into a single bundle

Apart from the single DC call, the logic should not be
changed by this patch

Signed-off-by: David Francis <David.Francis@amd.com>
Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>