cascardo/linux.git
7 years agodrm/amdgpu/si/dpm: make a bunch of things static
Alex Deucher [Tue, 13 Sep 2016 03:46:06 +0000 (23:46 -0400)]
drm/amdgpu/si/dpm: make a bunch of things static

remnants of the port from radeon.

Acked-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay/polaris10: mark symbols static where possible
Baoyou Xie [Tue, 6 Sep 2016 07:17:48 +0000 (15:17 +0800)]
drm/amd/powerplay/polaris10: mark symbols static where possible

We get a few warnings when building kernel with W=1:
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/polaris10_clockpowergating.c:34:5: warning: no previous prototype
for 'polaris10_phm_powerup_uvd' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/polaris10_thermal.c:428:5: warning: no previous prototype
for 'tf_polaris10_thermal_setup_fan_table' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/polaris10_hwmgr.c:125:31: warning: no previous prototype
for 'cast_phw_polaris10_power_state' [-Wmissing-prototypes]
....

In fact, these functions are only used in the file in which they are
declared and don't need a declaration, but can be made static.
So this patch marks these functions with 'static'.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay/fiji: mark symbols static where possible
Baoyou Xie [Tue, 6 Sep 2016 06:16:28 +0000 (14:16 +0800)]
drm/amd/powerplay/fiji: mark symbols static where possible

We get a few warnings when building kernel with W=1:
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/fiji_hwmgr.c:1633:9: warning: no previous prototype
for 'fiji_get_voltage_index' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/fiji_hwmgr.c:5412:5: warning: no previous prototype
for 'fiji_check_states_equal' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/fiji_thermal.c:424:5: warning: no previous prototype
for 'tf_fiji_thermal_setup_fan_table' [-Wmissing-prototypes]
....

In fact, these functions are only used in the file in which they are
declared and don't need a declaration, but can be made static.
So this patch marks these functions with 'static'.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: mark symbols static where possible
Baoyou Xie [Sat, 3 Sep 2016 05:57:14 +0000 (13:57 +0800)]
drm/amdgpu: mark symbols static where possible

We get a few warnings when building kernel with W=1:
drivers/gpu/drm/amd/amdgpu/cz_smc.c:51:5: warning: no previous prototype for 'cz_send_msg_to_smc_async' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/cz_smc.c:143:5: warning: no previous prototype for 'cz_write_smc_sram_dword' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/iceland_smc.c:124:6: warning: no previous prototype for 'iceland_start_smc' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c:3926:6: warning: no previous prototype for 'gfx_v8_0_rlc_stop' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c:94:6: warning: no previous prototype for 'amdgpu_job_free_cb' [-Wmissing-prototypes]
....

In fact, these functions are only used in the file in which they are
declared and don't need a declaration, but can be made static.
So this patch marks these functions with 'static'.

Reviewed-by: Christian König <christian.koenig@amd.com>
Acked-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add missing header dependencies
Baoyou Xie [Sat, 3 Sep 2016 06:01:41 +0000 (14:01 +0800)]
drm/amdgpu: add missing header dependencies

We get a few warnings when building kernel with W=1:
drivers/gpu/drm/amd/amdgpu/amdgpu_pll.c:113:6: warning: no previous prototype for 'amdgpu_pll_compute' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/cz_smc.c:38:10: warning: no previous prototype for 'cz_get_argument' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/cz_smc.c:302:5: warning: no previous prototype for 'cz_smu_start' [-Wmissing-prototypes]
....

In fact, these functions are declared in
drivers/gpu/drm/amd/amdgpu/atombios_i2c.h
drivers/gpu/drm/amd/amdgpu/amdgpu_pll.h
drivers/gpu/drm/amd/amdgpu/cz_dpm.h
drivers/gpu/drm/amd/amdgpu/vi_dpm.h.
So this patch adds missing header dependencies.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoamd/powerplay: use kmemdup instead of kmalloc + memcpy
Edward O'Callaghan [Sun, 4 Sep 2016 02:36:19 +0000 (12:36 +1000)]
amd/powerplay: use kmemdup instead of kmalloc + memcpy

