linux-2.6-microblaze.git
5 years agodrm/amd/display: fix code to control 48mhz refclk
Eric Yang [Thu, 18 Jul 2019 17:56:59 +0000 (13:56 -0400)]
drm/amd/display: fix code to control 48mhz refclk

[Why]
The SMU message to enable this feature looks at argument. Previous code
didn't send right argument. This change will allow the feature to be
be enabled.

[How]
Fixed one issue where SMU message to enable the feature was sent without
setting the parameter.

Signed-off-by: Eric Yang <Eric.Yang2@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: exit PSR during detection
Eric Yang [Fri, 6 Sep 2019 22:26:23 +0000 (18:26 -0400)]
drm/amd/display: exit PSR during detection

[Why]
If 48mhz refclk is turned off during PSR, we will have issue doing
link training during detection.

[How]
Get out of PSR before detection

Signed-off-by: Eric Yang <Eric.Yang2@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Program DWB watermarks from correct state
Julian Parkin [Thu, 29 Aug 2019 21:06:05 +0000 (17:06 -0400)]
drm/amd/display: Program DWB watermarks from correct state

[Why]
When diags adds a DWB via a stream update, we calculate MMHUBBUB
paramaters, but dc->current_state has not yet been updated
when the DWB programming happens. This leads to overflow on
high bandwidth tests since the incorrect MMHUBBUB arbitration
parameters are programmed.

[How]
Pass the updated context down to the (enable|update)_writeback functions
so that they can use the correct watermarks when programming MMHUBBUB.

Signed-off-by: Julian Parkin <julian.parkin@amd.com>
Reviewed-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: 3.2.53
Aric Cyr [Sat, 14 Sep 2019 15:19:18 +0000 (11:19 -0400)]
drm/amd/display: 3.2.53

Signed-off-by: Aric Cyr <aric.cyr@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Use dcn1 Optimal Taps Get
Wesley Chalmers [Fri, 13 Sep 2019 17:43:36 +0000 (13:43 -0400)]
drm/amd/display: Use dcn1 Optimal Taps Get

[WHY]
dpp2_get_optimal_number_of_taps is incorrect, and dcn2 should be using
dpp1_get_optimal_number_of_taps instead

Signed-off-by: Wesley Chalmers <Wesley.Chalmers@amd.com>
Reviewed-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: fix bug with check for HPD Low in verify link cap
Sivapiriyan Kumarasamy [Thu, 12 Sep 2019 19:55:44 +0000 (15:55 -0400)]
drm/amd/display: fix bug with check for HPD Low in verify link cap

[Why]
There is a bug when determining if link training should be retried when
HPD is low in dp_verify_link_cap_with_retries.

[How]
Correctly, fail dp_verify_link_cap_with_retries without retry when
HPD is low.

Signed-off-by: Sivapiriyan Kumarasamy <sivapiriyan.kumarasamy@amd.com>
Reviewed-by: Wenjing Liu <Wenjing.Liu@amd.com>
Acked-by: Abdoulaye Berthe <Abdoulaye.Berthe@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: wait for set pipe mcp command completion
Josip Pavic [Thu, 12 Sep 2019 19:40:08 +0000 (15:40 -0400)]
drm/amd/display: wait for set pipe mcp command completion

[Why]
When the driver sends a pipe set command to the DMCU FW, it does not wait
for the command to complete. This can lead to unpredictable behavior if,
for example, the driver were to request a pipe disable to the FW via MCP,
then power down some hardware before the firmware has completed processing
the command.

[How]
Wait for the DMCU FW to finish processing set pipe commands

Signed-off-by: Josip Pavic <Josip.Pavic@amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Add output bitrate to DML calculations
Nikola Cornij [Thu, 12 Sep 2019 21:15:16 +0000 (17:15 -0400)]
drm/amd/display: Add output bitrate to DML calculations

[why]
Output bitrate was mistakenly left out, causing corruption on some
DSC low resolution (such as 800x600) modes.

Signed-off-by: Nikola Cornij <nikola.cornij@amd.com>
Reviewed-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Properly round nominal frequency for SPD
Aric Cyr [Wed, 11 Sep 2019 20:17:08 +0000 (16:17 -0400)]
drm/amd/display: Properly round nominal frequency for SPD

[Why]
Some displays rely on the SPD verticle frequency maximum value.
Must round the calculated refresh rate to the nearest integer.

[How]
Round the nominal calculated refresh rate to the nearest whole
integer.

Signed-off-by: Aric Cyr <aric.cyr@amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Restore should_update_pstate_support after bad revert
Joshua Aberback [Thu, 12 Sep 2019 17:14:52 +0000 (13:14 -0400)]
drm/amd/display: Restore should_update_pstate_support after bad revert

[Why]
This function was mistakenly reverted as part of a legitimate revert. The
old version that was reverted to has bad logic, and is causing situations
where p-state change support is being toggled when it shouldn't be,
resulting in hangs.

Signed-off-by: Joshua Aberback <joshua.aberback@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: check phy dpalt lane count config
Lewis Huang [Thu, 5 Sep 2019 07:33:58 +0000 (15:33 +0800)]
drm/amd/display: check phy dpalt lane count config

[Why]
Type-c PHY config is not align with dpcd lane count.
When those values didn't match, it cause driver do
link training with 4 lane but phy only can output 2 lane.
The link trainig always fail.

[How]
1. Modify get_max_link_cap function. According DPALT_DP4
to update max lane count.
2. Add dp_mst_verify_link_cap to handle MST case because
we didn't call dp_mst_verify_link_cap for MST case.

Signed-off-by: Lewis Huang <Lewis.Huang@amd.com>
Reviewed-by: Wenjing Liu <Wenjing.Liu@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: build up VSIF infopacket
Wayne Lin [Tue, 3 Sep 2019 21:31:16 +0000 (05:31 +0800)]
drm/amd/display: build up VSIF infopacket

