]> git.proxmox.com Git - mirror_ubuntu-kernels.git/log
mirror_ubuntu-kernels.git
6 years agodrm/amdkfd: Only add bi-directional iolink on GPU with XGMI or largebar (v2)
shaoyunl [Fri, 7 Sep 2018 16:00:07 +0000 (12:00 -0400)]
drm/amdkfd: Only add bi-directional iolink on GPU with XGMI or largebar (v2)

v2: compile fix

Signed-off-by: shaoyunl <Shaoyun.Liu@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdkfd: Generate xGMI direct iolink
Shaoyun Liu [Mon, 13 Aug 2018 18:04:11 +0000 (14:04 -0400)]
drm/amdkfd: Generate xGMI direct iolink

Generate xGMI iolink for upper level usage

Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdkfd: Add new iolink type defines
Shaoyun Liu [Mon, 13 Aug 2018 18:02:17 +0000 (14:02 -0400)]
drm/amdkfd: Add new iolink type defines

Update the iolink type defines according to the new thunk spec

Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdkfd: kfd expose the hive_id of the device through its node properties
Shaoyun Liu [Fri, 6 Jul 2018 15:32:42 +0000 (11:32 -0400)]
drm/amdkfd: kfd expose the hive_id of the device through its node properties

Thunk will generate the XGMI topology information when necessary with the hive_id
for each specified device

Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: get_hive_id from amdgpu side (v2)
Shaoyun Liu [Fri, 6 Jul 2018 15:28:23 +0000 (11:28 -0400)]
drm/amdgpu: get_hive_id from amdgpu side (v2)

Retrieve hive_id from amdgpu device

v2: compile fix

Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/include: Add get_hive_id interface in kfd2kgd
Shaoyun Liu [Fri, 6 Jul 2018 15:26:08 +0000 (11:26 -0400)]
drm/amd/include: Add get_hive_id interface in kfd2kgd

KFD need to get hive id from amdgpu to build up the XGMI topology

Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu : Generate XGMI topology info from driver level
Shaoyun Liu [Wed, 27 Jun 2018 21:25:53 +0000 (17:25 -0400)]
drm/amdgpu : Generate XGMI topology info from driver level

Driver will save an array of XGMI hive info, each hive will have a list of devices
that have the same hive ID.

Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Add place holder functions for xgmi topology interface with psp
Shaoyun Liu [Tue, 14 Aug 2018 17:30:00 +0000 (13:30 -0400)]
drm/amdgpu: Add place holder functions for xgmi topology interface with psp

Add dummy function for xgmi function interface with psp

Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu : Add psp function interfaces for XGMI support
Shaoyun Liu [Wed, 27 Jun 2018 21:24:46 +0000 (17:24 -0400)]
drm/amdgpu : Add psp function interfaces for XGMI support

Place holder for XGMI support

Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/gmc9: Adjust GART and AGP location with xgmi offset (v2)
Alex Deucher [Tue, 19 Jun 2018 21:11:56 +0000 (16:11 -0500)]
drm/amdgpu/gmc9: Adjust GART and AGP location with xgmi offset (v2)

On hives with xgmi enabled, the fb_location aperture is a size
which defines the total framebuffer size of all nodes in the
hive.  Each GPU in the hive has the same view via the fb_location
aperture.  GPU0 starts at offset (0 * segment size),
GPU1 starts at offset (1 * segment size), etc.

For access to local vram on each GPU, we need to take this offset into
account. This including on setting up GPUVM page table and GART table

v2: squash in "drm/amdgpu: Init correct fb region for none XGMI configuration"

Acked-by: Huang Rui <ray.huang@amd.com>
Acked-by: Slava Abramov <slava.abramov@amd.com>
Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Huang Rui <ray.huang@amd.com>
6 years agodrm/amdgpu/gmc9: add a new gfxhub 1.1 helper for xgmi
Alex Deucher [Tue, 19 Jun 2018 22:03:27 +0000 (17:03 -0500)]
drm/amdgpu/gmc9: add a new gfxhub 1.1 helper for xgmi

Used to populate the xgmi info on vega20.

v2: PF_MAX_REGION is val - 1 (Ray)

Acked-by: Huang Rui <ray.huang@amd.com>
Acked-by: Slava Abramov <slava.abramov@amd.com>
Reviewed-by :Shaoyun liu <Shaoyun.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by :Shaoyun liu <Shaoyun.liu@amd.com>

6 years agodrm/amdgpu/gmc: add initial xgmi structure to amdgpu_gmc structure
Alex Deucher [Tue, 19 Jun 2018 21:00:47 +0000 (16:00 -0500)]
drm/amdgpu/gmc: add initial xgmi structure to amdgpu_gmc structure

Initial pass at a structure to store xgmi info.  xgmi is a high
speed cross gpu interconnect.

Acked-by: Huang Rui <ray.huang@amd.com>
Acked-by: Slava Abramov <slava.abramov@amd.com>
Reviewed-by :Shaoyun liu <Shaoyun.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
6 years agodrm/amd/include: update the bitfield define for PF_MAX_REGION
Shaoyun Liu [Tue, 7 Aug 2018 15:44:26 +0000 (11:44 -0400)]
drm/amd/include: update the bitfield define for PF_MAX_REGION

Correct the definition based on vega20 register spec

Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: move PSP init prior to IH in gpu reset
Emily Deng [Mon, 10 Sep 2018 09:51:31 +0000 (17:51 +0800)]
drm/amdgpu: move PSP init prior to IH in gpu reset

