]> git.ipfire.org Git - thirdparty/kernel/linux.git/log
thirdparty/kernel/linux.git
8 weeks agodrm/amdgpu: Correct xcc_id input to GET_INST from physical to logic
Likun Gao [Wed, 2 Jul 2025 05:09:22 +0000 (13:09 +0800)] 
drm/amdgpu: Correct xcc_id input to GET_INST from physical to logic

Correct xcc_id input to GET_INST from physical to logic for
gfx_v12_1.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amdgpu: Fix CP_MEC_MDBASE in multi-xcc for gfx v12_1
Michael Chen [Wed, 11 Jun 2025 15:25:37 +0000 (11:25 -0400)] 
drm/amdgpu: Fix CP_MEC_MDBASE in multi-xcc for gfx v12_1

Need to allocate memory for MEC FW data and program
registers CP_MEC_MDBASE for each XCC respectively.

Signed-off-by: Michael Chen <michael.chen@amd.com>
Acked-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Reviewed-by: Shaoyun.liu <Shaoyun.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amdgpu: Support 57bit fault address for GFX 12.1.0
Philip Yang [Wed, 2 Apr 2025 22:03:27 +0000 (18:03 -0400)] 
drm/amdgpu: Support 57bit fault address for GFX 12.1.0

The gmc fault virtual address is up to 57bit for 5 level page table,
this also works with 48bit virtual address for 4 level page table.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Acked-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amdgpu: Add pde3 table invalidation request for GFX 12.1.0
Philip Yang [Sun, 30 Mar 2025 15:03:02 +0000 (11:03 -0400)] 
drm/amdgpu: Add pde3 table invalidation request for GFX 12.1.0

Set pde3 invalidation request bit during tlb flush for up to 5 level
page table.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amdkfd: Update LDS, Scratch base for 57bit address
Philip Yang [Tue, 22 Apr 2025 20:30:02 +0000 (16:30 -0400)] 
drm/amdkfd: Update LDS, Scratch base for 57bit address

For 5-level page tables, update compute vmid sh_mem_base LDS aperture
and Scratch aperture base address to above 57-bit, use the same setting
from gfx vmid, we can remove the duplicate macro.

Update queue pdd lds_base and scratch_base to the same value as
sh_mem_base setting. Then application get process apertures return the
correct value to access LDS and Scratch memory for 57bit address 5-level
page tables. This may pass to MES in future when mapping queue.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Acked-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amdgpu: Enable 5-level page table for GFX 12.1.0
Philip Yang [Fri, 25 Apr 2025 15:08:17 +0000 (11:08 -0400)] 
drm/amdgpu: Enable 5-level page table for GFX 12.1.0

GFX 12.1.0 support 57bit virtual, 52bit physical address, set PDE
max_level to 4, min_vm_size to 128PB to enable GPU vm 5-level page
tables to support 57bit virtual address.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Acked-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amdgpu: init RS64_MEC_P2/P3_STACK for gfx12.1
Feifei Xu [Fri, 4 Jul 2025 14:12:29 +0000 (22:12 +0800)] 
drm/amdgpu: init RS64_MEC_P2/P3_STACK for gfx12.1

Add GFX12.1 MEC P2/P3 STACK firmware init.

Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amdgpu: Fix CU info calculations for GFX 12.1
Mukul Joshi [Wed, 18 Jun 2025 02:10:15 +0000 (22:10 -0400)] 
drm/amdgpu: Fix CU info calculations for GFX 12.1

This patch fixes the CU info calculations for gfx 12.1.

Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amdkfd: Update CWSR area calculations for GFX 12.1
Mukul Joshi [Fri, 10 Jan 2025 03:04:08 +0000 (22:04 -0500)] 
drm/amdkfd: Update CWSR area calculations for GFX 12.1

Update the SGPR, VGPR, HWREG size and number of waves supported
for GFX 12.1 CWSR memory limits. The CU calculation changed in
topology, as a result, the values need to be updated.

Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amdgpu: Add soc v1_0 ih client id table
Hawking Zhang [Wed, 2 Jul 2025 08:21:26 +0000 (16:21 +0800)] 
drm/amdgpu: Add soc v1_0 ih client id table

To acommandate the specific ih client for soc v1_0

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amdgpu: Flush TLB on all XCCs on GFX 12.1
Mukul Joshi [Mon, 23 Jun 2025 21:15:32 +0000 (17:15 -0400)] 
drm/amdgpu: Flush TLB on all XCCs on GFX 12.1

Currently, the driver code is flushing TLB on XCC 0 only.
Fix it by flushing on all XCCs within the partition.

Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amd/pm: restore SCLK settings after S0ix resume
mythilam [Thu, 4 Dec 2025 05:34:12 +0000 (11:04 +0530)] 
drm/amd/pm: restore SCLK settings after S0ix resume

User-configured SCLK(GPU core clock)frequencies were not persisting
across S0ix suspend/resume cycles on smu v14 hardware.
The issue occurred because of the code resetting clock frequency
to zero during resume.

This patch addresses the problem by:
- Preserving user-configured values in driver and sets the
  clock frequency across resume
- Preserved settings are sent to the hardware during resume

Signed-off-by: mythilam <mythilam@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amdgpu: do not use amdgpu_bo_gpu_offset_no_check individually
Saleemkhan Jamadar [Thu, 11 Dec 2025 17:36:53 +0000 (23:06 +0530)] 
drm/amdgpu: do not use amdgpu_bo_gpu_offset_no_check individually

This should not be used indiviually, use amdgpu_bo_gpu_offset
with bo reserved.

v3 - unpin bo in queue destroy (Christian)
v2 - pin bo so that offset returned won't change after unlock (Christian)

Signed-off-by: Saleemkhan Jamadar <saleemkhan083@gmail.com>
Suggested-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amdgpu: Change set ip clock/power gating param
Lijo Lazar [Mon, 8 Dec 2025 07:25:29 +0000 (12:55 +0530)] 
drm/amdgpu: Change set ip clock/power gating param

It's not required to use generic void *, change to struct amdgpu_device *.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amdgpu: Use helper to get ip block
Lijo Lazar [Mon, 8 Dec 2025 07:11:37 +0000 (12:41 +0530)] 
drm/amdgpu: Use helper to get ip block