[Why]
Didn't send VSIF infopacket when it's 4k mode defined in HDMI 1.4b.
For HDMI 1.4b, While displaying 4k modes, it should send VSP.

[How]
Call mod_build_hf_vsif_infopacket() function to build info frame
and send it.

Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: 3.2.52
Anthony Koo [Mon, 9 Sep 2019 14:27:31 +0000 (10:27 -0400)]
drm/amd/display: 3.2.52

Signed-off-by: Anthony Koo <Anthony.Koo@amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Add missing shifts and masks for dpp registers on dcn2
Joshua Aberback [Fri, 6 Sep 2019 21:34:19 +0000 (17:34 -0400)]
drm/amd/display: Add missing shifts and masks for dpp registers on dcn2

[Why]
The register CM_TEST_DEBUG_DATA is used in dpp1_program_input_csc, which is
called from dpp2_cnv_setup, but the shifts and masks for the fields of that
register are not initialized for dcn2. This causes all reads of that register
to return 0.

Signed-off-by: Joshua Aberback <joshua.aberback@amd.com>
Reviewed-by: Jaehyun Chung <Jaehyun.Chung@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: add explicit comparator as default optimization check
Jun Lei [Mon, 9 Sep 2019 15:05:33 +0000 (11:05 -0400)]
drm/amd/display: add explicit comparator as default optimization check

[why]
memcmp is vulnerable to regression due to dc_clocks structures not being
organized properly (not "current" clock related structures being at the beginning
of the structure) and causes unnecessary setting of the optimize bit

[how]
add a dcn sepcific comparator, implement for dcn2

Signed-off-by: Jun Lei <Jun.Lei@amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: add support for VSIP info packet
Wayne Lin [Tue, 3 Sep 2019 21:18:31 +0000 (05:18 +0800)]
drm/amd/display: add support for VSIP info packet

[Why]
The vendor specific infoframe is needed for HDMI while displaying
specific modes.
DC supports sending it, but we aren't currently building it

[How]
Add mod_build_hf_vsif_infopacket() to build the vendor specific
info packet.

Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: fix hotplug during display off
Joseph Gravenor [Wed, 4 Sep 2019 16:43:05 +0000 (12:43 -0400)]
drm/amd/display: fix hotplug during display off

[why]
HPD is not suppressed when we lower
clocks on renoir. B/c of this we do link
training when the 48mhz refclk is off, which
will cause ASIC hang.

[how]
Exit optimized power state for detection purpose.

Signed-off-by: Joseph Gravenor <joseph.gravenor@amd.com>
Reviewed-by: Eric Yang <eric.yang2@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: fix pipe re-assignment when odm present
Dmytro Laktyushkin [Fri, 6 Sep 2019 15:12:14 +0000 (11:12 -0400)]
drm/amd/display: fix pipe re-assignment when odm present

Currently pipe split may steal an existing ODM pipe depending on stream
sequence. This change prevents that from happening as easily.

Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Reviewed-by: Gary Kattan <Gary.Kattan@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Reprogram FMT on pipe change
Julian Parkin [Thu, 22 Aug 2019 20:32:05 +0000 (16:32 -0400)]
drm/amd/display: Reprogram FMT on pipe change

[Why]
When planes are added or removed from a stream, the change
in pipe usage from dynamic MPC combine can cause a second
stream using ODM combine to pick a different pipe to combine with.

In this scenario, a different OPP is connected to the ODM without
programming its FMT.

[How]
Reprogram the FMT in dcn20_program_pipe whenever a pipe is
newly enabled, or when its opp changes.

Signed-off-by: Julian Parkin <julian.parkin@amd.com>
Reviewed-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Update V_UPDATE whenever VSTARTUP changes
Aric Cyr [Fri, 6 Sep 2019 20:24:54 +0000 (16:24 -0400)]
drm/amd/display: Update V_UPDATE whenever VSTARTUP changes

[Why]
If VSTARTUP changes due to bandwidth requirements, we must
recalculate and update VLINE2 as well for proper flip reporting.

[How]
After all calls to program_global_sync which reconfigures
VSTARTUP, also make sure to update V_UPDATE (i.e. VLINE2 on DCNx).

Signed-off-by: Aric Cyr <aric.cyr@amd.com>
Reviewed-by: Sivapiriyan Kumarasamy <Sivapiriyan.Kumarasamy@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Add Logging for Gamma Related information
Wyatt Wood [Tue, 3 Sep 2019 14:29:00 +0000 (10:29 -0400)]
drm/amd/display: Add Logging for Gamma Related information

[Why]
A recent bug showed that logging would be useful in debugging
various gamma issues.

[How]
Fix formatting for easier graphing.
Prevent performance hit when doing diag.

Signed-off-by: Wyatt Wood <wyatt.wood@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: skip enable stream on disconnected display
Wenjing Liu [Tue, 3 Sep 2019 21:15:48 +0000 (17:15 -0400)]
drm/amd/display: skip enable stream on disconnected display

[why]
Virtual signal means there is no display attached.
In this case we will assign a virtual signal type to the stream.
We should only enable the front end of the stream but not the back end.

[how]
When stream is enabling with virtual signal type, skip backend programming.

Signed-off-by: Wenjing Liu <Wenjing.Liu@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Correct values in AVI infoframe
Wayne Lin [Tue, 3 Sep 2019 22:12:22 +0000 (06:12 +0800)]
drm/amd/display: Correct values in AVI infoframe

[Why]
While displaying 4k modes defined in HDMI1.4b, should set VIC to 0
and use VSP HDMI_VIC to indicate the mode.