Save a few clocks by replacing calls to kmalloc followed by memcpy
with a single call to kmemdup.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: delete duplicated function and definition.
Rex Zhu [Thu, 11 Aug 2016 09:56:56 +0000 (17:56 +0800)]
drm/amd/powerplay: delete duplicated function and definition.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: move smu related variable definitions to smumgr.
Rex Zhu [Thu, 11 Aug 2016 11:36:54 +0000 (19:36 +0800)]
drm/amd/powerplay: move smu related variable definitions to smumgr.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: wrap get evv voltage functions
Rex Zhu [Tue, 16 Aug 2016 13:38:19 +0000 (21:38 +0800)]
drm/amd/powerplay: wrap get evv voltage functions

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: add helper function to get voltage id in votage table
Rex Zhu [Mon, 12 Sep 2016 07:17:37 +0000 (15:17 +0800)]
drm/amd/powerplay: add helper function to get voltage id in votage table

Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: initialize platform caps in hwmgr_init.
Rex Zhu [Tue, 6 Sep 2016 08:35:01 +0000 (16:35 +0800)]
drm/amd/powerplay: initialize platform caps in hwmgr_init.

Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: add module parameter to mask pp features
Rex Zhu [Tue, 6 Sep 2016 08:34:37 +0000 (16:34 +0800)]
drm/amd/powerplay: add module parameter to mask pp features

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: add feature flags in hwmgr to enable/disable special features.
Rex Zhu [Tue, 16 Aug 2016 10:13:57 +0000 (18:13 +0800)]
drm/amd/powerplay: add feature flags in hwmgr to enable/disable special features.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: mark symbols static where possible on tonga/iceland.
Rex Zhu [Fri, 9 Sep 2016 11:01:10 +0000 (19:01 +0800)]
drm/amd/powerplay: mark symbols static where possible on tonga/iceland.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: use error label to handle exceptional case
Huang Rui [Wed, 7 Sep 2016 12:55:42 +0000 (20:55 +0800)]
drm/amdgpu: use error label to handle exceptional case

Use error label to decrease global item unref and make codes more
readable.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: update gart_pin_size if bo is in GTT
Flora Cui [Fri, 9 Sep 2016 06:15:30 +0000 (14:15 +0800)]
drm/amdgpu: update gart_pin_size if bo is in GTT

Signed-off-by: Flora Cui <Flora.Cui@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: bind GTT on demand
Christian König [Mon, 5 Sep 2016 15:00:57 +0000 (17:00 +0200)]
drm/amdgpu: bind GTT on demand

We don't really need the GTT table any more most of the time. So bind it
only on demand.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: fix GTT offset handling
Christian König [Sat, 3 Sep 2016 14:18:26 +0000 (16:18 +0200)]
drm/amdgpu: fix GTT offset handling

Otherwise we run into problems on 32bit systems with more than 4GB GART.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm: modify drm_global_item_ref to avoid two times of writing ref->object
Huang Rui [Wed, 7 Sep 2016 05:24:31 +0000 (13:24 +0800)]
drm: modify drm_global_item_ref to avoid two times of writing ref->object

In previous drm_global_item_ref, there are two times of writing
ref->object if item->refcount is 0. So this patch does a minor update
to put alloc and init ref firstly, and then to modify the item of glob
array. Use "else" to avoid two times of writing ref->object. It can
make the code logic more clearly.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:implement CONTEXT_CONTROL (v5)
Monk Liu [Fri, 26 Aug 2016 05:28:28 +0000 (13:28 +0800)]
drm/amdgpu:implement CONTEXT_CONTROL (v5)

v1:
for gfx8, use CONTEXT_CONTROL package to dynamically
skip preamble CEIB and other load_xxx command in sequence.

v2:
support GFX7 as well.
remove cntxcntl in compute ring funcs because CPC doesn't
support this packet.

v3: fix reduntant judgement in cntxcntl.
v4: some cleanups, don't change cs_submit()
v5: keep old MESA supported & bump up KMS version.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Ack-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>
7 years agodrm/amd/powerplay: declare functions instand of include header file.
Rex Zhu [Thu, 11 Aug 2016 11:52:25 +0000 (19:52 +0800)]
drm/amd/powerplay: declare functions instand of include header file.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: calculate flexible array member's address.
Rex Zhu [Wed, 7 Sep 2016 07:06:58 +0000 (15:06 +0800)]
drm/amd/powerplay: calculate flexible array member's address.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu/si: Call amdgpu_ttm_set_active_vram_size from si_dma_start/stop
Michel Dänzer [Wed, 7 Sep 2016 02:51:06 +0000 (11:51 +0900)]
drm/amdgpu/si: Call amdgpu_ttm_set_active_vram_size from si_dma_start/stop