Replace individual searches with the utility function get_ip_block

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amdgpu: Move ip block related functions
Lijo Lazar [Mon, 8 Dec 2025 07:02:52 +0000 (12:32 +0530)] 
drm/amdgpu: Move ip block related functions

Move ip block related functions to amdgpu_ip.c. No functional change
intended.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amdgpu: fix a job->pasid access race in gpu recovery
Alex Deucher [Wed, 10 Dec 2025 16:02:30 +0000 (11:02 -0500)] 
drm/amdgpu: fix a job->pasid access race in gpu recovery

Avoid a possible UAF in GPU recovery due to a race between
the sched timeout callback and the tdr work queue.

The gpu recovery function calls drm_sched_stop() and
later drm_sched_start().  drm_sched_start() restarts
the tdr queue which will eventually free the job.  If
the tdr queue frees the job before time out callback
completes, the job will be freed and we'll get a UAF
when accessing the pasid.  Cache it early to avoid the
UAF.

Example KASAN trace:
[  493.058141] BUG: KASAN: slab-use-after-free in amdgpu_device_gpu_recover+0x968/0x990 [amdgpu]
[  493.067530] Read of size 4 at addr ffff88b0ce3f794c by task kworker/u128:1/323
[  493.074892]
[  493.076485] CPU: 9 UID: 0 PID: 323 Comm: kworker/u128:1 Tainted: G            E       6.16.0-1289896.2.zuul.bf4f11df81c1410bbe901c4373305a31 #1 PREEMPT(voluntary)
[  493.076493] Tainted: [E]=UNSIGNED_MODULE
[  493.076495] Hardware name: TYAN B8021G88V2HR-2T/S8021GM2NR-2T, BIOS V1.03.B10 04/01/2019
[  493.076500] Workqueue: amdgpu-reset-dev drm_sched_job_timedout [gpu_sched]
[  493.076512] Call Trace:
[  493.076515]  <TASK>
[  493.076518]  dump_stack_lvl+0x64/0x80
[  493.076529]  print_report+0xce/0x630
[  493.076536]  ? _raw_spin_lock_irqsave+0x86/0xd0
[  493.076541]  ? __pfx__raw_spin_lock_irqsave+0x10/0x10
[  493.076545]  ? amdgpu_device_gpu_recover+0x968/0x990 [amdgpu]
[  493.077253]  kasan_report+0xb8/0xf0
[  493.077258]  ? amdgpu_device_gpu_recover+0x968/0x990 [amdgpu]
[  493.077965]  amdgpu_device_gpu_recover+0x968/0x990 [amdgpu]
[  493.078672]  ? __pfx_amdgpu_device_gpu_recover+0x10/0x10 [amdgpu]
[  493.079378]  ? amdgpu_coredump+0x1fd/0x4c0 [amdgpu]
[  493.080111]  amdgpu_job_timedout+0x642/0x1400 [amdgpu]
[  493.080903]  ? pick_task_fair+0x24e/0x330
[  493.080910]  ? __pfx_amdgpu_job_timedout+0x10/0x10 [amdgpu]
[  493.081702]  ? _raw_spin_lock+0x75/0xc0
[  493.081708]  ? __pfx__raw_spin_lock+0x10/0x10
[  493.081712]  drm_sched_job_timedout+0x1b0/0x4b0 [gpu_sched]
[  493.081721]  ? __pfx__raw_spin_lock_irq+0x10/0x10
[  493.081725]  process_one_work+0x679/0xff0
[  493.081732]  worker_thread+0x6ce/0xfd0
[  493.081736]  ? __pfx_worker_thread+0x10/0x10
[  493.081739]  kthread+0x376/0x730
[  493.081744]  ? __pfx_kthread+0x10/0x10
[  493.081748]  ? __pfx__raw_spin_lock_irq+0x10/0x10
[  493.081751]  ? __pfx_kthread+0x10/0x10
[  493.081755]  ret_from_fork+0x247/0x330
[  493.081761]  ? __pfx_kthread+0x10/0x10
[  493.081764]  ret_from_fork_asm+0x1a/0x30
[  493.081771]  </TASK>

Fixes: a72002cb181f ("drm/amdgpu: Make use of drm_wedge_task_info")
Link: https://github.com/HansKristian-Work/vkd3d-proton/pull/2670
Cc: SRINIVASAN.SHANMUGAM@amd.com
Cc: vitaly.prosyak@amd.com
Cc: christian.koenig@amd.com
Suggested-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amd/display: Promote DC to 3.2.363
Taimur Hassan [Sat, 6 Dec 2025 00:11:43 +0000 (19:11 -0500)] 
drm/amd/display: Promote DC to 3.2.363

This version brings along the following updates:

- Replay Video Conferencing V2
- Fix scratch registers offsets for DCN35 and DCN351
- Fix DP no audio issue
- Add use_max_lsw parameter
- Fix presentation of Z8 efficiency
- Add USB-C DP Alt Mode lane limitation in DCN32
- Support DRR granularity
- Don't disable DPCD mst_en if sink connected
- Set enable_legacy_fast_update to false for DCN35/351
- Split update_planes_and_stream_v3 into parts (V2)

Signed-off-by: Taimur Hassan <Syed.Hassan@amd.com>
Signed-off-by: Chenyu Chen <chen-yu.chen@amd.com>
Acked-by: Wayne Lin <Wayne.Lin@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amd/display: [FW Promotion] Release 0.1.40.0
Taimur Hassan [Fri, 5 Dec 2025 21:27:16 +0000 (16:27 -0500)] 
drm/amd/display: [FW Promotion] Release 0.1.40.0

Summary for changes in firmware:
* Update DCHVM restore sequence for dcn35
* Add 2 new debug polling methods for dchvm "busy" during IPS entry for DCN35

Signed-off-by: Taimur Hassan <Syed.Hassan@amd.com>
Signed-off-by: Chenyu Chen <chen-yu.chen@amd.com>
Acked-by: Wayne Lin <Wayne.Lin@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amd/display: Split update_planes_and_stream_v3 into parts (V2)
Dominik Kaszewski [Fri, 31 Oct 2025 12:01:35 +0000 (13:01 +0100)] 
drm/amd/display: Split update_planes_and_stream_v3 into parts (V2)

[Why]
Currently all of the preparation and execution of plane update is done
under a DC lock, blocking other code from accessing DC for longer than
strictly necessary.