since we use PSP to program IH regs now

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Emily Deng <Emily.Deng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: set bulk_moveable to false when a per VM is released
Christian König [Wed, 5 Sep 2018 15:04:44 +0000 (17:04 +0200)]
drm/amdgpu: set bulk_moveable to false when a per VM is released

Otherwise we might run into a use after free during bulk move.

Signed-off-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>
6 years agodrm/amdgpu: Fix SDMA hang in prt mode v2
Tao Zhou [Fri, 7 Sep 2018 05:50:31 +0000 (13:50 +0800)]
drm/amdgpu: Fix SDMA hang in prt mode v2

Fix SDMA hang in prt mode, clear XNACK_WATERMARK in reg SDMA0_UTCL1_WATERMK to avoid the issue

Affected ASICs: VEGA10 VEGA12 RV1 RV2

v2: add reg clear for SDMA1

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Tested-by: Yukun Li <yukun1.li@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: fix compile warning for wrong data type V2
Evan Quan [Wed, 5 Sep 2018 02:03:13 +0000 (10:03 +0800)]
drm/amd/powerplay: fix compile warning for wrong data type V2

do_div expects the 1st argument in 64bit instead of 32bit.
Drop the usage of do_div as it seems unnecessary.

V2: drop usage of do_div completely

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>
6 years agodrm/amdgpu: Fix warnings while make xmldocs
Masanari Iida [Thu, 6 Sep 2018 02:10:57 +0000 (11:10 +0900)]
drm/amdgpu: Fix warnings while make xmldocs

This patch fixes following warnings.

./drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:3011:
warning: Excess function parameter 'dev' description
in 'amdgpu_vm_get_task_info'

./drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:3012:
warning: Function parameter or member 'adev' not
described in 'amdgpu_vm_get_task_info'

./drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:3012:
warning: Excess function parameter 'dev' description
in 'amdgpu_vm_get_task_info'

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Fix compute VM BO params after rebase v2
Felix Kuehling [Thu, 6 Sep 2018 00:19:54 +0000 (20:19 -0400)]
drm/amdgpu: Fix compute VM BO params after rebase v2

The intent of two commits was lost in the last rebase:

810955b drm/amdgpu: Fix acquiring VM on large-BAR systems
b5d21aa drm/amdgpu: Don't use shadow BO for compute context

This commit restores the original behaviour:
* Don't set AMDGPU_GEM_CREATE_NO_CPU_ACCESS for page directories
  to allow them to be reused for compute VMs
* Don't create shadow BOs for page tables in compute VMs

v2: move more logic into amdgpu_vm_bo_param

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Tested-by: Kent Russell <Kent.Russell@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: enable AGP aperture for GMC9 v2
Christian König [Mon, 27 Aug 2018 16:23:11 +0000 (18:23 +0200)]
drm/amdgpu: enable AGP aperture for GMC9 v2

Enable the old AGP aperture to avoid GART mappings.

v2: don't enable it for SRIOV

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Clean up KFD init and fini
Felix Kuehling [Fri, 31 Aug 2018 20:54:12 +0000 (16:54 -0400)]
drm/amdgpu: Clean up KFD init and fini

Only initialize KFD once by moving amdgpu_amdkfd_init from
amdgpu_pci_probe to amdgpu_init. This fixes kernel oopses and hangs
when booting multi-GPU systems.

Also removed some vestiges of KFD being its own module.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Add invariant support instrumentation in driver
Jun Lei [Wed, 22 Aug 2018 21:00:34 +0000 (17:00 -0400)]
drm/amd/display: Add invariant support instrumentation in driver

Existing debug dump are all invariant, new “low 32-bit of address”
dump is not invariant

Signed-off-by: Jun Lei <Jun.Lei@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>
6 years agodrm/amd/display: clean code for transition event log.
Chiawen Huang [Tue, 28 Aug 2018 05:38:34 +0000 (13:38 +0800)]
drm/amd/display: clean code for transition event log.

[Why]
There are same purpose transition events.

[How]
remove the redundant event log.

Signed-off-by: Chiawen Huang <chiawen.huang@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>
6 years agodrm/amd/display: Remove call to amdgpu_pm_compute_clocks
David Francis [Fri, 17 Aug 2018 18:24:26 +0000 (14:24 -0400)]
drm/amd/display: Remove call to amdgpu_pm_compute_clocks

[Why]
The extraneous call to amdgpu_pm_compute_clocks is deprecated.

[How]
Remove it.

Signed-off-by: David Francis <David.Francis@amd.com>
Signed-off-by: Leo Li <sunpeng.li@amd.com>
Reviewed-by: David Francis <David.Francis@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: use link type to decide stream enc acquisition
Eric Yang [Fri, 24 Aug 2018 20:54:14 +0000 (16:54 -0400)]
drm/amd/display: use link type to decide stream enc acquisition

[Why]
Virtual sink is used when set mode happens on a disconnected display
to allow the mode set to proceed. This did not work with MST because
the logic for acquiring stream encoder uses stream signal to determine
the special handling is required, and stream signal is virtual instead
of DP in this case.

[How]
Use link type to decide instead.

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>
6 years agodrm/amd/display: dc 3.1.65
Tony Cheng [Mon, 27 Aug 2018 17:35:13 +0000 (13:35 -0400)]
drm/amd/display: dc 3.1.65

Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Reviewed-by: Steven Chiu <Steven.Chiu@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Reorder resource_pool to put i2c with aux
David Francis [Thu, 9 Aug 2018 14:05:10 +0000 (10:05 -0400)]
drm/amd/display: Reorder resource_pool to put i2c with aux

