openwrt/staging/blogic.git
8 years agodrm/amdgpu: rename fiji_smumgr.h to fiji_smum.h
Jammy Zhou [Wed, 21 Oct 2015 09:18:10 +0000 (17:18 +0800)]
drm/amdgpu: rename fiji_smumgr.h to fiji_smum.h

This conflicts with fiji_smumgr.h from powerplay
in DKMS environment

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jordan Lazare <Jordan.Lazare@amd.com>
8 years agodrm/amdgpu: rename tonga_smumgr.h to tonga_smum.h
Jammy Zhou [Wed, 21 Oct 2015 09:15:45 +0000 (17:15 +0800)]
drm/amdgpu: rename tonga_smumgr.h to tonga_smum.h

This conflicts with the tonga_smumgr.h from powerplay
in DKMS environement

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jordan Lazare <Jordan.Lazare@amd.com>
8 years agodrm/amd/powerplay: Add PPLib debug print macro.
David Rokhvarg [Thu, 19 Nov 2015 19:45:39 +0000 (14:45 -0500)]
drm/amd/powerplay: Add PPLib debug print macro.

- The macro is silent by default.
- Use the macro to print Display Configuration - related changes.

Signed-off-by: David Rokhvarg <David.Rokhvarg@amd.com>
8 years agodrm/amd/powerplay: enable/disable NB pstate feature for Carrizo.
Rex Zhu [Thu, 19 Nov 2015 05:48:14 +0000 (13:48 +0800)]
drm/amd/powerplay: enable/disable NB pstate feature for Carrizo.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: David Rokhvarg <David.Rokhvarg@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agodrm/amd/powerplay: enable set_cpu_power_state task. (v2)
Rex Zhu [Thu, 19 Nov 2015 05:47:02 +0000 (13:47 +0800)]
drm/amd/powerplay: enable set_cpu_power_state task. (v2)

v2: integrate Jammy's crash fix

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agodrm/amd/powerplay: export interface to DAL to init/change display configuration.
Rex Zhu [Thu, 19 Nov 2015 05:35:30 +0000 (13:35 +0800)]
drm/amd/powerplay: export interface to DAL to init/change display configuration.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: David Rokhvarg <David.Rokhvarg@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agodrm/amd/powerplay: add smc msg for NB P-State switch
Rex Zhu [Thu, 19 Nov 2015 05:47:36 +0000 (13:47 +0800)]
drm/amd/powerplay: add smc msg for NB P-State switch

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: David Rokhvarg <David.Rokhvarg@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agodrm/amd/powerplay: add new function point in hwmgr.
Rex Zhu [Thu, 19 Nov 2015 05:46:01 +0000 (13:46 +0800)]
drm/amd/powerplay: add new function point in hwmgr.

1. for set_cpu_power_state
2. restore display configuration

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agoamdgpu/powerplay: Add Stoney to list of early init cases
Tom St Denis [Fri, 20 Nov 2015 18:33:44 +0000 (13:33 -0500)]
amdgpu/powerplay:  Add Stoney to list of early init cases

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: fix warning of cast to pointer from integer of different size.
Rex Zhu [Mon, 16 Nov 2015 03:24:35 +0000 (11:24 +0800)]
drm/amd/powerplay: fix warning of cast to pointer from integer of different size.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: fix warning of cast to pointer from integer of different size.
rezhu [Thu, 12 Nov 2015 08:40:50 +0000 (16:40 +0800)]
drm/amd/powerplay: fix warning of cast to pointer from integer of different size.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: implement smc state upload for CZ
Alex Deucher [Sat, 14 Nov 2015 04:51:40 +0000 (23:51 -0500)]
drm/amd/powerplay: implement smc state upload for CZ

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: add atomctrl function to calculate CZ sclk dividers
Alex Deucher [Sat, 14 Nov 2015 03:00:01 +0000 (22:00 -0500)]
drm/amd/powerplay: add atomctrl function to calculate CZ sclk dividers

Use atombios to calculate the values.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: enable clock gating for Fiji.
Eric Huang [Thu, 12 Nov 2015 22:30:52 +0000 (17:30 -0500)]
drm/amd/powerplay: enable clock gating for Fiji.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
8 years agodrm/amd/powerplay: add parts of system clock gating support for Fiji. (v2)
Eric Huang [Thu, 12 Nov 2015 21:59:47 +0000 (16:59 -0500)]
drm/amd/powerplay: add parts of system clock gating support for Fiji. (v2)

Removed fiji_mgcg_cgcg_init that is affected and redundant for new implementation.

