Alex Deucher
d92867122c
drm/amdgpu/pp/smu7: cache smu firmware toc
...
Rather than calculating it everytime we rebuild the toc
buffer, calculate it once initially and then just copy
the cached results to the vram buffer.
Acked-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2018-07-13 14:52:58 -05:00
Alex Deucher
82088d5d7d
drm/amdgpu/pp/smu7: remove local mc_addr variable
...
use the structure member directly.
Acked-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2018-07-13 14:52:58 -05:00
Alex Deucher
2bce4be037
drm/amdgpu/pp/smu7: drop unused values in smu data structure
...
use kaddr directly rather than secondary variable.
Acked-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2018-07-13 14:52:57 -05:00
Alex Deucher
3d75a8b689
drm/amdgpu/pp/smu7: use a local variable for toc indexing
...
Rather than using the index variable stored in vram. If
the device fails to come back online after a resume cycle,
reads from vram will return all 1s which will cause a
segfault. Based on a patch from Thomas Martitz <kugel@rockbox.org >.
This avoids the segfault, but we still need to sort out
why the GPU does not come back online after a resume.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105760
Acked-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2018-07-13 14:52:50 -05:00
Rex Zhu
63e138abf0
drm/amd/pp: Fix static checker warning
...
error: uninitialized symbol 'xxxx'
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 >
2018-05-24 00:15:13 -05:00
Rex Zhu
8db42a7013
drm/amd/pp: Clear smu response register before send smu message
...
smu firmware do not update response register immediately under
some delay tasks, we may read out the original value.
so need to clear the register before send smu message.
Acked-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 >
2018-05-15 13:43:18 -05:00
Rex Zhu
b89c71d1eb
drm/amd/pp: Refine get_gpu_power for VI
...
pkgpwr is the average gpu power of 100ms. it is calculated by
firmware in real time.
1. we can send smu message PPSMC_MSG_GetCurrPkgPwr to read currentpkgpwr directly.
2. On Fiji/tonga/bonaire/hawwii, without PPSMC_MSG_GetCurrPkgPwr support.
Send PPSMC_MSG_PmStatusLogStart/Sample to let smu write currentpkgpwr
to ixSMU_PM_STATUS_94. driver can read pkgpwr from ixSMU_PM_STATUS_94.
Acked-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 >
2018-05-15 13:43:17 -05:00
Rex Zhu
89a1114766
drm/amd/pp: Remove useless smu7 running state check
...
Only check smc running state before start smu.
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 >
2018-05-15 13:43:10 -05:00
Rex Zhu
18081c2003
drm/amd/pp: Remove dead function in smu7_smumgr.c
...
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 >
2018-05-15 13:43:10 -05:00
Rex Zhu
64f6db77fc
drm/amd/pp: Use release_firmware directly in powerplay
...
Use kernel api directly so we can deprecate the cgs interface.
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 >
2018-04-11 13:07:49 -05:00
Rex Zhu
8bb575a2d8
drm/amd/pp: Save vf state in pp context
...
Store vf state in pp_context so we can
deprecate the cgs interface.
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 >
2018-04-11 13:07:48 -05:00
Rex Zhu
116af45059
drm/amd/pp: Simplified the avfs btc state on smu7
...
AVFS feature support/not support is enough to driver.
so remove the complex define of the avfs btc state.
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 >
2018-03-15 09:55:38 -05:00
Colin Ian King
c30c950ed8
drm/amd/pp: remove redundant pointer internal_buf
...
The pointer internal_buf is assigned a value but the pointer is never
read, hence it is redundant and can be removed.
Cleans up clang warning:
drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/smu7_smumgr.c:630:2:
warning: Value stored to 'internal_buf' is never read
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com >
Signed-off-by: Colin Ian King <colin.king@canonical.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2018-03-14 16:01:17 -05:00
Rex Zhu
bb03c9c4a9
drm/amd/pp: Drop wrapper functions for upper/lower_32_bits
...
replace smu_upper_32_bits/smu_lower_32_bits with
the standard kernel macros
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 >
2018-03-07 16:10:11 -05:00
Rex Zhu
ecc124b035
drm/amd/pp: Delete the wrapper layer of smu_allocate/free_memory
...
use amdgpu_bo_create/free_kernel instand.
Reviewed-by: Alex Deucher <alexdeucher@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 >
2018-03-07 16:10:10 -05:00
Yintian Tao
a25513e7b9
drm/amd/powerplay: fix memory leakage when reload (v2)
...
add smu_free_memory when smu fini to prevent memory leakage
v2: squash in typo fix (Yintian) and warning (Harry)
Signed-off-by: Yintian Tao <yttao@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2018-01-10 15:44:50 -05:00
Rex Zhu
82eb0f3071
drm/amd/pp: update smu_version value for CI/VI
...
Set the new common smu firmware version for smu7 parts (CI and VI).
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 >
2017-12-20 11:57:14 -05:00
Rex Zhu
66f1376269
drm/amd/pp: move common function to smu7_smumgr.c
...
fiji and polaris can share same setup_pwr_virus
function.
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 >
2017-10-19 15:26:53 -04:00
Colin Ian King
45b19706a4
drm/amd/powerplay: fix spelling mistake: "dividable" -> "divisible"
...
Trivial fix to spelling mistakes in pr_err error message and ASSERT
messages.
Signed-off-by: Colin Ian King <colin.king@canonical.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-09-28 16:03:29 -04:00
Rex Zhu
515113f5e5
drm/amd/powerplay: delete SMUM_READ_FIELD
...
repeated defining in hwmgr.h
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 >
2017-09-26 15:14:34 -04:00
Rex Zhu
f0f6e3752a
drm/amd/powerplay: delete SMUM_READ_VFPF_INDIRECT_FIELD
...
repeated defining in hwmgr.h
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 >
2017-09-26 15:14:33 -04:00
Rex Zhu
a9eca3a685
drm/amd/powerplay: delete SMUM_WRITE_FIELD
...
the macro is as same as PHM_WRITE_FIELD
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 >
2017-09-26 15:14:32 -04:00
Rex Zhu
538fdf1fe7
drm/amd/powerplay: move macros to hwmgr.h
...
the macro is not relevant to SMU,
so rename SMU_WAIT_FIELD_UNEQUAL to
PHM_WAIT_FIELD_UNEQUAL and move to hwmgr.h
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 >
2017-09-26 15:14:31 -04:00
Rex Zhu
57d13f794d
drm/amd/powerplay: move PHM_WAIT_VFPF_INDIRECT_FIELD to hwmgr.h
...
the macro is not relevant to SMU, so move to hwmgr.h
and rename to PHM_WAIT_VFPF_INDIRECT_FIELD
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 >
2017-09-26 15:14:30 -04:00
Rex Zhu
d92cb1629b
drm/amd/powerplay: add new helper functions in hwmgr.h
...
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 >
2017-09-26 15:14:29 -04:00
Rex Zhu
b3b030520d
drm/amd/powerplay: refine powerplay code.
...
delete struct smumgr, put smu backend function table
in struct hwmgr
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 >
2017-09-26 15:14:27 -04:00
Rex Zhu
d3f8c0abf4
drm/amd/powerplay: refine interface in struct pp_smumgr_func
...
unify to use struct hwmgr as function parameter in
smumgr.
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 >
2017-09-26 15:14:26 -04:00
Himanshu Jha
c5927537dd
drm/amd: Remove null check before kfree
...
Kfree on NULL pointer is a no-op and therefore checking is redundant.
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-08-29 15:57:32 -04:00
Evan Quan
9dd73b1e89
drm/amd/powerplay: unhalt mec after loading
...
Signed-off-by: Evan Quan <evan.quan@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-08-29 15:27:38 -04:00
Rex Zhu
ce09d8ecb1
drm/amd/powerplay: move VI common AVFS code to smu7_smumgr.c
...
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 >
2017-07-14 11:06:16 -04:00
Huang Rui
5d7213b0be
drm/amd/powerplay: add kicker flag into smumgr
...
Signed-off-by: Huang Rui <ray.huang@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-02-16 11:43:11 -05:00
Huang Rui
634a24d8af
drm/amd/powerplay: update all printk to pr_* on smumgr
...
Signed-off-by: Huang Rui <ray.huang@amd.com >
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-01-27 11:12:51 -05:00
Huang Rui
7bd55429fd
drm/amd/powerplay: reshuffle headers to make pr_fmt macro before <linux/xxx.h>
...
This patch reshuffles headers to define pr_fmt before <linux/xxx.h>.
It can avoid pr_fmt redefine warnning from linux/xxx.h like below:
CC [M] /home/ray/gpu/BUILD/x86_64/linux/drivers/gpu/drm/amd/amdgpu//../powerplay/amd_powerplay.o
/home/ray/gpu/BUILD/x86_64/linux/drivers/gpu/drm/amd/amdgpu//../powerplay/amd_powerplay.c:24:0: warning: "pr_fmt" redefined
#define pr_fmt(fmt) "[powerplay] " fmt
^
In file included from include/linux/kernel.h:13:0,
from include/linux/list.h:8,
from include/linux/agp_backend.h:33,
Signed-off-by: Huang Rui <ray.huang@amd.com >
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-01-27 11:12:48 -05:00
Xiangliang Yu
c7fac7dc1d
drm/amd/powerplay: Adjust the position of data size initial
...
Put the initial part close to memory allocate, it will make code
more clear.
Signed-off-by: Xiangliang Yu <Xiangliang.Yu@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Acked-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2016-12-06 18:08:36 -05:00
Xiangliang Yu
e224e4f17d
drm/amd/powerplay: Ignore smu buffer usage
...
SMU buffer is used for power feature, but for virtualization, the
power is controlled by hypervisor. Ignore it.
Signed-off-by: Xiangliang Yu <Xiangliang.Yu@amd.com >
Signed-off-by: Monk Liu <Monk.Liu@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Acked-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2016-12-06 18:08:36 -05:00
Xiangliang Yu
ed91dd49ba
drm/amd/powerplay: cut digest part
...
For virtualization, FW size need to cut its digest part.
Signed-off-by: Frank Min <Frank.Min@amd.com >
Signed-off-by: Monk Liu <Monk.Liu@amd.com >
Signed-off-by: Xiangliang Yu <Xiangliang.Yu@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Acked-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2016-12-06 18:08:35 -05:00
Xiangliang Yu
7047391fab
drm/amd/powerplay: fix firmware loading failure
...
For virtualization, firmware loading need the firmware version info,
and will load the right firmware. So, transfer fw_version to toc.
Signed-off-by: Frank Min <Frank.Min@amd.com >
Signed-off-by: Monk Liu <Monk.Liu@amd.com >
Signed-off-by: Xiangliang Yu <Xiangliang.Yu@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2016-12-06 18:08:24 -05:00
Monk Liu
bed5712e1a
drm/amdgpu:add MEC_STORAGE ucode id for sriov
...
for sriov, SMC need MEC_STORAGE reserved in fw bo.
Signed-off-by: Monk Liu <Monk.Liu@amd.com >
Signed-off-by: Frank Min <frank.min@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2016-10-25 14:38:23 -04:00
Rex Zhu
1ff55f4651
drm/amd/powerplay: implement smu7_smumgr for asics with smu ip version 7.
...
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 >
2016-09-19 13:22:14 -04:00