[Why]
The i2c and aux engines are similar, and should be placed
next to eachother for readability

[How]
Reorder the elements of the resource_pool struct

Signed-off-by: David Francis <David.Francis@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>
6 years agodrm/amd/display: Use DRM helper for best_encoder
Leo Li [Thu, 23 Aug 2018 19:28:08 +0000 (15:28 -0400)]
drm/amd/display: Use DRM helper for best_encoder

[Why]
Our implementation is functionally identical to DRM's

Note that instead of checking if the provided id is 0, the helper
follows through with the mode object search. However, It will still
return NULL, since 0 is not a valid object id, and missed searches
will return NULL.

[How]
Remove our implementation, and replace it with
drm_atomic_helper_best_encoder.

Signed-off-by: Leo Li <sunpeng.li@amd.com>
Reviewed-by: David Francis <David.Francis@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: num of sw i2c/aux engines less than num of connectors
Hersen Wu [Tue, 21 Aug 2018 13:35:47 +0000 (09:35 -0400)]
drm/amd/display: num of sw i2c/aux engines less than num of connectors

[why]
AMD Stoney reference board, there are only 2 pipes (not include
underlay), and 3 connectors. resource creation, only
2 I2C/AUX engines are created. Within dc_link_aux_transfer, when
pin_data_en =2, refer to enengines[ddc_pin->pin_data->en] = NULL.
NULL point is referred later causing system crash.

[how]
each asic design has fixed number of ddc engines at hw side.
for each ddc engine, create its i2x/aux engine at sw side.

Signed-off-by: Hersen Wu <hersenxs.wu@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>
6 years agodrm/amd/display: add aux transition event log.
Chiawen Huang [Fri, 24 Aug 2018 09:45:28 +0000 (17:45 +0800)]
drm/amd/display: add aux transition event log.

[Why]
Enhance aux transition debugging information.

[How]
Added Aux request and reply event log.

Signed-off-by: Chiawen Huang <chiawen.huang@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>
6 years agodrm/amd/display: add disconnect_delay to dc_panel_patch
Derek Lai [Thu, 23 Aug 2018 07:13:23 +0000 (15:13 +0800)]
drm/amd/display: add disconnect_delay to dc_panel_patch

Some display need disconnect delay. Adding this parameter for future use

Signed-off-by: Derek Lai <Derek.Lai@amd.com>
Reviewed-by: Charlene Liu <Charlene.Liu@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: remove unused clk_src code
Dmytro Laktyushkin [Mon, 30 Jul 2018 18:45:42 +0000 (14:45 -0400)]
drm/amd/display: remove unused clk_src code

Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Reviewed-by: Charlene Liu <Charlene.Liu@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: remove dead dc vbios code
Dmytro Laktyushkin [Tue, 14 Aug 2018 20:12:54 +0000 (16:12 -0400)]
drm/amd/display: remove dead dc vbios code

Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Reviewed-by: Charlene Liu <Charlene.Liu@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Add driver-side parsing for CM
Jun Lei [Mon, 13 Aug 2018 19:11:44 +0000 (15:11 -0400)]
drm/amd/display: Add driver-side parsing for CM

Although 4 unique register values exist for gamma modes, two are
actually the same (the two RAMs) It’s not possible for caller to
understand this HW specific behavior, so some parsing is necessary
in driver

Signed-off-by: Jun Lei <Jun.Lei@amd.com>
Reviewed-by: Wesley Chalmers <Wesley.Chalmers@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Fix DAL217 tests modify DTN logs for other tests
Gary Kattan [Mon, 20 Aug 2018 22:12:14 +0000 (15:12 -0700)]
drm/amd/display: Fix DAL217 tests modify DTN logs for other tests

[Why]Update Code to get DTN golden log check to pass for tests run after
DAL217 tests.
[How]Change how dcn10_log_hw_state function prints HW state info
(CM_GAMUT_REMAP_Cx_Cx registers) when GAMUT REMAP is in bypass mode.

Signed-off-by: Gary Kattan <gary.kattan@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>
6 years agodrm/amd/display: Add DP YCbCr 4:2:0 support
Eric Bernstein [Thu, 24 May 2018 19:50:27 +0000 (15:50 -0400)]
drm/amd/display: Add DP YCbCr 4:2:0 support

[Why]
For supporting DP YCbCr 4:2:0 output.

[How]
Update mod_build_vsc_infopacket to support Pixel
Encoding/Colorimetry Format indication for VSC SDP rev5.

Signed-off-by: Eric Bernstein <eric.bernstein@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>
6 years agodrm/amd/display: Build stream update and plane updates in dm
Bhawanpreet Lakha [Mon, 20 Aug 2018 17:32:07 +0000 (13:32 -0400)]
drm/amd/display: Build stream update and plane updates in dm

[Why]
We currently lock modeset by setting a boolean in dm. We want to lock
Based on what DC tells us.

[How]
Build stream_updates and plane_update based on what changed. Then we
call check_update_surfaces_for_stream() to get the update type
We lock only if update_type is not fast

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@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>
6 years agodrm/amd/display: dc 3.1.64
Tony Cheng [Thu, 19 Jul 2018 00:30:09 +0000 (20:30 -0400)]
drm/amd/display: dc 3.1.64

Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: manually map the shadow BOs again
Christian König [Wed, 29 Aug 2018 12:52:50 +0000 (14:52 +0200)]
drm/amdgpu: manually map the shadow BOs again

