linux-2.6-microblaze.git
11 months agodrm/amdkfd: remap unaligned svm ranges that have split
Alex Sierra [Tue, 17 Oct 2023 22:08:56 +0000 (17:08 -0500)]
drm/amdkfd: remap unaligned svm ranges that have split

Split SVM ranges that have been mapped into 2MB page table entries,
require to be remap in case the split has happened in a non-aligned
VA.
[WHY]:
This condition causes the 2MB page table entries be split into 4KB
PTEs.

Signed-off-by: Alex Sierra <alex.sierra@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: Create version number for coredumps
André Almeida [Fri, 15 Sep 2023 16:44:53 +0000 (18:44 +0200)]
drm/amdgpu: Create version number for coredumps

Even if there's nothing currently parsing amdgpu's coredump files, if
we eventually have such tools they will be glad to find a version field
to properly read the file.

Create a version number to be displayed on top of coredump file, to be
incremented when the file format or content get changed.

Signed-off-by: André Almeida <andrealmeid@igalia.com>
Reviewed-by: Shashank Sharma <shashank.sharma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: Move coredump code to amdgpu_reset file
André Almeida [Fri, 15 Sep 2023 14:44:16 +0000 (16:44 +0200)]
drm/amdgpu: Move coredump code to amdgpu_reset file

Giving that we use codedump just for device resets, move it's functions
and structs to a more semantic file, the amdgpu_reset.{c, h}.

Signed-off-by: André Almeida <andrealmeid@igalia.com>
Signed-off-by: Shashank Sharma <shashank.sharma@amd.com>
Reviewed-by: Shashank Sharma <shashank.sharma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: Encapsulate all device reset info
André Almeida [Fri, 15 Sep 2023 14:38:59 +0000 (16:38 +0200)]
drm/amdgpu: Encapsulate all device reset info

To better organize struct amdgpu_device, keep all reset information
related fields together in a separated struct.

Signed-off-by: André Almeida <andrealmeid@igalia.com>
Signed-off-by: Shashank Sharma <shashank.sharma@amd.com>
Reviewed-by: Shashank Sharma <shashank.sharma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: support the port num info based on the capability flag
Shiwu Zhang [Thu, 21 Sep 2023 12:05:12 +0000 (20:05 +0800)]
drm/amdgpu: support the port num info based on the capability flag

XGMI TA will set the capability flag to indicate whether the port_num
info is supported or not. KGD checks the flag and accordingly picks up
the right buffer format and send the right command to TA to retrieve
the info.

v2: simplify the code by reusing the same statement (lijo)

Signed-off-by: Shiwu Zhang <shiwu.zhang@amd.com>
Acked-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: prepare the output buffer for GET_PEER_LINKS command
Shiwu Zhang [Wed, 20 Sep 2023 10:36:55 +0000 (18:36 +0800)]
drm/amdgpu: prepare the output buffer for GET_PEER_LINKS command

Per the xgmi ta implementation, KGD needs to fill in node_ids
in concern into the shared command output buffer rather than the
command input buffer.

Input buffer is not used for GET_PEER_LINKS command execution.

In this way, xgmi ta can reuse the node info in the output buffer
just filled in and populate the same buffer with link info directly.

Signed-off-by: Shiwu Zhang <shiwu.zhang@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: drop status query/reset for GCEA 9.4.3 and MMEA 1.8
Tao Zhou [Tue, 17 Oct 2023 11:06:24 +0000 (19:06 +0800)]
drm/amdgpu: drop status query/reset for GCEA 9.4.3 and MMEA 1.8

PMFW will be responsible for them.

v2: remove query interfaces.

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: update the xgmi ta interface header
Shiwu Zhang [Wed, 20 Sep 2023 09:05:41 +0000 (17:05 +0800)]
drm/amdgpu: update the xgmi ta interface header

Update the header file to the v20.00.00.13

v1: rename TA_COMMAND_XGMI__GET_GET_TOPOLOGY_INFO to
TA_COMMAND_XGMI__GET_TOPOLOGY_INFO

And also rename struct ta_xgmi_cmd_get_peer_link_info_output to
ta_xgmi_cmd_get_peer_link_info accordingly

v2: add structs to support xgmi GET_EXTEND_PEER_LINK command

Signed-off-by: Shiwu Zhang <shiwu.zhang@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: add set/get mca debug mode operations
Tao Zhou [Thu, 12 Oct 2023 03:22:07 +0000 (11:22 +0800)]
drm/amdgpu: add set/get mca debug mode operations

Record the debug mode status in RAS.

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: replace reset_error_count with amdgpu_ras_reset_error_count
Tao Zhou [Wed, 18 Oct 2023 09:57:25 +0000 (17:57 +0800)]
drm/amdgpu: replace reset_error_count with amdgpu_ras_reset_error_count

Simplify the code.

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: add clockgating support for NBIO v7.7.1
Li Ma [Wed, 18 Oct 2023 05:32:39 +0000 (13:32 +0800)]
drm/amdgpu: add clockgating support for NBIO v7.7.1

add clockgating support for NBIO ip 7.7.1

Signed-off-by: Li Ma <li.ma@amd.com>
Reviewed-by: Tim Huang <Tim.Huang@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: fix missing stuff in NBIO v7.11
Li Ma [Mon, 16 Oct 2023 06:36:26 +0000 (14:36 +0800)]
drm/amdgpu: fix missing stuff in NBIO v7.11

add get_clockgating_state, update_medium_grain_light_sleep and
update_medium_grain_clock_gating in nbio_v7_11_funcs
v1:
add missing funcs in nbio_v7_11.c
v2:
modify the if condition and add spport for nbio v7.11 clockgating.

Signed-off-by: Li Ma <li.ma@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: Enable RAS feature by default for APU
Stanley.Yang [Thu, 19 Oct 2023 14:49:32 +0000 (22:49 +0800)]
drm/amdgpu: Enable RAS feature by default for APU

Enable RAS feature by default for aqua vanjaram on apu
platform.

