platform/kernel/linux-starfive.git
5 years agodrm/amd/powerplay: move PPTable_t uses into asic level
Huang Rui [Sun, 31 Mar 2019 05:25:04 +0000 (13:25 +0800)]
drm/amd/powerplay: move PPTable_t uses into asic level

This patch moves the rest of PPTable_t uses into asic level. It's to avoid the
conflicts with different asic.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: use the table size member in the structure instead of getting...
Huang Rui [Sun, 31 Mar 2019 04:49:11 +0000 (12:49 +0800)]
drm/amd/powerplay: use the table size member in the structure instead of getting directly

This patch uses the table size member in the structure instead of getting
directly, because the table is different in each asic.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: modify smu_update_table to use SMU_TABLE_xxx as the input
Huang Rui [Sun, 31 Mar 2019 04:02:00 +0000 (12:02 +0800)]
drm/amd/powerplay: modify smu_update_table to use SMU_TABLE_xxx as the input

Table id may be different for each asic, so it's good to use this as the input
for common interface.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay/smu11: remove smu_update_table_with_arg
Alex Deucher [Mon, 22 Apr 2019 19:06:42 +0000 (14:06 -0500)]
drm/amd/powerplay/smu11: remove smu_update_table_with_arg

Nothing was using it.  Just replace with smu_update_table
which is what everything was using via a wrapper anyway.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add tables_init interface for each asic
Huang Rui [Sun, 31 Mar 2019 03:53:28 +0000 (11:53 +0800)]
drm/amd/powerplay: add tables_init interface for each asic

The smc tables defines should be in the asic level.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: init table_count for smu tables on asic level
Huang Rui [Fri, 29 Mar 2019 10:07:23 +0000 (18:07 +0800)]
drm/amd/powerplay: init table_count for smu tables on asic level

TABLE_COUNT should be inited in asic level. Because the value may be different
on each asic even on the same ip.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: introduce smu table id type to handle the smu table for each asic
Huang Rui [Fri, 29 Mar 2019 09:52:11 +0000 (17:52 +0800)]
drm/amd/powerplay: introduce smu table id type to handle the smu table for each asic

This patch introduces new smu table type, it's to handle the different smu table
defines for each asic with the same smu ip.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: introduce smu feature type to handle feature mask for each asic
Huang Rui [Thu, 30 May 2019 04:14:33 +0000 (23:14 -0500)]
drm/amd/powerplay: introduce smu feature type to handle feature mask for each asic

This patch introduces new smu feature type, it's to handle the different feature
mask defines for each asic with the same smu ip.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: introduce smu clk type to handle ppclk for each asic
Huang Rui [Sun, 24 Mar 2019 11:22:07 +0000 (19:22 +0800)]
drm/amd/powerplay: introduce smu clk type to handle ppclk for each asic

This patch introduces new smu clk type, it's to handle the different ppclk
defines for each asic with the same smu ip.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: enable sw smu driver for navi10 by default
Hawking Zhang [Mon, 1 Apr 2019 07:32:48 +0000 (15:32 +0800)]
drm/amdgpu: enable sw smu driver for navi10 by default

Navi10 will use sw smu driver for dynamic power managment,
while vega20 could also use sw smu driver when amdgpu_dpm is
set to 2

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: enable DCEFCLK dpm support
Kenneth Feng [Thu, 28 Mar 2019 09:14:42 +0000 (17:14 +0800)]
drm/amd/powerplay: enable DCEFCLK dpm support

Enabale DCEFCLK dpm on navi10

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: gfxoff-seperate the Vega20 case
Kenneth Feng [Thu, 28 Mar 2019 02:54:16 +0000 (10:54 +0800)]
drm/amd/powerplay: gfxoff-seperate the Vega20 case

seperate the Vega20 case from navi10 for gfxoff so that gfxoff
won't be allowed on Vega20

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/amdgpu: fw version check with gfxoff
Kenneth Feng [Wed, 27 Mar 2019 09:10:09 +0000 (17:10 +0800)]
drm/amd/amdgpu: fw version check with gfxoff

1. check the firmware version when enabling gfxoff
2. overwrite the pptable to make sure gfxoff is really
enabled on navi10

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd: add gfxoff support on navi10
Kenneth Feng [Wed, 27 Mar 2019 03:46:31 +0000 (11:46 +0800)]
drm/amd: add gfxoff support on navi10