Without this, we were only ever using the first 256MB of VRAM.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97593
Tested-by: Konstantin A. Lepikhov <lakostis@altlinux.org>
Tested-by: Arek Ruśniak <arek.rusi@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: free the BO in kernel by helper amdgpu_bo_free_kernel()
Junwei Zhang [Wed, 7 Sep 2016 09:14:46 +0000 (17:14 +0800)]
drm/amdgpu: free the BO in kernel by helper amdgpu_bo_free_kernel()

Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add a new helper to free a BO in kernel allocations
Junwei Zhang [Thu, 8 Sep 2016 02:13:32 +0000 (10:13 +0800)]
drm/amdgpu: add a new helper to free a BO in kernel allocations

Free the BO allocated by amdgpu_bo_create_kernel()

Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: Fix return values in SI DPM code
Tom St Denis [Wed, 7 Sep 2016 12:42:41 +0000 (08:42 -0400)]
drm/amd/amdgpu: Fix return values in SI DPM code

Fix a couple of spots where errors were not returned as
well as add some error messages to
si_patch_dependency_based_on_leakage() which were not being
read.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: move some release handles into fail labels (v2)
Huang Rui [Mon, 12 Sep 2016 02:16:21 +0000 (10:16 +0800)]
drm/amdgpu: move some release handles into fail labels (v2)

Clean up the codes to move the release handles into fail labels.

v2: squash in Christian's regression fix

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-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>
7 years agodrm/amd/amdgpu: Remove double lock from gfx v6
Tom St Denis [Wed, 7 Sep 2016 12:03:28 +0000 (08:03 -0400)]
drm/amd/amdgpu: Remove double lock from gfx v6

The function gfx_v6_0_get_cu_info() was taking the
grbm_idx_mutex which was then taken by a dependent
function gfx_v6_0_get_cu_active_bitmap().

This patch removes the select from the parent function
to avoid the double lock.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: Convert messages in gmc v6 to dev_*()
Tom St Denis [Tue, 6 Sep 2016 17:09:26 +0000 (13:09 -0400)]
drm/amd/amdgpu: Convert messages in gmc v6 to dev_*()

Make the kernel log messaging more consistent and use the
dev_*() functions instead of a mix of DRM_*() and printk().

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: Comment out currently unused SI DPM struct
Tom St Denis [Tue, 6 Sep 2016 16:07:21 +0000 (12:07 -0400)]
drm/amd/amdgpu: Comment out currently unused SI DPM struct

The tahiti_le structure is not currently used.  Comment it out
to avoid warnings.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: Tidy up SI SMC code (v2)
Tom St Denis [Tue, 6 Sep 2016 15:56:42 +0000 (11:56 -0400)]
drm/amd/amdgpu: Tidy up SI SMC code (v2)

As well as merge SMC clock functions into one to reduce LOC.

v2: Fix swapped ck enable bit
bug: https://bugs.freedesktop.org/show_bug.cgi?id=97801

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: Tidy up SI IH code
Tom St Denis [Tue, 6 Sep 2016 15:36:42 +0000 (11:36 -0400)]
drm/amd/amdgpu: Tidy up SI IH code

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: Correct whitespace in SI DPM code
Tom St Denis [Tue, 6 Sep 2016 13:45:43 +0000 (09:45 -0400)]
drm/amd/amdgpu: Correct whitespace in SI DPM code

Replace 8 spaces with tabs, correct {} braces, etc.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: Clean up SI DPM table assignments
Tom St Denis [Tue, 6 Sep 2016 13:44:47 +0000 (09:44 -0400)]
drm/amd/amdgpu: Clean up SI DPM table assignments

Hoist common assignments out of cases.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: Allow calling si_dpm_fini at any point
Tom St Denis [Tue, 6 Sep 2016 13:42:55 +0000 (09:42 -0400)]
drm/amd/amdgpu: Allow calling si_dpm_fini at any point