Signed-off-by: Stanley.Yang <Stanley.Yang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: fix typo for amdgpu ras error data print
Yang Wang [Thu, 19 Oct 2023 06:59:19 +0000 (14:59 +0800)]
drm/amdgpu: fix typo for amdgpu ras error data print

typo fix.

Fixes: 5b1270beb380 ("drm/amdgpu: add ras_err_info to identify RAS error source")
Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Candice Li <candice.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/amdgpu/vcn: Add RB decouple feature under SRIOV - P4
Bokun Zhang [Mon, 16 Oct 2023 16:51:00 +0000 (12:51 -0400)]
drm/amd/amdgpu/vcn: Add RB decouple feature under SRIOV - P4

- In VCN 4 SRIOV code path, add code to enable RB decouple feature

Signed-off-by: Bokun Zhang <bokun.zhang@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/amdgpu/vcn: Add RB decouple feature under SRIOV - P3
Bokun Zhang [Mon, 16 Oct 2023 16:49:58 +0000 (12:49 -0400)]
drm/amd/amdgpu/vcn: Add RB decouple feature under SRIOV - P3

- Update VCN header for RB decouple feature
- Add metadata struct, metadata will be placed after each RB

Signed-off-by: Bokun Zhang <bokun.zhang@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/amdgpu/vcn: Add RB decouple feature under SRIOV - P2
Bokun Zhang [Mon, 16 Oct 2023 16:49:11 +0000 (12:49 -0400)]
drm/amd/amdgpu/vcn: Add RB decouple feature under SRIOV - P2

- Add function to check if RB decouple is enabled under SRIOV

Signed-off-by: Bokun Zhang <bokun.zhang@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/amdgpu/vcn: Add RB decouple feature under SRIOV - P1
Bokun Zhang [Mon, 16 Oct 2023 16:48:02 +0000 (12:48 -0400)]
drm/amd/amdgpu/vcn: Add RB decouple feature under SRIOV - P1

- Update SRIOV header with RB decouple flag

Signed-off-by: Bokun Zhang <bokun.zhang@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: Fix delete nodes that have been relesed
Stanley.Yang [Thu, 19 Oct 2023 06:55:57 +0000 (14:55 +0800)]
drm/amdgpu: Fix delete nodes that have been relesed

Fix delete nodes that it has been freed.

Fixes: 5b1270beb380 ("drm/amdgpu: add ras_err_info to identify RAS error source")
Signed-off-by: Stanley.Yang <Stanley.Yang@amd.com>
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: Enable mca debug mode mode when ras enabled
Stanley.Yang [Wed, 18 Oct 2023 12:10:34 +0000 (20:10 +0800)]
drm/amdgpu: Enable mca debug mode mode when ras enabled

Enable smu_v13_0_6 mca debug mode if ras is enabled.

Changed from V1:
enable mca debug mode if ras enabled.

Signed-off-by: Stanley.Yang <Stanley.Yang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: Add UVD_VCPU_INT_EN2 to dpg sram
Hawking Zhang [Thu, 28 Sep 2023 09:05:59 +0000 (17:05 +0800)]
drm/amdgpu: Add UVD_VCPU_INT_EN2 to dpg sram

Add RAS sepcifc programming to dpg sram.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Respect CONFIG_FRAME_WARN=0 in DML2
Nathan Chancellor [Wed, 18 Oct 2023 18:45:52 +0000 (11:45 -0700)]
drm/amd/display: Respect CONFIG_FRAME_WARN=0 in DML2

display_mode_code.c is unconditionally built with
-Wframe-larger-than=2048, which causes warnings even when
CONFIG_FRAME_WARN has been set to 0, which should show no warnings.