add the gfxoff interface to navi10,it's disabled by default.

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add allowed feature mask for navi10
Kevin Wang [Wed, 20 Mar 2019 07:10:29 +0000 (15:10 +0800)]
drm/amd/powerplay: add allowed feature mask for navi10

add smu feature mask:
1.FEATURE_DPM_PREFETCHER_BIT
2.FEATURE_DPM_PREFETCHER_BIT
3.FEATURE_ATHUB_PG

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: optimization feature mask function for asic
Kevin Wang [Tue, 19 Mar 2019 09:20:09 +0000 (17:20 +0800)]
drm/amd/powerplay: optimization feature mask function for asic

1.change function return value type: from "unallowed" to "allowed"
2.replace feature mask number with feature macro, the code will clear.

Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: remove duplicate code from smu hw init
Kevin Wang [Tue, 19 Mar 2019 03:00:41 +0000 (11:00 +0800)]
drm/amd/powerplay: remove duplicate code from smu hw init

remove duplicate code (un-used) in smu

Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Xiaojie Yuan <xiaojie.yuan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement smc firmware v2.1 for smu11
Kevin Wang [Fri, 21 Jun 2019 15:49:22 +0000 (10:49 -0500)]
drm/amd/powerplay: implement smc firmware v2.1 for smu11

1.add smc_firmware_header_v2_1 hfirmware support, support more pptable in smc firmware.
2.optimization current pptable load framework.
3.rename read_pptable_from_vbios with setup_pptable.

Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add smu11 smu_if_version check for navi10
Kevin Wang [Mon, 11 Mar 2019 06:15:37 +0000 (14:15 +0800)]
drm/amd/powerplay: add smu11 smu_if_version check for navi10

add smu11 fw version check for navi10

Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: move the function of is_dpm_running to asic file
Kevin Wang [Tue, 5 Mar 2019 07:42:16 +0000 (15:42 +0800)]
drm/amd/powerplay: move the function of is_dpm_running to asic file

the function os is_dpm_running is aisc related function,
so move them to asic file.

Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: move the function of read_sensor to asic file
Kevin Wang [Tue, 5 Mar 2019 06:16:12 +0000 (14:16 +0800)]
drm/amd/powerplay: move the function of read_sensor to asic file

The read_sensor functions has asic related parts code,
so move them to asic file to implement.

Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: move the function of uvd&vce dpm to asic file
Kevin Wang [Thu, 30 May 2019 04:11:28 +0000 (23:11 -0500)]
drm/amd/powerplay: move the function of uvd&vce dpm to asic file

Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: move the function of get[set]_power_profile to asic file
Kevin Wang [Thu, 30 May 2019 04:09:06 +0000 (23:09 -0500)]
drm/amd/powerplay: move the function of get[set]_power_profile to asic file

The callback of get[set]_power_profile is asic related function,
so move theme into vega20_ppt file.

Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: move the funciton of conv_profile_to_workload to asic file
Kevin Wang [Mon, 4 Mar 2019 11:50:02 +0000 (19:50 +0800)]
drm/amd/powerplay: move the funciton of conv_profile_to_workload to asic file

the function of conv_profile_to_workload is asic related function,
so move them into vega20_ppt file

Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: enable power features
Kenneth Feng [Mon, 11 Mar 2019 08:06:03 +0000 (16:06 +0800)]
drm/amd/powerplay: enable power features

the below smu related power features can be enabled now.
1.Prefetcher
2.GFX DPM
3.SOCCLK DPM
4.MP0CLK DPM
5.LCLK DPM
6.GFX ULV
7.CG
8.PPT
9.TDC
10.GFX EDC
11.VR0HOT
12.Fan Control
13.Thermal Control
14.LED Display
15.MMHub PG
16.ATHub PG

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: skip od feature on navi10 for the moment
Huang Rui [Wed, 20 Feb 2019 12:20:00 +0000 (20:20 +0800)]
drm/amd/powerplay: skip od feature on navi10 for the moment

OD feature isn't enabled on navi10 so skip it for the moment.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: modify the feature mask to enable gfx/soc dpm
Huang Rui [Wed, 20 Feb 2019 12:17:23 +0000 (20:17 +0800)]
drm/amd/powerplay: modify the feature mask to enable gfx/soc dpm

So far, the gfx/soc dpm is enabled with feature mask set.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: introduce the function to load the soft pptable for navi10 (v2)
Huang Rui [Wed, 20 Feb 2019 12:12:22 +0000 (20:12 +0800)]
drm/amd/powerplay: introduce the function to load the soft pptable for navi10 (v2)