Allow calling fini even if ps array is not allocated.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: Tidy up SI DMA code
Tom St Denis [Tue, 6 Sep 2016 12:42:02 +0000 (08:42 -0400)]
drm/amd/amdgpu: Tidy up SI DMA code

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: fix issue power containment not enabled on Tonga.
Rex Zhu [Mon, 5 Sep 2016 10:34:18 +0000 (18:34 +0800)]
drm/amd/powerplay: fix issue power containment not enabled on Tonga.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Acked-by: Flora Cui <Flora.Cui@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: enable/disable auto thermal throttle for tonga.
Rex Zhu [Mon, 5 Sep 2016 09:49:19 +0000 (17:49 +0800)]
drm/amd/powerplay: enable/disable auto thermal throttle for tonga.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Acked-by: Flora Cui <Flora.Cui@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: S4 issue for amdgpu (v2)
jimqu [Wed, 7 Sep 2016 09:09:12 +0000 (17:09 +0800)]
drm/amd/amdgpu: S4 issue for amdgpu (v2)

reset the asic if adapter is not powerdown when doing freeze()
thaw() and restore(), in order to get a valid state of adapter.

v2: squash in warning fix from Rex

Signed-off-by: JimQu <Jim.Qu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Tested By: Shawn Starr <shawn.starr@rogers.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: change job->ctx field name
Monk Liu [Thu, 25 Aug 2016 07:40:48 +0000 (15:40 +0800)]
drm/amdgpu: change job->ctx field name

job->ctx actually is a fence_context of the entity
it belongs to, naming it as ctx is too vague, and
we'll need add amdgpu_ctx into the job structure
later.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: new method to sync ce&de
Monk Liu [Fri, 26 Aug 2016 06:15:03 +0000 (14:15 +0800)]
drm/amdgpu: new method to sync ce&de

sync switch buffer scheme with windows kmd for gfx v8,
step2:
Insert 128NOP after&before VM flush to prevent CE vm fault.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add VCE VM mode support
Maruthi Srinivas Bayyavarapu [Tue, 30 Aug 2016 09:46:36 +0000 (15:16 +0530)]
drm/amdgpu: add VCE VM mode support

This adds VCE VM mode support from Stoney onwards. Session tracking
is an open issue, yet to be supported.

v2: Fixed warnings from checkpatch.pl

Signed-off-by: Maruthi Bayyavarapu <maruthi.bayyavarapu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: Merge get_wptr functions in gfx6
Tom St Denis [Fri, 2 Sep 2016 12:19:15 +0000 (08:19 -0400)]
drm/amd/amdgpu: Merge get_wptr functions in gfx6

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: Merge get_rptr functions in gfx8
Tom St Denis [Fri, 2 Sep 2016 12:15:42 +0000 (08:15 -0400)]
drm/amd/amdgpu: Merge get_rptr functions in gfx8

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: Merge get_rptr functions in gfx7
Tom St Denis [Fri, 2 Sep 2016 12:14:42 +0000 (08:14 -0400)]
drm/amd/amdgpu: Merge get_rptr functions in gfx7

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: Merge get_rptr functions in gfx6
Tom St Denis [Fri, 2 Sep 2016 12:13:48 +0000 (08:13 -0400)]
drm/amd/amdgpu: Merge get_rptr functions in gfx6

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: Various tidy ups for gfx6
Tom St Denis [Thu, 1 Sep 2016 17:39:37 +0000 (13:39 -0400)]
drm/amd/amdgpu: Various tidy ups for gfx6

Various whitespace and logical simplifications for gfx6.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: Simplify mask creation in gfx6
Tom St Denis [Thu, 1 Sep 2016 17:31:35 +0000 (13:31 -0400)]
drm/amd/amdgpu: Simplify mask creation in gfx6

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: Add GRBM lock to various SI functions
Tom St Denis [Thu, 1 Sep 2016 17:29:49 +0000 (13:29 -0400)]
drm/amd/amdgpu: Add GRBM lock to various SI functions