[How]
Break the v3 update flow into 3 parts:
    * prepare - locked, calculate update flow and modify DC state
    * execute - unlocked, program hardware
    * cleanup - locked, finalize DC state and free temp resources
Legacy v2 flow too compilicated to break down for now, link new API
with old by executing everything in slightly misnamed prepare stage.

V2:
Keep the new code structure, but point all users back at the old code,
until fully tested.

Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: Dominik Kaszewski <dominik.kaszewski@amd.com>
Signed-off-by: Roman Li <roman.li@amd.com>
Signed-off-by: Chenyu Chen <chen-yu.chen@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amd/display: DPP low mem pwr related adjustment -Part I
Charlene Liu [Tue, 2 Dec 2025 20:51:31 +0000 (15:51 -0500)] 
drm/amd/display: DPP low mem pwr related adjustment -Part I

[why]
Default low pwr mem state get chagned.
SW needs to wake mem up first
also need to put back to LS again after use: will do in Part II.

Reviewed-by: Leo Chen <leo.chen@amd.com>
Signed-off-by: Charlene Liu <Charlene.Liu@amd.com>
Signed-off-by: Chenyu Chen <chen-yu.chen@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amd/display: Set enable_legacy_fast_update to false for DCN35/351
Fudong Wang [Fri, 5 Dec 2025 01:15:35 +0000 (09:15 +0800)] 
drm/amd/display: Set enable_legacy_fast_update to false for DCN35/351

[Why]
Existing logic will treat color temperature update = full update, cause
user color temp adjustment goes wait for update logic and fsleep in that
cause the adjustment not smooth.

[How]
Let DCN35/351 to follow DCN401 to set default value to false.

Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: Fudong Wang <fudong.wang@amd.com>
Signed-off-by: Chenyu Chen <chen-yu.chen@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amd/display: Don't disable DPCD mst_en if sink connected
Peichen Huang [Tue, 18 Nov 2025 03:19:36 +0000 (11:19 +0800)] 
drm/amd/display: Don't disable DPCD mst_en if sink connected

[WHY]
User may connect mst dock with multi monitors and do quick unplug
and plug in one of the monitor. This operatioin may create CSN from
dock to display driver. Then display driver would disable and then enable
mst link and also disable/enable DPCD mst_en bit in dock RX. However,
when mst_en bit being disabled, if dock has another CSN message to
transmit then the message would be removed because of the disabling of
mst_en. In this case, the message is missing and it ends up no display in
the replugged monitor.

[HOW]
Don't disable mst_en bit when link still has sink connected.

Reviewed-by: Wenjing Liu <wenjing.liu@amd.com>
Signed-off-by: Peichen Huang <PeiChen.Huang@amd.com>
Signed-off-by: Chenyu Chen <chen-yu.chen@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amd/display: Support DRR granularity
Weiguang Li [Thu, 27 Nov 2025 09:49:49 +0000 (17:49 +0800)] 
drm/amd/display: Support DRR granularity

[Why&How]
Support DRR granularity for coasting Vtotal calculation

Reviewed-by: Robin Chen <robin.chen@amd.com>
Reviewed-by: Wenjing Liu <wenjing.liu@amd.com>
Signed-off-by: Weiguang Li <wei-guang.li@amd.com>
Signed-off-by: Chenyu Chen <chen-yu.chen@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amd/display: Add USB-C DP Alt Mode lane limitation in DCN32
LinCheng Ku [Wed, 3 Dec 2025 02:18:16 +0000 (10:18 +0800)] 
drm/amd/display: Add USB-C DP Alt Mode lane limitation in DCN32

[Why]
USB-C DisplayPort Alt Mode with concurrent USB data needs lane count
limitation to prevent incorrect 4-lane DP configuration when only 2 lanes
are available due to hardware lane sharing between DP and USB3.

[How]
Query DMUB for Alt Mode status (is_dp_alt_disable, is_usb, is_dp4) in
dcn32_link_encoder_get_max_link_cap() and cap DP to 2 lanes when USB is
active on USB-C port. Added inline documentation explaining the USB-C
lane sharing constraint.

Reviewed-by: PeiChen Huang <peichen.huang@amd.com>
Signed-off-by: LinCheng Ku <lincheng.ku@amd.com>
Signed-off-by: Chenyu Chen <chen-yu.chen@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amd/display: Fix presentation of Z8 efficiency
Austin Zheng [Mon, 3 Nov 2025 23:00:50 +0000 (18:00 -0500)] 
drm/amd/display: Fix presentation of Z8 efficiency

[Why/How]
Should differentiate when vblank is or isn't included

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Signed-off-by: Austin Zheng <Austin.Zheng@amd.com>
Signed-off-by: Chenyu Chen <chen-yu.chen@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amd/display: Add use_max_lsw parameter
Oleh Kuzhylnyi [Tue, 25 Nov 2025 14:34:37 +0000 (15:34 +0100)] 
drm/amd/display: Add use_max_lsw parameter

[WHY&HOW]
Add use_max_lsw parameter to make prefetch for linear surfaces similar to
tiled.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Signed-off-by: Oleh Kuzhylnyi <okuzhyln@amd.com>
Signed-off-by: Chenyu Chen <chen-yu.chen@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amd/display: Fix DP no audio issue
Charlene Liu [Sat, 29 Nov 2025 00:38:31 +0000 (19:38 -0500)] 
drm/amd/display: Fix DP no audio issue

[why]
need to enable APG_CLOCK_ENABLE enable first
also need to wake up az from D3 before access az block

Reviewed-by: Swapnil Patel <swapnil.patel@amd.com>
Signed-off-by: Charlene Liu <Charlene.Liu@amd.com>
Signed-off-by: Chenyu Chen <chen-yu.chen@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amd/display: Fix scratch registers offsets for DCN351
Ray Wu [Fri, 28 Nov 2025 01:14:09 +0000 (09:14 +0800)] 
drm/amd/display: Fix scratch registers offsets for DCN351

[Why]
Different platforms use different NBIO header files,
causing display code to use differnt offset and read
wrong accelerated status.

[How]
- Unified NBIO offset header file across platform.
- Correct scratch registers offsets to proper locations.

Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4667
Cc: Mario Limonciello <mario.limonciello@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Ray Wu <ray.wu@amd.com>
Signed-off-by: Chenyu Chen <chen-yu.chen@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amd/display: Fix scratch registers offsets for DCN35
Ray Wu [Fri, 28 Nov 2025 00:58:13 +0000 (08:58 +0800)] 
drm/amd/display: Fix scratch registers offsets for DCN35