Otherwise we won't be able to use the AGP aperture.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: use the AGP aperture for system memory access v2
Christian König [Mon, 27 Aug 2018 16:19:48 +0000 (18:19 +0200)]
drm/amdgpu: use the AGP aperture for system memory access v2

Start to use the old AGP aperture for system memory access.

v2: Move that to amdgpu_ttm_alloc_gart

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: add amdgpu_gmc_agp_location v3
Christian König [Fri, 24 Aug 2018 10:08:06 +0000 (12:08 +0200)]
drm/amdgpu: add amdgpu_gmc_agp_location v3

Helper to figure out the location of the AGP BAR.

v2: fix a couple of bugs
v3: correctly add one to vram_end

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: correctly sign extend 48bit addresses v3
Christian König [Mon, 27 Aug 2018 16:22:31 +0000 (18:22 +0200)]
drm/amdgpu: correctly sign extend 48bit addresses v3

Correct sign extend the GMC addresses to 48bit.

v2: sign extending turned out easier than thought.
v3: clean up the defines and move them into amdgpu_gmc.h as well

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: improve VM state machine documentation v2
Christian König [Thu, 30 Aug 2018 08:27:15 +0000 (10:27 +0200)]
drm/amdgpu: improve VM state machine documentation v2

Since we have a lot of FAQ on the VM state machine try to improve the
documentation by adding functions for each state move.

v2: fix typo in amdgpu_vm_bo_invalidated, use amdgpu_vm_bo_relocated in
    one more place as well.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: fix amdgpu_mn_unlock() in the CS error path
Christian König [Mon, 3 Sep 2018 08:51:51 +0000 (10:51 +0200)]
drm/amdgpu: fix amdgpu_mn_unlock() in the CS error path

Avoid unlocking a lock we never locked.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: separate per VM BOs from normal in the moved state
Christian König [Sat, 1 Sep 2018 11:25:31 +0000 (13:25 +0200)]
drm/amdgpu: separate per VM BOs from normal in the moved state

Allows us to avoid taking the spinlock in more places.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: move size calculations to the front of the file again
Christian König [Thu, 30 Aug 2018 08:31:52 +0000 (10:31 +0200)]
drm/amdgpu: move size calculations to the front of the file again

amdgpu_vm_bo_* functions should come much later.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: correct data type to support under voltage
Evan Quan [Thu, 30 Aug 2018 04:38:45 +0000 (12:38 +0800)]
drm/amd/powerplay: correct data type to support under voltage

For under voltage, negative value will be applied to voltage
offset. Update the data type to cover this case.

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>
6 years agodrm/amd/powerplay: added vega20 overdrive support V3
Evan Quan [Wed, 29 Aug 2018 06:38:50 +0000 (14:38 +0800)]
drm/amd/powerplay: added vega20 overdrive support V3

Added vega20 overdrive support based on existing OD sysfs
APIs. However, the OD logics are simplified on vega20. So,
the behavior will be a little different and works only on
some limited levels.

V2: fix typo
    fix commit description
    revise error logs
    add support for clock OD

V3: separate clock from voltage OD settings

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>
6 years agodrm/amdgpu/gmc9: don't keep stolen memory on vega20
Alex Deucher [Thu, 30 Aug 2018 14:46:27 +0000 (09:46 -0500)]
drm/amdgpu/gmc9: don't keep stolen memory on vega20

Vega20 does not appear to be affected by the same issue
as vega10.  Enable the full stolen memory handling on
vega20.  Reserve the appropriate size at init time to avoid
display artifacts and then free it at the end of init once
the new FB is up and running.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/gmc9: don't keep stolen memory on vega12
Alex Deucher [Thu, 30 Aug 2018 14:44:31 +0000 (09:44 -0500)]
drm/amdgpu/gmc9: don't keep stolen memory on vega12

vega12 does not appear to be affected by the same issue
as vega10.  Enable the full stolen memory handling on
vega12.  Reserve the appropriate size at init time to avoid
display artifacts and then free it at the end of init once
the new FB is up and running.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/gmc9: don't keep stolen memory on Raven
Alex Deucher [Thu, 30 Aug 2018 14:41:12 +0000 (09:41 -0500)]
drm/amdgpu/gmc9: don't keep stolen memory on Raven

Raven does not appear to be affected by the same issue
as vega10.  Enable the full stolen memory handling on
Raven.  Reserve the appropriate size at init time to avoid
display artifacts and then free it at the end of init once
the new FB is up and running.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=106639
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/gmc9: rework stolen vga memory handling
Alex Deucher [Thu, 30 Aug 2018 14:31:56 +0000 (09:31 -0500)]
drm/amdgpu/gmc9: rework stolen vga memory handling

No functional change, just rework it in order to adjust the
behavior on a per asic level.  The problem is that on vega10,
something corrupts the lower 8 MB of vram on the second
resume from S3.  This does not seem to affect Raven, other
gmc9 based asics need testing.

Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: fix idle state and bulk_moveable flag
Christian König [Fri, 31 Aug 2018 09:08:06 +0000 (11:08 +0200)]
drm/amdgpu: fix idle state and bulk_moveable flag

Add BOs to the idle state again and correctly clear the flag when
new BOs are added.

Signed-off-by: Christian König <christian.koenig@amd.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: fix "use bulk moves for efficient VM LRU handling" v2
Christian König [Thu, 30 Aug 2018 08:04:53 +0000 (10:04 +0200)]
drm/amdgpu: fix "use bulk moves for efficient VM LRU handling" v2