Add missing lock around SE/SH/INSTANCE selections.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: original power state table should not be changed.
Rex Zhu [Wed, 31 Aug 2016 18:30:42 +0000 (02:30 +0800)]
drm/amd/powerplay: original power state table should not be changed.

power state table was set based on vbios and should not be changed.
when client need to change power state, just make a copy and send to
smu.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: refine struct name for coding style reason.
Rex Zhu [Wed, 31 Aug 2016 10:13:08 +0000 (18:13 +0800)]
drm/amd/powerplay: refine struct name for coding style reason.

delete useless member.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: add vce state tables initialize for ppt v1.
Rex Zhu [Wed, 31 Aug 2016 09:27:11 +0000 (17:27 +0800)]
drm/amd/powerplay: add vce state tables initialize for ppt v1.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: refine struct name for code style reason.
Rex Zhu [Wed, 31 Aug 2016 09:25:49 +0000 (17:25 +0800)]
drm/amd/powerplay: refine struct name for code style reason.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: prevent command submission failures under memory pressure v2
Christian König [Thu, 1 Sep 2016 10:13:18 +0000 (12:13 +0200)]
drm/amdgpu: prevent command submission failures under memory pressure v2

As last resort try to evict BOs from the current working set into other
memory domains. This effectively prevents command submission failures when
VM page tables have been swapped out.

v2: fix typos

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: only try again if we actually run into -ENOMEM
Christian König [Wed, 31 Aug 2016 15:28:11 +0000 (17:28 +0200)]
drm/amdgpu: only try again if we actually run into -ENOMEM

All other errors can't be fixed by using a different memory domain.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/radeon: wire up a pci shutdown callback
Alex Deucher [Mon, 22 Aug 2016 18:29:44 +0000 (14:29 -0400)]
drm/radeon: wire up a pci shutdown callback

Normally on shutdown or reboot we don't care about necessarily
making sure the hw is in a good state because the system is about
to be powered down or reset.  However, after a shutdown or reboot
in a VM, it's best to tear down the hw properly otherwise there
can be problems with the next VM use.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: wire up a pci shutdown callback
Alex Deucher [Mon, 22 Aug 2016 17:50:22 +0000 (13:50 -0400)]
drm/amdgpu: wire up a pci shutdown callback

Normally on shutdown or reboot we don't care about necessarily
making sure the hw is in a good state because the system is about
to be powered down or reset.  However, after a shutdown or reboot
in a VM, it's best to tear down the hw properly otherwise there
can be problems with the next VM use.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/radeon: handle runtime pm in drm pre/post close
Alex Deucher [Wed, 31 Aug 2016 21:23:31 +0000 (17:23 -0400)]
drm/radeon: handle runtime pm in drm pre/post close

Close was not handled correctly.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: handle runtime pm in drm pre/post close
Alex Deucher [Sat, 27 Aug 2016 16:27:24 +0000 (12:27 -0400)]
drm/amdgpu: handle runtime pm in drm pre/post close

Close was not handled correctly.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/radeon: handle runtime pm correctly in amdgpu_driver_open_kms
Alex Deucher [Wed, 31 Aug 2016 21:27:03 +0000 (17:27 -0400)]
drm/radeon: handle runtime pm correctly in amdgpu_driver_open_kms

Need to fix the error paths.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: handle runtime pm correctly in amdgpu_driver_open_kms
Alex Deucher [Sat, 27 Aug 2016 16:30:25 +0000 (12:30 -0400)]
drm/amdgpu: handle runtime pm correctly in amdgpu_driver_open_kms

Need to fix the error paths.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/radeon: skip suspend/resume on DRM_SWITCH_POWER_DYNAMIC_OFF
Alex Deucher [Wed, 31 Aug 2016 21:31:30 +0000 (17:31 -0400)]
drm/radeon: skip suspend/resume on DRM_SWITCH_POWER_DYNAMIC_OFF

Missed this case previously. No need to do anything if the
device is already off.  runtime pm will handle it.

Acked-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/radeon: set runtime pm state to active on resume
Alex Deucher [Wed, 31 Aug 2016 21:34:23 +0000 (17:34 -0400)]
drm/radeon: set runtime pm state to active on resume

The sbios always powers up the dGPU on resume.