Driver is able to load soft pptable from smc bin file with this function. We
stored the soft pptable in the bottom of smc.bin that the version is v2.

v2: remove is_fw_v2_0 flag.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: smu needs to be initialized after rlc in direct mode
Huang Rui [Wed, 20 Feb 2019 12:05:11 +0000 (20:05 +0800)]
drm/amd/powerplay: smu needs to be initialized after rlc in direct mode

For gfx 10, rlc firmware loading relies on smu firmware is loaded firstly, so in
direct type, it has to load smc ucode here before rlc. And meanwhile, the smu
initialization has to move after rlc, otherwise, smu message will get failure
during the handshake with rlc and smu.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: fix the issue of checking on message mapping
Huang Rui [Wed, 20 Feb 2019 12:00:21 +0000 (20:00 +0800)]
drm/amdgpu: fix the issue of checking on message mapping

The navi10_message_map[index] scope should be in PPSMC_Message_Count not in
SMU_MSG_MAX_COUNT.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: bump smc firmware header version to v2 (v2)
Huang Rui [Wed, 20 Feb 2019 11:43:36 +0000 (19:43 +0800)]
drm/amdgpu: bump smc firmware header version to v2 (v2)

This patch bumps smc firmware header version to v2 for storing soft pptable.

v2: fix the typo, and add prints for v2 header

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: update smu11 driver if header for navi10 (v2)
Huang Rui [Wed, 13 Feb 2019 02:44:50 +0000 (10:44 +0800)]
drm/amd/powerplay: update smu11 driver if header for navi10 (v2)

This patch updates smu11 driver if header for navi10 to match 42.09.00 smu
firmware.

v2: clean up comments

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: enable backdoor smu fw loading (v2)
Kenneth Feng [Sat, 2 Feb 2019 03:43:12 +0000 (11:43 +0800)]
drm/amd/powerplay: enable backdoor smu fw loading (v2)

enable backdoor smu fw loading on navi10

v2: squash in define fix (Alex)

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: move bootup value before read pptable from vbios
Huang Rui [Thu, 31 Jan 2019 13:11:11 +0000 (21:11 +0800)]
drm/amd/powerplay: move bootup value before read pptable from vbios

In navi10, we need read the pp_table_id from bootup value, then decide whether
use load the soft pptable.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add navi10 smc ucode init and navi10 ppt functions setting
Huang Rui [Thu, 31 Jan 2019 12:49:59 +0000 (20:49 +0800)]
drm/amd/powerplay: add navi10 smc ucode init and navi10 ppt functions setting

This patch adds navi10 smc ucode init and ppt functions setting.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: set smu v11 funcs for navi10
Huang Rui [Thu, 31 Jan 2019 12:32:54 +0000 (20:32 +0800)]
drm/amd/powerplay: set smu v11 funcs for navi10

Naiv10 also uses smu v11 functions.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: introduce the navi10 pptable implementation
Huang Rui [Thu, 31 Jan 2019 11:46:26 +0000 (19:46 +0800)]
drm/amd/powerplay: introduce the navi10 pptable implementation

This patch introduces the navi10 pptable implementation, so far it is already
has firmware loading, pptable side loading, writing back to smc, and feature
mask enabling.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: fix the mp/smuio header for navi10
Huang Rui [Thu, 31 Jan 2019 13:03:24 +0000 (21:03 +0800)]
drm/amd/powerplay: fix the mp/smuio header for navi10

SMU11 should use mp11 and smuio11 headers.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: update smu 11 driver if header for navi10
Huang Rui [Thu, 31 Jan 2019 11:21:25 +0000 (19:21 +0800)]
drm/amd/powerplay: update smu 11 driver if header for navi10

This patch updates smu 11 driver if header for navi10.

UVD/VCE won't be used for navi10. Here, reverve them for vega20.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: update smu v11 ppsmc header
Huang Rui [Thu, 31 Jan 2019 11:19:48 +0000 (19:19 +0800)]
drm/amd/powerplay: update smu v11 ppsmc header

This patch updates smu v11 ppsmc header for navi10.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add to set navi ip blocks
Huang Rui [Wed, 19 Jul 2017 01:45:26 +0000 (09:45 +0800)]
drm/amdgpu: add to set navi ip blocks