v2: re-add mgcg_cgcg init

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
8 years agodrm/amdgpu: add sdma clock gating support for Fiji.
Eric Huang [Wed, 11 Nov 2015 16:49:11 +0000 (11:49 -0500)]
drm/amdgpu: add sdma clock gating support for Fiji.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
8 years agodrm/amd/amdgpu: add gmc clock gating support for Fiji.
Eric Huang [Tue, 10 Nov 2015 16:27:39 +0000 (11:27 -0500)]
drm/amd/amdgpu: add gmc clock gating support for Fiji.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
8 years agodrm/amd/amdgpu: add gfx clock gating support for Fiji.
Eric Huang [Tue, 10 Nov 2015 15:50:25 +0000 (10:50 -0500)]
drm/amd/amdgpu: add gfx clock gating support for Fiji.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
8 years agodrm/amd/powerplay/tonga: Add UVD DPM init
Alex Deucher [Fri, 13 Nov 2015 15:46:30 +0000 (10:46 -0500)]
drm/amd/powerplay/tonga: Add UVD DPM init

Load the UVD DPM state into the SMC.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: fix boolreturn.cocci warnings
kbuild test robot [Thu, 12 Nov 2015 17:58:34 +0000 (12:58 -0500)]
drm/amd/powerplay: fix boolreturn.cocci warnings

drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/tonga_hwmgr.c:2653:9-10: WARNING: return of 0/1 in function 'is_pcie_gen2_supported' with return type bool
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/tonga_hwmgr.c:2645:9-10: WARNING: return of 0/1 in function 'is_pcie_gen3_supported' with return type bool

 Return statements in functions returning bool should use
 true/false instead of 1/0.
Generated by: scripts/coccinelle/misc/boolreturn.cocci

CC: yanyang1 <young.yang@amd.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/powerplay/fiji: query supported pcie info from cgs (v2)
Alex Deucher [Thu, 12 Nov 2015 02:02:16 +0000 (21:02 -0500)]
drm/amdgpu/powerplay/fiji: query supported pcie info from cgs (v2)

Rather than hardcode it.

v2: integrate spc fix from Rex

Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/powerplay/tonga: query supported pcie info from cgs (v2)
Alex Deucher [Thu, 12 Nov 2015 01:58:55 +0000 (20:58 -0500)]
drm/amdgpu/powerplay/tonga: query supported pcie info from cgs (v2)

Rather than hardcode it.

v2: integrate spc fix from Rex

Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/cgs: add sys info query for pcie gen and link width
Alex Deucher [Thu, 12 Nov 2015 01:35:32 +0000 (20:35 -0500)]
drm/amdgpu/cgs: add sys info query for pcie gen and link width

Needed by powerplay to properly handle pcie dpm switching.

Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: store pcie gen mask and link width
Alex Deucher [Thu, 12 Nov 2015 00:45:06 +0000 (19:45 -0500)]
drm/amdgpu: store pcie gen mask and link width

We'll need this later for pcie dpm.

Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm: add drm_pcie_get_max_link_width helper (v2)
Alex Deucher [Thu, 12 Nov 2015 04:14:39 +0000 (23:14 -0500)]
drm: add drm_pcie_get_max_link_width helper (v2)

Add a helper to get the max link width of the port.
Similar to the helper to get the max link speed.

v2: fix typo in commit message

Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: extract pcie helpers to common header
Alex Deucher [Thu, 12 Nov 2015 01:18:52 +0000 (20:18 -0500)]
drm/amdgpu: extract pcie helpers to common header

These will be used by multiple powerplay drivers and
other IP modules.

Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay/fiji: enable pcie and mclk forcing for low
Alex Deucher [Wed, 11 Nov 2015 05:31:00 +0000 (00:31 -0500)]
drm/amd/powerplay/fiji: enable pcie and mclk forcing for low

When forcing the lowest state also force mclk and pcie.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay/tonga: enable pcie and mclk forcing for low
Alex Deucher [Wed, 11 Nov 2015 05:23:57 +0000 (00:23 -0500)]
drm/amd/powerplay/tonga: enable pcie and mclk forcing for low

When forcing the lowest state also force mclk and pcie.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: refine the logic of whether need to update power state.
Rex Zhu [Wed, 4 Nov 2015 06:56:56 +0000 (14:56 +0800)]
drm/amd/powerplay: refine the logic of whether need to update power state.

Better handle power state changes.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agodrm/amd/powerplay: implement new funcs to check current states for tonga.
Rex Zhu [Wed, 4 Nov 2015 03:21:35 +0000 (11:21 +0800)]
drm/amd/powerplay: implement new funcs to check current states for tonga.

Implement the new callbacks for tonga.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agodrm/amd/powerplay: add and export hwmgr interface to eventmgr to check hw states.
Rex Zhu [Wed, 4 Nov 2015 03:07:34 +0000 (11:07 +0800)]
drm/amd/powerplay: add and export hwmgr interface to eventmgr to check hw states.