Acked-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: skip suspend/resume on DRM_SWITCH_POWER_DYNAMIC_OFF
Alex Deucher [Sat, 27 Aug 2016 16:57:20 +0000 (12:57 -0400)]
drm/amdgpu: skip suspend/resume on DRM_SWITCH_POWER_DYNAMIC_OFF

Missed this case previously. No need to do anything if the
device is already off.  runtime pm will handle it.

Acked-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: set runtime pm state to active on resume
Alex Deucher [Sat, 27 Aug 2016 18:53:08 +0000 (14:53 -0400)]
drm/amdgpu: set runtime pm state to active on resume

The sbios always powers up the dGPU on resume.

Acked-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu/gfx6: drop some dead code
Alex Deucher [Thu, 1 Sep 2016 18:10:46 +0000 (14:10 -0400)]
drm/amdgpu/gfx6: drop some dead code

The mqd is only used on CI and newer.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add gart recovery by gtt list V2
Chunming Zhou [Tue, 30 Aug 2016 08:36:25 +0000 (16:36 +0800)]
drm/amdgpu: add gart recovery by gtt list V2

V2:
a. gart recovery should be ahead of ring test.
b. rename to amdgpu_ttm_recover_gart

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>
7 years agodrm/amdgpu: link all gtt when binding them V2
Chunming Zhou [Tue, 30 Aug 2016 08:13:10 +0000 (16:13 +0800)]
drm/amdgpu: link all gtt when binding them V2

V2:
spin lock instead of mutex for gtt list

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>
7 years agodrm/amdgpu: add si pciids v2
Ken Wang [Thu, 21 Jan 2016 09:33:00 +0000 (17:33 +0800)]
drm/amdgpu: add si pciids v2

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu/si: Add updated smc firmware for SI kickers
Alex Deucher [Mon, 1 Aug 2016 20:05:47 +0000 (16:05 -0400)]
drm/amdgpu/si: Add updated smc firmware for SI kickers

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: Add SI Family information
Ken Wang [Tue, 24 May 2016 13:02:53 +0000 (21:02 +0800)]
drm/amdgpu: Add SI Family information

Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: enable SI DPM
Maruthi Srinivas Bayyavarapu [Tue, 26 Apr 2016 15:05:36 +0000 (20:35 +0530)]
drm/amdgpu: enable SI DPM

Signed-off-by: Maruthi Bayyavarapu <maruthi.bayyavarapu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: use DRM print instead of printk
Huang Rui [Wed, 31 Aug 2016 05:23:18 +0000 (13:23 +0800)]
drm/amdgpu: use DRM print instead of printk

Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add SI DPM support (v4)
Maruthi Bayyavarapu [Mon, 1 Aug 2016 16:42:32 +0000 (12:42 -0400)]
drm/amdgpu: add SI DPM support (v4)

v2: corrected register offset shift
v3: rebase fixes
v4: fix firmware paths
    add SI smc firmware versions for sysfs dump
    remove unused function forward define
    fix the tahiti specific value of DEEP_SLEEP_CLK_SEL field
    fix to miss adding thermal controller
    use vram_type instead of checking mem_gddr5 flag
    fix incorrect index of CG_FFCT_0 register
    fix incorrect reading method at si_get_current_pcie_speed

Signed-off-by: Maruthi Bayyavarapu <maruthi.bayyavarapu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add SI SMC support
Maruthi Srinivas Bayyavarapu [Tue, 26 Apr 2016 15:01:54 +0000 (20:31 +0530)]
drm/amdgpu: add SI SMC support

Signed-off-by: Maruthi Bayyavarapu <maruthi.bayyavarapu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add si dpm support in amdgpu_atombios
Maruthi Srinivas Bayyavarapu [Tue, 26 Apr 2016 14:54:38 +0000 (20:24 +0530)]
drm/amdgpu: add si dpm support in amdgpu_atombios

v2: renamed _atom_ to _atombios_ for consistency
    added ulClockParams to _COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V3 and
    _COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V5 to avoid build break

Signed-off-by: Maruthi Bayyavarapu <maruthi.bayyavarapu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add si specific logic into the device initialize function v3
Ken Wang [Thu, 21 Jan 2016 11:08:55 +0000 (19:08 +0800)]
drm/amdgpu: add si specific logic into the device initialize function v3

