History log of /linux-master/drivers/gpu/drm/radeon/cypress_dpm.c
Revision Date Author Comments
# 1becc57c 19-May-2023 Nikita Zhandarovich <n.zhandarovich@fintech.ru>

drm/radeon: fix possible division-by-zero errors

Function rv740_get_decoded_reference_divider() may return 0 due to
unpredictable reference divider value calculated in
radeon_atom_get_clock_dividers(). This will lead to
division-by-zero error once that value is used as a divider
in calculating 'clk_s'.
While unlikely, this issue should nonetheless be prevented so add a
sanity check for such cases by testing 'decoded_ref' value against 0.

Found by Linux Verification Center (linuxtesting.org) with static
analysis tool SVACE.

v2: minor coding style fixes (Alex)
In practice this should actually happen as the vbios should be
properly populated.

Fixes: 66229b200598 ("drm/radeon/kms: add dpm support for rv7xx (v4)")
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 1c5ae3ba 16-Nov-2020 Lee Jones <lee.jones@linaro.org>

drm/radeon/btc_dpm: Move 'evergreen_get_pi's prototype to shared header

Fixes the following W=1 kernel build warning(s):

drivers/gpu/drm/radeon/rv770_dpm.c:62:30: warning: no previous prototype for ‘evergreen_get_pi’ [-Wmissing-prototypes]
62 | struct evergreen_power_info *evergreen_get_pi(struct radeon_device *rdev)
| ^~~~~~~~~~~~~~~~

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 586831d6 16-Nov-2020 Lee Jones <lee.jones@linaro.org>

drm/radeon/rv770: Move 'rv770_get_*()'s prototypes to shared header

Fixes the following W=1 kernel build warning(s):

drivers/gpu/drm/radeon/rv770_dpm.c:47:18: warning: no previous prototype for ‘rv770_get_ps’ [-Wmissing-prototypes]
47 | struct rv7xx_ps *rv770_get_ps(struct radeon_ps *rps)
| ^~~~~~~~~~~~
drivers/gpu/drm/radeon/rv770_dpm.c:54:26: warning: no previous prototype for ‘rv770_get_pi’ [-Wmissing-prototypes]
54 | struct rv7xx_power_info *rv770_get_pi(struct radeon_device *rdev)
| ^~~~~~~~~~~~

Cc: Evan Quan <evan.quan@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 2ef79416 03-Dec-2019 Thomas Zimmermann <tzimmermann@suse.de>

drm/radeon: Don't include <drm/drm_pci.h>

Including <drm/drm_pci.h> is unnecessary in most cases. Replace
these instances.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191203100406.9674-9-tzimmermann@suse.de


# c182615f 08-Jun-2019 Sam Ravnborg <sam@ravnborg.org>

drm/radeon: drop use of drmP.h (2/2)

Drop use of drmP.h in remaining .c files.
To ease review a little the drmP.h removal was divided in two commits.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20190608080241.4958-8-sam@ravnborg.org


# 64a9dfc4 23-Apr-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

drm/radeon: fix include notation and remove -Iinclude/drm flag