Interface between hwmgr and eventmgr.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agodrm/amdgpu: support per device powerplay enablement (v2)
Jammy Zhou [Tue, 10 Nov 2015 23:31:08 +0000 (18:31 -0500)]
drm/amdgpu: support per device powerplay enablement (v2)

The amdgu_powerplay variable is global for multiple GPU instances.

v2: fold in Flora's module option change, protect adev reference in
macros

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agodrm/amdgpu: enable sysfs interface for powerplay
Rex Zhu [Tue, 10 Nov 2015 23:29:11 +0000 (18:29 -0500)]
drm/amdgpu: enable sysfs interface for powerplay

Same interface exposed in pre-powerplay dpm code.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: export fan control functions to amdgpu
Rex Zhu [Thu, 15 Oct 2015 09:23:43 +0000 (17:23 +0800)]
drm/amdgpu: export fan control functions to amdgpu

Hook up the amdgpu thermal control callbacks for powerplay.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/powerplay: implement fan control interface in amd_powerplay_funcs
Rex Zhu [Fri, 16 Oct 2015 03:48:21 +0000 (11:48 +0800)]
drm/amdgpu/powerplay: implement fan control interface in amd_powerplay_funcs

This adds the interface needed to expose powerplay fan control to sysfs
via hwmon.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/powerplay: implement thermal control for tonga.
Rex Zhu [Tue, 20 Oct 2015 10:06:23 +0000 (18:06 +0800)]
drm/amdgpu/powerplay: implement thermal control for tonga.

Implement thermal and fan control for tonga.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/powerplay: enable thermal interrupt task in eventmgr.
Rex Zhu [Fri, 16 Oct 2015 12:32:36 +0000 (20:32 +0800)]
drm/amdgpu/powerplay: enable thermal interrupt task in eventmgr.

Add thermal handling to the event manager.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/powerplay: add thermal control interface in hwmgr.
Rex Zhu [Wed, 21 Oct 2015 02:34:22 +0000 (10:34 +0800)]
drm/amdgpu/powerplay: add thermal control interface in hwmgr.

Thermal controller interface.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/powerplay: mv ppinterrupt.h to inc folder to share with other submodule.
Rex Zhu [Wed, 21 Oct 2015 02:30:02 +0000 (10:30 +0800)]
drm/amdgpu/powerplay: mv ppinterrupt.h to inc folder to share with other submodule.

Redefine interrupt callback function in accordance with cgs.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/powerplay: add new function point in hwmgr_funcs for thermal control
Rex Zhu [Fri, 16 Oct 2015 03:46:51 +0000 (11:46 +0800)]
drm/amdgpu/powerplay: add new function point in hwmgr_funcs for thermal control

Add the interface for fan and thermal control.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: Add CG and PG support for tonga
Rex Zhu [Thu, 15 Oct 2015 13:12:58 +0000 (21:12 +0800)]
drm/amd/powerplay: Add CG and PG support for tonga

Implement clock and power gating support for tonga.  On Tonga
this is handles by the SMU rather than direct register settings
in the driver.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: add new function point in hwmgr_func for CG/PG.
Rex Zhu [Wed, 30 Sep 2015 05:28:49 +0000 (13:28 +0800)]
drm/amd/powerplay: add new function point in hwmgr_func for CG/PG.

Add callbacks interface for clock and powergating.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/powerplay: add some definition for other ip block to update cg pg.
Rex Zhu [Fri, 9 Oct 2015 10:43:28 +0000 (18:43 +0800)]
drm/amdgpu/powerplay: add some definition for other ip block to update cg pg.

Interface for clock and power gating handling.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: enable powerplay module by default for fiji.
Rex Zhu [Tue, 20 Oct 2015 03:05:45 +0000 (11:05 +0800)]
drm/amdgpu: enable powerplay module by default for fiji.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: enable powerplay module by default for tonga.
Rex Zhu [Sat, 17 Oct 2015 09:57:58 +0000 (17:57 +0800)]
drm/amdgpu: enable powerplay module by default for tonga.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/powerplay: program display gap for tonga.
Rex Zhu [Fri, 16 Oct 2015 07:02:04 +0000 (15:02 +0800)]
drm/amdgpu/powerplay: program display gap for tonga.

Implement displaygap programming for tonga.  This is
required for properly mclk switching.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/powerplay: implement pem_task for display_configuration_change
Rex Zhu [Fri, 16 Oct 2015 06:59:17 +0000 (14:59 +0800)]
drm/amdgpu/powerplay: implement pem_task for display_configuration_change