Set the IPs for navi10 in early_init like other asics.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add Navi10 pci ids
Alex Deucher [Fri, 19 Apr 2019 22:58:21 +0000 (17:58 -0500)]
drm/amdgpu: add Navi10 pci ids

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: Add navi10 support to amdkfd. (v3)
Philip Cox [Thu, 30 May 2019 04:03:45 +0000 (23:03 -0500)]
drm/amdkfd: Add navi10 support to amdkfd. (v3)

KFD (kernel fusion driver) is the kernel driver
for the compute backend for usermode compute
stack.

v2: squash in updates (Alex)
v3: squash in rebase fixes (Alex)

Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
Signed-off-by: Philip Cox <Philip.Cox@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: update golden setting programming logic
Hawking Zhang [Fri, 8 Jun 2018 10:10:57 +0000 (18:10 +0800)]
drm/amdgpu: update golden setting programming logic

Since from soc15, make sure only AndMasked bit get changed
when applied or_mask

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Add navi10 kfd support for amdgpu (v3)
Hawking Zhang [Tue, 5 Mar 2019 11:59:30 +0000 (19:59 +0800)]
drm/amdgpu: Add navi10 kfd support for amdgpu (v3)

KFD (Kernel Fusion Driver) is the compute backend driver
for AMD GPUs.

v2: squash in updates (Alex)
v3: fix warnings (Alex)

Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
Signed-off-by: Philip Cox <Philip.Cox@amd.com>
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add navi10 common ip block (v3)
Hawking Zhang [Mon, 4 Mar 2019 06:07:37 +0000 (14:07 +0800)]
drm/amdgpu: add navi10 common ip block (v3)

This adds the core SOC code for navi asics.

v1: add place holder and initial basic function (Ray)
v2: add new introduced functions to avoid reference
    NULL pointer (Hawking)
v3L squash in updates (Alex)

Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: avoid to use SOC15_REG_OFFSET in static array for navi10
Hawking Zhang [Fri, 10 May 2019 16:05:13 +0000 (11:05 -0500)]
drm/amdgpu: avoid to use SOC15_REG_OFFSET in static array for navi10

Move to the header file.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add gfx v10 implementation (v10)
Hawking Zhang [Mon, 4 Mar 2019 06:41:42 +0000 (14:41 +0800)]
drm/amdgpu: add gfx v10 implementation (v10)

GFX is the graphics and compute block on the GPU.

v1: add initial gfx v10 implementation (Ray)
v2: convert to new get_vm_pde function in emit_vm_flush (Hawking)
v3: switch to new emit ib interfaces (Hawking)
v4: squash in updates (Alex)
v5: remove unused variables (Alex)
v6: v6: some golden regs moved to vbios (Alex)
v7: squash in some cleanups (Alex)
v8: squash in golden settings update (Alex)
v9: squash in whitespace fixes (Ernst Sjöstrand, Alex)
v10: squash in GDS backup size fix and GDS/GWS/OA removal rebase fixes (Hawking)

Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/mes10.1: add ip block mes10.1 (v2)
Jack Xiao [Fri, 25 Jan 2019 07:25:15 +0000 (15:25 +0800)]
drm/amdgpu/mes10.1: add ip block mes10.1 (v2)

MES takes over the scheduling capability of GFX and SDMA,
add MES as a standalone ip.

v2: squash in updates (Alex)

Acked-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/mes: enable mes on navi10 and later asic
Jack Xiao [Fri, 25 Jan 2019 06:56:01 +0000 (14:56 +0800)]
drm/amdgpu/mes: enable mes on navi10 and later asic

When amdgpu_mes is enabled and asic family is navi10 and
later asic, enable mes per device.

Acked-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/mes: add definitions of ip callback function
Jack Xiao [Fri, 25 Jan 2019 09:54:58 +0000 (17:54 +0800)]
drm/amdgpu/mes: add definitions of ip callback function

Abstract mes ip independent function layer.

Acked-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/mes: add mes header file and definition
Jack Xiao [Fri, 25 Jan 2019 06:36:23 +0000 (14:36 +0800)]
drm/amdgpu/mes: add mes header file and definition

Add dummy header file and definitions of mes.

Acked-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/mes: add amdgpu_mes driver parameter
Jack Xiao [Fri, 25 Jan 2019 06:11:35 +0000 (14:11 +0800)]
drm/amdgpu/mes: add amdgpu_mes driver parameter