v3: guard doorbell_fini as well

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add si ip blocks setup v3
Ken Wang [Thu, 21 Jan 2016 09:29:41 +0000 (17:29 +0800)]
drm/amdgpu: add si ip blocks setup v3

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add all the components for si into Makefile/kconfig v3
Ken Wang [Tue, 19 Jan 2016 06:19:53 +0000 (14:19 +0800)]
drm/amdgpu: add all the components for si into Makefile/kconfig v3

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: introduce pcie port read/write entry
Huang Rui [Wed, 31 Aug 2016 05:23:25 +0000 (13:23 +0800)]
drm/amdgpu: introduce pcie port read/write entry

This patch adds pcie port read/write entry, because it will be also
used on si dpm part.

Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add si implementation v10
Ken Wang [Tue, 19 Jan 2016 06:08:49 +0000 (14:08 +0800)]
drm/amdgpu: add si implementation v10

v5: rebase fixes
v6: add mgcg arrays
v7: rebase fixes
v8: rebase fixes
v9: add get_disabled_bios(), make get_xclk static
v10: fix oland and hainan asic specific handle at si_program_aspm

Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add DMA implementation for si v8
Ken Wang [Tue, 19 Jan 2016 06:05:23 +0000 (14:05 +0800)]
drm/amdgpu: add DMA implementation for si v8

v4: rebase fixes
v5: use the generic nop fill
v6: rebase fixes
v7: rebase fixes
    copy count fixes from Jonathan
    general cleanup
    add fill buffer implementation
v8: adapt write_pte and copy_pte to latest changes

Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add graphic pipeline implementation for si v8
Ken Wang [Tue, 19 Jan 2016 06:04:28 +0000 (14:04 +0800)]
drm/amdgpu: add graphic pipeline implementation for si v8

v5: rebase fixes
v6: rebase fixes
v7: rebase fixes
    fix tile reg offset as noticed by Jonathan
    Drop some debugging remnants
v8: add gfx v6 firmware versions for sysfs dump

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: atombios change for dce6 to work v3
Ken Wang [Tue, 19 Jan 2016 07:07:29 +0000 (15:07 +0800)]
drm/amdgpu: atombios change for dce6 to work v3

v3: white space fixes

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add display controller implementation for si v10
Ken Wang [Tue, 19 Jan 2016 06:03:24 +0000 (14:03 +0800)]
drm/amdgpu: add display controller implementation for si v10

v4: rebase fixups
v5: more fixes based on dce8 code
v6: squash in dmif offset fix
v7: rebase fixups
v8: rebase fixups, drop some debugging remnants
v9: fix BE build
v10: include Marek's tiling fixes, add support for
     page_flip_target, set MASTER_UDPATE_MODE=0,
     fix cursor

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add interupt handler implementation for si v3
Ken Wang [Tue, 19 Jan 2016 06:02:14 +0000 (14:02 +0800)]
drm/amdgpu: add interupt handler implementation for si v3

v3: rebase fixups

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add graphic memory controller implementation for si v7
Ken Wang [Tue, 19 Jan 2016 06:01:19 +0000 (14:01 +0800)]
drm/amdgpu: add graphic memory controller implementation for si v7

v4: rebase fixups
v5: rebase fixups
v5: rebase fixups
v6: rebase fixups for gart size changes
v7: add gmc v6 firmware versions for sysfs dump

Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add si header files v4
Ken Wang [Tue, 19 Jan 2016 05:53:10 +0000 (13:53 +0800)]
drm/amdgpu: add si header files v4

v4: drop unused DCE6 macro

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add SI asics types v2
Ken Wang [Thu, 21 Jan 2016 09:00:06 +0000 (17:00 +0800)]
drm/amdgpu: add SI asics types v2

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:add switch buffer to end of CS (v2)
Monk Liu [Fri, 26 Aug 2016 06:12:37 +0000 (14:12 +0800)]
drm/amdgpu:add switch buffer to end of CS (v2)

sync switch buffer scheme with windows kmd for gfx v8,
step1: append a switch_buffer to the end of CS