First step to fix the LRU corruption, we accidentially tried to move things
on the LRU after dropping the lock.

Signed-off-by: Christian König <christian.koenig@amd.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: fix ttm_bo_bulk_move_helper
Christian König [Fri, 31 Aug 2018 13:06:35 +0000 (15:06 +0200)]
drm/ttm: fix ttm_bo_bulk_move_helper

Staring at the function for six hours, just to essentially move one line
of code. The problem was that the first list_cut_position call could result
in list2 pointing to la-la-land.

Signed-off-by: Christian König <christian.koenig@amd.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Use drm_dev_unplug in PCI .remove
Andrey Grodzovsky [Thu, 30 Aug 2018 15:24:17 +0000 (11:24 -0400)]
drm/amdgpu: Use drm_dev_unplug in PCI .remove

This at least allows to fail any subsequent IOCTLs with -ENODEV
after the device is gone.
Still this operation is not supported yet in graphic mode
and will lead at least to page faults and other issues.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Revert "kmap PDs/PTs in amdgpu_vm_update_directories"
Christian König [Thu, 30 Aug 2018 07:45:07 +0000 (09:45 +0200)]
drm/amdgpu: Revert "kmap PDs/PTs in amdgpu_vm_update_directories"

This reverts commit a7f91061c60ad9cac2e6a03b642be6a4f88b3662.

Felix pointed out that we need to have the BOs mapped even before
amdgpu_vm_update_directories is called.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: put GART away from VRAM v2
Christian König [Fri, 24 Aug 2018 08:48:12 +0000 (10:48 +0200)]
drm/amdgpu: put GART away from VRAM v2

Always try to put the GART away from where VRAM is.

v2: correctly handle the 4GB limitation

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: add missing CHIP_HAINAN in amdgpu_ucode_get_load_type
Alex Deucher [Tue, 28 Aug 2018 19:16:23 +0000 (14:16 -0500)]
drm/amdgpu: add missing CHIP_HAINAN in amdgpu_ucode_get_load_type

This caused a confusing error message, but there is functionally
no problem since the default method is DIRECT.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm/amdgpu: Relocate some definitions v2
Amber Lin [Wed, 29 Aug 2018 17:39:16 +0000 (12:39 -0500)]
drm/amdgpu: Relocate some definitions v2

Move some KFD-related (but used in amdgpu_drv.c) definitions from
kfd_priv.h to kgd_kfd_interface.h so we don't need to include kfd_priv.h
in amdgpu_drv.c. This fixes a build failure when AMDGPU is enabled but
MMU_NOTIFIER is not.
This patch also disables KFD-related module options when HSA_AMD is not
enabled.

v2: rebase (Alex)

Signed-off-by: Amber Lin <Amber.Lin@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: remove redundant memset
Philip Yang [Wed, 29 Aug 2018 14:53:23 +0000 (10:53 -0400)]
drm/amdgpu: remove redundant memset

kvmalloc_array uses __GFP_ZERO flag ensures that the returned address
is zeroed already, memset it to zero again afterwards is unnecessary,
and in this case buggy because we only clear the first entry.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: Initialize local lists in ttm_bo_bulk_move_helper
Michel Dänzer [Tue, 28 Aug 2018 16:56:29 +0000 (18:56 +0200)]
drm/ttm: Initialize local lists in ttm_bo_bulk_move_helper

The first parameter of list_cut_position() must point to an initialized
list.

Noticed thanks to KASAN pointing out something's fishy here.

Fixes: "drm/ttm: add bulk move function on LRU"
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: use the smaller hole for GART
Christian König [Fri, 24 Aug 2018 07:40:10 +0000 (09:40 +0200)]
drm/amdgpu: use the smaller hole for GART

Instead of the larger one use the smaller hole in the MC address
space for the GART mappings.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoRevert "drm/amdgpu: move PD/PT bos on LRU again"
Michel Dänzer [Wed, 29 Aug 2018 09:59:38 +0000 (11:59 +0200)]
Revert "drm/amdgpu: move PD/PT bos on LRU again"

This reverts commit 31625ccae4464b61ec8cdb9740df848bbc857a5b.

It triggered various badness on my development machine when running the
piglit gpu profile with radeonsi on Bonaire, looks like memory
corruption due to insufficiently protected list manipulations.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: distinct between allocated GART space and GMC addr
Christian König [Mon, 27 Aug 2018 11:51:27 +0000 (13:51 +0200)]
drm/amdgpu: distinct between allocated GART space and GMC addr

Most of the time we only need to know if the BO has a valid GMC addr.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: stop using gart_start as offset for the GTT domain
Christian König [Mon, 27 Aug 2018 11:12:19 +0000 (13:12 +0200)]
drm/amdgpu: stop using gart_start as offset for the GTT domain

Further separate GART and GTT domain.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: fix amdgpu_gmc_gart_location a little bit
Christian König [Thu, 23 Aug 2018 18:38:52 +0000 (20:38 +0200)]
drm/amdgpu: fix amdgpu_gmc_gart_location a little bit

Improve the VCE limitation handling.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: move amdgpu_device_(vram|gtt)_location
Christian König [Thu, 23 Aug 2018 13:20:43 +0000 (15:20 +0200)]
drm/amdgpu: move amdgpu_device_(vram|gtt)_location