amdgpu_mes, which is a driver scope parameter, is used
to whether enable mes or not.

MES (Micro Engine Scheduler) is the new on chip hw scheduling
microcontroller.  It can be used to handle queue scheduling and
preemption and priorities.

Acked-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add initial VCN2.0 support (v2)
Leo Liu [Mon, 15 Oct 2018 15:38:59 +0000 (11:38 -0400)]
drm/amdgpu: add initial VCN2.0 support (v2)

VCN (Video Core Next) is the video encode/decode block.

Porting over the same functions from VCN1.0

v2: squash in updates (Alex)

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add JPEG2.0 decode ring ib test
Leo Liu [Mon, 15 Oct 2018 20:17:27 +0000 (16:17 -0400)]
drm/amdgpu: add JPEG2.0 decode ring ib test

Add internal register offset for registers involving in ib tests

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add JPEG2.0 decode ring test
Leo Liu [Mon, 3 Dec 2018 16:42:28 +0000 (11:42 -0500)]
drm/amdgpu: add JPEG2.0 decode ring test

Use register from JPEG tile, the UVD tile reg won't work for JPEG

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add VCN2.0 decode ib test
Leo Liu [Mon, 15 Oct 2018 19:41:36 +0000 (15:41 -0400)]
drm/amdgpu: add VCN2.0 decode ib test

Add internal register offset for registers involving in ib tests

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add VCN2.0 decode ring test
Leo Liu [Wed, 17 Oct 2018 18:33:48 +0000 (14:33 -0400)]
drm/amdgpu: add VCN2.0 decode ring test

Add internal register offset for registers involving in ring tests

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add Navi10 VCN firmware support
Leo Liu [Mon, 15 Oct 2018 19:07:08 +0000 (15:07 -0400)]
drm/amdgpu: add Navi10 VCN firmware support

Add Navi10 to VCN family

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add initial support for sdma v5.0 (v6)
Hawking Zhang [Sun, 31 Mar 2019 14:13:57 +0000 (22:13 +0800)]
drm/amdgpu: add initial support for sdma v5.0 (v6)

SDMA (System DMA) is a general purpose DMA engine usable
by UMDs for transfers or the kernel for paging or GPUVM
updates.

v1: support basic funcitonalites includes rb, ib, vm,
    copy buffer and trap irq
v2: convert to use new get_vm_pde in emit_vm_flush
v3: retire amdgpu_ttm_set_active_vram_size from sdma v5
v4: retire the redundant hdp_invalidate implementation
v5: squash in updates
v6: some golden regs moved to vbios

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: set the default value of pa_sc_tile_steering_override
Hawking Zhang [Tue, 12 Jun 2018 10:31:24 +0000 (18:31 +0800)]
drm/amdgpu: set the default value of pa_sc_tile_steering_override

So userspace can access it.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add pa_sc_tile_steering_override to drm_amdgpu_info_device
Hawking Zhang [Tue, 12 Jun 2018 10:30:04 +0000 (18:30 +0800)]
drm/amdgpu: add pa_sc_tile_steering_override to drm_amdgpu_info_device

the initial/default value of pa_sc_tile_steering_override need to
be exposed to user mode driver

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: disable concurrent flushes for Navi10 v2
Christian König [Thu, 7 Feb 2019 11:10:29 +0000 (12:10 +0100)]
drm/amdgpu: disable concurrent flushes for Navi10 v2

Navi10 have a bug in the SDMA which can theoretically cause memory
corruption with concurrent VMID flushes

v2: explicitely check Navi10

Signed-off-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>
5 years agodrm/amdgpu/discovery: refactor ip list traversal
Xiaojie Yuan [Wed, 27 Mar 2019 09:58:25 +0000 (17:58 +0800)]
drm/amdgpu/discovery: refactor ip list traversal

for each ip, check whether it is needed by amdgpu driver,
if yes, record its base addresses

v2: change some DRM_INFO to DRM_DEBUG
v3: remove unused variable (Alex)

Signed-off-by: Xiaojie Yuan <xiaojie.yuan@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/discovery: add module param for ip discovery enablement
Xiaojie Yuan [Wed, 27 Mar 2019 04:39:18 +0000 (12:39 +0800)]
drm/amdgpu/discovery: add module param for ip discovery enablement

to control enablement.