Add support for display configuration changes to the event manager.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/poweprlay: export program display gap function to eventmgr
Rex Zhu [Fri, 16 Oct 2015 06:55:03 +0000 (14:55 +0800)]
drm/amdgpu/poweprlay: export program display gap function to eventmgr

This allows the eventmgr to properly update the displaygap on
certain power events.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/powerplay: add function point in hwmgr_funcs for program display gap
Rex Zhu [Fri, 16 Oct 2015 06:51:09 +0000 (14:51 +0800)]
drm/amdgpu/powerplay: add function point in hwmgr_funcs for program display gap

Displaygap support is required for proper mclk switching.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/amdgpu: enable powerplay and smc firmware loading for Fiji.
Eric Huang [Tue, 29 Sep 2015 18:58:53 +0000 (14:58 -0400)]
drm/amd/amdgpu: enable powerplay and smc firmware loading for Fiji.

Switch over to handling in the powerplay module.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
8 years agodrm/amdgpu: add amdgpu.powerplay module option
Jammy Zhou [Tue, 21 Jul 2015 06:01:50 +0000 (14:01 +0800)]
drm/amdgpu: add amdgpu.powerplay module option

This option can be used to enable the new powerplay implementation,
and it is disabled by default.

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: add Fiji DPM support.
Eric Huang [Wed, 26 Aug 2015 20:52:28 +0000 (16:52 -0400)]
drm/amd/powerplay: add Fiji DPM support.

This enabled DPM support for Fiji.  DPM is dynamic
clock and voltage scaling.

v2: rename fiji_hwmgr_early_init to fiji_hwmgr_init
v3: (agd) fold in endian fix, additional function addition

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
8 years agodrm/amd/powerplay: add Fiji SMU support.
Eric Huang [Wed, 26 Aug 2015 20:50:59 +0000 (16:50 -0400)]
drm/amd/powerplay: add Fiji SMU support.

Add support for the SMU manager for Fiji. This handles the
firmware loading for other IP blocks (GFX, SDMA, etc.).

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
8 years agodrm/amd/powerplay: update atomctrl for fiji
Eric Huang [Mon, 9 Nov 2015 22:35:45 +0000 (17:35 -0500)]
drm/amd/powerplay: update atomctrl for fiji

Add some new functions to support Fiji.  Split out
from the previous patch.

Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
8 years agodrm/amd/powerplay: add/update headers for Fiji SMU and DPM
Eric Huang [Mon, 9 Nov 2015 22:34:31 +0000 (17:34 -0500)]
drm/amd/powerplay: add/update headers for Fiji SMU and DPM

New headers for Fiji.

Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
8 years agodrm/amd/powerplay: add Tonga dpm support (v3)
yanyang1 [Tue, 18 Aug 2015 07:28:32 +0000 (15:28 +0800)]
drm/amd/powerplay: add Tonga dpm support (v3)

This implements DPM for tonga.  DPM handles dynamic
clock and voltage scaling.

v2: merge all the patches related with tonga dpm
v3: merge dpm force level fix, cgs display fix, spelling fix

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: yanyang1 <young.yang@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
8 years agodrm/amd/powerplay: Add Tonga SMU support
Jammy Zhou [Wed, 22 Jul 2015 03:29:58 +0000 (11:29 +0800)]
drm/amd/powerplay: Add Tonga SMU support

The SMU manager handles firmware loading for other IP
blocks (GFX, SDMA, etc.).  This implements it for Tonga.

v3: delete peci sub-module
v2: use cgs interface directly

Signed-off-by: Young Yang <Young.Yang@amd.com>
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: add header file for tonga smu and dpm
yanyang1 [Mon, 17 Aug 2015 06:15:20 +0000 (14:15 +0800)]
drm/amd/powerplay: add header file for tonga smu and dpm

These headers provide the SMU interface used by the driver.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: yanyang1 <young.yang@amd.com>
8 years agodrm/amd/powerplay: Move smu7*.h from amdgpu to powerplay.
yanyang1 [Wed, 19 Aug 2015 04:22:34 +0000 (12:22 +0800)]
drm/amd/powerplay: Move smu7*.h from amdgpu to powerplay.

Move smu7.h, smu7_discrete.h and smu7_fusion.h from amdgpu to powerplay.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: yanyang1 <young.yang@amd.com>
8 years agodrm/amd/powerplay: Add ixSWRST_COMMAND_1 in bif_5_0_d.h
yanyang1 [Mon, 17 Aug 2015 06:15:20 +0000 (14:15 +0800)]
drm/amd/powerplay: Add ixSWRST_COMMAND_1 in bif_5_0_d.h