v2:rebase on latest staging

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: debugfs SMC addresses are byte addresses
Tom St Denis [Mon, 29 Aug 2016 12:39:29 +0000 (08:39 -0400)]
drm/amd/amdgpu: debugfs SMC addresses are byte addresses

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: Remove unused variable causing compile warning
Jordan Lazare [Fri, 26 Aug 2016 21:10:28 +0000 (17:10 -0400)]
drm/amd/powerplay: Remove unused variable causing compile warning

If treating warnings as errors this causes a build error

Signed-off-by: Jordan Lazare <Jordan.Lazare@amd.com>
Reviewed-by: Alex Deucher <Alexander.Deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: Only load SDMA0/MEC firmware once on Stoney (v2)
Tom St Denis [Fri, 26 Aug 2016 16:44:01 +0000 (12:44 -0400)]
drm/amd/powerplay: Only load SDMA0/MEC firmware once on Stoney (v2)

Only load the SDMA0/MEC1 firmware once in the Carrizo SMU manager
driver.

(v2) Avoid loading SDMA0 twice too.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: Fix up return codes in cz SMU manager
Tom St Denis [Fri, 26 Aug 2016 16:43:14 +0000 (12:43 -0400)]
drm/amd/powerplay: Fix up return codes in cz SMU manager

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: Tidy up cz SMU manager
Tom St Denis [Fri, 26 Aug 2016 16:42:36 +0000 (12:42 -0400)]
drm/amd/powerplay: Tidy up cz SMU manager

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: Fix CZ SMU firmware load check (v4)
Tom St Denis [Fri, 26 Aug 2016 14:29:19 +0000 (10:29 -0400)]
drm/amd/powerplay:  Fix CZ SMU firmware load check (v4)

Remove an errant return in the middle of the check
function as well as check for success in the start
function.

(v2) Add return check to smu_load_fw()
(v3) Don't return early if SMU load check fails
(v4) No returns!  :-)

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: throttle buffer migrations at CS using a fixed MBps limit (v2)
Marek Olšák [Wed, 17 Aug 2016 21:49:27 +0000 (23:49 +0200)]
drm/amdgpu: throttle buffer migrations at CS using a fixed MBps limit (v2)

The old mechanism used a per-submission limit that didn't take previous
submissions within the same time frame into account. It also filled VRAM
slowly when VRAM usage dropped due to a big eviction or buffer deallocation.

This new method establishes a configurable MBps limit that is obeyed when
VRAM usage is very high. When VRAM usage is not very high, it gives
the driver the freedom to fill it quickly. The result is more consistent
performance.

It can't keep the BO move rate low if lots of evictions are happening due
to VRAM fragmentation, or if a big buffer is being migrated.

The amdgpu.moverate parameter can be used to set a non-default limit.
Measurements can be done to find out which amdgpu.moverate setting gives
the best results.

Mainly APUs and cards with small VRAM will benefit from this. For F1 2015,
anything with 2 GB VRAM or less will benefit.

Some benchmark results - F1 2015 (Tonga 2GB):

Limit      MinFPS AvgFPS
Old code:  14     32.6
128 MB/s:  28     41
64 MB/s:   15.5   43
32 MB/s:   28.7   43.4
8 MB/s:    27.8   44.4
8 MB/s:    21.9   42.8 (different run)

Random drops in Min FPS can still occur (due to fragmented VRAM?), but
the average FPS is much better. 8 MB/s is probably a good limit for this
game & the current VRAM management. The random FPS drops are still to be
tackled.

v2: use a spinlock

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: Tidy up cz_dpm.c
Tom St Denis [Thu, 25 Aug 2016 17:02:06 +0000 (13:02 -0400)]
drm/amd/amdgpu: Tidy up cz_dpm.c

Various minor formatting changes.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: Clean up memory leak in cz_dpm_init().
Tom St Denis [Thu, 25 Aug 2016 16:41:15 +0000 (12:41 -0400)]
drm/amd/amdgpu: Clean up memory leak in cz_dpm_init().

If init fails free up any allocated memory.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: Fix memleak in cz_parse_power_table()
Tom St Denis [Thu, 25 Aug 2016 16:16:24 +0000 (12:16 -0400)]
drm/amd/amdgpu: Fix memleak in cz_parse_power_table()

If one of the entries fails to be allocated then free
all of the previous entries before freeing the array which
holds their pointers.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>