Signed-off-by: Xiaojie Yuan <xiaojie.yuan@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/discovery: stop converting the units of base addresses
Xiaojie Yuan [Wed, 27 Mar 2019 12:27:20 +0000 (20:27 +0800)]
drm/amdgpu/discovery: stop converting the units of base addresses

the unit is already in dword

Signed-off-by: Xiaojie Yuan <xiaojie.yuan@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/discovery: update definition for struct die_header
Xiaojie Yuan [Wed, 27 Mar 2019 09:46:04 +0000 (17:46 +0800)]
drm/amdgpu/discovery: update definition for struct die_header

Update to latest spec.

Signed-off-by: Xiaojie Yuan <xiaojie.yuan@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/discovery: stop taking psp header into account
Xiaojie Yuan [Wed, 27 Mar 2019 04:21:40 +0000 (12:21 +0800)]
drm/amdgpu/discovery: stop taking psp header into account

psp will write a header to vram, but the value exposed in
RCC_CONFIG_MEMSIZE does not include the memory that this header is
written to. Therefore, the interpretation of the table does not need to
take the psp header into account.

Signed-off-by: Xiaojie Yuan <xiaojie.yuan@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/discovery: fix hwid for nbio
Xiaojie Yuan [Wed, 27 Mar 2019 04:19:20 +0000 (12:19 +0800)]
drm/amdgpu/discovery: fix hwid for nbio

Properly set this.

Signed-off-by: Xiaojie Yuan <xiaojie.yuan@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/discovery: use hardcoded mmRCC_CONFIG_MEMSIZE
Xiaojie Yuan [Wed, 27 Mar 2019 04:29:49 +0000 (12:29 +0800)]
drm/amdgpu/discovery: use hardcoded mmRCC_CONFIG_MEMSIZE

register base offset of nbio is not known before IP Discovery table is
parsed, so hardcode this value.

Signed-off-by: Xiaojie Yuan <xiaojie.yuan@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/discovery: add harvest info data table
Xiaojie Yuan [Thu, 21 Feb 2019 09:55:30 +0000 (17:55 +0800)]
drm/amdgpu/discovery: add harvest info data table

Add support for the harvest tables.

Signed-off-by: Xiaojie Yuan <xiaojie.yuan@amd.com>
Reviewed-by: Jack Xiao <Jack.Xiao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/discovery: update definitions of table_info and binary_header
Xiaojie Yuan [Thu, 21 Feb 2019 09:55:05 +0000 (17:55 +0800)]
drm/amdgpu/discovery: update definitions of table_info and binary_header

Use the proper definitions.

Signed-off-by: Xiaojie Yuan <xiaojie.yuan@amd.com>
Reviewed-by: Jack Xiao <Jack.Xiao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/discovery: fix calculations of some gfx info
Xiaojie Yuan [Thu, 21 Feb 2019 06:05:47 +0000 (14:05 +0800)]
drm/amdgpu/discovery: fix calculations of some gfx info

fix gfx info table handling.

Signed-off-by: Xiaojie Yuan <xiaojie.yuan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/discovery: add ip discovery initial support
Xiaojie Yuan [Thu, 20 Jun 2019 15:18:50 +0000 (10:18 -0500)]
drm/amdgpu/discovery: add ip discovery initial support

The IP discovery table lists is populated by the psp at power on
and includes all of the hw details on the board:
- List of IPs and MMIO offsets
- IP harvest details
- IP configuration details

v2: prefix struct and function names with 'amdgpu'
v3: read table binary from vram using mmMM_INDEX and mmMM_DATA
    update TABLE_BINARY_MAX_SIZE to 64kb (1 TMR)
    add 'instance_number' field per ip info
    consider endianness and replace uint8/16/32_t with u8/16/32
    initialize register base addresses
    initialize adev->gfx.config and adev->gfx.cu_info to replace gpu info fw
    get major and minor version using a single api
    don't expose internal data structures in amdgpu_discovery.h
v4: RCC_CONFIG_MEMSIZE is in MB units
    hold mmio_idx_lock while reading ip discovery binary
v5: pick out discovery.h as a cross-OS header
    do structure pointer cast directly
    consider endianness while using the member of structure
    convert base addresses to dword

at boot up, PSP BL copies ip discovery binary from VBIOS(SPIROM) image to the
top of the frame buffer (just below the reserved regions for PSP & SMU).

ip discovery data table includes the collection of each ip's identification
number, base addresses, version number, and harvest setting placeholder.

gc data table includes gfx info structure.