Add ixSWRST_COMMAND_1 in bif_5_0_d.h.  Required by
new powerplay code for tonga and fiji.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: yanyang1 <young.yang@amd.com>
8 years agodrm/amd/powerplay: implement functions of amd_powerplay_func
Rex Zhu [Fri, 28 Aug 2015 04:56:43 +0000 (12:56 +0800)]
drm/amd/powerplay: implement functions of amd_powerplay_func

This is the common interface for interacting with the powerplay
module.

v2: squash in fixes

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Acked-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: add event manager sub-component
Rex Zhu [Wed, 23 Sep 2015 07:14:54 +0000 (15:14 +0800)]
drm/amd/powerplay: add event manager sub-component

The event manager handles power related driver events.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: add CG and PG support for carrizo
Rex Zhu [Wed, 23 Sep 2015 07:14:38 +0000 (15:14 +0800)]
drm/amd/powerplay: add CG and PG support for carrizo

This adds clock and powergating support for CZ.

v2: squash in fixes

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: add Carrizo dpm support
Jammy Zhou [Wed, 22 Jul 2015 02:41:30 +0000 (10:41 +0800)]
drm/amd/powerplay: add Carrizo dpm support

This patch enables basic DPM support for Carrizo.
DPM handles dynamic clock and voltage scaling.

v3: delete peci sub-module
v2: use cgs interface directly
    correct define SMU_EnabledFeatureScoreboard_SclkDpmOn

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: add Carrizo smu support
Jammy Zhou [Wed, 22 Jul 2015 01:54:16 +0000 (09:54 +0800)]
drm/amd/powerplay: add Carrizo smu support

This implements the SMU firmware manager interface for CZ.
Some header files are moved from amdgpu folder to powerplay as well.

v3: delete peci sub-module.
v2: use cgs interface directly
    add load_mec_firmware function

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: add hardware manager sub-component
Jammy Zhou [Tue, 21 Jul 2015 13:18:15 +0000 (21:18 +0800)]
drm/amd/powerplay: add hardware manager sub-component

The hwmgr handles all hardware related calls, including clock/power
gating control, DPM, read and parse PPTable, etc.

v5: squash in fixes
v4: implement acpi's atcs function use cgs interface
v3: fix code style error and add big-endian mode support.
v2: use cgs interface directly in hwmgr sub-module

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: add SMU manager sub-component
Jammy Zhou [Tue, 21 Jul 2015 09:43:02 +0000 (17:43 +0800)]
drm/amd/powerplay: add SMU manager sub-component

The SMUMGR is one sub-component of powerplay for SMU firmware support.
The SMU handles firmware loading for other IP blocks (GFX, SDMA, etc.)
on VI parts.  The adds the core powerplay infrastructure to handle that.

v3: direct use printk in powerplay module.
v2: direct use cgs_read/write_register functions in smu-modules

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: export amd_powerplay_func to amdgpu and other ip block
Rex Zhu [Tue, 10 Nov 2015 23:25:24 +0000 (18:25 -0500)]
drm/amdgpu: export amd_powerplay_func to amdgpu and other ip block

Update amdgpu to deal with the new powerplay module properly.

v2: squash in fixes
v3: squash in Rex's power state reporting fix

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Acked-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: disable legacy path of firmware check if powerplay is enabled
Rex Zhu [Sat, 7 Nov 2015 01:33:24 +0000 (20:33 -0500)]
drm/amdgpu: disable legacy path of firmware check if powerplay is enabled

Powerplay will use a different interface once it's integrated.  These
legacy pathes will be removed once powerplay is enabled by default.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: add basic powerplay framework
Alex Deucher [Wed, 2 Dec 2015 22:46:21 +0000 (17:46 -0500)]
drm/amd/powerplay: add basic powerplay framework

amdgpu_pp_ip_funcs is introduced to handle the two code paths,
the legacy one and the new powerplay implementation.

CONFIG_DRM_AMD_POWERPLAY kernel configuration option is
introduced for the powerplay component.

v4: squash in fixes
v3: register debugfs file when powerplay module enable
v2: add amdgpu_ucode_init_bo in hw init when amdgpu_powerplay enable.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: add new cgs interface to get display info (v2)
Rex Zhu [Thu, 17 Sep 2015 08:34:14 +0000 (16:34 +0800)]
drm/amdgpu: add new cgs interface to get display info (v2)

Add new CGS interfaces to query display info across modules.
This is nedded by the powerplay module for synchronizing with
the display module.

v2: (agd): fold in refresh rate fix, rebase

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: implement cgs interface to query system info
Rex Zhu [Wed, 23 Sep 2015 12:11:54 +0000 (20:11 +0800)]
drm/amdgpu: implement cgs interface to query system info

Add a query to get the bus number and function of the
device.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agodrm/amdgpu: implement new cgs interface for acpi function
Rex Zhu [Tue, 15 Sep 2015 06:44:44 +0000 (14:44 +0800)]
drm/amdgpu: implement new cgs interface for acpi function