Include <drm/*.h> instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1493009447-31524-14-git-send-email-yamada.masahiro@socionext.com


# 3cf8bb1a 15-Mar-2016 Jérome Glisse <jglisse@redhat.com>

drm/radeon: fix indentation.

I hate doing this but it hurts my eyes to go over code that does not
comply with indentation rules. Only thing that is not only space change
is in atom.c all other files are space indentation issues.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# ed50890d 14-Jan-2015 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: comment out some currently unused eg dpm code

Keep it around for reference.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 01467a9b 14-Oct-2014 Michele Curti <michele.curti@gmail.com>

drm/radeon: reduce sparse false positive warnings

include radeon_asic.h header file in the various xxx_dpm.c files
to reduce sparse false positive warnings. Not so great patch
in itself, but reducing warning count from 391 to 258 may help
to see real problems..

Signed-off-by: Michele Curti <michele.curti@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# e0792981 30-Jun-2014 Alex Deucher <alexander.deucher@amd.com>

drm/radeon/dpm: fix typo in vddci setup for eg/btc

We were using the vddc mask rather than the vddci mask.

Bug:
https://bugzilla.kernel.org/show_bug.cgi?id=79071

Possibly also fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=68571

Noticed-by: Jonathan Howard <jonathan@unbiased.name>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org


# 82f79cc5 21-Aug-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon/dpm: move platform caps fetching to a separate function

It's needed by by both the asic specific functions and the
extended table parser.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# e14cd2bb 19-Dec-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon/dpm: switch on new late_enable callback

Right now it's called right after enable, but after
reworking the dpm init order, it will get called later
to accomodate loading the smc early, but enabling
thermal interrupts and block powergating later after
the ring tests are complete.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 936b3264 11-Nov-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: cypress_dpm: Fix unused variable warning when CONFIG_ACPI=n

With CONFIG_ACPI=n the following build warning is seen:

drivers/gpu/drm/radeon/cypress_dpm.c:302:31: warning: unused variable 'eg_pi' [-Wunused-variable]

Protect eg_pi with CONFIG_ACPI.

Based on patch from: Fabio Estevam <fabio.estevam@freescale.com>
but doesn't mix allocation and code.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 1cd8b21a 13-Sep-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon/dpm: rework auto performance level enable

Calling force_performance_level() from set_power_state()
doesn't work on some asics because the current power
state pointer has not been properly updated at that point.
Move the calls to force_performance_level() out of the
asic specific set_power_state() functions and into
the main power state sequence.

Fixes dpm resume on SI.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 1bd4cff6 12-Aug-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon/dpm: adjust the vblank time checks for eg, ni, si

According to the internal teams, we never hit the limit for
mclk switching on these asics, so we can disable the check.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# b841ce7b 31-Jul-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon/dpm: fix spread spectrum setup (v2)

Need to check for engine and memory clock ss separately
and only enable dynamic ss if either of them are found.

This should fix systems which have a ss table, but do
not have entries for engine or memory. On those systems
we may enable dynamic spread spectrum without enabling
it on the engine or memory clocks which can lead to a
hang in some cases.

fixes some systems reported here:
https://bugs.freedesktop.org/show_bug.cgi?id=66963

v2: fix typo

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# fda83724 30-Jul-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon/dpm: adjust thermal protection requirements

On rv770 and newer, clock gating is not required
for thermal protection. The only requirement is that
the design utilizes a thermal sensor.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# d0b54bdc 08-Jul-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon/dpm: implement vblank_too_short callback for evergreen

Check if we can switch the mclk during the vblank time otherwise
we may get artifacts on the screen when the mclk changes.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 8b5e6b7f 02-Jul-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon/dpm: implement force performance levels for 7xx/eg/btc

Allows you to limit the selected power levels via sysfs.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 173dbb0e 27-Jun-2013 Alex Deucher <alexander.deucher@amd.com>

add dpm_set_power_state failure output (7xx-ni)

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 72dd2c54 28-Mar-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon/dpm: add dpm_set_power_state failure output (7xx-ni)

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# fa4b5471 28-Mar-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon/dpm: add dpm_enable failure output (7xx-ni)

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 1f67df4d 26-Mar-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon/dpm/evergreen: properly catch errors in dpm setup

We weren't properly catching errors in dpm_enable()
and dpm_set_power_state().

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 32ce4652 18-Mar-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon/dpm: add an enum for pcie gen selection

This makes it easier the understand what the code is
doing.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 65171944 13-Feb-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: update radeon_atom_get_voltage_table() for SI

SI uses a new atom table revision. Required for DPM on SI.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 58653abd 13-Feb-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: update radeon_atom_is_voltage_gpio() for SI

SI uses a new atom table. Required for DPM on SI.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# dbc34160 25-Jun-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon/dpm/evergreen: restructure code

Needed to properly handle dynamic state adjustment.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 5d77d776 27-Jun-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon/dpm/rv7xx: restructure code

Needed to properly handle dynamic state adjustment.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 69e0b57a 12-Apr-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon/kms: add dpm support for cayman (v5)

This adds dpm support for cayman asics. This includes:
- clockgating
- dynamic engine clock scaling
- dynamic memory clock scaling
- dynamic voltage scaling
- dynamic pcie gen1/gen2 switching (requires additional acpi support)
- power containment
- shader power scaling

Set radeon.dpm=1 to enable.

v2: fold in tdp fix
v3: fix indentation
v4: fix 64 bit div
v5: attempt to fix state enable

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>


# f85392bc 25-Jun-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: add dpm UVD handling for evergreen/btc asics

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# dc50ba7f 25-Jun-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon/kms: add dpm support for evergreen (v4)

This adds dpm support for evergreen asics. This includes:
- clockgating
- dynamic engine clock scaling
- dynamic memory clock scaling
- dynamic voltage scaling
- dynamic pcie gen1/gen2 switching (requires additional acpi support)

Set radeon.dpm=1 to enable.

v2: reduce stack usage, rename ulv struct
v3: fix thermal interrupt check notices by Jerome
v4: fix state enable

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>