Signed-off-by: Xiaojie Yuan <xiaojie.yuan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: mark the partial job as preempted in mcbp unit test
Jack Xiao [Wed, 23 Jan 2019 05:54:26 +0000 (13:54 +0800)]
drm/amdgpu: mark the partial job as preempted in mcbp unit test

In mcbp unit test, the test should detect the preempted job which may
be a partial execution ib and mark it as preempted; so that the gfx
block can correctly generate PM4 frame.

Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add mcbp unit test in debugfs (v3)
Jack Xiao [Thu, 20 Jun 2019 15:17:31 +0000 (10:17 -0500)]
drm/amdgpu: add mcbp unit test in debugfs (v3)

The MCBP unit test is used to test the functionality of MCBP.
It emualtes to send preemption request and resubmit the unfinished
jobs.

v2: squash in fixes (Alex)
v3: squash in memory leak fix (Jack)

Acked-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: program for resuming preempted ib
Jack Xiao [Tue, 8 Jan 2019 07:28:52 +0000 (15:28 +0800)]
drm/amdgpu: program for resuming preempted ib

For new submission ib, CE/DE metadata should be programmed to 0;
for partially execution ib, CE/DE metadata should be restored.

Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/sdma: allocate CSA per sdma ring
Jack Xiao [Mon, 7 Jan 2019 07:28:01 +0000 (15:28 +0800)]
drm/amdgpu/sdma: allocate CSA per sdma ring

Allocate CSA for the given sdma ring.

Acked-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add ib preemption status in amdgpu_job (v2)
Jack Xiao [Thu, 17 Jan 2019 07:47:36 +0000 (15:47 +0800)]
drm/amdgpu: add ib preemption status in amdgpu_job (v2)

Add ib preemption status in amdgpu_job, so that ring level function
can detect preemption and program for resuming it.

v2: squash in fix to restore job->preamble_status back to status value (Jack)

Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: enable the static csa when mcbp enabled
Jack Xiao [Thu, 10 Jan 2019 07:50:10 +0000 (15:50 +0800)]
drm/amdgpu: enable the static csa when mcbp enabled

CSA is the Context Save Area for preemption.

Acked-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add mcbp driver parameter
Jack Xiao [Thu, 10 Jan 2019 07:43:33 +0000 (15:43 +0800)]
drm/amdgpu: add mcbp driver parameter

Add mcbp driver parameter, so that mcbp feature can be
enabled/disabled by driver parameter.

Acked-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Add new ring interface preempt_ib
Rex Zhu [Wed, 31 Oct 2018 12:21:55 +0000 (20:21 +0800)]
drm/amdgpu: Add new ring interface preempt_ib

Used to trigger preemtption

Acked-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add the trailing fence per ring
Jack Xiao [Thu, 10 Jan 2019 06:28:08 +0000 (14:28 +0800)]
drm/amdgpu: add the trailing fence per ring

The trailing fence for ring is used to track the
completion of preemption.

Acked-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Add helper function amdgpu_ring_set_preempt_cond_exec
Rex Zhu [Mon, 8 Oct 2018 06:55:42 +0000 (14:55 +0800)]
drm/amdgpu: Add helper function amdgpu_ring_set_preempt_cond_exec

can preempt the ring by setting cond_exec to false

Acked-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: enable virtual display feature for navi10
Le.Ma [Fri, 5 Jan 2018 08:21:18 +0000 (16:21 +0800)]
drm/amdgpu: enable virtual display feature for navi10

Virtual display is a pure sw implementation of KMS for use
in virtualization and for bring up and emulation.

Signed-off-by: Le.Ma <Le.Ma@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/psp11: skip ta firmware for navi10
Hawking Zhang [Sat, 16 Feb 2019 14:22:46 +0000 (22:22 +0800)]
drm/amdgpu/psp11: skip ta firmware for navi10

Not used on Navi10.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: declare navi10 asd firmware
Hawking Zhang [Sat, 16 Feb 2019 14:17:35 +0000 (22:17 +0800)]
drm/amdgpu: declare navi10 asd firmware

So the dependencies are properly handled.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: load smc ucode at first with psp while rlc auto load is supported
Huang Rui [Thu, 14 Feb 2019 11:08:22 +0000 (19:08 +0800)]
drm/amdgpu: load smc ucode at first with psp while rlc auto load is supported