Add a new driver internal interface for accessing ACPI
methods.  These will be used by various new components
including powerplay.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: mv amdgpu_acpi.h to amd/include/amd_acpi.h
Rex Zhu [Fri, 18 Sep 2015 08:35:17 +0000 (16:35 +0800)]
drm/amdgpu: mv amdgpu_acpi.h to amd/include/amd_acpi.h

This will be shared with the new powerplay module.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: mv some definition from amdgpu_acpi.c to amdgpu_acpi.h
Rex Zhu [Mon, 21 Sep 2015 06:29:10 +0000 (14:29 +0800)]
drm/amdgpu: mv some definition from amdgpu_acpi.c to amdgpu_acpi.h

These will be shared with the new powerplay module.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: share struct amdgpu_pm_state_type with powerplay module
Rex Zhu [Tue, 25 Aug 2015 07:57:43 +0000 (15:57 +0800)]
drm/amdgpu: share struct amdgpu_pm_state_type with powerplay module

rename amdgpu_pm_state_type to amd_pm_state_type

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Acked-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/radeon: clean up fujitsu quirks
Alex Deucher [Thu, 17 Dec 2015 17:52:17 +0000 (12:52 -0500)]
drm/radeon: clean up fujitsu quirks

Combine the two quirks.

bug:
https://bugzilla.kernel.org/show_bug.cgi?id=109481

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
8 years agodrm/amdgpu: Fix off-by-one errors in amdgpu_vm_bo_map
Felix Kuehling [Mon, 23 Nov 2015 22:43:48 +0000 (17:43 -0500)]
drm/amdgpu: Fix off-by-one errors in amdgpu_vm_bo_map

eaddr is sometimes treated as the last address inside the address
range, and sometimes as the first address outside the range. This
was resulting in errors when a test filled up the entire address
space. Make it consistent to always be the last address within the
range.

Signed-off-by: Felix.Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Cc: stable@vger.kernel.org
8 years agodrm/radeon: Fix off-by-one errors in radeon_vm_bo_set_addr
Felix Kuehling [Mon, 23 Nov 2015 22:39:11 +0000 (17:39 -0500)]
drm/radeon: Fix off-by-one errors in radeon_vm_bo_set_addr

eoffset is sometimes treated as the last address inside the address
range, and sometimes as the first address outside the range. This
was resulting in errors when a test filled up the entire address
space. Make it consistent to always be the last address within the
range. Also fixed related errors when checking the VA limit and in
radeon_vm_fence_pts.

Signed-off-by: Felix.Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Cc: stable@vger.kernel.org
8 years agodrm/radeon: fix dp link rate selection (v2)
Alex Deucher [Thu, 17 Dec 2015 15:23:34 +0000 (10:23 -0500)]
drm/radeon: fix dp link rate selection (v2)

Need to properly handle the max link rate in the dpcd.
This prevents some cases where 5.4 Ghz is selected when
it shouldn't be.

v2: simplify logic, add array bounds check

Reviewed-by: Tom St Denis <tom.stdenis@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: fix dp link rate selection (v2)
Alex Deucher [Thu, 17 Dec 2015 14:57:49 +0000 (09:57 -0500)]
drm/amdgpu: fix dp link rate selection (v2)

Need to properly handle the max link rate in the dpcd.
This prevents some cases where 5.4 Ghz is selected when
it shouldn't be.

v2: simplify logic, add array bounds check

Reviewed-by: Tom St Denis <tom.stdenis@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/radeon: only increment sync_seq when a fence is really emitted
Nicolai Hähnle [Sat, 12 Dec 2015 16:42:25 +0000 (11:42 -0500)]
drm/radeon: only increment sync_seq when a fence is really emitted

In the rare situation where the kmalloc fails we're probably screwed anyway,
but let's try to be more robust about it.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Nicolai Hähnle <Nicolai.Haehnle@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/radeon: fix typo in cik_ring_ib_execute documentation (v2)
Nicolai Hähnle [Sat, 12 Dec 2015 16:42:24 +0000 (11:42 -0500)]
drm/radeon: fix typo in cik_ring_ib_execute documentation (v2)

v2: agd: clarify commit message, fix "an" as spotted by Michel.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/ttm: fix documentation of ttm_bo_reserve
Nicolai Hähnle [Sat, 12 Dec 2015 16:42:23 +0000 (11:42 -0500)]
drm/ttm: fix documentation of ttm_bo_reserve

Previously, the comment was inconsistent. EDEADLK is what the ww_mutex
mechanism really returns.