[How]
Use functions defined in drm to set up the VIC correspondingly.

Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Added pixel dynamic expansion control.
Robin Singh [Thu, 22 Aug 2019 18:42:49 +0000 (14:42 -0400)]
drm/amd/display: Added pixel dynamic expansion control.

[Why]
To compare the crc of the framebuffer data at input of
display pipeline with the crc of the otg, we need to
disable pixel formatter's dynamic expansion feature during
crc capture and keep it enable in the normal operation.

[HOW]
Expose a new interface in DM and dc for pixel formatter
(fmt dynamic bitdepth expansion control). Interface control
the FMT_DYNAMIC_EXP_EN  bit, during crc capture keep
it disabled.

Signed-off-by: Robin Singh <robin.singh@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Enable gfx cache probing on HDP write for arcturus
Oak Zeng [Mon, 7 Oct 2019 20:32:23 +0000 (15:32 -0500)]
drm/amdgpu: Enable gfx cache probing on HDP write for arcturus

This allows gfx cache to be probed and invalidated (for none-dirty cache lines)
on a HDP write (from either another GPU or CPU). This should work only for the
memory mapped as RW memory type newly added for arcturus, to achieve some cache
coherence b/t multiple memory clients.

Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
Acked-by: Christian Konig <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Clean up gmc_v9_0_gart_enable
Oak Zeng [Mon, 7 Oct 2019 20:21:03 +0000 (15:21 -0500)]
drm/amdgpu: Clean up gmc_v9_0_gart_enable

Many logic in this function are HDP set up,
not gart set up. Moved those logic to gmc_v9_0_hw_init.
No functional change.

Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
Acked-by: Christian konig <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: simplify gds_compute_max_wave_id computation
Marek Olšák [Wed, 25 Sep 2019 19:50:17 +0000 (15:50 -0400)]
drm/amdgpu: simplify gds_compute_max_wave_id computation

Use asic constants.

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: update for drmP.h removal
Stephen Rothwell [Wed, 9 Oct 2019 00:35:57 +0000 (11:35 +1100)]
drm/amdkfd: update for drmP.h removal

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: Check against device cgroup
Harish Kasiviswanathan [Mon, 20 Aug 2018 16:14:50 +0000 (12:14 -0400)]
drm/amdkfd: Check against device cgroup

Participate in device cgroup. All kfd devices are exposed via /dev/kfd.
So use /dev/dri/renderN node.

Before exposing the device to a task check if it has permission to
access it. If the task (based on its cgroup) can access /dev/dri/renderN
then expose the device via kfd node.

If the task cannot access /dev/dri/renderN then process device data
(pdd) is not created. This will ensure that task cannot use the device.

In sysfs topology, all device nodes are visible irrespective of the task
cgroup. The sysfs node directories are created at driver load time and
cannot be changed dynamically. However, access to information inside
nodes is controlled based on the task's cgroup permissions.

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodevice_cgroup: Export devcgroup_check_permission
Harish Kasiviswanathan [Thu, 16 May 2019 15:37:16 +0000 (11:37 -0400)]
device_cgroup: Export devcgroup_check_permission

For AMD compute (amdkfd) driver.

All AMD compute devices are exported via single device node /dev/kfd. As
a result devices cannot be controlled individually using device cgroup.

AMD compute devices will rely on its graphics counterpart that exposes
/dev/dri/renderN node for each device. For each task (based on its
cgroup), KFD driver will check if /dev/dri/renderN node is accessible
before exposing it.

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Roman Gushchin <guro@fb.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: fix the build when CIK support is disabled
Alex Deucher [Fri, 4 Oct 2019 14:14:35 +0000 (09:14 -0500)]
drm/amdkfd: fix the build when CIK support is disabled

Add proper ifdefs around CIK code in kfd setup.

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd: Fix Kconfig indentation
Krzysztof Kozlowski [Mon, 7 Oct 2019 17:33:22 +0000 (19:33 +0200)]
drm/amd: Fix Kconfig indentation

Adjust indentation from spaces to tab (+optional two spaces) as in
coding style with command like:
    $ sed -e 's/^        /\t/' -i */Kconfig

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Report vram vendor with sysfs (v3)
Ori Messinger [Wed, 2 Oct 2019 14:02:07 +0000 (10:02 -0400)]
drm/amdgpu: Report vram vendor with sysfs (v3)

The vram vendor can be found as a separate sysfs file at:
/sys/class/drm/card[X]/device/mem_info_vram_vendor
The vram vendor is displayed as a string value.

v2: Use correct bit masking, and cache vram_vendor in gmc
v3: Drop unused functions for vram width, type, and vendor

Signed-off-by: Ori Messinger <ori.messinger@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: Fix a && vs || typo
Dan Carpenter [Mon, 7 Oct 2019 08:52:10 +0000 (11:52 +0300)]
drm/amdkfd: Fix a && vs || typo

In the current code if "device_info" is ever NULL then the kernel will
Oops so probably || was intended instead of &&.

Fixes: e392c887df97 ("drm/amdkfd: Use array to probe kfd2kgd_calls")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: Fix error handling in smu_init_fb_allocations()
Dan Carpenter [Mon, 7 Oct 2019 09:02:06 +0000 (12:02 +0300)]
drm/amd/powerplay: Fix error handling in smu_init_fb_allocations()

The error handling is off by one.  We should not free the first
"tables[i].bo" without decrementing "i" because that might result in a
double free.  The second problem is that when an error occurs, then the
zeroth element "tables[0].bo" isn't freed.

I had make "i" signed int for the error handling to work, so I just
updated "ret" as well as a clean up.

Fixes: f96357a991b9 ("drm/amd/powerplay: implement smu_init(fini)_fb_allocations function")
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: unlock on error in smu_resume()
Dan Carpenter [Mon, 7 Oct 2019 09:04:54 +0000 (12:04 +0300)]
drm/amd/powerplay: unlock on error in smu_resume()