Move that into amdgpu_gmc.c since we are really deadling with GMC
address space here.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: remove amdgpu_bo_gpu_accessible
Christian König [Tue, 28 Aug 2018 11:44:32 +0000 (13:44 +0200)]
drm/amdgpu: remove amdgpu_bo_gpu_accessible

Not used any more.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdkfd: Release an acquired process vm
Oak Zeng [Mon, 27 Aug 2018 19:18:36 +0000 (15:18 -0400)]
drm/amdkfd: Release an acquired process vm

For compute vm acquired from amdgpu, vm.pasid is managed
by kfd. Decouple pasid from such vm on process destroy
to avoid duplicate pasid release.

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>
6 years agodrm/amdgpu: Set pasid for compute vm (v2)
Oak Zeng [Wed, 29 Aug 2018 17:33:52 +0000 (12:33 -0500)]
drm/amdgpu: Set pasid for compute vm (v2)

To make a amdgpu vm to a compute vm, the old pasid will be freed and
replaced with a pasid managed by kfd. Kfd can't reuse original pasid
allocated by amdgpu because kfd uses different pasid policy with amdgpu.
For example, all graphic devices share one same pasid in a process.

v2: rebase (Alex)

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>
6 years agodrm/amdgpu: Only retrieve GPU address of GART table after pinning it
Michel Dänzer [Tue, 28 Aug 2018 09:26:17 +0000 (11:26 +0200)]
drm/amdgpu: Only retrieve GPU address of GART table after pinning it

Doing it earlier hits a WARN_ON_ONCE in amdgpu_bo_gpu_offset.

Fixes: "drm/amdgpu: remove gart.table_addr"
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Need to set moved to true when evict bo
Emily Deng [Tue, 28 Aug 2018 12:52:40 +0000 (20:52 +0800)]
drm/amdgpu: Need to set moved to true when evict bo

Fix the VMC page fault when the running sequence is as below:
1.amdgpu_gem_create_ioctl
2.ttm_bo_swapout->amdgpu_vm_bo_invalidate, as not called
amdgpu_vm_bo_base_init, so won't called
list_add_tail(&base->bo_list, &bo->va). Even the bo was evicted,
it won't set the bo_base->moved.
3.drm_gem_open_ioctl->amdgpu_vm_bo_base_init, here only called
list_move_tail(&base->vm_status, &vm->evicted), but not set the
bo_base->moved.
4.amdgpu_vm_bo_map->amdgpu_vm_bo_insert_map, as the bo_base->moved is
not set true, the function amdgpu_vm_bo_insert_map will call
list_move(&bo_va->base.vm_status, &vm->moved)
5.amdgpu_cs_ioctl won't validate the swapout bo, as it is only in the
moved list, not in the evict list. So VMC page fault occurs.

Signed-off-by: Emily Deng <Emily.Deng@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: move full access into amdgpu_device_ip_suspend
Yintian Tao [Wed, 22 Aug 2018 09:08:13 +0000 (17:08 +0800)]
drm/amdgpu: move full access into amdgpu_device_ip_suspend

It will be more safe to make full-acess include both phase1 and phase2.
Then accessing special registeris wherever at phase1 or phase2 will not
block any shutdown and suspend process under virtualization.

Signed-off-by: Yintian Tao <yttao@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: remove extra newline when printing VM faults
Christian König [Mon, 27 Aug 2018 13:43:37 +0000 (15:43 +0200)]
drm/amdgpu: remove extra newline when printing VM faults

Looks like a copy&paste error to me.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Move KFD parameters to amdgpu (v3)
Amber Lin [Thu, 23 Aug 2018 14:52:34 +0000 (10:52 -0400)]
drm/amdgpu: Move KFD parameters to amdgpu (v3)

After merging KFD into amdgpu, move module parameters defined in KFD to
amdgpu_drv.c, where other module parameters are declared.

v2: add kernel-doc comments
v3: rebase and fix parameter variable name (Alex)

Signed-off-by: Amber Lin <Amber.Lin@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Remove CONFIG_HSA_AMD_MODULE
Amber Lin [Wed, 22 Aug 2018 21:05:33 +0000 (17:05 -0400)]
drm/amdgpu: Remove CONFIG_HSA_AMD_MODULE

After amdkfd is merged to amdgpu, CONFIG_HSA_AMD_MODULE no longer exists.

Signed-off-by: Amber Lin <Amber.Lin@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Merge amdkfd into amdgpu
Amber Lin [Wed, 22 Aug 2018 20:48:50 +0000 (16:48 -0400)]
drm/amdgpu: Merge amdkfd into amdgpu

Since KFD is only supported by single GPU driver, it makes sense to merge
amdgpu and amdkfd into one module. This patch is the initial step: merge
Kconfig and Makefile.

v2: also remove kfd from drm Kconfig

Signed-off-by: Amber Lin <Amber.Lin@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Refine gmc9 VM fault print.
Andrey Grodzovsky [Mon, 27 Aug 2018 18:17:26 +0000 (14:17 -0400)]
drm/amdgpu: Refine gmc9 VM fault print.

The fault reports the page number where the fault happend and not
the exact faulty address. Update the print message to reflect that.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Flatten unnecessary i2c functions
David Francis [Fri, 3 Aug 2018 17:24:28 +0000 (13:24 -0400)]
drm/amd/display: Flatten unnecessary i2c functions

[Why]
The dce_i2c_hw code contained four funtcions that were only
called in one place and did not have a clearly delineated
purpose.

[How]
Inline these functions, keeping the same functionality.

This is not a functional change.