Signed-off-by: Nicolai Hähnle <Nicolai.Haehnle@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/radeon: Update radeon_get_vblank_counter_kms()
Thierry Reding [Wed, 16 Dec 2015 14:31:47 +0000 (15:31 +0100)]
drm/radeon: Update radeon_get_vblank_counter_kms()

Commit 88e72717c2de ("drm/irq: Use unsigned int pipe in public API")
updated the prototype of this function but not the implementation. This
wasn't noticed even through compile tests because the prototype is part
of the source file that uses it and hence the compiler won't know the
prototype when it compiles the implementation.

The right thing would've been to move the prototype to a header that's
included in radeon_kms.c so that the implementation signature could be
checked against it, but the closest thing would've been radeon_drv.h
and including that results in a lot of build errors, so we'll leave it
as is for now.

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/radeon: Fixup hw vblank counter/ts for new drm_update_vblank_count() (v2)
Mario Kleiner [Wed, 25 Nov 2015 19:14:31 +0000 (20:14 +0100)]
drm/radeon: Fixup hw vblank counter/ts for new drm_update_vblank_count() (v2)

commit 4dfd6486 "drm: Use vblank timestamps to guesstimate how many
vblanks were missed" introduced in Linux 4.4-rc1 makes the drm core
more fragile to drivers which don't update hw vblank counters and
vblank timestamps in sync with firing of the vblank irq and
essentially at leading edge of vblank.

This exposed a problem with radeon-kms/amdgpu-kms which do not
satisfy above requirements:

The vblank irq fires a few scanlines before start of vblank, but
programmed pageflips complete at start of vblank and
vblank timestamps update at start of vblank, whereas the
hw vblank counter increments only later, at start of vsync.

This leads to problems like off by one errors for vblank counter
updates, vblank counters apparently going backwards or vblank
timestamps apparently having time going backwards. The net result
is stuttering of graphics in games, or little hangs, as well as
total failure of timing sensitive applications.

See bug #93147 for an example of the regression on Linux 4.4-rc:

https://bugs.freedesktop.org/show_bug.cgi?id=93147

This patch tries to align all above events better from the
viewpoint of the drm core / of external callers to fix the problem:

1. The apparent start of vblank is shifted a few scanlines earlier,
so the vblank irq now always happens after start of this extended
vblank interval and thereby drm_update_vblank_count() always samples
the updated vblank count and timestamp of the new vblank interval.

To achieve this, the reporting of scanout positions by
radeon_get_crtc_scanoutpos() now operates as if the vblank starts
radeon_crtc->lb_vblank_lead_lines before the real start of the hw
vblank interval. This means that the vblank timestamps which are based
on these scanout positions will now update at this earlier start of
vblank.

2. The driver->get_vblank_counter() function will bump the returned
vblank count as read from the hw by +1 if the query happens after
the shifted earlier start of the vblank, but before the real hw increment
at start of vsync, so the counter appears to increment at start of vblank
in sync with the timestamp update.

3. Calls from vblank irq-context and regular non-irq calls are now
treated identical, always simulating the shifted vblank start, to
avoid inconsistent results for queries happening from vblank irq vs.
happening from drm_vblank_enable() or vblank_disable_fn().

4. The radeon_flip_work_func will delay mmio programming a pageflip until
the start of the real vblank iff it happens to execute inside the shifted
earlier start of the vblank, so pageflips now also appear to execute at
start of the shifted vblank, in sync with vblank counter and timestamp
updates. This to avoid some races between updates of vblank count and
timestamps that are used for swap scheduling and pageflip execution which
could cause pageflips to execute before the scheduled target vblank.

The lb_vblank_lead_lines "fudge" value is calculated as the size of
the display controllers line buffer in scanlines for the given video
mode: Vblank irq's are triggered by the line buffer logic when the line
buffer refill for a video frame ends, ie. when the line buffer source read
position enters the hw vblank. This means that a vblank irq could fire at
most as many scanlines before the current reported scanout position of the
crtc timing generator as the number of scanlines the line buffer can
maximally hold for a given video mode.

This patch has been successfully tested on a RV730 card with DCE-3 display
engine and on a evergreen card with DCE-4 display engine, in single-display
and dual-display configuration, with different video modes.

A similar patch is needed for amdgpu-kms to fix the same problem.

Limitations:

- Line buffer sizes in pixels are hard-coded on < DCE-4 to a value
  i just guessed to be high enough to work ok, lacking info on the true
  sizes atm.

Fixes: fdo#93147
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Michel Dänzer <michel.daenzer@amd.com>
Cc: Harry Wentland <Harry.Wentland@amd.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
(v1) Tested-by: Dave Witbrodt <dawitbro@sbcglobal.net>