This function needs to drop the mutex before returning.

Fixes: f7e3a5776fa6 ("drm/amd/powerplay: check SMU engine readiness before proceeding on S3 resume")
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Remove set but not used variables 'pp_smu', 'old_pipe'
zhengbin [Sat, 5 Oct 2019 02:44:36 +0000 (10:44 +0800)]
drm/amd/display: Remove set but not used variables 'pp_smu', 'old_pipe'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c: In function dce110_enable_audio_stream:
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c:949:23: warning: variable pp_smu set but not used [-Wunused-but-set-variable]
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c: In function dce110_disable_audio_stream:
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c:983:23: warning: variable pp_smu set but not used [-Wunused-but-set-variable]
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c: In function dce110_program_front_end_for_pipe:
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c:2429:19: warning: variable old_pipe set but not used [-Wunused-but-set-variable]

'pp_smu' is not used since commit 170a2398d2d8 ("drm/amd/display:
make clk_mgr call enable_pme_wa")

'old_pipe' is not used since commit 65d38262b3e8 ("drm/amd/display:
fbc state could not reach while enable fbc")

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Remove set but not used variable 'pixel_width'
zhengbin [Sat, 5 Oct 2019 02:44:35 +0000 (10:44 +0800)]
drm/amd/display: Remove set but not used variable 'pixel_width'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dpp.c: In function dpp2_get_optimal_number_of_taps:
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dpp.c:359:11: warning: variable pixel_width set but not used [-Wunused-but-set-variable]

It is not used since commit f7de96ee8b5f ("drm/amd/display:
Add DCN2 DPP")

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Remove set but not used variables 'h_ratio_chroma', 'v_ratio_chroma'
zhengbin [Sat, 5 Oct 2019 02:44:34 +0000 (10:44 +0800)]
drm/amd/display: Remove set but not used variables 'h_ratio_chroma', 'v_ratio_chroma'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dwb_scl.c: In function dwb_program_horz_scalar:
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dwb_scl.c:725:11: warning: variable h_ratio_chroma set but not used [-Wunused-but-set-variable]
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dwb_scl.c: In function dwb_program_vert_scalar:
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dwb_scl.c:806:11: warning: variable v_ratio_chroma set but not used [-Wunused-but-set-variable]

They are not used since commit 345429a67c48 ("drm/amd/display:
Add DCN2 DWB")

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Remove set but not used variable 'source_bpp'
zhengbin [Sat, 5 Oct 2019 02:44:33 +0000 (10:44 +0800)]
drm/amd/display: Remove set but not used variable 'source_bpp'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/gpu/drm/amd/display/dc/dsc/rc_calc.c: In function calc_rc_params:
drivers/gpu/drm/amd/display/dc/dsc/rc_calc.c:180:6: warning: variable source_bpp set but not used [-Wunused-but-set-variable]

It is not used since commit 97bda0322b8a ("drm/amd/display:
Add DSC support for Navi (v2)")

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Make function wait_for_alt_mode static
zhengbin [Sat, 5 Oct 2019 02:44:32 +0000 (10:44 +0800)]
drm/amd/display: Make function wait_for_alt_mode static

Fix sparse warnings:

drivers/gpu/drm/amd/display/dc/core/dc_link.c:687:6: warning: symbol 'wait_for_alt_mode' was not declared. Should it be static?

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: add missing void argument to function kgd2kfd_init
Colin Ian King [Sat, 5 Oct 2019 17:58:08 +0000 (18:58 +0100)]
drm/amdkfd: add missing void argument to function kgd2kfd_init

Function kgd2kfd_init is missing a void argument, add it
to clean up the non-ANSI function declaration.

Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: remove duplicated include from mmhub_v1_0.c
YueHaibing [Sun, 6 Oct 2019 07:44:04 +0000 (07:44 +0000)]
drm/amdgpu: remove duplicated include from mmhub_v1_0.c

Remove duplicated include.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: move amdgpu_device_get_job_timeout_settings
Alex Deucher [Fri, 4 Oct 2019 18:36:09 +0000 (13:36 -0500)]
drm/amdgpu: move amdgpu_device_get_job_timeout_settings

It's only used in amdgpu_device.c and the naming also
reflects that.  Move it there.

Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: remove set but not used variable 'core_freesync'
YueHaibing [Sun, 6 Oct 2019 10:57:35 +0000 (18:57 +0800)]
drm/amd/display: remove set but not used variable 'core_freesync'

Fixes gcc '-Wunused-but-set-variable' warning:

rivers/gpu/drm/amd/amdgpu/../display/modules/freesync/freesync.c:
 In function mod_freesync_get_settings:
drivers/gpu/drm/amd/amdgpu/../display/modules/freesync/freesync.c:984:24:
 warning: variable core_freesync set but not used [-Wunused-but-set-variable]

It is not used since commit 98e6436d3af5 ("drm/amd/display: Refactor FreeSync module")

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Fix typo in some comments
Christophe JAILLET [Sat, 5 Oct 2019 11:32:05 +0000 (13:32 +0200)]
drm/amd/display: Fix typo in some comments

p and g are switched in 'amdpgu_dm'

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: Print more sdma engine hqds in debug fs
Oak Zeng [Fri, 4 Oct 2019 14:34:29 +0000 (09:34 -0500)]
drm/amdkfd: Print more sdma engine hqds in debug fs

Previously only PCIe-optimized SDMA engine hqds were
exposed in debug fs. Print all SDMA engine hqds.

Reported-by: Jonathan Kim <Jonathan.Kim@amd.com>
Signed-off-by: Jonathan Kim <Jonathan.Kim@amd.com>
Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: Fix MQD size calculation
Oak Zeng [Fri, 4 Oct 2019 14:28:21 +0000 (09:28 -0500)]
drm/amdkfd: Fix MQD size calculation

On device initialization, a chunk of GTT memory is pre-allocated for
HIQ and all SDMA queues mqd. The size of this allocation was wrong.
The correct sdma engine number should be PCIe-optimized SDMA engine
number plus xgmi SDMA engine number.

Reported-by: Jonathan Kim <Jonathan.Kim@amd.com>
Signed-off-by: Jonathan Kim <Jonathan.Kim@amd.com>
Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Fix error handling in amdgpu_ras_recovery_init
Felix Kuehling [Thu, 3 Oct 2019 21:54:57 +0000 (17:54 -0400)]
drm/amdgpu: Fix error handling in amdgpu_ras_recovery_init

Don't set a struct pointer to NULL before freeing its members. It's
hard to see what's happening due to a local pointer-to-pointer data
aliasing con->eh_data.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Tested-by: Philip Cox <Philip.Cox@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: remove redundant variable r and redundant return statement
Colin Ian King [Thu, 3 Oct 2019 21:40:49 +0000 (22:40 +0100)]
drm/amdgpu: remove redundant variable r and redundant return statement

There is a return statement that is not reachable and a variable that
is not used.  Remove them.

Addresses-Coverity: ("Structurally dead code")
Fixes: de7b45babd9b ("drm/amdgpu: cleanup creating BOs at fixed location (v2)")
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: fix uninitialized variable pasid_mapping_needed
Colin Ian King [Thu, 3 Oct 2019 21:52:27 +0000 (22:52 +0100)]
drm/amdgpu: fix uninitialized variable pasid_mapping_needed

The boolean variable pasid_mapping_needed is not initialized and
there are code paths that do not assign it any value before it is
is read later.  Fix this by initializing pasid_mapping_needed to
false.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: 6817bf283b2b ("drm/amdgpu: grab the id mgr lock while accessing passid_mapping")
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Make some functions static
zhengbin [Fri, 4 Oct 2019 09:37:40 +0000 (17:37 +0800)]
drm/amd/display: Make some functions static

Fix sparse warnings:

drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_hdcp.c:32:6: warning: symbol 'lp_write_i2c' was not declared. Should it be static?
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_hdcp.c:42:6: warning: symbol 'lp_read_i2c' was not declared. Should it be static?
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_hdcp.c:52:6: warning: symbol 'lp_write_dpcd' was not declared. Should it be static?
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_hdcp.c:59:6: warning: symbol 'lp_read_dpcd' was not declared. Should it be static?

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: fix struct init in update_bounding_box
Raul E Rangel [Thu, 3 Oct 2019 20:24:44 +0000 (14:24 -0600)]
drm/amd/display: fix struct init in update_bounding_box

dcn20_resource.c:2636:9: error: missing braces around initializer [-Werror=missing-braces]
  struct _vcs_dpi_voltage_scaling_st calculated_states[MAX_CLOCK_LIMIT_STATES] = {0};
         ^

Fixes: 7ed4e6352c16f ("drm/amd/display: Add DCN2 HW Sequencer and Resource")

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add code comment in vcn_v2_5_hw_init
Leo Liu [Tue, 1 Oct 2019 22:12:45 +0000 (18:12 -0400)]
drm/amdgpu: add code comment in vcn_v2_5_hw_init

Add a comment to VCN 2.5 encode ring

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
Cc: 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>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Cc: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/vcn: use amdgpu_ring_test_helper
Leo Liu [Tue, 1 Oct 2019 22:08:46 +0000 (18:08 -0400)]
drm/amdgpu/vcn: use amdgpu_ring_test_helper

Instead of amdgpu_ring_test_ring, so the helper function determines
whether the ring is ready

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
Acked-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Cc: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: improve MSI-X handling (v3)
Alex Deucher [Thu, 3 Oct 2019 15:34:30 +0000 (10:34 -0500)]
drm/amdgpu: improve MSI-X handling (v3)

Check the number of supported vectors and fall back to MSI if
we return or error or 0 MSI-X vectors.

v2: only allocate one vector.  We can't currently use more than
one anyway.

v3: install the irq on vector 0.

Tested-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Shaoyun liu <shaoyun.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: fix spelling mistake AUTHENICATED -> AUTHENTICATED
Colin Ian King [Thu, 3 Oct 2019 08:22:32 +0000 (09:22 +0100)]
drm/amd/display: fix spelling mistake AUTHENICATED -> AUTHENTICATED

There is a spelling mistake in the macros H1_A45_AUTHENICATED and
D1_A4_AUTHENICATED, fix these by adding the missing T.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: display_mode_vba_21: remove uint typedef
Arnd Bergmann [Wed, 2 Oct 2019 12:01:24 +0000 (14:01 +0200)]
drm/amdgpu: display_mode_vba_21: remove uint typedef

The type definition for 'uint' clashes with the generic kernel
headers:

drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn21/display_mode_vba_21.c:43:22: error: redefinition of typedef 'uint' is a C11 feature [-Werror,-Wtypedef-redefinition]
include/linux/types.h:92:23: note: previous definition is here

Just remove this type and use plain 'unsigned int' consistently,
as it is already use almost everywhere in this file.

Fixes: b04641a3f4c5 ("drm/amd/display: Add Renoir DML")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: hide another #warning
Arnd Bergmann [Wed, 2 Oct 2019 12:01:23 +0000 (14:01 +0200)]
drm/amdgpu: hide another #warning

An earlier patch of mine disabled some #warning statements
that get in the way of build testing, but then another
instance was added around the same time.

Remove that as well.

Fixes: b5203d16aef4 ("drm/amd/amdgpu: hide #warning for missing DC config")
Fixes: e1c14c43395c ("drm/amdgpu: Enable DC on Renoir")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: make pmu support optional, again
Arnd Bergmann [Wed, 2 Oct 2019 12:01:22 +0000 (14:01 +0200)]
drm/amdgpu: make pmu support optional, again

When CONFIG_PERF_EVENTS is disabled, we cannot compile the pmu
portion of the amdgpu driver:

drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c:48:38: error: no member named 'hw' in 'struct perf_event'
        struct hw_perf_event *hwc = &event->hw;
                                     ~~~~~  ^
drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c:51:13: error: no member named 'attr' in 'struct perf_event'
        if (event->attr.type != event->pmu->type)
            ~~~~~  ^
...

The same bug was already fixed by commit d155bef0636e ("amdgpu: make pmu
support optional") but broken again by what looks like an incorrectly
rebased patch.

Fixes: 64f55e629237 ("drm/amdgpu: Add RAS EEPROM table.")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: memory leak
Navid Emamdoost [Tue, 17 Sep 2019 03:20:44 +0000 (22:20 -0500)]
drm/amd/display: memory leak

In dcn*_clock_source_create when dcn20_clk_src_construct fails allocated
clk_src needs release.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: remove set but not used variable 'pipe'
yu kuai [Sun, 29 Sep 2019 12:38:43 +0000 (20:38 +0800)]
drm/amdgpu: remove set but not used variable 'pipe'

Fixes gcc '-Wunused-but-set-variable' warning:

rivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c: In function
‘amdgpu_gfx_graphics_queue_acquire’:
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:234:16: warning:
variable ‘pipe’ set but not used [-Wunused-but-set-variable]

It is never used, so can be removed.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: yu kuai <yukuai3@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Drop unused variable and statement
Austin Kim [Wed, 2 Oct 2019 05:17:59 +0000 (14:17 +0900)]
drm/amdgpu: Drop unused variable and statement

Even though 'smu8_smu' is declared, it is not used after below statement.

   smu8_smu = hwmgr->smu_backend;

So 'unused variable' could be safely removed
to stop warning message as below:

   drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/smu8_smumgr.c:180:22:
   warning: variable ‘smu8_smu’ set but not used
   [-Wunused-but-set-variable]

   struct smu8_smumgr *smu8_smu;
             ^
Signed-off-by: Austin Kim <austindh.kim@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: fix multiple memory leaks in acp_hw_init
Navid Emamdoost [Wed, 2 Oct 2019 03:46:07 +0000 (22:46 -0500)]
drm/amdgpu: fix multiple memory leaks in acp_hw_init

In acp_hw_init there are some allocations that needs to be released in
case of failure:

1- adev->acp.acp_genpd should be released if any allocation attemp for
adev->acp.acp_cell, adev->acp.acp_res or i2s_pdata fails.
2- all of those allocations should be released if
mfd_add_hotplug_devices or pm_genpd_add_device fail.
3- Release is needed in case of time out values expire.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: don't increment vram lost if we are in hibernation
Alex Deucher [Tue, 1 Oct 2019 21:45:27 +0000 (16:45 -0500)]
drm/amdgpu: don't increment vram lost if we are in hibernation

We reset the GPU as part of our hibernation sequence so we need
to make sure we don't mark vram as lost in that case.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=111879
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu : enable msix for amdgpu driver
shaoyunl [Tue, 1 Oct 2019 19:52:31 +0000 (15:52 -0400)]
drm/amdgpu : enable msix for amdgpu driver

We might used out of the msi resources in some cloud project
which have a lot gpu devices(including PF and VF), msix can
provide enough resources from system level view

Signed-off-by: shaoyunl <shaoyun.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: Improve KFD IOCTL printing
Yong Zhao [Sat, 21 Sep 2019 02:06:57 +0000 (22:06 -0400)]
drm/amdkfd: Improve KFD IOCTL printing

The code use hex define, so should the printing.

Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Export setup_vm_pt_regs() logic for mmhub 2.0
Yong Zhao [Tue, 24 Sep 2019 21:23:12 +0000 (17:23 -0400)]
drm/amdgpu: Export setup_vm_pt_regs() logic for mmhub 2.0

The KFD code will call this function later.

Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Add the HDP flush support for Navi
Yong Zhao [Sat, 28 Sep 2019 03:30:05 +0000 (23:30 -0400)]
drm/amdgpu: Add the HDP flush support for Navi

The HDP flush support code was missing in the nbio and nv files.

Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: Use array to probe kfd2kgd_calls
Yong Zhao [Sat, 28 Sep 2019 02:03:42 +0000 (22:03 -0400)]
drm/amdkfd: Use array to probe kfd2kgd_calls

This is the same idea as the kfd device info probe and move all the
probe control together for easy maintenance.

Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: Delete unnecessary function declarations
Yong Zhao [Sat, 28 Sep 2019 01:22:07 +0000 (21:22 -0400)]
drm/amdkfd: Delete unnecessary function declarations

Ajust the function sequences so that those function delcarations are not
needed any more.

Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Delete useless header file reference
Yong Zhao [Sat, 21 Sep 2019 19:51:19 +0000 (15:51 -0400)]
drm/amdgpu: Delete useless header file reference

Those header file includes are not needed.

Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/amdgpu/sriov ip block setting of Arcturus
Jack Zhang [Thu, 26 Sep 2019 07:24:55 +0000 (15:24 +0800)]
drm/amd/amdgpu/sriov ip block setting of Arcturus

Add ip block setting for Arcturus SRIOV

1.PSP need to be initialized before IH.
2.SMU doesn't need to be initialized at kmd driver.
3.Arcturus doesn't support DCE hardware,it needs to skip
  register access to DCE.

Signed-off-by: Jack Zhang <Jack.Zhang1@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: return tcc_disabled_mask to userspace
Marek Olšák [Tue, 24 Sep 2019 21:53:25 +0000 (17:53 -0400)]
drm/amdgpu: return tcc_disabled_mask to userspace

UMDs need this for correct programming of harvested chips.

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/dm/mst: Use ->atomic_best_encoder
Lyude Paul [Thu, 26 Sep 2019 22:51:05 +0000 (18:51 -0400)]
drm/amdgpu/dm/mst: Use ->atomic_best_encoder

We are supposed to be atomic after all. We'll need this in a moment for
the next commit.

Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/dm/mst: Don't create MST topology managers for eDP ports
Lyude Paul [Thu, 26 Sep 2019 22:51:03 +0000 (18:51 -0400)]
drm/amdgpu/dm/mst: Don't create MST topology managers for eDP ports

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/dm/mst: Remove unnecessary NULL check
Lyude Paul [Thu, 26 Sep 2019 22:51:04 +0000 (18:51 -0400)]
drm/amdgpu/dm/mst: Remove unnecessary NULL check

kfree() checks this automatically.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Iterate through DRM connectors correctly
Lyude Paul [Tue, 3 Sep 2019 20:46:01 +0000 (16:46 -0400)]
drm/amdgpu: Iterate through DRM connectors correctly

Currently, every single piece of code in amdgpu that loops through
connectors does it incorrectly and doesn't use the proper list iteration
helpers, drm_connector_list_iter_begin() and
drm_connector_list_iter_end(). Yeesh.

So, do that.

Cc: Juston Li <juston.li@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Harry Wentland <hwentlan@amd.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/dm: Resume short HPD IRQs before resuming MST topology
Lyude Paul [Wed, 25 Sep 2019 21:52:48 +0000 (17:52 -0400)]
drm/amdgpu/dm: Resume short HPD IRQs before resuming MST topology

Since we're going to be reprobing the entire topology state on resume
now using sideband transactions, we need to ensure that we actually have
short HPD irqs enabled before calling drm_dp_mst_topology_mgr_resume().
So, do that.

Changes since v4:
* Fix typo in comments

Cc: Juston Li <juston.li@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Harry Wentland <hwentlan@amd.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: fix kgd2kfd_device_init() definition conflict error
Prike Liang [Fri, 27 Sep 2019 04:16:42 +0000 (12:16 +0800)]
drm/amdkfd: fix kgd2kfd_device_init() definition conflict error

The patch c670707 drm/amd: Pass drm_device to kfd introduced this issue and
fix the following compiler error.

  CC [M]  drivers/gpu/drm/amd/amdgpu//../powerplay/smumgr/fiji_smumgr.o
drivers/gpu/drm/amd/amdgpu//amdgpu_amdkfd.c:746:6: error: conflicting types for ‘kgd2kfd_device_init’
 bool kgd2kfd_device_init(struct kfd_dev *kfd,
      ^
In file included from drivers/gpu/drm/amd/amdgpu//amdgpu_amdkfd.c:23:0:
drivers/gpu/drm/amd/amdgpu//amdgpu_amdkfd.h:253:6: note: previous declaration of ‘kgd2kfd_device_init’ was here
 bool kgd2kfd_device_init(struct kfd_dev *kfd,
      ^
scripts/Makefile.build:273: recipe for target 'drivers/gpu/drm/amd/amdgpu//amdgpu_amdkfd.o' failed
make[1]: *** [drivers/gpu/drm/amd/amdgpu//amdgpu_amdkfd.o] Error 1

Signed-off-by: Prike Liang <Prike.Liang@amd.com>
Acked-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: initlialize smu->is_apu is false by default
Kevin Wang [Fri, 27 Sep 2019 06:52:10 +0000 (14:52 +0800)]
drm/amd/powerplay: initlialize smu->is_apu is false by default

the member of is_apu in smu_context need to initlialize by default.

set default value is false (dGPU)

for patch:
drm/amd/powerplay: bypass dpm_context null pointer check guard
for some smu series

Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Prike Liang <Prike.Liang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agoRevert "drm/amdgpu: disable stutter mode for renoir"
Aaron Liu [Mon, 16 Sep 2019 02:05:09 +0000 (10:05 +0800)]
Revert "drm/amdgpu: disable stutter mode for renoir"

This reverts commit 5813f97a5969bf1e7e723397a74e00b5de7278d6.

Since SBIOS WCD9925N, NMI printing disappeared. Hence enable stutter
mode.

Signed-off-by: Aaron Liu <aaron.liu@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: update the interface for getting dpm full scale clock frequency
Prike Liang [Wed, 25 Sep 2019 09:48:56 +0000 (17:48 +0800)]
drm/amd/powerplay: update the interface for getting dpm full scale clock frequency

Update get_dpm_uclk_limited to get more clock type full scale dpm frequency.

Signed-off-by: Prike Liang <Prike.Liang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement the interface for setting sclk/uclk profile_peak level
Prike Liang [Wed, 25 Sep 2019 06:11:41 +0000 (14:11 +0800)]
drm/amd/powerplay: implement the interface for setting sclk/uclk profile_peak level

Add the interface for setting sclk and uclk peak frequency.

Signed-off-by: Prike Liang <Prike.Liang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement interface set_power_profile_mode() (v2)
Prike Liang [Mon, 23 Sep 2019 07:52:12 +0000 (15:52 +0800)]
drm/amd/powerplay: implement interface set_power_profile_mode() (v2)

v1:
Add set_power_profile_mode() for none manual dpm level case setting power profile mode.

v2:
After input power profile update successfully need can update the smu profile mode.

Signed-off-by: Prike Liang <Prike.Liang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add the interfaces for getting and setting profiling dpm clock...
Prike Liang [Mon, 23 Sep 2019 07:29:07 +0000 (15:29 +0800)]
drm/amd/powerplay: add the interfaces for getting and setting profiling dpm clock level

implement get_profiling_clk_mask and force_clk_levels for forcing dpm clk to limit value.

Signed-off-by: Prike Liang <Prike.Liang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interface for getting workload type
Prike Liang [Mon, 23 Sep 2019 06:42:36 +0000 (14:42 +0800)]
drm/amd/powerplay: add interface for getting workload type

The workload type was got from the input of power profile mode.

Signed-off-by: Prike Liang <Prike.Liang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interface for forcing and unforcing dpm limit value
Prike Liang [Mon, 23 Sep 2019 03:02:40 +0000 (11:02 +0800)]
drm/amd/powerplay: add interface for forcing and unforcing dpm limit value

That's base function for forcing and unforcing dpm limit value.

Signed-off-by: Prike Liang <Prike.Liang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement the interface for setting soft freq range
Prike Liang [Tue, 24 Sep 2019 06:40:09 +0000 (14:40 +0800)]
drm/amd/powerplay: implement the interface for setting soft freq range

The APU soft freq range set by different way from DGPU, thus need implement
the function respectively base on each common SMU part.

Signed-off-by: Prike Liang <Prike.Liang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: bypass dpm_context null pointer check guard for some smu series
Prike Liang [Wed, 18 Sep 2019 07:11:34 +0000 (15:11 +0800)]
drm/amd/powerplay: bypass dpm_context null pointer check guard for some smu series

For now APU has no smu_dpm_context structure for containing default/current related dpm tables,
thus will needn't initialize smu_dpm_context to aviod APU null pointer issue.

Signed-off-by: Prike Liang <Prike.Liang@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/amdgpu: add IH cg support on soc15 project
Kenneth Feng [Wed, 25 Sep 2019 05:41:35 +0000 (13:41 +0800)]
drm/amd/amdgpu: add IH cg support on soc15 project

enable/disable IH clock gating on soc15 projects.

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add sensor lock support for smu
Kevin Wang [Thu, 26 Sep 2019 08:22:13 +0000 (16:22 +0800)]
drm/amd/powerplay: add sensor lock support for smu

when multithreading access sysfs of amdgpu_pm_info at the sametime.
the swsmu driver cause smu firmware hang.

eg:
single thread access:
Message A + Param A ==> right
Message B + Param B ==> right
Message C + Param C ==> right
multithreading access:
Message A + Param B ==> error
Message B + Param A ==> error
Message C + Param C ==> right

the patch will add sensor lock(mutex) to avoid this error.

Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: change metrics update period from 1ms to 100ms
Kevin Wang [Thu, 26 Sep 2019 08:16:41 +0000 (16:16 +0800)]
drm/amd/powerplay: change metrics update period from 1ms to 100ms

v2:
change period from 10ms to 100ms (typo error)

too high frequence to update mertrics table will cause smu firmware
error,so change mertrics table update period from 1ms to 100ms
(navi10, 12, 14)

Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: Fix race in gfx10 context restore handler
Jay Cornwall [Wed, 25 Sep 2019 22:05:01 +0000 (17:05 -0500)]
drm/amdkfd: Fix race in gfx10 context restore handler

Missing synchronization with VGPR restore leads to intermittent
VGPR trashing in the user shader.

Signed-off-by: Jay Cornwall <jay.cornwall@amd.com>
Reviewed-by: Yong Zhao <Yong.Zhao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: Use setup_vm_pt_regs function from base driver in KFD
Yong Zhao [Wed, 25 Sep 2019 18:01:24 +0000 (14:01 -0400)]
drm/amdkfd: Use setup_vm_pt_regs function from base driver in KFD

This was done on GFX9 previously, now do it for GFX10.

Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Export setup_vm_pt_regs() logic for gfxhub 2.0
Yong Zhao [Tue, 24 Sep 2019 21:08:30 +0000 (17:08 -0400)]
drm/amdgpu: Export setup_vm_pt_regs() logic for gfxhub 2.0

The KFD code will call this function later.

Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: Eliminate get_atc_vmid_pasid_mapping_valid
Yong Zhao [Thu, 26 Sep 2019 03:57:30 +0000 (23:57 -0400)]
drm/amdkfd: Eliminate get_atc_vmid_pasid_mapping_valid

get_atc_vmid_pasid_mapping_valid() is very similar to
get_atc_vmid_pasid_mapping_pasid(), so they can be merged into a new
function get_atc_vmid_pasid_mapping_info() to reduce register access
times. More importantly, getting the PASID and the valid bit atomically
with a single read fixes some potential race conditions where the
mapping changes between the two reads.

Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: Query vmid pasid mapping through stored info for non HWS
Yong Zhao [Wed, 25 Sep 2019 21:06:12 +0000 (17:06 -0400)]
drm/amdkfd: Query vmid pasid mapping through stored info for non HWS

Because we record the mapping under non HWS mode in the software,
we can query pasid through vmid using the stored mapping instead of
reading from ATC registers.

This also prepares for the defeatured ATC block in future ASICs.

Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: Record vmid pasid mapping in the driver for non HWS mode
Yong Zhao [Thu, 26 Sep 2019 03:49:46 +0000 (23:49 -0400)]
drm/amdkfd: Record vmid pasid mapping in the driver for non HWS mode

This makes possible the vmid pasid mapping query through software.

Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: Use hex print format for pasid
Yong Zhao [Wed, 25 Sep 2019 21:00:59 +0000 (17:00 -0400)]
drm/amdkfd: Use hex print format for pasid

Since KFD pasid starts from 0x8000 (32768 in decimal), it is better
perceived as a hex number. Meanwhile, change the pasid type from
unsigned int to uint16_t to be consistent throughout the code.

Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>