[Why]
Different platforms use differnet NBIO header files,
causing display code to use differnt offset and read
wrong accelerated status.

[How]
- Unified NBIO offset header file across platform.
- Correct scratch registers offsets to proper locations.

Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4667
Cc: Mario Limonciello <mario.limonciello@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Ray Wu <ray.wu@amd.com>
Signed-off-by: Chenyu Chen <chen-yu.chen@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amd/display: Replay Video Conferencing V2
ChunTao Tso [Mon, 1 Dec 2025 07:47:50 +0000 (15:47 +0800)] 
drm/amd/display: Replay Video Conferencing V2

[WHY&HOW]
Add new coasting vtotal type and an union to optimize
the video conference for more power saving.

Reviewed-by: Robin Chen <robin.chen@amd.com>
Signed-off-by: ChunTao Tso <chuntao.tso@amd.com>
Signed-off-by: Chenyu Chen <chen-yu.chen@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amd: Resume the device in thaw() callback when console suspend is disabled
Mario Limonciello (AMD) [Tue, 9 Dec 2025 22:00:29 +0000 (16:00 -0600)] 
drm/amd: Resume the device in thaw() callback when console suspend is disabled

If console suspend has been disabled using `no_console_suspend` also
wake up during thaw() so that some messages can be seen for debugging.

Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/4191
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amdkfd: allow debug subscription to lds violations on gfx 1250
Jonathan Kim [Mon, 23 Jun 2025 18:12:58 +0000 (14:12 -0400)] 
drm/amdkfd: allow debug subscription to lds violations on gfx 1250

GFX 1250 allows the debugger to subcribe to LDS out-of-range read/write
memory violations.
Bump IOCTL minor version and flag KFD capabilities for enablement
hint.

Signed-off-by: Jonathan Kim <jonathan.kim@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amdgpu: enable gpu tlb flush for gfxhub
Likun Gao [Tue, 24 Jun 2025 02:58:50 +0000 (10:58 +0800)] 
drm/amdgpu: enable gpu tlb flush for gfxhub

Enable gpu tlb flush for gfxhub without check gfx.is_poweron
as gfx is power on by default for gfx v12_1 ASIC.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amd/include : Update MES v12 API header
Shaoyun Liu [Thu, 19 Jun 2025 16:40:46 +0000 (12:40 -0400)] 
drm/amd/include : Update MES v12 API header

Add LDS out of range reporting support in mes API

Signed-off-by: Shaoyun Liu <shaoyun.liu@amd.com>
Reviewed-by: Jonathan Kim <jonathan.kim@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amdgpu: flush tlb properly for GMC v12.1 in early phase
Le Ma [Mon, 16 Jun 2025 10:56:41 +0000 (18:56 +0800)] 
drm/amdgpu: flush tlb properly for GMC v12.1 in early phase

Flush tlb properly for GMC v12.1

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>
8 weeks agodrm/amdgpu: Use AMDGPU_IS_GFXHUB to screen out GFXHUB for GMC v12.1
Le Ma [Wed, 11 Jun 2025 12:35:50 +0000 (20:35 +0800)] 
drm/amdgpu: Use AMDGPU_IS_GFXHUB to screen out GFXHUB for GMC v12.1

There're multiple gfxhubs on GMC v12.1

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>
8 weeks agodrm/amdgpu: only copy ucode for enabled xcc
Likun Gao [Wed, 18 Jun 2025 09:56:30 +0000 (17:56 +0800)] 
drm/amdgpu: only copy ucode for enabled xcc

Only copy ucode for enabled xcc instead of copy for all 8 xcc
for rlc autoload on gfx v12_1 to save time.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amdgpu: fix issue when switch NPS1 to NPSX
chong li [Tue, 9 Dec 2025 03:16:54 +0000 (11:16 +0800)] 
drm/amdgpu: fix issue when switch NPS1 to NPSX

fix the function execution sequence after removing
kgd2kfd_init_zone_device out of gpu full access region.

Fixes: c71980a3fc1d ("drm/amdgpu: reduce the full gpu access time in amdgpu_device_init.")
Signed-off-by: chong li <chongli2@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amd/display: Fix 64-bit state pointer passed as 32-bit GPINT response buffer
Srinivasan Shanmugam [Wed, 10 Dec 2025 06:45:56 +0000 (12:15 +0530)] 
drm/amd/display: Fix 64-bit state pointer passed as 32-bit GPINT response buffer

edp_pr_get_state() incorrectly casts a uint64_t * to uint32_t * when
calling dc_wake_and_execute_gpint(). The GPINT path writes only 32 bits,
leaving the upper 32 bits of the u64 output uninitialized. Replace the
cast with a u32 temporary and copy the result into the u64 pointer.