The functions disable_i2c_hw_engine and release_engine_dce_hw were
pulled into their respective callers.

The most interesting part of this change is the acquire functions.
dce_i2c_hw_engine_acquire_engine was pulled into
dce_i2c_engine_acquire_hw, and dce_i2c_engine_acquire_hw was pulled
into acquire_i2c_hw_engine.

Some notes to show that this change is not functional:
-Failure conditions in any function resulted in a cascade of calls that
ended in a 'return NULL'.
Those are replaced with a direct 'return NULL'.

-The variable result is the one from dce_i2c_hw_engine_acquire_engine.
The boolean result used as part of return logic was removed.

-As the second half of dce_i2c_hw_engine_acquire_engine is only executed
if that function is returning true and therefore exiting the do-while
loop in dce_i2c_engine_acquire_hw, those lines were moved outside
of the loop.

Signed-off-by: David Francis <David.Francis@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: support 48 MHZ refclk off
Eric Yang [Wed, 15 Aug 2018 21:35:50 +0000 (17:35 -0400)]
drm/amd/display: support 48 MHZ refclk off

[Why]
On PCO and up, whenever SMU receive message to indicate active
display count = 0. SMU will turn off 48MHZ TMDP reference clock
by writing to 1 TMDP_48M_Refclk_Driver_PWDN. Once this clock is
off, no PHY register will respond to register access. This means
our current sequence of notifying display count along with requesting
clock will cause driver to hang when accessing PHY registers after
displays count goes to 0.

[How]
Separate the PPSMC_MSG_SetDisplayCount message from the SMU messages
that request clocks, have display own sequencing of this message so
that we can send it at the appropriate time.
Do not redundantly power off HW when entering S3, S4, since display
should already be called to disable all streams. And ASIC soon be
powered down.

Signed-off-by: Eric Yang <Eric.Yang2@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Remove redundant i2c structs
David Francis [Fri, 3 Aug 2018 18:25:19 +0000 (14:25 -0400)]
drm/amd/display: Remove redundant i2c structs

[Why]
The i2c code contains two structs that contain the same
information as i2c_payload

[How]
Replace references to those structs with references to
i2c_payload

dce_i2c_transaction_request->status was written to but never read,
so all references to it are removed

Signed-off-by: David Francis <David.Francis@amd.com>
Reviewed-by: Jordan Lazare <Jordan.Lazare@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Support reading hw state from debugfs file
Nicholas Kazlauskas [Wed, 15 Aug 2018 16:00:23 +0000 (12:00 -0400)]
drm/amd/display: Support reading hw state from debugfs file

[Why]

Logging hardware state can be done by triggering a write to the
debugfs file. It would also be useful to be able to read the hardware
state from the debugfs file to be able to generate a clean log without
timestamps.

[How]

Usage: cat /sys/kernel/debug/dri/0/amdgpu_dm_dtn_log

Threading is an obvious concern when dealing with multiple debugfs
operations and blocking on global state in dm or dc seems unfavorable.

Adding an extra parameter for the debugfs log context state is the
implementation done here. Existing code that made use of DTN_INFO
and its associated macros needed to be refactored to support this.

We don't know the size of the log in advance so it reallocates the
log string dynamically. Once the log has been generated it's copied
into the user supplied buffer for the debugfs. This allows for seeking
support but it's worth nothing that unlike triggering output via
dmesg the hardware state might change in-between reads if your buffer
size is too small.

Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: Jordan Lazare <Jordan.Lazare@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Improve spelling, grammar, and formatting of amdgpu_dm.c comments
David Francis [Wed, 15 Aug 2018 18:38:30 +0000 (14:38 -0400)]
drm/amd/display: Improve spelling, grammar, and formatting of amdgpu_dm.c comments

[Why]
Good spelling and grammar makes comments
more pleasant and clearer.

Linux has coding standards for comments
that we should try to follow.

[How]
Fix obvious spelling and grammar issues

Ensure all comments use '/*' and '*/' and multi-line comments
follow linux convention

Remove line-of-stars comments that do not separate sections
of code and comments referring to lines of code that have
since been removed

Signed-off-by: David Francis <David.Francis@amd.com>
Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Fix memory leak caused by missed dc_sink_release
SivapiriyanKumarasamy [Wed, 15 Aug 2018 20:55:18 +0000 (16:55 -0400)]
drm/amd/display: Fix memory leak caused by missed dc_sink_release

[Why]
There is currently an intermittent hang from a memory leak in
DTN stress testing. It is caused by unfreed memory during driver
disable.

[How]
Do a dc_sink_release in the case that skips it incorrectly.

Signed-off-by: SivapiriyanKumarasamy <sivapiriyan.kumarasamy@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: eliminate long wait between register polls on Maximus
Ken Chalmers [Fri, 10 Aug 2018 19:51:59 +0000 (15:51 -0400)]
drm/amd/display: eliminate long wait between register polls on Maximus

[Why]
Now that we "scale" time delays correctly on Maximus (as of diags svn
r170115), the forced "35 ms" wait time now becomes 35 ms * 500 = 17.5
seconds, which is far too long.  Even having to repeat polling a
register once causes excessive delays on Maximus.

[How]
Just use the regular wait time passed to the generic_reg_wait()
function.  This is sufficient for Maximus now, and it also means that
there's one less "Maximus-only" code path in DAL.

Also disable the "REG_WAIT taking a while:" message on Maximus, since
things do take a while longer there and 1-2ms delays are not uncommon
(and nothing to worry about).