This patch loades smc ucode at first with psp while rlc auto load is supported
on navi10.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: enable psp front door loading by default on navi10
Hawking Zhang [Thu, 31 Jan 2019 04:19:54 +0000 (12:19 +0800)]
drm/amdgpu: enable psp front door loading by default on navi10

Required for production hw and vddgfx.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/psp: skip mec jt when autoload is enabled
Hawking Zhang [Wed, 12 Dec 2018 17:29:53 +0000 (01:29 +0800)]
drm/amdgpu/psp: skip mec jt when autoload is enabled

When autoload is enabled, there is no need to load mec jt,
RLC will handle it automatically

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jack Xiao <Jack.Xiao@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/amdgpu: add flag to mark whether autoload is supported or not
Hawking Zhang [Wed, 12 Dec 2018 17:21:30 +0000 (01:21 +0800)]
drm/amd/amdgpu: add flag to mark whether autoload is supported or not

rlc autoload is supported since navi10

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jack Xiao <Jack.Xiao@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/psp: initialize autoload_supported flag in psp_sw_init
Hawking Zhang [Wed, 12 Dec 2018 17:23:56 +0000 (01:23 +0800)]
drm/amdgpu/psp: initialize autoload_supported flag in psp_sw_init

RLC autoload is supported since from Navi10

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jack Xiao <Jack.Xiao@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/psp: update psp gfx interface to match with psp fw (v2)
Hawking Zhang [Fri, 10 May 2019 15:58:44 +0000 (10:58 -0500)]
drm/amdgpu/psp: update psp gfx interface to match with psp fw (v2)

new psp gfx cmd is introuduced for rlc autoload

v2: rebase (Alex)

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jack Xiao <Jack.Xiao@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/psp: perform tmr_init and asd_init after loading sysdrv/sos
Hawking Zhang [Mon, 12 Nov 2018 08:33:08 +0000 (16:33 +0800)]
drm/amdgpu/psp: perform tmr_init and asd_init after loading sysdrv/sos

Since from navi10, the tmr_size should be decided by psp sos according to
toc header. Driver should issue LOAD_TOC to psp sos to get the tmr_size needed.
The allocation of tmr_size then should be done only when sos/sysdrv loading
completed

Accordingly, asd_init also move to psp_hw_start after sos fw loading to make
calling sequence consistent.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/psp: switch to use sos_offset_bytes member as sys_bin_size
Hawking Zhang [Fri, 9 Nov 2018 10:09:36 +0000 (18:09 +0800)]
drm/amdgpu/psp: switch to use sos_offset_bytes member as sys_bin_size

Navi10 will have toc built-in sos binary so that using header.ucode_size_bytes
minus sos_size_bytes actually is not sys_bin_size.

Using sos_offset_bytes works for both vega20 (psp_firmware_header_v1_0) and
navi10 (psp_firmware_header_v1_1)

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/psp: start rlc autoload after psp recieved all gfx firmware
Hawking Zhang [Wed, 24 Oct 2018 11:41:13 +0000 (19:41 +0800)]
drm/amdgpu/psp: start rlc autoload after psp recieved all gfx firmware

RLC handles firmware loading for gfx to support vddgfx feature.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/psp: add support to load TOC to psp
Hawking Zhang [Wed, 24 Oct 2018 07:25:38 +0000 (15:25 +0800)]
drm/amdgpu/psp: add support to load TOC to psp

Add support for the new load TOC command.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/psp: add structure to support load toc in psp (v2)
Hawking Zhang [Fri, 10 May 2019 15:06:19 +0000 (10:06 -0500)]
drm/amdgpu/psp: add structure to support load toc in psp (v2)

Update the psp interface for the new commands.

v2: rebase (Alex)

FIXME:
GFX_CMD_ID_PROG_REG     = 0x0000000B,   /* program regs */
GFX_CMD_ID_LOAD_TOC     = 0x0000000B,   /* Load TOC and obtain TMR size */

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/psp: support print out psp firmware header v1_1 info
Hawking Zhang [Tue, 23 Oct 2018 09:55:38 +0000 (17:55 +0800)]
drm/amdgpu/psp: support print out psp firmware header v1_1 info

Support version 1.1.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/psp: print out psp v11 ucode hdr in drm debug mode
Hawking Zhang [Tue, 23 Oct 2018 09:49:17 +0000 (17:49 +0800)]
drm/amdgpu/psp: print out psp v11 ucode hdr in drm debug mode

Print the psp header data if requested.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>