(v2) Refine radeon_flip_work_func() for better efficiency:

     In radeon_flip_work_func, replace the busy waiting udelay(5)
     with event lock held by a more performance and energy efficient
     usleep_range() until at least predicted true start of hw vblank,
     with some slack for scheduler happiness. Release the event lock
     during waits to not delay other outputs in doing their stuff, as
     the waiting can last up to 200 usecs in some cases.

     Retested on DCE-3 and DCE-4 to verify it still works nicely.

(v2) Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/radeon: Fix "slow" audio over DP on DCE8+
Slava Grigorev [Thu, 17 Dec 2015 16:09:58 +0000 (11:09 -0500)]
drm/radeon: Fix "slow" audio over DP on DCE8+

DP audio is derived from the dfs clock.

Signed-off-by: Slava Grigorev <slava.grigorev@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
8 years agodrm/amdgpu: keep the PTs validation list in the VM v2
Christian König [Fri, 11 Dec 2015 20:01:23 +0000 (21:01 +0100)]
drm/amdgpu: keep the PTs validation list in the VM v2

This avoids allocating it on the fly.

v2: fix grammar in comment

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
8 years agodrm/amdgpu: split VM PD and PT handling during CS
Christian König [Fri, 11 Dec 2015 14:16:32 +0000 (15:16 +0100)]
drm/amdgpu: split VM PD and PT handling during CS

This way we avoid the extra allocation for the page directory entry.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
8 years agodrm/amdgpu: put VM page tables directly into duplicates list
Christian König [Fri, 11 Dec 2015 13:39:05 +0000 (14:39 +0100)]
drm/amdgpu: put VM page tables directly into duplicates list

They share the reservation object with the page directory anyway.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
8 years agodrm/amdgpu: restrict the sched jobs number to power of two
Chunming Zhou [Thu, 10 Dec 2015 09:34:33 +0000 (17:34 +0800)]
drm/amdgpu: restrict the sched jobs number to power of two

Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
CC: stable@vger.kernel.org
8 years agodrm/amdgpu: limit visible vram if it's smaller than the BAR
Alex Deucher [Wed, 9 Dec 2015 20:36:40 +0000 (15:36 -0500)]
drm/amdgpu: limit visible vram if it's smaller than the BAR

In some cases the amount of vram may be less than the BAR size,
if so, limit visible vram to the amount of actual vram, not the
BAR size.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: change default sched jobs to 32
Chunming Zhou [Thu, 10 Dec 2015 07:46:50 +0000 (15:46 +0800)]
drm/amdgpu: change default sched jobs to 32

Change the default scheduler queue size from 16 to 32.

Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: unify AMDGPU_CTX_MAX_CS_PENDING and amdgpu_sched_jobs
Chunming Zhou [Thu, 10 Dec 2015 07:45:11 +0000 (15:45 +0800)]
drm/amdgpu: unify AMDGPU_CTX_MAX_CS_PENDING and amdgpu_sched_jobs

Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: handle error case for ctx
Chunming Zhou [Thu, 10 Dec 2015 07:50:02 +0000 (15:50 +0800)]
drm/amdgpu: handle error case for ctx

Properly handle ctx init failure.

Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: add entity only when first job come
Chunming Zhou [Fri, 11 Dec 2015 10:22:52 +0000 (18:22 +0800)]
drm/amdgpu: add entity only when first job come

umd somtimes will create a context for every ring,
that means some entities wouldn't be used at all.

Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: add more debugging output for driver failures
Alex Deucher [Mon, 7 Dec 2015 22:02:53 +0000 (17:02 -0500)]
drm/amdgpu: add more debugging output for driver failures

Add more fine grained debugging output for init/fini/suspend/
resume failures.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: update rev id register for VI
Flora Cui [Fri, 20 Nov 2015 03:40:53 +0000 (11:40 +0800)]
drm/amdgpu: update rev id register for VI

Change-Id: I2ae9bb4a929f7c0c8783e0be563ae04be77596e2
Signed-off-by: Flora Cui <Flora.Cui@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/gfx8: update PA_SC_RASTER_CONFIG:PKR_MAP only
Flora Cui [Tue, 8 Dec 2015 03:23:29 +0000 (11:23 +0800)]
drm/amdgpu/gfx8: update PA_SC_RASTER_CONFIG:PKR_MAP only

Use default value as a base.

Signed-off-by: Flora Cui <Flora.Cui@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agodrm/amdgpu/gfx8: Enable interrupt on ME1_PIPE3
Flora Cui [Wed, 2 Dec 2015 01:56:06 +0000 (09:56 +0800)]
drm/amdgpu/gfx8: Enable interrupt on ME1_PIPE3

Otherwise FW cannot see the RLC ACK for the memory clean request
It's for Stoney.

Signed-off-by: Flora Cui <Flora.Cui@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>