Signed-off-by: Ken Chalmers <ken.chalmers@amd.com>
Reviewed-by: Eric Bernstein <Eric.Bernstein@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Add support for hw_state logging via debugfs
Nicholas Kazlauskas [Tue, 14 Aug 2018 19:40:57 +0000 (15:40 -0400)]
drm/amd/display: Add support for hw_state logging via debugfs

[Why]

We have logging methods for printing hardware state for newer ASICs
but no way to trigger the log output.

[How]

Add support for triggering the output via writing to a debugfs file
entry. Log output currently goes into dmesg for convenience, but
accessing via a read should be possible later.

Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: Jordan Lazare <Jordan.Lazare@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Use non-deprecated vblank handler
Leo (Sunpeng) Li [Mon, 13 Aug 2018 21:45:05 +0000 (17:45 -0400)]
drm/amd/display: Use non-deprecated vblank handler

[Why]
drm_handle_vblank is deprecated. Use drm_crtc_handle_vblank instead.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: David Francis <David.Francis@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: dc 3.1.63
Tony Cheng [Thu, 19 Jul 2018 00:29:46 +0000 (20:29 -0400)]
drm/amd/display: dc 3.1.63

Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Reviewed-by: Steven Chiu <Steven.Chiu@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Eliminate i2c hw function pointers
David Francis [Thu, 9 Aug 2018 17:20:04 +0000 (13:20 -0400)]
drm/amd/display: Eliminate i2c hw function pointers

[Why]
The function pointers of the dce_i2c_hw struct were never
accessed from outside dce_i2c_hw.c and had only one version.
As function pointers take up space and make debugging difficult,
and they are not needed in this case, they should be removed.

[How]
Remove the dce_i2c_hw_funcs struct and make static all
functions that were previously a part of it.  Reorder
the functions in dce_i2c_hw.c.

Signed-off-by: David Francis <David.Francis@amd.com>
Reviewed-by: Sun peng Li <Sunpeng.Li@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: enable GTT PD/PT for raven v3
Christian König [Wed, 22 Aug 2018 14:44:56 +0000 (16:44 +0200)]
drm/amdgpu: enable GTT PD/PT for raven v3

Should work on Vega10 as well, but with an obvious performance hit.

Older APUs can be enabled as well, but will probably be more work.

v2: fix error checking
v3: use more general check

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: add amdgpu_gmc_get_pde_for_bo helper v2
Christian König [Wed, 22 Aug 2018 12:11:19 +0000 (14:11 +0200)]
drm/amdgpu: add amdgpu_gmc_get_pde_for_bo helper v2

Helper to get the PDE for a PD/PT.

v2: improve documentation

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: add GMC9 support for PDs/PTs in system memory
Christian König [Wed, 22 Aug 2018 10:27:05 +0000 (12:27 +0200)]
drm/amdgpu: add GMC9 support for PDs/PTs in system memory

Add the necessary handling.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@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>
6 years agodrm/amdgpu: add helper for VM PD/PT allocation parameters v3
Christian König [Mon, 27 Aug 2018 20:17:59 +0000 (15:17 -0500)]
drm/amdgpu: add helper for VM PD/PT allocation parameters v3

Add a helper function to figure them out only once.

v2: fix typo with memset
v3: rebase on kfd changes (Alex)

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@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>
6 years agodrm/amdgpu: remove extra root PD alignment
Christian König [Wed, 22 Aug 2018 13:47:37 +0000 (15:47 +0200)]
drm/amdgpu: remove extra root PD alignment

Just another leftover from radeon.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Acked-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: fix holding mn_lock while allocating memory
Christian König [Fri, 24 Aug 2018 12:48:02 +0000 (14:48 +0200)]
drm/amdgpu: fix holding mn_lock while allocating memory

We can't hold the mn_lock while allocating memory.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: amdgpu_ctx_add_fence can't fail
Christian König [Fri, 24 Aug 2018 12:23:33 +0000 (14:23 +0200)]
drm/amdgpu: amdgpu_ctx_add_fence can't fail

No more waiting for a fence done here.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Change kiq ring initialize sequence on gfx9
Rex Zhu [Wed, 22 Aug 2018 10:54:45 +0000 (18:54 +0800)]
drm/amdgpu: Change kiq ring initialize sequence on gfx9

1. initialize kiq before initialize gfx ring.
2. set kiq ring ready immediately when kiq initialize
   successfully.
3. split function gfx_v9_0_kiq_resume into two functions.
     gfx_v9_0_kiq_resume is for kiq initialize.
     gfx_v9_0_kcq_resume is for kcq initialize.

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>
6 years agodrm/amdgpu: Change kiq initialize/reset sequence on gfx8
Rex Zhu [Wed, 22 Aug 2018 09:58:31 +0000 (17:58 +0800)]
drm/amdgpu: Change kiq initialize/reset sequence on gfx8

1. initialize kiq before initialize gfx ring.
2. set kiq ring ready immediately when kiq initialize
   successfully.
3. split function gfx_v8_0_kiq_resume into two functions.
   gfx_v8_0_kiq_resume is for kiq initialize.
   gfx_v8_0_kcq_resume is for kcq initialize.

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>
6 years agodrm/amdgpu: Refine gfx_v9_0_kcq_disable function
Rex Zhu [Fri, 17 Aug 2018 08:45:16 +0000 (16:45 +0800)]
drm/amdgpu: Refine gfx_v9_0_kcq_disable function

Send all kcq unmap_queue packets and then wait for
complete.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>