Fixes the below:
drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_edp_panel_control.c
    1448 bool edp_pr_get_state(const struct dc_link *link, uint64_t *state)
                                                           ^^^^^^^^^^^^^^^
    1449 {

    ...

    1457         do {
    1458                 // Send gpint command and wait for ack
--> 1459                 if (!dc_wake_and_execute_gpint(dc->ctx, DMUB_GPINT__GET_REPLAY_STATE, panel_inst,
    1460                                                (uint32_t *)state, DM_DMUB_WAIT_TYPE_WAIT_WITH_REPLY)) {
                                                        ^^^^^^^^^^^^^^^^^

The dc_wake_and_execute_gpint() function doesn't take a u64, it takes a
u32.  It tries to initialize the state to zero at the start but that's
not going to work because of the type mismatch.  It suggests that
callers are allowed to pass uninitialized data to edp_pr_get_state() but
at present there are no callers so this is only a bug in the code but
doesn't affect runtime.

    1461                         // Return invalid state when GPINT times out
    1462                         *state = PR_STATE_INVALID;
    1463                 }

Fixes: 74ce00932e7e ("drm/amd/display: Refactor panel replay set dmub cmd flow")
Reported by: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Robin Chen <robin.chen@amd.com>
Cc: Jack Chang <jack.chang@amd.com>
Cc: Leon Huang <Leon.Huang1@amd.com>
Cc: Alex Hung <alex.hung@amd.com>
Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
Cc: Roman Li <roman.li@amd.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amd/include : Update MES v12 comments on RESET API
Shaoyun Liu [Tue, 4 Nov 2025 16:27:12 +0000 (11:27 -0500)] 
drm/amd/include : Update MES v12 comments on RESET API

Added comments for the layout of contents that addressed by doorbell_offset_addr
in RESET API

Signed-off-by: Shaoyun Liu <shaoyun.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Set xcp id for mes ring
Hawking Zhang [Mon, 16 Jun 2025 08:16:18 +0000 (16:16 +0800)] 
drm/amdgpu: Set xcp id for mes ring

Set xcp id for mes ring

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Init partition_mode and xcc_mask for GFX_IMU_PARTITION_SWITCH
Hawking Zhang [Sun, 15 Jun 2025 06:28:20 +0000 (14:28 +0800)] 
drm/amdgpu: Init partition_mode and xcc_mask for GFX_IMU_PARTITION_SWITCH

Set partition_mode and physical xcc mask fields in
GFX_IMU_PARTITION_SWITCH register

v2: cleanup (Alex)

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Initialize vram_info for gmc v12_1
Hawking Zhang [Thu, 12 Jun 2025 16:08:10 +0000 (00:08 +0800)] 
drm/amdgpu: Initialize vram_info for gmc v12_1

Initialize vram_info for gmc v12_1

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Init compute partition mode for gfx v12_1
Hawking Zhang [Thu, 12 Jun 2025 03:47:58 +0000 (11:47 +0800)] 
drm/amdgpu: Init compute partition mode for gfx v12_1

Init compute partition mode for gfx v12_1

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Initialize memory ranges for gmc v12_1
Hawking Zhang [Sun, 15 Jun 2025 06:22:13 +0000 (14:22 +0800)] 
drm/amdgpu: Initialize memory ranges for gmc v12_1

Initialize memory ranges for gmc v12_1

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Initialize memory partition callbacks for gmc v12_1
Hawking Zhang [Sun, 15 Jun 2025 06:21:10 +0000 (14:21 +0800)] 
drm/amdgpu: Initialize memory partition callbacks for gmc v12_1

Initialize memory partition callbacks for gmv v12_1

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: support rlc autoload for muti-xcc
Likun Gao [Mon, 16 Jun 2025 09:42:09 +0000 (17:42 +0800)] 
drm/amdgpu: support rlc autoload for muti-xcc

Support rlc autload for muti-xcc on gfx v12_1.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Enable atomics for all the available xcc
Hawking Zhang [Wed, 11 Jun 2025 13:58:54 +0000 (21:58 +0800)] 
drm/amdgpu: Enable atomics for all the available xcc

Apply TCP_UTCL0_CNTL1 settings to all the available
xcc

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Update MES VM_CNTX_CNTL for XNACK off for GFX 12.1
Mukul Joshi [Tue, 29 Apr 2025 02:08:10 +0000 (22:08 -0400)] 
drm/amdgpu: Update MES VM_CNTX_CNTL for XNACK off for GFX 12.1

Currently, we do not turn off retry faults in VM_CONTEXT_CNTL value
when passing it to MES if XNACK is off. This creates a situation where
XNACK is disabled in SQ but enabled in UTCL2, which is not recommended.
As a result, turn off/on retry faults in both SQ and UTCL2 when passing
vm_context_cntl value to MES if XNACK is disabled/enabled.

Suggested-by: Jay Cornwall <jay.cornwall@amd.com>
Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Philip Yang <Philip.Yang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdkfd: Enable per-process XNACK for GFX 12.1.0
Mukul Joshi [Thu, 27 Mar 2025 02:16:21 +0000 (22:16 -0400)] 
drm/amdkfd: Enable per-process XNACK for GFX 12.1.0

GFX 12.1.0 will support enabling/disabling XNACK on a per-
process basis. This change enables the per process XNACK feature.

Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Philip Yang <Philip.Yang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Enable retry faults for GFX 12.1
Mukul Joshi [Thu, 27 Mar 2025 02:06:39 +0000 (22:06 -0400)] 
drm/amdgpu: Enable retry faults for GFX 12.1

Enable retry faults in both GCVM/MMVM Context1 Control
and L2_PROTECTION_FAULT_CNTL2 registers for GFX 12.1.

Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Philip Yang <Philip.Yang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Add IH node-id to XCC mapping
Mukul Joshi [Fri, 6 Jun 2025 19:19:26 +0000 (15:19 -0400)] 
drm/amdgpu: Add IH node-id to XCC mapping

Add a generic function to map IH node-id to XCC instance.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Add interrupt handler for GFX 12.1.0
Mukul Joshi [Sat, 1 Mar 2025 02:48:19 +0000 (21:48 -0500)] 
drm/amdgpu: Add interrupt handler for GFX 12.1.0

Add a separate interrupt handler for handling interrupts,
both retry and no-retry, for GFX 12.1.0.

Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Add UTCL2 Retry fault interrupt for GFX 12.1
Mukul Joshi [Thu, 17 Apr 2025 02:46:19 +0000 (22:46 -0400)] 
drm/amdgpu: Add UTCL2 Retry fault interrupt for GFX 12.1

Add the UTCL2 retry fault interrupt for both GCVM and MMVM for GFX 12.1.

Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Philip Yang <Philip.Yang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu/sdma: add query for CSA size and alignment
Alex Deucher [Fri, 10 Oct 2025 19:54:49 +0000 (15:54 -0400)] 
drm/amdgpu/sdma: add query for CSA size and alignment

Needed to query the CSA size and alignment for SDMA
user queues.

Reviewed-by: Prike Liang <Prike.Liang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: fix mes packet params issue when flush hdp.
chong li [Fri, 28 Nov 2025 02:51:51 +0000 (10:51 +0800)] 
drm/amdgpu: fix mes packet params issue when flush hdp.

v4:
use func "amdgpu_gfx_get_hdp_flush_mask" to get ref_and_mask for
gfx9 through gfx12.

v3:
Unify the get_ref_and_mask function in amdgpu_gfx_funcs,
to support both GFX11 and earlier generations

v2:
place "get_ref_and_mask" in amdgpu_gfx_funcs instead of amdgpu_ring,
since this function only assigns the cp entry.

v1:
both gfx ring and mes ring use cp0 to flush hdp, cause conflict.

use function get_ref_and_mask to assign the cp entry.
reassign mes to use cp8 instead.

Signed-off-by: chong li <chongli2@amd.com>
Acked-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu/gfx: add eop size and alignment to shadow info
Alex Deucher [Fri, 10 Oct 2025 19:52:51 +0000 (15:52 -0400)] 
drm/amdgpu/gfx: add eop size and alignment to shadow info

This is used by firmware for compute user queues.

Reviewed-by: Prike Liang <Prike.Liang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/ras: Add vram_type to ras_ta_init_flags
Candice Li [Fri, 5 Dec 2025 01:16:26 +0000 (09:16 +0800)] 
drm/amd/ras: Add vram_type to ras_ta_init_flags

Add vram_type to ras_ta_init_flags.

Signed-off-by: Candice Li <candice.li@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: update sdma configuration for soc v1_0
Likun Gao [Mon, 9 Jun 2025 09:19:25 +0000 (17:19 +0800)] 
drm/amdgpu: update sdma configuration for soc v1_0

Update SDMA instances/masks according to xcc num for
multi-xcc models on soc v1.0.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Initialize xcp manager for soc v1_0
Hawking Zhang [Thu, 5 Jun 2025 16:38:51 +0000 (00:38 +0800)] 
drm/amdgpu: Initialize xcp manager for soc v1_0

Initialize xcp manager for soc v1_0

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Add soc_v1_0_xcp_funcs
Hawking Zhang [Thu, 5 Jun 2025 16:27:39 +0000 (00:27 +0800)] 
drm/amdgpu: Add soc_v1_0_xcp_funcs

Implement xcp mgr callbacks for soc v1_0

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Export sdma_v7_1_xcp_funcs
Hawking Zhang [Thu, 5 Jun 2025 16:14:24 +0000 (00:14 +0800)] 
drm/amdgpu: Export sdma_v7_1_xcp_funcs

To be used by soc v1_0 xcp manager

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Export gfx_v12_1_xcp_func
Hawking Zhang [Thu, 5 Jun 2025 16:12:54 +0000 (00:12 +0800)] 
drm/amdgpu: Export gfx_v12_1_xcp_func

To be used by soc v1_0 xcp manager

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Add vram_type to ras init_flags
Candice Li [Fri, 5 Dec 2025 01:10:19 +0000 (09:10 +0800)] 
drm/amdgpu: Add vram_type to ras init_flags

Add vram_type to ras init_flags.

Signed-off-by: Candice Li <candice.li@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/ras: Reduce stack usage in amdgpu_virt_ras_get_cper_records()
Srinivasan Shanmugam [Fri, 5 Dec 2025 12:15:10 +0000 (17:45 +0530)] 
drm/amd/ras: Reduce stack usage in amdgpu_virt_ras_get_cper_records()

amdgpu_virt_ras_get_cper_records() was using a large stack array
of ras_log_info pointers. This contributed to the frame size
warning on this function.

Replace the fixed-size stack array:

    struct ras_log_info *trace[MAX_RECORD_PER_BATCH];

with a heap-allocated array using kcalloc().

We free the trace buffer together with out_buf on all exit paths.
If allocation of trace or out_buf fails, we return a generic RAS
error code.

This reduces stack usage and keeps the runtime behaviour
unchanged.

Fixes:
stack frame size: 1112 bytes (limit: 1024)

Cc: Tao Zhou <tao.zhou1@amd.com>
Cc: Hawking Zhang <Hawking.Zhang@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdkfd: Handle GPU reset and drain retry fault race
Philip Yang [Wed, 19 Nov 2025 21:32:45 +0000 (16:32 -0500)] 
drm/amdkfd: Handle GPU reset and drain retry fault race

Only check and drain IH1 ring if CAM is not enabled.

If GPU is under reset, don't access IH to drain retry fault.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agoRevert "drm/amd/display: Fix pbn to kbps Conversion"
Mario Limonciello [Tue, 9 Dec 2025 17:14:47 +0000 (11:14 -0600)] 
Revert "drm/amd/display: Fix pbn to kbps Conversion"

Deeply daisy chained DP/MST displays are no longer able to light
up. This reverts commit e0dec00f3d05 ("drm/amd/display: Fix pbn
to kbps Conversion")

Cc: Jerry Zuo <jerry.zuo@amd.com>
Reported-by: nat@nullable.se
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4756
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Add switch_compute_partition callback for imu v12_1
Hawking Zhang [Thu, 5 Jun 2025 16:11:10 +0000 (00:11 +0800)] 
drm/amdgpu: Add switch_compute_partition callback for imu v12_1

To enable switching compute partition mode

v2: cleanup (Alex)

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Implement gfx_v12_1_get_xccs_per_xcp
Hawking Zhang [Mon, 8 Dec 2025 22:00:46 +0000 (17:00 -0500)] 
drm/amdgpu: Implement gfx_v12_1_get_xccs_per_xcp

Use gfx v12_1 callback to query the numbers of xccs
per xcp

v2: add todo (Alex)

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>
2 months agodrm/amdgpu: Remove redundant check for async_gfx_ring
Hawking Zhang [Tue, 27 May 2025 15:45:46 +0000 (23:45 +0800)] 
drm/amdgpu: Remove redundant check for async_gfx_ring

Remove the redundant check for async_gfx_ring,
as it is not required for gfx v12_1

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: disable graphics doorbell range for gfx v12_1
Likun Gao [Thu, 5 Jun 2025 02:36:07 +0000 (10:36 +0800)] 
drm/amdgpu: disable graphics doorbell range for gfx v12_1

Disable doorbell range for graphics engine on gfx v12_1.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: enable unmap doorbell handle for gfx v12_1
Likun Gao [Thu, 5 Jun 2025 02:34:32 +0000 (10:34 +0800)] 
drm/amdgpu: enable unmap doorbell handle for gfx v12_1

Enable unmapped doorbell handling for gfx v12_1.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: revision doorbel range for gfx v12_1
Likun Gao [Wed, 21 May 2025 00:52:36 +0000 (08:52 +0800)] 
drm/amdgpu: revision doorbel range for gfx v12_1

Revision doorbell range on muti-XCC mode for gfx v12_1.
Clean up doorbell range set for graphics engine.
V2: Remove doorbell range set from gfx_v12_1_xcc_kiq_init_register.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdkfd: disable shader message vgpr deallocation on gc 12.1
Jonathan Kim [Mon, 26 May 2025 19:39:45 +0000 (15:39 -0400)] 
drm/amdkfd: disable shader message vgpr deallocation on gc 12.1

Shader messages to deallocate VGPRs prior to shader end can prevent
the trap handler from saving context, making debugging and core dumps
unreliable.

VGPR deallocations for performance gain is negligible.
GC 12.1 will NOP shader VGPR deallocation messages via HW
settings on driver boot.

Signed-off-by: Jonathan Kim <jonathan.kim@amd.com>
Acked-by: Harish Kasiviswanathan <harish.kasiviswanathan@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Remove redundant pmfw backdoor loading
Hawking Zhang [Mon, 26 May 2025 07:49:42 +0000 (15:49 +0800)] 
drm/amdgpu: Remove redundant pmfw backdoor loading

PMFW is integrated into ifwi for gfx 12_1 adapter,
making PMFW backdoor loading unnecessary.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd: Fix unbind/rebind for VCN 4.0.5
Mario Limonciello (AMD) [Tue, 9 Dec 2025 04:46:46 +0000 (22:46 -0600)] 
drm/amd: Fix unbind/rebind for VCN 4.0.5

Unbinding amdgpu has no problems, but binding it again leads to an
error of sysfs file already existing.  This is because it wasn't
actually cleaned up on unbind.  Add the missing cleanup step.

Fixes: 547aad32edac ("drm/amdgpu: add VCN4 ip block support")
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu/acpi: Reduce amdgpu_acpi_detect stack usage
Srinivasan Shanmugam [Fri, 5 Dec 2025 11:18:50 +0000 (16:48 +0530)] 
drm/amdgpu/acpi: Reduce amdgpu_acpi_detect stack usage

amdgpu_acpi_detect() calls some helper functions it calls have large
local structures.  When the compiler inlines these helpers, their local
data adds to the amdgpu_acpi_detect() stack frame.

Mark the helpers with noinline_for_stack:
- amdgpu_atif_verify_interface()
- amdgpu_atif_get_notification_params()
- amdgpu_atif_query_backlight_caps()
- amdgpu_atcs_verify_interface()
- amdgpu_acpi_enumerate_xcc()

This keeps the large temporary objects inside the helper’s own stack
frame instead of being inlined into the caller, preventing the caller
from growing beyond the stack limit.

Fixes the below with gcc W=1:
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:1403:6: warning: stack frame size (1688) exceeds limit (1024) in 'amdgpu_acpi_detect' [-Wframe-larger-than]

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: pass the entity to use to ttm public functions
Pierre-Eric Pelloux-Prayer [Mon, 17 Nov 2025 14:53:15 +0000 (15:53 +0100)] 
drm/amdgpu: pass the entity to use to ttm public functions

This way the caller can select the one it wants to use.

Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Acked-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: pass the entity to use to amdgpu_ttm_map_buffer
Pierre-Eric Pelloux-Prayer [Mon, 17 Nov 2025 14:42:31 +0000 (15:42 +0100)] 
drm/amdgpu: pass the entity to use to amdgpu_ttm_map_buffer

This way the caller can select the one it wants to use.

Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: fix error handling in amdgpu_copy_buffer
Pierre-Eric Pelloux-Prayer [Mon, 24 Nov 2025 17:25:04 +0000 (18:25 +0100)] 
drm/amdgpu: fix error handling in amdgpu_copy_buffer

drm_sched_job_add_resv_dependencies can fail in amdgpu_ttm_prepare_job.
In this case we need to use amdgpu_job_free to release memory.

---
v4: moved job pointer clearing to a different patchset
---

Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: add amdgpu_ttm_job_submit helper
Pierre-Eric Pelloux-Prayer [Tue, 18 Nov 2025 13:41:50 +0000 (14:41 +0100)] 
drm/amdgpu: add amdgpu_ttm_job_submit helper

Deduplicate the IB padding code and will also be used
later to check locking.

Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: introduce amdgpu_ttm_buffer_entity
Pierre-Eric Pelloux-Prayer [Fri, 19 Sep 2025 07:35:03 +0000 (09:35 +0200)] 
drm/amdgpu: introduce amdgpu_ttm_buffer_entity

No functional change for now, but this struct will have more
fields added in the next commit.

This change would introduce synchronisation issue, because
dependencies between successive jobs are not taken care of
properly. For instance, amdgpu_ttm_clear_buffer uses
amdgpu_ttm_map_buffer then amdgpu_ttm_fill_mem which should
use different entities (default_entity then move/clear entity).
To prevent failures for this commit, we limit ourselves to
2 entities: default_entity (which replaces high_pr usages) and
clear_entity (which replaces low_pr usages).

The next commits will deal with these dependencies correctly,
and then we'll be able to use move_entity.

---
v2: renamed amdgpu_ttm_buffer_entity
v4: don't use move_entity in ttm yet
---

Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com> (v3)
Acked-by: Felix Kuehling <felix.kuehling@amd.com> (v3)
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: add imu support for gc 12_1
Likun Gao [Tue, 13 May 2025 06:03:46 +0000 (14:03 +0800)] 
drm/amdgpu: add imu support for gc 12_1

Add IMU support for gc version 12.1.0.
Only support imu fw loading for imu 12.1.0.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: fix mes code error for muti-xcc
Likun Gao [Fri, 18 Apr 2025 03:11:24 +0000 (11:11 +0800)] 
drm/amdgpu: fix mes code error for muti-xcc

Fix some code error for muti-xcc on mes v12_1.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu/gmc12: set MMHUBs based on aid_mask
Likun Gao [Tue, 11 Nov 2025 03:43:05 +0000 (11:43 +0800)] 
drm/amdgpu/gmc12: set MMHUBs based on aid_mask

Update number of mmhub and mid_mask via reuse aid_mask.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: set gfxhub according xcc_mask for gfx 12_1
Likun Gao [Fri, 18 Apr 2025 03:06:51 +0000 (11:06 +0800)] 
drm/amdgpu: set gfxhub according xcc_mask for gfx 12_1

Set GFXHUB accodring to xcc_mask for gfx version 12_1.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: add xcc info for compute ring name
Likun Gao [Fri, 18 Apr 2025 03:04:12 +0000 (11:04 +0800)] 
drm/amdgpu: add xcc info for compute ring name

Add XCC id info for compute ring name on gfx version 12.1.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdkfd: bump minimum vgpr size for gfx1151
Jonathan Kim [Fri, 5 Dec 2025 19:41:08 +0000 (14:41 -0500)] 
drm/amdkfd: bump minimum vgpr size for gfx1151

GFX1151 has 1.5x the number of available physical VGPRs per SIMD.
Bump total memory availability for acquire checks on queue creation.

Signed-off-by: Jonathan Kim <jonathan.kim@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Revert retry based thrashing prevention on GFX 12.1.0
Mukul Joshi [Thu, 15 May 2025 02:07:47 +0000 (22:07 -0400)] 
drm/amdgpu: Revert retry based thrashing prevention on GFX 12.1.0

Revert the change to enable retry based thrashing prevention on GFX 12.1.0
for now as its causing data mismatch and slowness issues with multiple HIP
tests.

Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Init single mes instance if xcc_mask is unset
Hawking Zhang [Tue, 6 May 2025 06:43:36 +0000 (14:43 +0800)] 
drm/amdgpu: Init single mes instance if xcc_mask is unset

Configure a single mes instance if the xcc_mask remains
uninitialized.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Jack Xiao <Jack.Xiao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Setup MTYPEs for GFX 12.1.0
Mukul Joshi [Sat, 29 Mar 2025 02:21:28 +0000 (22:21 -0400)] 
drm/amdgpu: Setup MTYPEs for GFX 12.1.0

For GFX 12.1.0, setup correct MTYPE for a BO depending on
its current location relative to the mapping GPU.

Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Alex Sierra <alex.sierra@amd.com>
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: update sh mem base offsets for gfx 12.1
Alex Sierra [Thu, 3 Apr 2025 21:49:54 +0000 (16:49 -0500)] 
drm/amdgpu: update sh mem base offsets for gfx 12.1

Signed-off-by: Alex Sierra <alex.sierra@amd.com>
Reviewed-by: Philip Yang <Philip.Yang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/ras: Reduce stack usage in ras_umc_handle_bad_pages()
Srinivasan Shanmugam [Fri, 5 Dec 2025 12:07:57 +0000 (17:37 +0530)] 
drm/amd/ras: Reduce stack usage in ras_umc_handle_bad_pages()

ras_umc_handle_bad_pages() function used a large local array:
  struct eeprom_umc_record records[MAX_ECC_NUM_PER_RETIREMENT];

Move this array off the stack by allocating it with kcalloc()
and freeing it before return.

This reduces the stack frame size of ras_umc_handle_bad_pages()
and avoids the frame size warning.

Fixes the below:
drivers/gpu/drm/amd/amdgpu/../ras/rascore/ras_umc.c:498:5: warning: stack frame size (1208) exceeds limit (1024) in 'ras_umc_handle_bad_pages' [-Wframe-larger-than]

v2: Removed the duplicate ras_umc_get_new_records() invocation. (Lijo)

Cc: Tao Zhou <tao.zhou1@amd.com>
Cc: Hawking Zhang <Hawking.Zhang@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Fix SHMEM alignment mode for GFX 12.1.0
Mukul Joshi [Thu, 27 Mar 2025 21:17:06 +0000 (17:17 -0400)] 
drm/amdgpu: Fix SHMEM alignment mode for GFX 12.1.0

Alignment mode in SHMEM config register is only a single bit
value on GFX 12.1.0 instead of 2 bits in previous asics.
Add a new enum and use the correct value of SHMEM alignment mode
when programming the SHMEM config register.

Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/display: shrink struct members
Rosen Penev [Sat, 8 Nov 2025 17:40:47 +0000 (09:40 -0800)] 
drm/amd/display: shrink struct members

On a 32-bit ARM system, the audio_decoder struct ends up being too large
for dp_retrain_link_dp_test.

link_dp_cts.c:157:1: error: the frame size of 1328 bytes is larger than
1280 bytes [-Werror=frame-larger-than=]

This is mitigated by shrinking the members of the struct and avoids
having to deal with dynamic allocation.

feed_back_divider is assigned but otherwise unused. Remove both.

pixel_repetition looks like it should be a bool since it's only ever
assigned to 1. But there are checks for 2 and 4. Reduce to uint8_t.

Remove ss_percentage_divider. Unused.

Shrink refresh_rate as it gets assigned to at most a 3 digit integer
value.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdkfd: Export the cwsr_size and ctl_stack_size to userspace
Mario Limonciello [Fri, 5 Dec 2025 18:41:58 +0000 (12:41 -0600)] 
drm/amdkfd: Export the cwsr_size and ctl_stack_size to userspace

This is important for userspace to avoid hardcoding VGPR size.

Reviewed-by: Kent Russell <kent.russell@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agoamdkfd: Bump ABI to indicate presence of Trap handler support for expert scheduling
Mario Limonciello [Fri, 5 Dec 2025 14:04:41 +0000 (08:04 -0600)] 
amdkfd: Bump ABI to indicate presence of Trap handler support for expert scheduling

commit 0f0c8a6983db ("drm/amdkfd: Trap handler support for expert
scheduling mode") introduced support for a trap handler when expert
scheduling mode. However userspace needs to know whether or not a trap
handler support is present.

Bump the KFD IOCTL API so that userspace can key off this to decide.

Suggested-by: Stella Laurenzo <stella.laurenzo@amd.com>
Fixes: 423888879412 ("drm/amdkfd: Trap handler support for expert scheduling mode")
Reviewed-by: Kent Russell <kent.russell@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/display: Promote DC to 3.2.362
Taimur Hassan [Sat, 29 Nov 2025 01:15:43 +0000 (20:15 -0500)] 
drm/amd/display: Promote DC to 3.2.362

This version brings along the following updates:

 - Defer transitions from minimal state to final state
 - Remove periodic detection callbacks from dcn35+
 - Fixes for S0i3 exit
 - Refactor dml_core_mode_support to reduce stack frame
 - Add additional info from DML for DMU

Signed-off-by: Taimur Hassan <Syed.Hassan@amd.com>
Signed-off-by: Chenyu Chen <chen-yu.chen@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/display: Additional info from DML for DMU
Nevenko Stupar [Mon, 17 Nov 2025 21:47:21 +0000 (16:47 -0500)] 
drm/amd/display: Additional info from DML for DMU

[WHAT]
Add additional info from DML for DMU when applicable
on future platforms.

Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
Signed-off-by: Nevenko Stupar <Nevenko.Stupar@amd.com>
Signed-off-by: Chenyu Chen <chen-yu.chen@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>