Use the existing $(frame_warn_flag) variable, which handles this
situation. This is basically commit 25f178bbd078 ("drm/amd/display:
Respect CONFIG_FRAME_WARN=0 in dml Makefile") but for DML2.

Fixes: 7966f319c66d ("drm/amd/display: Introduce DML2")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: clean up some inconsistent indenting
Jiapeng Chong [Thu, 19 Oct 2023 03:38:26 +0000 (11:38 +0800)]
drm/amd/display: clean up some inconsistent indenting

No functional modification involved.

drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:2902 dm_resume() warn: inconsistent indenting.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=6940
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Simplify bool conversion
Yang Li [Wed, 18 Oct 2023 01:22:32 +0000 (09:22 +0800)]
drm/amd/display: Simplify bool conversion

./drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.c:4802:84-89: WARNING: conversion to bool not needed here

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=6901
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Remove unneeded semicolon
Yang Li [Wed, 18 Oct 2023 01:16:14 +0000 (09:16 +0800)]
drm/amd/display: Remove unneeded semicolon

./drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c:464:3-4: Unneeded semicolon

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=6900
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Remove duplicated include in dce110_hwseq.c
Yang Li [Wed, 18 Oct 2023 01:02:03 +0000 (09:02 +0800)]
drm/amd/display: Remove duplicated include in dce110_hwseq.c

./drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c: dce110_hwseq.h is included more than once.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=6897
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: clean up some inconsistent indentings
Yang Li [Thu, 28 Sep 2023 01:13:51 +0000 (09:13 +0800)]
drm/amd/display: clean up some inconsistent indentings

drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn35/dcn35_fpu.c:261 dcn35_update_bw_bounding_box_fpu() warn: inconsistent indenting

Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/pm: Handle non-terminated overdrive commands.
Bas Nieuwenhuizen [Tue, 17 Oct 2023 14:01:35 +0000 (16:01 +0200)]
drm/amd/pm: Handle non-terminated overdrive commands.

The incoming strings might not be terminated by a newline
or a 0.

(found while testing a program that just wrote the string
 itself, causing a crash)

Cc: stable@vger.kernel.org
Fixes: e3933f26b657 ("drm/amd/pp: Add edit/commit/show OD clock/voltage support in sysfs")
Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: Enable software RAS in vcn v4_0_3
Hawking Zhang [Thu, 28 Sep 2023 09:00:31 +0000 (17:00 +0800)]
drm/amdgpu: Enable software RAS in vcn v4_0_3

Set VCN/JPEG RAS masks to enable software RAS for
VCN and JPEG.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: define ras_reset_error_count function
Tao Zhou [Wed, 11 Oct 2023 10:36:15 +0000 (18:36 +0800)]
drm/amdgpu: define ras_reset_error_count function

Make the code architecture more simple.

v2: reuse ras_reset_error_count in ras_reset_error_status.

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdkfd:remove unused code
Jesse Zhang [Thu, 19 Oct 2023 06:39:48 +0000 (14:39 +0800)]
drm/amdkfd:remove unused code

Function svm_range_split_by_grinity is not used,
so it is removed.

Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
Suggested-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/pm: Support for getting power1_cap_min value
Ma Jun [Thu, 12 Oct 2023 01:33:45 +0000 (09:33 +0800)]
drm/amd/pm: Support for getting power1_cap_min value

Support for getting power1_cap_min value on smu13 and smu11.
For other Asics, we still use 0 as the default value.

Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: Log UE corrected by replay as correctable error
Candice Li [Wed, 18 Oct 2023 07:16:39 +0000 (15:16 +0800)]
drm/amdgpu: Log UE corrected by replay as correctable error

Support replay mode where UE could be converted to CE.

Signed-off-by: Candice Li <candice.li@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: Reserve fences for VM update
Felix Kuehling [Mon, 17 Jul 2023 19:28:52 +0000 (15:28 -0400)]
drm/amdgpu: Reserve fences for VM update

In amdgpu_dma_buf_move_notify reserve fences for the page table updates
in amdgpu_vm_clear_freed and amdgpu_vm_handle_moved. This fixes a BUG_ON
in dma_resv_add_fence when using SDMA for page table updates.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: Fix possible null pointer dereference
Felix Kuehling [Tue, 17 Oct 2023 20:51:03 +0000 (16:51 -0400)]
drm/amdgpu: Fix possible null pointer dereference

abo->tbo.resource may be NULL in amdgpu_vm_bo_update.

Fixes: 180253782038 ("drm/ttm: stop allocating dummy resources during BO creation")
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: Workaround to skip kiq ring test during ras gpu recovery
Stanley.Yang [Tue, 17 Oct 2023 13:49:09 +0000 (21:49 +0800)]
drm/amdgpu: Workaround to skip kiq ring test during ras gpu recovery

This is workaround, kiq ring test failed in suspend stage when do ras
recovery.

Signed-off-by: Stanley.Yang <Stanley.Yang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Fix a handful of spelling mistakes in dml_print output
Colin Ian King [Tue, 17 Oct 2023 08:06:16 +0000 (09:06 +0100)]
drm/amd/display: Fix a handful of spelling mistakes in dml_print output

There are a few spelling mistakes and an minor grammatical issue in
some dml_print messages. Fix these.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdkfd: clean up some inconsistent indenting
Jiapeng Chong [Fri, 13 Oct 2023 03:21:29 +0000 (11:21 +0800)]
drm/amdkfd: clean up some inconsistent indenting

No functional modification involved.

drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_svm.c:305 svm_range_free() warn: inconsistent indenting.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=6804
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Remove brackets in macro to conform to coding style
Stylon Wang [Fri, 13 Oct 2023 08:10:53 +0000 (16:10 +0800)]
drm/amd/display: Remove brackets in macro to conform to coding style

[Why]
Many of the register macros defined ind dcn32_resource.h have
extra brackets. This is not conforming to the style of those
defined in other DC header files.

[How]
Remove these brackets in dcn32_resource.h

Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Stylon Wang <stylon.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd: Read IMU FW version from scratch register during hw_init
Mario Limonciello [Fri, 13 Oct 2023 19:26:04 +0000 (14:26 -0500)]
drm/amd: Read IMU FW version from scratch register during hw_init

If the IMU version wasn't discovered from the header, such as when
the firmware was directly loaded by PSP then there is no firmware
version to show to userspace from sysfs or IOCTL.

The IMU F/W stores the version in the first scratch register though,
so fetch it in these cases to let the driver export.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd: Don't parse IMU ucode version if it won't be loaded
Mario Limonciello [Fri, 13 Oct 2023 19:26:03 +0000 (14:26 -0500)]
drm/amd: Don't parse IMU ucode version if it won't be loaded

When the IMU ucode is loaded by the PSP parsing the version that comes from
Linux will vary. Rather than showing the wrong data to kernel interface
consumers, avoid populating it in this case.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd: Move microcode init step to early_init()
Mario Limonciello [Fri, 13 Oct 2023 19:26:02 +0000 (14:26 -0500)]
drm/amd: Move microcode init step to early_init()

The intention for early init is to find any missing microcode early
and fail the driver load if it's missing.  Move this step to earlier
in driver init to match other IP blocks.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: update retry times for psp BL wait
Asad Kamal [Mon, 16 Oct 2023 14:10:34 +0000 (22:10 +0800)]
drm/amdgpu: update retry times for psp BL wait

Increase retry time for PSP BL wait, to compensate
for longer time to set c2pmsg 35 ready bit during
mode1 with RAS

Signed-off-by: Asad Kamal <asad.kamal@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd: Add missing kernel doc for prepare_suspend()
Mario Limonciello [Tue, 17 Oct 2023 19:37:43 +0000 (14:37 -0500)]
drm/amd: Add missing kernel doc for prepare_suspend()

prepare_suspend() is intended to be used for any IP blocks
that must allocate memory during the suspend sequence.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Closes: https://lore.kernel.org/all/20231017143555.6a6450fc@canb.auug.org.au/
Fixes: cb11ca3233aa ("drm/amd: Add concept of running prepare_suspend() sequence for IP blocks")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: update to the latest GC 11.5 headers
Alex Deucher [Thu, 21 Sep 2023 19:43:30 +0000 (15:43 -0400)]
drm/amdgpu: update to the latest GC 11.5 headers

Add some additional bitfields.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/pm: Fix a memory leak on an error path
Kunwu.Chan [Tue, 10 Oct 2023 06:10:39 +0000 (14:10 +0800)]
drm/amd/pm: Fix a memory leak on an error path

Add missing free on an error path.

Fixes: 511a95552ec8 ("drm/amd/pm: Add SMU 13.0.6 support")
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: Kunwu.Chan <chentao@kylinos.cn>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu/mes11: remove aggregated doorbell code
Alex Deucher [Wed, 11 Oct 2023 13:49:14 +0000 (09:49 -0400)]
drm/amdgpu/mes11: remove aggregated doorbell code

It's not enabled in hardware so the code is dead.
Remove it.

Reviewed-by: Jack Xiao <Jack.Xiao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu : Add hive ras recovery check
Asad Kamal [Thu, 5 Oct 2023 07:40:42 +0000 (15:40 +0800)]
drm/amdgpu : Add hive ras recovery check

If one of the devices in the hive detects a
fatal error, need to send ras recovery reset
message to PMFW of all devices in the hive.
For that add a flag in hive to indicate that
it's undergoing ras recovery

Signed-off-by: Asad Kamal <asad.kamal@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Add missing lines of code in dc.c
Stylon Wang [Thu, 12 Oct 2023 09:07:10 +0000 (17:07 +0800)]
drm/amd/display: Add missing lines of code in dc.c

[Why & How]
A critial part of "drm/amd/display: Fix windowed MPO video with ODM
combine for DCN32" is lost during promotion to upstream. This patch
addes the code back to dc.c.

Signed-off-by: Stylon Wang <stylon.wang@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agoRevert "drm/amdgpu: Program xcp_ctl registers as needed"
Mangesh Gadre [Wed, 11 Oct 2023 08:33:17 +0000 (16:33 +0800)]
Revert "drm/amdgpu: Program xcp_ctl registers as needed"

This reverts commit 0bdebfef3fb2b6291000765eaa9c6c8030293fce.

XCP_CTL register is programmed by firmware and
register access is protected.

Signed-off-by: Mangesh Gadre <Mangesh.Gadre@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu/umsch: add suspend and resume callback
Lang Yu [Thu, 12 Oct 2023 09:48:40 +0000 (17:48 +0800)]
drm/amdgpu/umsch: add suspend and resume callback

Add missing IP callbacks.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Veerabadhran Gopalakrishnan <Veerabadhran.Gopalakrishnan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu/pm: update SMU 13.0.0 PMFW version check
Alex Deucher [Thu, 12 Oct 2023 19:10:53 +0000 (15:10 -0400)]
drm/amdgpu/pm: update SMU 13.0.0 PMFW version check

Update the PMFW version check the the ROCm optimizations.

Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agoMerge tag 'amd-drm-next-6.7-2023-10-13' of https://gitlab.freedesktop.org/agd5f/linux...
Dave Airlie [Wed, 18 Oct 2023 06:08:07 +0000 (16:08 +1000)]
Merge tag 'amd-drm-next-6.7-2023-10-13' of https://gitlab.freedesktop.org/agd5f/linux into drm-next

amd-drm-next-6.7-2023-10-13:

amdgpu:
- DC replay fixes
- Misc code cleanups and spelling fixes
- Documentation updates
- RAS EEPROM Updates
- FRU EEPROM Updates
- IP discovery updates
- SR-IOV fixes
- RAS updates
- DC PQ fixes
- SMU 13.0.6 updates
- GC 11.5 Support
- NBIO 7.11 Support
- GMC 11 Updates
- Reset fixes
- SMU 11.5 Updates
- SMU 13.0 OD support
- Use flexible arrays for bo list handling
- W=1 Fixes
- SubVP fixes
- DPIA fixes
- DCN 3.5 Support
- Devcoredump fixes
- VPE 6.1 support
- VCN 4.0 Updates
- S/G display fixes
- DML fixes
- DML2 Support
- MST fixes
- VRR fixes
- Enable seamless boot in more cases
- Enable content type property for HDMI
- OLED fixes
- Rework and clean up GPUVM TLB flushing
- DC ODM fixes
- DP 2.x fixes
- AGP aperture fixes
- SDMA firmware loading cleanups
- Cyan Skillfish GPU clock counter fix
- GC 11 GART fix
- Cache GPU fault info for userspace queries
- DC cursor check fixes
- eDP fixes
- DC FP handling fixes
- Variable sized array fixes
- SMU 13.0.x fixes
- IB start and size alignment fixes for VCN
- SMU 14 Support
- Suspend and resume sequence rework
- vkms fix

amdkfd:
- GC 11 fixes
- GC 10 fixes
- Doorbell fixes
- CWSR fixes
- SVM fixes
- Clean up GC info enumeration
- Rework memory limit handling
- Coherent memory handling fixes
- Use partial migrations in GPU faults
- TLB flush fixes
- DMA unmap fixes
- GC 9.4.3 fixes
- SQ interrupt fix
- GTT mapping fix
- GC 11.5 Support

radeon:
- Misc code cleanups
- W=1 Fixes
- Fix possible buffer overflow
- Fix possible NULL pointer dereference

UAPI:
- Add EXT_COHERENT memory allocation flags.  These allow for system scope atomics.
  Proposed userspace: https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface/pull/88
- Add support for new VPE engine.  This is a memory to memory copy engine with advanced scaling, CSC, and color management features
  Proposed mesa MR: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25713
- Add INFO IOCTL interface to query GPU faults
  Proposed Mesa MR: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23238
  Proposed libdrm MR: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/298

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231013175758.1735031-1-alexander.deucher@amd.com
11 months agoMerge tag 'drm-habanalabs-next-2023-10-10' of https://git.kernel.org/pub/scm/linux...
Dave Airlie [Tue, 17 Oct 2023 08:07:53 +0000 (18:07 +1000)]
Merge tag 'drm-habanalabs-next-2023-10-10' of https://git./linux/kernel/git/ogabbay/linux into drm-next

This tag contains habanalabs driver changes for v6.7.

The notable changes are:

- uAPI changes:
  - Expose tsc clock sampling to better sync clock information in profiler.
  - Enhance engine error reporting in the info ioctl.
  - Block access to the eventfd operations through the control device.
  - Disable the option of the user to register multiple times with the same
    offset for timestamp dump by the driver. If a user wants to use the same
    offset in the timestamp buffer for different interrupt, it needs to first
    de-register the offset.
  - When exporting dma-buf (for p2p), force the user to specify size/offset
    in multiples of PAGE_SIZE. This is instead of the driver doing the
    rounding to PAGE_SIZE, which has caused the driver to map more memory
    than was intended by the user.

- New features and improvements:
  - Complete the move of the driver to the accel subsystem by removing the
    custom habanalabs class and major and registering to accel subsystem.
  - Move the firmware interface files to include/linux/habanalabs. This is
    a pre-requisite for upstreaming the NIC drivers of Gaudi (as they need to
    include those files).
  - Perform device hard-reset upon PCIe AXI drain event to prevent the failure
    from cascading to different IP blocks in the SoC. In secured environments,
    this is done automatically by the firmware.
  - Print device name when it is removed for better debuggability.
  - Add support for trace of dma map sgtable operations.
  - Optimize handling of user interrupts by splitting the interrupts to two
    lists. One list for fast handling and second list for handling with
    timestamp recording, which is slower.
  - Prevent double device hard-reset due to 2 adjacent H/W events.
  - Set device status 'malfunction' while in rmmod.

- Firmware related fixes:
  - Extend preboot timeout because preboot loading might take longer than
    expected in certain cases.
  - Add a protection mechanism for the Event Queue. In case it is full, the
    firmware will be able to notify about it through a dedicated interrupt.
  - Perform device hard-reset in case scrubbing of memory has failed.

- Bug fixes and code cleanups:
  - Small fixes of dma-buf handling in Gaudi2, such as handling an offset != 0,
    using the correct exported size, creation of sg table.
  - Fix spmu mask creation.
  - Fix bug in wait for cs completion for decoder workloads.
  - Cleanup Greco name from documentation.
  - Fix bug in recording timestamp during cs completion interrupt handling.
  - Fix CoreSight ETF configuration and flush logic.
  - Fix small bug in hpriv_list handling (the list that contains the private
    data per process that opens our device).

Signed-off-by: Dave Airlie <airlied@redhat.com>
# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEE7TEboABC71LctBLFZR1NuKta54AFAmUlHoQACgkQZR1NuKta
# 54DsXQf8CW+W4iWJf5UDTj/E/giu9rVRrsUsU0hhCcXbecIxRsLObYXtulENu5/u
# VuEAo/tAvo0LUKi8pdIv6ernDKaxZ1+fimlfXMCzllAA/ts3yp1NgunprsIsx3tv
# YgcJ2GNR8UlVZ1qYuZl+4dOTyD0yfRMROUXBe7wqKnUXOEepOiLBxq6W15tZiJnx
# L+V0yGkNk6pAoADIXLW9EgEXiN/bJZCXGPWp06i/Nz7cHIHJGoV59wAqftqllCtk
# 8ZMkLByjlQKPhc5AgWBtKE8EGVip3sm7b/Q2Gq0ZXdZiebyVJ+AjuuDOdtq1UCIw
# Rcp2576E7rByIBu3RAFlrioWhuR5Zw==
# =2ien
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 10 Oct 2023 19:51:00 AEST
# gpg:                using RSA key ED311BA00042EF52DCB412C5651D4DB8AB5AE780
# gpg: Can't check signature: No public key
From: Oded Gabbay <ogabbay@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/ZSUfiX4J7v4Wn0cU@ogabbay-vm-u22.habana-labs.com
11 months agoMerge tag 'drm-intel-gt-next-2023-10-12' of git://anongit.freedesktop.org/drm/drm...
Dave Airlie [Tue, 17 Oct 2023 03:46:21 +0000 (13:46 +1000)]
Merge tag 'drm-intel-gt-next-2023-10-12' of git://anongit.freedesktop.org/drm/drm-intel into drm-next

Driver Changes:

Fixes/improvements/new stuff:

- Register engines early to avoid type confusion (Mathias Krause)
- Suppress 'ignoring reset notification' message [guc] (John Harrison)
- Update 'recommended' version to 70.12.1 for DG2/ADL-S/ADL-P/MTL [guc] (John Harrison)
- Enable WA 14018913170 [guc, dg2] (Daniele Ceraolo Spurio)

Future platform enablement:

- Clean steer semaphore on resume (Nirmoy Das)
- Skip MCR ops for ring fault register [mtl] (Nirmoy Das)
- Make i915_gem_shrinker multi-gt aware [gem] (Jonathan Cavitt)
- Enable GGTT updates with binder in MTL (Nirmoy Das, Chris Wilson)
- Invalidate the TLBs on each GT (Chris Wilson)

Miscellaneous:

- Clarify type evolution of uabi_node/uabi_engines (Mathias Krause)
- Annotate struct ct_incoming_msg with __counted_by [guc] (Kees Cook)
- More use of GT specific print helpers [gt] (John Harrison)

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/ZSfKotZVdypU6NaX@tursulin-desk
11 months agoMerge tag 'drm-intel-next-2023-10-12' of git://anongit.freedesktop.org/drm/drm-intel...
Dave Airlie [Mon, 16 Oct 2023 06:44:43 +0000 (16:44 +1000)]
Merge tag 'drm-intel-next-2023-10-12' of git://anongit.freedesktop.org/drm/drm-intel into drm-next

drm/i915 feature pull #2 for v6.7:

Features and functionality:
- Preparation for i915 display code reuse in upcoming Xe driver (Jani)
- Drop the fastboot module parameter and use the platform defaults (Arun)
- Enable new LNL FBC features (Vinod)
- Add LNL display feature capability reads (Vinod)

Refactoring and cleanups:
- Locally enable W=1 warnings by default in i915 (Jani)
- Move HDCP GSC message code to a separate file (Suraj)
- GVT include cleanups (Jani)
- Move more display init under display/ (Jani)
- DPLL ID refactoring (Ville)
- Better abstraction of GT0 (Jani)
- Move VGA decode function to GMCH code (Uma)
- Use local64_try_cmpxchg() to optimize PMU event read (Uros Bizjak)
- Clean up FBC checks (Ville)
- Constify and unify state checker calling conventions (Ville)
- Add display step name helper (Chaitanya)

Documentation:
- Update CCS and GSC CS documentation (Rodrigo)
- Fix a number of documentation typos (Randy Dunlap)

Fixes:
- VLV DSI fixes and quirks (Hans)
- Fix crtc state memory leaks (Suraj)
- Increase LSPCON mode settle timeout (Niko Tsirakis)
- Stop clobbering old crtc state during state check (Ville)
- Fix VLV color state readout (Ville)
- Fix cx0 PHY pipe reset to allow S0iX (Khaled)
- Ensure DP MST pbn_div is up-to-date after sink reconnect (Imre)
- Drop an unnecessary NULL check to fix static analyzer warning (Suraj)
- Use an explicit rather than implicit include for frontbuffer tracking (Jouni)

Merges:
- Backmerge drm-next to fix a conflict (Jani)

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/87r0m00xew.fsf@intel.com
11 months agoMerge tag 'drm-misc-next-2023-10-12' of git://anongit.freedesktop.org/drm/drm-misc...
Dave Airlie [Mon, 16 Oct 2023 00:40:31 +0000 (10:40 +1000)]
Merge tag 'drm-misc-next-2023-10-12' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

drm-misc-next for v6.7-rc1:

Contains the previous pull request drm-misc-next-2023-10-06 + following:

Cross-subsystem Changes:
- Rename fb_pgprot to pgprot_framebuffer and remove file argument/
- Update iosys-map documentation typos.

Core Changes:
- Assorted fixes to drm/panel.
- Add HPD state to drm_connector_oob_hotplug_event(), and implement
  oob hotplug events in bridge connector.
- Replace drm_framebuffer_plane_width/height  with calls to
  drm_format_info_plane_width/height.

Driver Changes:
- Clock and debug fixes for bridge/samsung-dsim.
- More btree -> maple tree conversions.
- Assorted bugfixes in rockchip, panel-tpo-tpg110,
- Add LTK050H3148W-CTA6 panel support.
- Assorted small fixes in host1x, tegra, simpledrm.
- Suspend fixes for host1x.

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/3812345e-b086-4d72-8504-f58d84e8feab@linux.intel.com
11 months agodrm/amdgpu/vkms: fix a possible null pointer dereference
Ma Ke [Fri, 13 Oct 2023 01:53:43 +0000 (09:53 +0800)]
drm/amdgpu/vkms: fix a possible null pointer dereference

In amdgpu_vkms_conn_get_modes(), the return value of drm_cvt_mode()
is assigned to mode, which will lead to a NULL pointer dereference
on failure of drm_cvt_mode(). Add a check to avoid null pointer
dereference.

Signed-off-by: Ma Ke <make_ruc2021@163.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/swsmu: update smu v14_0_0 header files and metrics table
Li Ma [Wed, 11 Oct 2023 14:51:50 +0000 (22:51 +0800)]
drm/amd/swsmu: update smu v14_0_0 header files and metrics table

Update driver if, pmfw and ppsmc header files.
Add new gpu_metrics_v3_0 for metrics table updated in driver if
and reserve legacy metrics table to maintain backward compatibility.
---
v1:
Update header files and add gpu_metrics_v3_0.
v2:
Update smu_types.h, smu headers and drop smu_cmn_get_smc_version in smu v14_0_0.

Signed-off-by: Li Ma <li.ma@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: add RAS error info support for umc_v12_0
Yang Wang [Wed, 27 Sep 2023 03:31:16 +0000 (11:31 +0800)]
drm/amdgpu: add RAS error info support for umc_v12_0

add RAS error info support for umc_v12_0.

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: add RAS error info support for mmhub_v1_8
Yang Wang [Wed, 27 Sep 2023 04:21:12 +0000 (12:21 +0800)]
drm/amdgpu: add RAS error info support for mmhub_v1_8

add RAS error info support for mmhub_v1_8.

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: add RAS error info support for gfx_v9_4_3
Yang Wang [Wed, 27 Sep 2023 04:02:28 +0000 (12:02 +0800)]
drm/amdgpu: add RAS error info support for gfx_v9_4_3

add RAS error info support for gfx_v9_4_3.

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: add RAS error info support for sdma_v4_4_2.
Yang Wang [Wed, 27 Sep 2023 03:39:30 +0000 (11:39 +0800)]
drm/amdgpu: add RAS error info support for sdma_v4_4_2.

add RAS error info support for sdma_v4_4_2.

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: add ras_err_info to identify RAS error source
Yang Wang [Mon, 25 Sep 2023 11:30:26 +0000 (19:30 +0800)]
drm/amdgpu: add ras_err_info to identify RAS error source

introduced "ras_err_info" to better identify a RAS ERROR source.

NOTE:
For legacy chips, keep the original RAS error print format.

v1:
RAS errors may come from different dies during a RAS error query,
therefore, need a new data structure to identify the source of RAS ERROR.

v2:
- use new data structure 'amdgpu_smuio_mcm_config_info' instead of
  ras_err_id (in v1 patch)
- refine ras error dump function name
- refine ras error dump log format

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: flush the correct vmid tlb for specific pasid
Yifan Zhang [Thu, 12 Oct 2023 07:27:39 +0000 (15:27 +0800)]
drm/amdgpu: flush the correct vmid tlb for specific pasid

flush the correct vmid tlb for specific pasid on gmc 11.

Fixes: 041a5743883d ("drm/amdgpu: fix and cleanup gmc_v11_0_flush_gpu_tlb_pasid")
Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: make err_data structure built-in for ras_manager
Yang Wang [Wed, 11 Oct 2023 06:09:20 +0000 (14:09 +0800)]
drm/amdgpu: make err_data structure built-in for ras_manager

(No effect outside the ras_mgr data structure)

Since a new member was added to the ras_err_data data structure,
it becomes unreasonable for the ras_mgr instance to contain this data,
because ras mgr only uses the 2 member information of ue_count/ce_count in err_data.

This patch changes the code err_data into built-in structure members,
making the code directly compatible.

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: disable GFXOFF and PG during compute for GFX9
Jesse Zhang [Fri, 13 Oct 2023 01:28:44 +0000 (09:28 +0800)]
drm/amdgpu: disable GFXOFF and PG during compute for GFX9

Temporary workaround to fix issues observed in some compute
applications when GFXOFF is enabled on GFX9.

Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu/umsch: fix missing stuff during rebase
Lang Yu [Wed, 11 Oct 2023 09:08:34 +0000 (17:08 +0800)]
drm/amdgpu/umsch: fix missing stuff during rebase

These are missed during rebase.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Veerabadhran Gopalakrishnan <Veerabadhran.Gopalakrishnan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu/umsch: correct IP version format
Lang Yu [Thu, 12 Oct 2023 04:27:01 +0000 (12:27 +0800)]
drm/amdgpu/umsch: correct IP version format

FW uses IP_VERSION_MAJ_MIN_REV format.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Veerabadhran Gopalakrishnan <Veerabadhran.Gopalakrishnan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: don't use legacy invalidation on MMHUB v3.3
Lang Yu [Wed, 11 Oct 2023 05:03:46 +0000 (13:03 +0800)]
drm/amdgpu: don't use legacy invalidation on MMHUB v3.3

Legacy invalidation is not supported.
This is missed during rebase.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: correct NBIO v7.11 programing
Lang Yu [Thu, 12 Oct 2023 06:30:40 +0000 (14:30 +0800)]
drm/amdgpu: correct NBIO v7.11 programing

Use v7.7 before, switch to v7.11 now.
Fix incorrect programing.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/radeon: fix a possible null pointer dereference
Ma Ke [Wed, 11 Oct 2023 01:21:43 +0000 (09:21 +0800)]
drm/radeon: fix a possible null pointer dereference

In radeon_tv_get_modes(), the return value of drm_cvt_mode()
is assigned to mode, which will lead to a NULL pointer
dereference on failure of drm_cvt_mode(). Add a check to
avoid null point dereference.

Signed-off-by: Ma Ke <make_ruc2021@163.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: Correctly use bo_va->ref_count in compute VMs
Xiaogang Chen [Thu, 12 Oct 2023 20:48:06 +0000 (15:48 -0500)]
drm/amdgpu: Correctly use bo_va->ref_count in compute VMs

This is needed to correctly handle BOs imported into compute VM from gfx.
Both kfd and gfx should use same bo_va and set bo_va->ref_count correctly
when map the Bos into same VM, otherwise we may trigger kernel general
protection when iterate mappings over bo_va's valids or invalids list.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Xiaogang Chen <Xiaogang.Chen@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ramesh Errabolu <Ramesh.Errabolu@amd.com>
Tested-by: Xiaogang Chen <Xiaogang.Chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/pm: Add P2S tables for SMU v13.0.6
Lijo Lazar [Wed, 11 Oct 2023 14:27:38 +0000 (19:57 +0530)]
drm/amd/pm: Add P2S tables for SMU v13.0.6

Add P2S table load support on SMU v13.0.6 ASICs.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: Add support to load P2S tables
Lijo Lazar [Wed, 11 Oct 2023 14:26:21 +0000 (19:56 +0530)]
drm/amdgpu: Add support to load P2S tables

Add support to load P2S tables through PSP.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: Update PSP interface header
Lijo Lazar [Wed, 11 Oct 2023 14:13:56 +0000 (19:43 +0530)]
drm/amdgpu: Update PSP interface header

Adds FW id for P2S table.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: Avoid FRU EEPROM access on APU
Lijo Lazar [Thu, 12 Oct 2023 07:33:22 +0000 (13:03 +0530)]
drm/amdgpu: Avoid FRU EEPROM access on APU

FRU EEPROM access is not valid for APU devices.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: save VCN instances init info before jpeg init
Lin.Cao [Tue, 10 Oct 2023 08:58:31 +0000 (16:58 +0800)]
drm/amdgpu: save VCN instances init info before jpeg init

JPEG init header will overwirte vcn init header info which will loss
some debug information

Signed-off-by: Lin.Cao <lincao12@amd.com>
Reviewed-by: Jingwen Chen <Jingwen.Chen2@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agoRevert "drm/amd/display: Skip entire amdgpu_dm build if !CONFIG_DRM_AMD_DC"
Alex Hung [Wed, 11 Oct 2023 19:24:00 +0000 (13:24 -0600)]
Revert "drm/amd/display: Skip entire amdgpu_dm build if !CONFIG_DRM_AMD_DC"

This reverts commit 1b097bcd224e76807b66ef32cee76a3e87271a2b.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agoRevert "drm/amd/display: Create one virtual connector in DC"
Alex Hung [Wed, 11 Oct 2023 19:23:07 +0000 (13:23 -0600)]
Revert "drm/amd/display: Create one virtual connector in DC"

This reverts commit 554340133e4f596fc40fd75a58f9cf18b6b8dbbc.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agoRevert "drm/amd/display: Disable virtual links"
Alex Hung [Wed, 11 Oct 2023 19:23:05 +0000 (13:23 -0600)]
Revert "drm/amd/display: Disable virtual links"

This reverts commit b22c336268e477e3e8fc21e7d6b18fa8c4cd1f9a.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agoRevert "drm/amd/display: Initialize writeback connector"
Alex Hung [Wed, 11 Oct 2023 19:21:50 +0000 (13:21 -0600)]
Revert "drm/amd/display: Initialize writeback connector"

This reverts commit a2830b9e852f4007f7ee53f2c5765ab07ddb55e2.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agoRevert "drm/amd/display: Skip writeback connector when we get amdgpu_dm_connector"
Alex Hung [Wed, 11 Oct 2023 19:21:49 +0000 (13:21 -0600)]
Revert "drm/amd/display: Skip writeback connector when we get amdgpu_dm_connector"

This reverts commit 30a24318cc8f4947c6567c78997c8deb546e7a0b.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agoRevert "drm/amd/display: Return drm_connector from find_first_crtc_matching_connector"
Alex Hung [Wed, 11 Oct 2023 19:21:48 +0000 (13:21 -0600)]
Revert "drm/amd/display: Return drm_connector from find_first_crtc_matching_connector"

This reverts commit ca2b37a1c249d05f21eeb7522489036efbc6c7f8.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agoRevert "drm/amd/display: Use drm_connector in create_stream_for_sink"
Alex Hung [Wed, 11 Oct 2023 19:21:47 +0000 (13:21 -0600)]
Revert "drm/amd/display: Use drm_connector in create_stream_for_sink"

This reverts commit 5d91801870ba0ba23d90885edf0821634ecd405d.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/pm: drop most smu_cmn_get_smc_version in smu
Yifan Zhang [Tue, 10 Oct 2023 13:43:40 +0000 (21:43 +0800)]
drm/amd/pm: drop most smu_cmn_get_smc_version in smu

smu_check_fw_version is called in smu hw init, thus smu if version
and version are garenteed to be stored in smu context. No need to
call smu_cmn_get_smc_version again after system boot up.

Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com>
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/pm: Add reset option for fan_ctrl on smu 13.0.7
Ma Jun [Wed, 13 Sep 2023 08:54:58 +0000 (16:54 +0800)]
drm/amd/pm: Add reset option for fan_ctrl on smu 13.0.7

Add reset option for fan_ctrl interfaces on the smu v13.0.7
User can use command "echo r > interface_name" to reset the
interface to boot value

Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/pm: Add reset option for fan_ctrl interfaces
Ma Jun [Wed, 13 Sep 2023 06:25:38 +0000 (14:25 +0800)]
drm/amd/pm: Add reset option for fan_ctrl interfaces

Add reset option for fan_ctrl interfaces.

For example:
User can use the "echo r > acoustic_limit_rpm_threshold" command
to reset acoustic_limit_rpm_threshold to boot value

Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agoRevert "drm/amd/display: Create amdgpu_dm_wb_connector"
Alex Hung [Wed, 11 Oct 2023 19:18:48 +0000 (13:18 -0600)]
Revert "drm/amd/display: Create amdgpu_dm_wb_connector"

This reverts commit a5f9523c9ca352d6454e81ff9e9a4419f457210a.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agoRevert "drm/amd/display: Create fake sink and stream for writeback connector"
Alex Hung [Wed, 11 Oct 2023 19:18:47 +0000 (13:18 -0600)]
Revert "drm/amd/display: Create fake sink and stream for writeback connector"

This reverts commit 01aaeb8c23301194ee063d89c06eae41599698af.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agoRevert "drm/amd/display: Hande writeback request from userspace"
Alex Hung [Wed, 11 Oct 2023 19:18:46 +0000 (13:18 -0600)]
Revert "drm/amd/display: Hande writeback request from userspace"

This reverts commit cd1a4bc22821eea9a98f1beddd1a8d789989a720.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agoRevert "drm/amd/display: Add writeback enable/disable in dc"
Alex Hung [Wed, 11 Oct 2023 19:18:45 +0000 (13:18 -0600)]
Revert "drm/amd/display: Add writeback enable/disable in dc"

This reverts commit c6d3c7b6309726fbe93cf595d6de326fb8295a64.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agoRevert "drm/amd/display: Fix writeback_info never got updated"
Alex Hung [Wed, 11 Oct 2023 19:18:44 +0000 (13:18 -0600)]
Revert "drm/amd/display: Fix writeback_info never got updated"

This reverts commit 8a307777c36e15f38c9f23778babcd368144c7d8.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agoRevert "drm/amd/display: Validate hw_points_num before using it"
Alex Hung [Wed, 11 Oct 2023 19:18:38 +0000 (13:18 -0600)]
Revert "drm/amd/display: Validate hw_points_num before using it"

This reverts commit 58c3b3341cea4f75dc8c003b89f8a6dd8ec55e50.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agoRevert "drm/amd/display: Fix writeback_info is not removed"
Alex Hung [Wed, 11 Oct 2023 19:18:36 +0000 (13:18 -0600)]
Revert "drm/amd/display: Fix writeback_info is not removed"

This reverts commit 5b89d2ccc8466e0445a4994cb288fc009b565de5.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agoRevert "drm/amd/display: Add writeback enable field (wb_enabled)"
Alex Hung [Wed, 11 Oct 2023 19:18:34 +0000 (13:18 -0600)]
Revert "drm/amd/display: Add writeback enable field (wb_enabled)"

This reverts commit f6893fcb10c7b24526454e465f6ec2563ef044cc.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agoRevert "drm/amd/display: Setup for mmhubbub3_warmup_mcif with big buffer"
Alex Hung [Wed, 11 Oct 2023 19:18:33 +0000 (13:18 -0600)]
Revert "drm/amd/display: Setup for mmhubbub3_warmup_mcif with big buffer"

This reverts commit 428542d9177286c01ef7a3dbd026eb00567e06b1.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agoRevert "drm/amd/display: Add new set_fc_enable to struct dwbc_funcs"
Alex Hung [Wed, 11 Oct 2023 19:18:31 +0000 (13:18 -0600)]
Revert "drm/amd/display: Add new set_fc_enable to struct dwbc_funcs"

This reverts commit b79a00a4d4f8fc827ca0fc19e259913a81252f6b.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agoRevert "drm/amd/display: Disable DWB frame capture to emulate oneshot"
Alex Hung [Wed, 11 Oct 2023 19:18:24 +0000 (13:18 -0600)]
Revert "drm/amd/display: Disable DWB frame capture to emulate oneshot"

This reverts commit 77a66faaccc0455fe30e326e9a997aec8d0abed4.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Revert "drm/amd/display: Use drm_connector in create_validate_stream...
Alex Hung [Tue, 10 Oct 2023 22:39:32 +0000 (16:39 -0600)]
drm/amd/display: Revert "drm/amd/display: Use drm_connector in create_validate_stream_for_sink"

This reverts commit c4c182b5488e8d4a48be3327aab14d778cdfe5e7.

After this was commit PCON and USB4 issues were observed. A new fix will
be submitted instead.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>