Linus Torvalds
2f48641cfc
Merge tag 'gcc-plugins-v4.12-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
...
Pull gcc-plugin prepwork from Kees Cook:
"Use designated initializers for mtk-vcodec, powerplay, amdgpu, and
sgi-xp. Use ERR_CAST() to avoid cross-structure cast in ocf2, ntfs,
and NFS.
Christoph Hellwig recommended that I send these fixes now, rather than
waiting for the v4.13 merge window. These are all initializer and cast
fixes needed for the future randstruct plugin that haven't been picked
up by the respective maintainers"
* tag 'gcc-plugins-v4.12-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
mtk-vcodec: Use designated initializers
drm/amd/powerplay: Use designated initializers
drm/amdgpu: Use designated initializers
sgi-xp: Use designated initializers
ocfs2: Use ERR_CAST() to avoid cross-structure cast
ntfs: Use ERR_CAST() to avoid cross-structure cast
NFS: Use ERR_CAST() to avoid cross-structure cast
2017-06-01 16:17:42 -07:00
Kees Cook
3ddd396f6b
drm/amd/powerplay: Use designated initializers
...
The randstruct plugin requires designated initializers for structures
that are entirely function pointers.
Cc: Christian König <christian.koenig@amd.com >
Cc: Eric Huang <JinHuiEric.Huang@amd.com >
Cc: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Kees Cook <keescook@chromium.org >
2017-05-28 10:23:01 -07:00
Dan Carpenter
3083696a1e
drm/amd/powerplay: fix a signedness bugs
...
Smatch complains about a signedness bug here:
vega10_hwmgr.c:4202 vega10_force_clock_level()
warn: always true condition '(i >= 0) => (0-u32max >= 0)'
Fixes: 7b52db39a4
("drm/amd/powerplay: fix bug sclk/mclk
level can't be set on vega10.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com >
Reviewed-by: Eric Huang <JinHuiEric.Huang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-05-24 16:49:34 -04:00
Alex Deucher
2275a3a2fe
drm/amd/powerplay/smu7: disable mclk switching for high refresh rates
...
Even if the vblank period would allow it, it still seems to
be problematic on some cards.
bug: https://bugs.freedesktop.org/show_bug.cgi?id=96868
Cc: stable@vger.kernel.org
Acked-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-05-24 16:46:01 -04:00
Alex Deucher
09be4a5219
drm/amd/powerplay/smu7: add vblank check for mclk switching (v2)
...
Check to make sure the vblank period is long enough to support
mclk switching.
v2: drop needless initial assignment (Nils)
bug: https://bugs.freedesktop.org/show_bug.cgi?id=96868
Cc: stable@vger.kernel.org
Acked-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-05-24 16:45:28 -04:00
Rex Zhu
2fde9ab218
drm/amd/powerplay: refine pwm1_enable callback functions for vi.
...
Use the new enums for setting and getting the fan control mode.
Fixes problems due to previous inconsistencies between enums.
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-05-10 13:36:35 -04:00
Rex Zhu
7522ffc41b
drm/amd/powerplay: refine pwm1_enable callback functions for Vega10.
...
Use the new enums for setting and getting the fan control mode.
Fixes problems due to previous inconsistencies between enums.
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-05-10 13:36:28 -04:00
Rex Zhu
ded96c7389
drm/amd/powerplay: add more smu message on Vega10.
...
Add some new SMU messages.
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-05-10 13:36:06 -04:00
Rex Zhu
7b52db39a4
drm/amd/powerplay: fix bug sclk/mclk level can't be set on vega10.
...
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-05-05 18:15:08 -04:00
Rex Zhu
5784d5cca6
drm/amd/powerplay: Setup sw CTF to allow graceful exit when temperature exceeds maximum.
...
cherry-pick from amd windows driver.
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-05-05 18:14:56 -04:00
Rex Zhu
652bd0c344
drm/amd/powerplay: delete dead code in powerplay.
...
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-05-05 18:14:44 -04:00
Rex Zhu
327fce0c0d
drm/amd/powerplay: disable engine spread spectrum feature on Vega10.
...
Vega10 atomfirmware do not have ASIC_InternalSS_Info table
so disable this feature by default in driver.
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com >
Reviewed-by: Ken Wang <Qingqing.wang@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-05-05 18:13:28 -04:00
Rex Zhu
b4a33e325c
drm/amd/powerplay: clean up code in vega10_smumgr.c
...
1. fix typo in print message info.
2. fix block comments's coding style.
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-05-05 18:13:13 -04:00
Rex Zhu
0dca704751
drm/amd/powerplay: correct LoadLineResistance value in pptable.
...
this value is used by avfs to adjust inversion voltage.
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-05-05 18:12:08 -04:00
Rex Zhu
b7a1f0e3cc
drm/amd/powerplay: Allow duplicate enteries in pptable.
...
This is a valid configuration.
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-05-05 18:12:00 -04:00
Rex Zhu
56a2f08c41
drm/amd/powerplay: set fan target temperature by msg on vega10.
...
SMU not support FanTargetTemperature in pptable,
so send msg instand.
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-05-05 18:11:52 -04:00
Rex Zhu
05ee321511
drm/amd/powerplay: set soc floor voltage on boot on vega10.
...
Send the VBIOS bootup VDDC as a SOC floor voltage to SMU
before populating the PPTABLE. After DPM is enabled, This
floor voltage will be removed. This will prevent SMC from
going to Vmin upon receiving PPTable causing a violation.
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-05-05 18:11:44 -04:00
Rex Zhu
ef181f268e
drm/amd/powerplay: refine code in vega10_smumgr.c
...
1. return error code instand of -1.
2. print msg info if send msg failed
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-05-05 18:11:35 -04:00
Rex Zhu
8b9242eddd
drm/amd/powerplay: implement stop dpm task for vega10.
...
Add functions to disable dpm for S3/S4.
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 >
2017-04-28 17:33:16 -04:00
Rex Zhu
f8dc9476d9
drm/amd/powerplay: complete disable_smc_firmware_ctf_tasks.
...
Disable ctf in eventmgr to fix S3/S4 support.
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 >
2017-04-28 17:33:15 -04:00
Rex Zhu
1dfc41d44c
drm/amd/powerplay: add disable_smc_ctf callback in hwmgr.
...
export disablesmcctf to eventmgr.
need to disable temperature alert when s3/s4.
otherwise, when resume back,enable temperature
alert will fail.
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 >
2017-04-28 17:33:15 -04:00
Rex Zhu
00c4855ef8
drm/amd/powerplay: refine set pcie dpm default table on vega10.
...
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-04-28 17:33:12 -04:00
Rex Zhu
97782cc93f
drm/amd/powerplay: disable cks by default on vega10.
...
run gpu test auto reboot when enable cks right now.
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-04-28 17:33:11 -04:00
Rex Zhu
effa290caa
drm/amd/powerplay: correct UlvOffsetVid on Vega10.
...
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-04-28 17:33:10 -04:00
Rex Zhu
4bae05e196
drm/amd/powerplay: Fix AVFS param.
...
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-04-28 17:32:51 -04:00
Rex Zhu
afc0255c9a
drm/amd/powerplay: enable clock stretch feature on Vega10.
...
Correctly calculate CKSVidOffset
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-04-28 17:32:51 -04:00
Rex Zhu
2d5f5f9496
drm/amd/powerplay: enable pcie dpm on Vega10.
...
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-04-28 17:32:50 -04:00
Rex Zhu
d475ce6296
drm/amd/powerplay: allocate fb for avfs fuse table on vega10.
...
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-04-28 17:32:50 -04:00
Rex Zhu
67131aa525
drm/amd/powerplay: enable AGM logging while dpm disabled.
...
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-04-28 17:32:49 -04:00
Huang Rui
42f72d0b37
drm/amd/powerplay: add error message to remind user updating firmware
...
Signed-off-by: Huang Rui <ray.huang@amd.com >
Reviewed-by: Evan Quan <evan.quan@amd.com >
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-04-28 17:32:48 -04:00
Evan Quan
e0b2f8cff1
drm/amdgpu: update smu9 driver interface
...
Updated interface between the driver and the SMU controller.
Signed-off-by: Evan Quan <evan.quan@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-04-28 17:32:46 -04:00
Rex Zhu
2211a787de
drm/amd/powerplay: delete dead functions in vega10.
...
Vega10 does not support AVFS BTC, remove function.
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-04-28 17:32:39 -04:00
Huang Rui
4573f0f21d
drm/amd/powerplay: fix suspend error on DPM disabled
...
Don't fail if DPM is disabled.
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-04-28 17:32:12 -04:00
Rex Zhu
6524e494a8
drm/amd/powerplay: align with VBIOS to support new AVFS structure
...
Align the driver with the latest vbios structures.
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-04-28 16:37:55 -04:00
Rex Zhu
8250880ed8
drm/amd/powerplay: add fan controller table v11 support.
...
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-04-07 15:15:44 -04:00
Rex Zhu
1e1eb6a893
drm/amd/powerplay: port newest process pptable code for vega10.
...
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-04-07 15:15:43 -04:00
Evan Quan
ba8a21cfbc
drm/amdgpu/smu9: update to latest driver interface
...
Signed-off-by: Evan Quan <evan.quan@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-04-06 13:27:26 -04:00
Dan Carpenter
99147e6442
drm/amd/powerplay: fix a couple locking issues
...
We should return unlock on the error path in pp_dpm_dispatch_tasks()
and there is a double lock bug in pp_dpm_set_sclk_od().
Fixes: 2a5071056e
("drm/amd/powerplay: add global PowerPlay mutex.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-04-04 13:40:34 -04:00
Dan Carpenter
0f987cd0d7
drm/amd/powerplay: fix pp_dpm_get_current_power_state() (v2)
...
This switch statement is missing breaks.
v2: agd: break in default case as well
Fixes: 2a5071056e
("drm/amd/powerplay: add global PowerPlay mutex.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-04-04 13:40:33 -04:00
Alex Deucher
ad4febd9b7
drm/amdgpu/powerplay: fix locking typo
...
Fixes: 2a5071056e
("drm/amd/powerplay: add global PowerPlay mutex.")
Reported-by: Julia Lawall <julia.lawall@lip6.fr >
Reviewed-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Harry Wentland <harry.wentland@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-04-04 13:40:30 -04:00
Rex Zhu
a7c7bc4c0c
drm/amd/powerplay: reduce sample period time
...
for power readings.
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-03-29 23:55:22 -04:00
Eric Huang
f83a999164
drm/amd/powerplay: add Vega10 powerplay support (v5)
...
Adds power management support for vega10.
v2: squash in fan control and led config fixes from Rex
v3: squash in dead code removal and socvid fixes from Rex
v4: squash in dpm force level fix from Rex
v5: squash in latest headless, gpu load fixes from Rex
Acked-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-03-29 23:54:54 -04:00
Eric Huang
d018772748
drm/amd/powerplay: add some display/powerplay interfaces
...
New interfaces needed to handle the new clock trees and
bandwidth requirements on vega10.
Acked-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com >
Acked-by: Alex Deucher <alexander.deucher@amd.com >
Acked-by: Tony Cheng <tony.cheng@amd.com >
Acked-by: Harry Wentland <harry.wentland@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-03-29 23:54:54 -04:00
Eric Huang
e29922795f
drm/amd/powerplay: add some new structures for Vega10
...
Acked-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com >
Reviewed-by: Ken Wang <Qingqing.Wang@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-03-29 23:54:52 -04:00
Rex Zhu
2a5071056e
drm/amd/powerplay: add global PowerPlay mutex.
...
Acked-by: Christian König <christian.koenig@amd.com >
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-03-29 23:54:52 -04:00
Eric Huang
0d2c7569e1
drm/amdgpu: add new atomfirmware based helpers for powerplay
...
New helpers for fetching info out of atomfirmware.
Acked-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com >
Reviewed-by: Ken Wang <Ken.Wang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-03-29 23:54:51 -04:00
Eric Huang
bcea239686
drm/amd/powerplay: add new Vega10's ppsmc header file
...
Acked-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com >
Reviewed-by: Ken Wang <Qingqing.Wang@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-03-29 23:54:51 -04:00
Eric Huang
25e2196cc8
drm/amd/powerplay: add smu9 header files for Vega10
...
Acked-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com >
Reviewed-by: Ken Wang <Qingqing.Wang@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-03-29 23:54:50 -04:00
Eric Huang
923d26db85
drm/amd/powerplay: restore disabling power containment on Fiji (v2)
...
Power containment will degrade performance in some compute tests.
Restore disabling it as before code refining in powerplay.
v2: only in the compute profile
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com >
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-03-29 23:54:14 -04:00
Andrew F. Davis
93a4aec218
drm/amd/powerplay: remove unneeded conversions to bool
...
Found with scripts/coccinelle/misc/boolconv.cocci.
Signed-off-by: Andrew F. Davis <afd@ti.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-03-29 23:53:58 -04:00