]> www.infradead.org Git - users/hch/misc.git/log
users/hch/misc.git
8 weeks agodrm/amdgpu/uapi: Introduce AMDGPU_GEM_DOMAIN_MMIO_REMAP
Srinivasan Shanmugam [Wed, 20 Aug 2025 07:03:29 +0000 (12:33 +0530)]
drm/amdgpu/uapi: Introduce AMDGPU_GEM_DOMAIN_MMIO_REMAP

Add a new GEM domain bit AMDGPU_GEM_DOMAIN_MMIO_REMAP to allow
userspace to request the MMIO remap (HDP flush) page via GEM_CREATE.

- include/uapi/drm/amdgpu_drm.h:
  * define AMDGPU_GEM_DOMAIN_MMIO_REMAP
  * include the bit in AMDGPU_GEM_DOMAIN_MASK

v2: Add early reject in amdgpu_gem_create_ioctl() (Alex).

Cc: Christian König <christian.koenig@amd.com>
Suggested-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/ttm: Bump TTM_NUM_MEM_TYPES to 9 (Prep for AMDGPU_PL_MMIO_REMAP)
Srinivasan Shanmugam [Tue, 26 Aug 2025 10:19:20 +0000 (15:49 +0530)]
drm/ttm: Bump TTM_NUM_MEM_TYPES to 9 (Prep for AMDGPU_PL_MMIO_REMAP)

Increase TTM_NUM_MEM_TYPES from 8 to 9 to accommodate the upcoming
AMDGPU_PL_MMIO_REMAP placement.

Cc: Alex Deucher <alexander.deucher@amd.com>
Suggested-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amd/amdgpu: Declare isp firmware binary file
Pratap Nirujogi [Wed, 3 Sep 2025 20:00:24 +0000 (16:00 -0400)]
drm/amd/amdgpu: Declare isp firmware binary file

Declare isp firmware file isp_4_1_1.bin required by isp4.1.1 device.

Suggested-by: Alexey Zagorodnikov <xglooom@gmail.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Pratap Nirujogi <pratap.nirujogi@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amd/display: use udelay rather than fsleep
Alex Deucher [Wed, 3 Sep 2025 13:11:12 +0000 (09:11 -0400)]
drm/amd/display: use udelay rather than fsleep

This function can be called from an atomic context so we can't use
fsleep().

Fixes: 01f60348d8fb ("drm/amd/display: Fix 'failed to blank crtc!'")
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4549
Cc: Wen Chen <Wen.Chen3@amd.com>
Cc: Fangzhi Zuo <jerry.zuo@amd.com>
Cc: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amdgpu: Fix NULL ptr deref in amdgpu_device_cache_switch_state()
John Olender [Fri, 5 Sep 2025 10:11:28 +0000 (06:11 -0400)]
drm/amdgpu: Fix NULL ptr deref in amdgpu_device_cache_switch_state()

Kaveri has no upstream bridge, therefore parent is NULL.

$ lspci -PP
...
00:01.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Kaveri [Radeon R7 Graphics] (rev d4)

For comparison, Raphael:

$ lspci -PP
...
00:08.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Raphael/Granite Ridge Internal GPP Bridge to Bus [C:A]
...
00:08.1/0e:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Raphael (rev c5)

Fixes: 1dd2fa0e00f1 ("drm/amdgpu: Save and restore switch state")
Link: https://lore.kernel.org/amd-gfx/38fe6513-f8a9-4669-8e86-89c54c465611@gmail.com/
Reviewed-by: Candice Li <candice.li@amd.com>
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: John Olender <john.olender@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 weeks agodrm/amdgpu: fix a memory leak in fence cleanup when unloading
Alex Deucher [Thu, 4 Sep 2025 16:35:05 +0000 (12:35 -0400)]
drm/amdgpu: fix a memory leak in fence cleanup when unloading

Commit b61badd20b44 ("drm/amdgpu: fix usage slab after free")
reordered when amdgpu_fence_driver_sw_fini() was called after
that patch, amdgpu_fence_driver_sw_fini() effectively became
a no-op as the sched entities we never freed because the
ring pointers were already set to NULL.  Remove the NULL
setting.

Reported-by: Lin.Cao <lincao12@amd.com>
Cc: Vitaly Prosyak <vitaly.prosyak@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Fixes: b61badd20b44 ("drm/amdgpu: fix usage slab after free")
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/display: Drop dm_prepare_suspend() and dm_complete()
Mario Limonciello (AMD) [Fri, 5 Sep 2025 15:36:27 +0000 (10:36 -0500)]
drm/amd/display: Drop dm_prepare_suspend() and dm_complete()

[Why]
dm_prepare_suspend() was added in commit 50e0bae34fa6b
("drm/amd/display: Add and use new dm_prepare_suspend() callback")
to allow display to turn off earlier in the suspend sequence.

This caused a regression that HDMI audio sometimes didn't work
properly after resume unless audio was playing during suspend.

[How]
Drop dm_prepare_suspend() callback. All code in it will still run
during dm_suspend(). Also drop unnecessary dm_complete() callback.
dm_complete() was used for failed prepare and also for any case
of successful resume.  The code in it already runs in dm_resume().

This change will introduce more time that the display is turned on
during suspend sequence. The compositor can turn it off sooner if
desired.

Cc: Harry Wentland <harry.wentland@amd.com>
Reported-by: Przemysław Kopa <prz.kopa@gmail.com>
Closes: https://lore.kernel.org/amd-gfx/1cea0d56-7739-4ad9-bf8e-c9330faea2bb@kernel.org/T/#m383d9c08397043a271b36c32b64bb80e524e4b0f
Reported-by: Kalvin <hikaph+oss@gmail.com>
Closes: https://github.com/alsa-project/alsa-lib/issues/465
Closes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4809
Fixes: 50e0bae34fa6b ("drm/amd/display: Add and use new dm_prepare_suspend() callback")
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: Fix error codes if copy_to_user() fails
Dan Carpenter [Thu, 4 Sep 2025 18:58:49 +0000 (21:58 +0300)]
drm/amdgpu: Fix error codes if copy_to_user() fails

The copy_to_user() function returns the number of bytes that it wasn't
able to copy, but we should return -EFAULT to the user.

Fixes: 4d82724f7f2b ("drm/amdgpu: Add mapping info option for GEM_OP ioctl")
Fixes: f9db1fc52ceb ("drm/amdgpu: Add ioctl to get all gem handles for a process")
Reviewed-By: David Francis <David.Francis@amd.com>
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/radeon: use dev_warn_once() in CS parsers
Alex Deucher [Tue, 2 Sep 2025 16:45:34 +0000 (12:45 -0400)]
drm/radeon: use dev_warn_once() in CS parsers

Older GPUs did not support memory protection, so the kernel
driver would validate the command submissions (CS) from userspace
to avoid the GPU accessing any memory it shouldn't.

Change any error messages in that validation to dev_warn_once() to
avoid spamming the kernel log in the event of a bad CS.  If users
see any of these messages they should report them to the user space
component, which in most cases is mesa
(https://gitlab.freedesktop.org/mesa/mesa/-/issues).

Cc: Borislav Petkov (AMD) <bp@alien8.de>
Acked-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20250829171655.GBaLHgh3VOvuM1UfJg@fat_crate.local
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Correct misnamed function in amdgpu_gem.c
Srinivasan Shanmugam [Sun, 31 Aug 2025 09:46:04 +0000 (15:16 +0530)]
drm/amdgpu: Correct misnamed function in amdgpu_gem.c

The header comment above amdgpu_gem_list_handles_ioctl referenced
drm_amdgpu_gem_list_handles_ioctl. Update the comment to reflect the
actual function identifier to avoid misleading prototype warnings.

Fixes the below:
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c:1106: warning: expecting prototype for drm_amdgpu_gem_list_handles_ioctl(). Prototype was for amdgpu_gem_list_handles_ioctl() instead

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: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: print root PD address in PDE format instead of GPU
Sunil Khatri [Mon, 18 Aug 2025 07:21:25 +0000 (12:51 +0530)]
drm/amdgpu: print root PD address in PDE format instead of GPU

Print PD address of VM root instead of GPU address in the debugfs.
On modern GPU's this is what UMR tool expects in the registers
as well.

Fixes: 719b378d3718 ("drm/amdgpu: add debugfs support for VM pagetable per client")
Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/display: Promote DC to 3.2.349
Taimur Hassan [Fri, 29 Aug 2025 14:45:27 +0000 (09:45 -0500)]
drm/amd/display: Promote DC to 3.2.349

This version brings along following updates:

- Disable stutter when programming watermarks on dcn32
- Fix pbn_div Calculation Error
- Correct sequences and delays for DCN35 PG & RCG
- Define interfaces for hubbub perfmance monitoring support
- Extend to read eDP general capability 2
- Indicate when custom brightness curves are in use
- Dont wait for pipe update during medupdate/highirq
- Add HDCP retry_limit control parameter

Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Taimur Hassan <Syed.Hassan@amd.com>
Signed-off-by: Wayne Lin <wayne.lin@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/display: Fix pbn_div Calculation Error
Fangzhi Zuo [Tue, 8 Apr 2025 19:11:43 +0000 (15:11 -0400)]
drm/amd/display: Fix pbn_div Calculation Error

[Why]
dm_mst_get_pbn_divider() returns value integer coming from
the cast from fixed point, but the casted integer will then be used
in dfixed_const to be multiplied by 4096. The cast from fixed point to integer
causes the calculation error becomes bigger when multiplied by 4096.

That makes the calculated pbn_div value becomes smaller than
it should be, which leads to the req_slot number becomes bigger.

Such error is getting reflected in 8k30 timing,
where the correct and incorrect calculated req_slot 62.9 Vs 63.1.
That makes the wrong calculation failed to light up 8k30
after a dock under HBR3 x 4.

[How]
Restore the accuracy by keeping the fraction part
calculated for the left shift operation.

Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Fangzhi Zuo <Jerry.Zuo@amd.com>
Signed-off-by: Wayne Lin <wayne.lin@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/display: Correct sequences and delays for DCN35 PG & RCG
Ovidiu Bunea [Mon, 25 Aug 2025 18:45:33 +0000 (14:45 -0400)]
drm/amd/display: Correct sequences and delays for DCN35 PG & RCG

[why]
The current PG & RCG programming in driver has some gaps and incorrect
sequences.

[how]
Added delays after ungating clocks to allow ramp up, increased polling
to allow more time for power up, and removed the incorrect sequences.

Cc: Mario Limonciello <mario.limonciello@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Charlene Liu <charlene.liu@amd.com>
Signed-off-by: Ovidiu Bunea <ovidiu.bunea@amd.com>
Signed-off-by: Wayne Lin <wayne.lin@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/display: Refine error message for vblank init failure
Roman Li [Thu, 21 Aug 2025 19:43:31 +0000 (15:43 -0400)]
drm/amd/display: Refine error message for vblank init failure

[Why]
The error message "failed to initialize sw for display support" is used
for both DRM device and vblank initialization failures, making it difficult
to identify the specific failure during troubleshooting.

[How]
Update the vblank initialization error message to
"failed to initialize vblank for display support"
to distinguish it from the DRM device init failure.

Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Roman Li <Roman.Li@amd.com>
Signed-off-by: Wayne Lin <wayne.lin@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/display: Update dchubbub.h for hubbub perfmon support
Wenjing Liu [Wed, 13 Aug 2025 20:18:53 +0000 (16:18 -0400)]
drm/amd/display: Update dchubbub.h for hubbub perfmon support

[why]
dchubbub supports performance monitoring for hubbub.
The interfaces define the performance monitoring events and their
attributes.

Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Signed-off-by: Wayne Lin <wayne.lin@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/display: Read DPCD to obtain eDP capability information.
Allen Li [Mon, 25 Aug 2025 06:23:14 +0000 (14:23 +0800)]
drm/amd/display: Read DPCD to obtain eDP capability information.

[Why & How]
Extend to read eDP general capability 2 in detect_edp_sink_caps().

Reviewed-by: Robin Chen <robin.chen@amd.com>
Reviewed-by: Wenjing Liu <wenjing.liu@amd.com>
Signed-off-by: Allen Li <wei-guang.li@amd.com>
Signed-off-by: Wayne Lin <wayne.lin@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/display: Indicate when custom brightness curves are in use
Mario Limonciello [Sun, 24 Aug 2025 20:20:58 +0000 (15:20 -0500)]
drm/amd/display: Indicate when custom brightness curves are in use

[Why]
There is a `scale` sysfs attribute that can be used to indicate when
non-linear brightness scaling is in use.  As Custom brightness curves
work by linear interpolation of points the scale is no longer linear.

[How]
Indicate non-linear scaling when custom brightness curves in use and
linear scaling otherwise.

Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Mario Limonciello <superm1@kernel.org>
Signed-off-by: Wayne Lin <wayne.lin@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/display: dont wait for pipe update during medupdate/highirq
Ausef Yousof [Thu, 21 Aug 2025 22:11:54 +0000 (18:11 -0400)]
drm/amd/display: dont wait for pipe update during medupdate/highirq

[why&how]
control flag for the wait during pipe update wait for vupdate should
be set if update type is not fast or med to prevent an invalid sleep
operation

Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
Signed-off-by: Ausef Yousof <Ausef.Yousof@amd.com>
Signed-off-by: Wayne Lin <wayne.lin@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/display: Add link index in AUX and dpms
Cruise Hung [Fri, 22 Aug 2025 07:45:03 +0000 (15:45 +0800)]
drm/amd/display: Add link index in AUX and dpms

[Why & How]
Add the link index in DP AUX transfer and DPMS functions.

Reviewed-by: Wenjing Liu <wenjing.liu@amd.com>
Signed-off-by: Cruise Hung <Cruise.Hung@amd.com>
Signed-off-by: Wayne Lin <wayne.lin@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/display: Add HDCP policy control
Oleh Kuzhylnyi [Mon, 18 Aug 2025 11:19:29 +0000 (13:19 +0200)]
drm/amd/display: Add HDCP policy control

[Why]
DM should be able to control HDCP retry limit via configurable
parameter.

[How]
Expose a retry_limit parameter for controlling the maximum number of
retries and lift the hardcode out to DM.

Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: Aric Cyr <aric.cyr@amd.com>
Signed-off-by: Oleh Kuzhylnyi <okuzhyln@amd.com>
Signed-off-by: Wayne Lin <wayne.lin@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Add vbios build number interface
Lijo Lazar [Thu, 28 Aug 2025 07:20:09 +0000 (12:50 +0530)]
drm/amdgpu: Add vbios build number interface

Fetch VBIOS build number from atom rom image. Add a sysfs interface to
read the build number.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/display: Disable DPCD Probe Quirk
Fangzhi Zuo [Thu, 4 Sep 2025 19:13:51 +0000 (15:13 -0400)]
drm/amd/display: Disable DPCD Probe Quirk

Disable dpcd probe quirk to native aux.

Signed-off-by: Fangzhi Zuo <Jerry.Zuo@amd.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4500
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20250904191351.746707-1-Jerry.Zuo@amd.com
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/pm: Add caching for SystemMetrics table
Lijo Lazar [Thu, 28 Aug 2025 04:32:35 +0000 (10:02 +0530)]
drm/amd/pm: Add caching for SystemMetrics table

Implement caching separately for SystemMetrics table from PMFW. The same
table could be used for multiple interfaces. Hence, cache it internally
to avoid multiple queries to the firmware. For SystemMetrics table, 5ms
cache interval is sufficient.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/pm: refine amdgpu pm sysfs node error code
Yang Wang [Wed, 3 Sep 2025 06:29:12 +0000 (14:29 +0800)]
drm/amd/pm: refine amdgpu pm sysfs node error code

v1:
Returns different error codes based on the scenario to help the user app understand
the AMDGPU device status when an exception occurs.

v2:
change -NODEV to -EBUSY.

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/pm: use int type to store negative error codes
Qianfeng Rong [Thu, 4 Sep 2025 14:58:00 +0000 (22:58 +0800)]
drm/amd/pm: use int type to store negative error codes

Use int instead of uint32_t for 'ret' variable to store negative error
codes or zero returned by other functions.

Storing the negative error codes in unsigned type, doesn't cause an issue
at runtime but can be confusing. Additionally, assigning negative error
codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
flag is enabled.

No effect on runtime.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/radeon/pm: Remove redundant ternary operators
Liao Yuanhong [Thu, 4 Sep 2025 11:32:00 +0000 (19:32 +0800)]
drm/radeon/pm: Remove redundant ternary operators

For ternary operators in the form of "a ? true : false", if 'a' itself
returns a boolean result, the ternary operator can be omitted. Remove
redundant ternary operators to clean up the code.

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/radeon/radeon_legacy_encoders: Remove redundant ternary operators
Liao Yuanhong [Thu, 4 Sep 2025 11:31:59 +0000 (19:31 +0800)]
drm/radeon/radeon_legacy_encoders: Remove redundant ternary operators

For ternary operators in the form of "a ? true : false", if 'a' itself
returns a boolean result, the ternary operator can be omitted. Remove
redundant ternary operators to clean up the code.

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/radeon/dpm: Remove redundant ternary operators
Liao Yuanhong [Thu, 4 Sep 2025 11:31:58 +0000 (19:31 +0800)]
drm/radeon/dpm: Remove redundant ternary operators

For ternary operators in the form of "a ? true : false", if 'a' itself
returns a boolean result, the ternary operator can be omitted. Remove
redundant ternary operators to clean up the code.

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/radeon/atom: Remove redundant ternary operators
Liao Yuanhong [Thu, 4 Sep 2025 11:31:57 +0000 (19:31 +0800)]
drm/radeon/atom: Remove redundant ternary operators

For ternary operators in the form of "a ? true : false", if 'a' itself
returns a boolean result, the ternary operator can be omitted. Remove
redundant ternary operators to clean up the code.

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/pm/powerplay/smumgr: remove redundant ternary operators
Liao Yuanhong [Thu, 4 Sep 2025 08:21:13 +0000 (16:21 +0800)]
drm/amd/pm/powerplay/smumgr: remove redundant ternary operators

For ternary operators in the form of "a ? true : false", if 'a' itself
returns a boolean result, the ternary operator can be omitted. Remove
redundant ternary operators to clean up the code. Swap variable positions
on either side of '==' to enhance readability.

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/pm/powerplay/hwmgr/ppatomctrl: Remove redundant ternary operators
Liao Yuanhong [Thu, 4 Sep 2025 08:21:12 +0000 (16:21 +0800)]
drm/amd/pm/powerplay/hwmgr/ppatomctrl: Remove redundant ternary operators

For ternary operators in the form of "a ? true : false", if 'a' itself
returns a boolean result, the ternary operator can be omitted. Remove
redundant ternary operators to clean up the code. Swap variable positions
on either side of '!=' to enhance readability.

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agoamdgpu/pm/legacy: remove redundant ternary operators
Liao Yuanhong [Thu, 4 Sep 2025 08:21:11 +0000 (16:21 +0800)]
amdgpu/pm/legacy: remove redundant ternary operators

For ternary operators in the form of "a ? true : false", if 'a' itself
returns a boolean result, the ternary operator can be omitted. Remove
redundant ternary operators to clean up the code.

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/display: Remove redundant ternary operators
Liao Yuanhong [Thu, 4 Sep 2025 07:10:15 +0000 (15:10 +0800)]
drm/amd/display: Remove redundant ternary operators

For ternary operators in the form of "a ? true : false" or
"a ? false : true", if 'a' itself returns a boolean result, the ternary
operator can be omitted. Remove redundant ternary operators to clean up the
code.

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu/userq: add a detect and reset callback
Jesse.Zhang [Thu, 4 Sep 2025 01:54:36 +0000 (09:54 +0800)]
drm/amdgpu/userq: add a detect and reset callback

Add a detect and reset callback and add the implementation
for mes.  The callback will detect all hung queues of a
particular ip type (e.g., GFX or compute or SDMA) and
reset them.

v2: increase reset counter and set fence force completion
v3: Removed userq_mutex in mes_userq_detect_and_reset since the driver holds it when calling

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdkfd: Fix error code sign for EINVAL in svm_ioctl()
Qianfeng Rong [Thu, 4 Sep 2025 12:36:46 +0000 (20:36 +0800)]
drm/amdkfd: Fix error code sign for EINVAL in svm_ioctl()

Use negative error code -EINVAL instead of positive EINVAL in the default
case of svm_ioctl() to conform to Linux kernel error code conventions.

Fixes: 42de677f7999 ("drm/amdkfd: register svm range")
Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: don't enable SMU on cyan skillfish
Alex Deucher [Fri, 27 Jun 2025 14:25:09 +0000 (10:25 -0400)]
drm/amdgpu: don't enable SMU on cyan skillfish

Cyan skillfish uses different SMU firmware.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: add support for cyan skillfish gpu_info
Alex Deucher [Fri, 27 Jun 2025 14:21:16 +0000 (10:21 -0400)]
drm/amdgpu: add support for cyan skillfish gpu_info

Some SOCs which are part of the cyan skillfish family
rely on an explicit firmware for IP discovery.  Add support
for the gpu_info firmware.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: add support for cyan skillfish without IP discovery
Alex Deucher [Fri, 27 Jun 2025 14:18:46 +0000 (10:18 -0400)]
drm/amdgpu: add support for cyan skillfish without IP discovery

For platforms without an IP discovery table.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: add ip offset support for cyan skillfish
Alex Deucher [Fri, 27 Jun 2025 14:12:36 +0000 (10:12 -0400)]
drm/amdgpu: add ip offset support for cyan skillfish

For chips that don't have IP discovery tables.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Fix function header names in amdgpu_connectors.c
Srinivasan Shanmugam [Sun, 31 Aug 2025 09:59:56 +0000 (15:29 +0530)]
drm/amdgpu: Fix function header names in amdgpu_connectors.c

Align the function headers for `amdgpu_max_hdmi_pixel_clock` and
`amdgpu_connector_dvi_mode_valid` with the function implementations so
they match the expected kdoc style.

Fixes the below:
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c:1199: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
 * Returns the maximum supported HDMI (TMDS) pixel clock in KHz.
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c:1212: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
 * Validates the given display mode on DVI and HDMI connectors.

Fixes: 585b2f685c56 ("drm/amdgpu: Respect max pixel clock for HDMI and DVI-D (v2)")
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: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agoamd/amdkfd: correct mem limit calculation for small APUs
Yifan Zhang [Wed, 20 Aug 2025 08:10:51 +0000 (16:10 +0800)]
amd/amdkfd: correct mem limit calculation for small APUs

Current mem limit check leaks some GTT memory (reserved_for_pt
reserved_for_ras + adev->vram_pin_size) for small APUs.

Since carveout VRAM is tunable on APUs, there are three case
regarding the carveout VRAM size relative to GTT:

1. 0 < carveout < gtt
   apu_prefer_gtt = true, is_app_apu = false

2. carveout > gtt / 2
   apu_prefer_gtt = false, is_app_apu = false

3. 0 = carveout
   apu_prefer_gtt = true, is_app_apu = true

It doesn't make sense to check below limitation in case 1
(default case, small carveout) because the values in the below
expression are mixed with carveout and gtt.

adev->kfd.vram_used[xcp_id] + vram_needed >
    vram_size - reserved_for_pt - reserved_for_ras -
    atomic64_read(&adev->vram_pin_size)

gtt: kfd.vram_used, vram_needed, vram_size
carveout: reserved_for_pt, reserved_for_ras, adev->vram_pin_size

In case 1, vram allocation will go to gtt domain, skip vram check
since ttm_mem_limit check already cover this allocation.

Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/display: remove oem i2c adapter on finish
Geoffrey McRae [Thu, 28 Aug 2025 12:26:22 +0000 (22:26 +1000)]
drm/amd/display: remove oem i2c adapter on finish

Fixes a bug where unbinding of the GPU would leave the oem i2c adapter
registered resulting in a null pointer dereference when applications try
to access the invalid device.

Fixes: 3d5470c97314 ("drm/amd/display/dm: add support for OEM i2c bus")
Cc: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Geoffrey McRae <geoffrey.mcrae@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu/userq: add force completion helpers
Alex Deucher [Fri, 18 Apr 2025 15:35:49 +0000 (11:35 -0400)]
drm/amdgpu/userq: add force completion helpers

Add support for forcing completion of userq fences.
This is needed for userq resets and asic resets so that we
can set the error on the fence and force completion.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: add user queue reset source
Alex Deucher [Wed, 16 Apr 2025 17:12:40 +0000 (13:12 -0400)]
drm/amdgpu: add user queue reset source

Track resets from user queues.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Sunil Khatri <sunil.khatri@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu/mes12: implement detect and reset callback
Jesse.Zhang [Thu, 4 Sep 2025 01:50:00 +0000 (09:50 +0800)]
drm/amdgpu/mes12: implement detect and reset callback

Implement support for the hung queue detect and reset
functionality.

v2: Always use AMDGPU_MES_SCHED_PIPE

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu/mes11: implement detect and reset callback
Jesse.Zhang [Thu, 4 Sep 2025 01:44:51 +0000 (09:44 +0800)]
drm/amdgpu/mes11: implement detect and reset callback

Implement support for the hung queue detect and reset
functionality.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu/mes: add front end for detect and reset hung queue
Jesse.Zhang [Thu, 4 Sep 2025 01:39:34 +0000 (09:39 +0800)]
drm/amdgpu/mes: add front end for detect and reset hung queue

Helper function to detect and reset hung queues.  MES will
return an array of doorbell indices of which queues are hung
and were optionally reset.

v2:  Clear the doorbell array before detection

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/amdgpu: Implement MES suspend/resume gang functionality for v12
Jesse.Zhang [Sun, 3 Aug 2025 13:21:42 +0000 (21:21 +0800)]
drm/amd/amdgpu: Implement MES suspend/resume gang functionality for v12

This commit implements the actual MES (Micro Engine Scheduler) suspend
and resume gang operations for version 12 hardware. Previously these
functions were just stubs returning success.

v2: Always use AMDGPU_MES_SCHED_PIPE

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
2 months agodrm/amdgpu: Add preempt and restore callbacks to userq funcs
Jesse.Zhang [Tue, 5 Aug 2025 03:26:15 +0000 (11:26 +0800)]
drm/amdgpu: Add preempt and restore callbacks to userq funcs

Add two new function pointers to struct amdgpu_userq_funcs:
- preempt: To handle preemption of user mode queues
- restore: To restore preempted user mode queues

These callbacks will allow the driver to properly manage queue
preemption and restoration when needed, such as during context
switching or priority changes.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: fix the formating for debugfs print
Sunil Khatri [Thu, 14 Aug 2025 07:59:04 +0000 (13:29 +0530)]
drm/amdgpu: fix the formating for debugfs print

Fix the format of debugfs print in the mqd. Need to
add a colon so parser can parse it properly.

Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd: add more cyan skillfish PCI ids
Alex Deucher [Fri, 27 Jun 2025 14:09:06 +0000 (10:09 -0400)]
drm/amd: add more cyan skillfish PCI ids

Add additional PCI IDs to the cyan skillfish family.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: add more information in debugfs to pagetable dump
Sunil Khatri [Thu, 14 Aug 2025 07:53:32 +0000 (13:23 +0530)]
drm/amdgpu: add more information in debugfs to pagetable dump

Add more information in the debugfs which is needed to dump
a pagetable correctly for userqueues where vmid is not known
in the kernel.

Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Correct info field of bad page threshold exceed CPER
Xiang Liu [Tue, 2 Sep 2025 14:13:44 +0000 (22:13 +0800)]
drm/amdgpu: Correct info field of bad page threshold exceed CPER

Correct valid_bits and ms_chk_bits of section info field for bad page
threshold exceed CPER to match OOB's behavior.

Signed-off-by: Xiang Liu <xiang.liu@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdkfd: fix p2p links bug in topology
Eric Huang [Mon, 25 Aug 2025 13:50:49 +0000 (09:50 -0400)]
drm/amdkfd: fix p2p links bug in topology

When creating p2p links, KFD needs to check XGMI link
with two conditions, hive_id and is_sharing_enabled,
but it is missing to check is_sharing_enabled, so add
it to fix the error.

Signed-off-by: Eric Huang <jinhuieric.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/radeon/ci_dpm: Use int type to store negative error codes
Qianfeng Rong [Wed, 3 Sep 2025 12:21:10 +0000 (20:21 +0800)]
drm/radeon/ci_dpm: Use int type to store negative error codes

Change the 'ret' variable in ci_populate_all_graphic_levels()
and ci_populate_all_memory_levels() from u32 to int, as it needs to store
either negative error codes or zero returned by other functions.

Storing the negative error codes in unsigned type, doesn't cause an issue
at runtime but can be confusing.  Additionally, assigning negative error
codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
flag is enabled.

No effect on runtime.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu/vcn: Remove redundant ternary operators
Liao Yuanhong [Wed, 3 Sep 2025 12:03:50 +0000 (20:03 +0800)]
drm/amdgpu/vcn: Remove redundant ternary operators

For ternary operators in the form of "a ? true : false", if 'a' itself
returns a boolean result, the ternary operator can be omitted. Remove
redundant ternary operators to clean up the code.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu/jpeg: Remove redundant ternary operators
Liao Yuanhong [Wed, 3 Sep 2025 12:03:49 +0000 (20:03 +0800)]
drm/amdgpu/jpeg: Remove redundant ternary operators

For ternary operators in the form of "a ? true : false", if 'a' itself
returns a boolean result, the ternary operator can be omitted. Remove
redundant ternary operators to clean up the code.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu/ih: Remove redundant ternary operators
Liao Yuanhong [Wed, 3 Sep 2025 12:03:48 +0000 (20:03 +0800)]
drm/amdgpu/ih: Remove redundant ternary operators

For ternary operators in the form of "a ? false : true", if 'a' itself
returns a boolean result, the ternary operator can be omitted. Remove
redundant ternary operators to clean up the code.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu/gmc: Remove redundant ternary operators
Liao Yuanhong [Wed, 3 Sep 2025 12:03:47 +0000 (20:03 +0800)]
drm/amdgpu/gmc: Remove redundant ternary operators

For ternary operators in the form of "a ? false : true", if 'a' itself
returns a boolean result, the ternary operator can be omitted. Remove
redundant ternary operators to clean up the code.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu/gfx: Remove redundant ternary operators
Liao Yuanhong [Wed, 3 Sep 2025 12:03:46 +0000 (20:03 +0800)]
drm/amdgpu/gfx: Remove redundant ternary operators

For ternary operators in the form of "a ? false : true", if 'a' itself
returns a boolean result, the ternary operator can be omitted. Remove
redundant ternary operators to clean up the code.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu/amdgpu_cper: Remove redundant ternary operators
Liao Yuanhong [Wed, 3 Sep 2025 12:03:45 +0000 (20:03 +0800)]
drm/amdgpu/amdgpu_cper: Remove redundant ternary operators

For ternary operators in the form of "a ? false : true", if 'a' itself
returns a boolean result, the ternary operator can be omitted. Remove
redundant ternary operators to clean up the code.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/amdgpu: Fix a less than zero check on a uint32_t struct field
Colin Ian King [Wed, 3 Sep 2025 08:20:18 +0000 (09:20 +0100)]
drm/amd/amdgpu: Fix a less than zero check on a uint32_t struct field

Currently the error check from the call to mes_v12_inv_tlb_convert_hub_id
is always false because a uint32_t struct field hub_id is being used to
to perform the less than zero error check. Fix this by using the int
variable ret to perform the check.

Fixes: 87e65052616c ("drm/amd/amdgpu : Use the MES INV_TLBS API for tlb invalidation on gfx12")
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu/amdkfd: Avoid a couple hundred -Wflex-array-member-not-at-end warnings
Gustavo A. R. Silva [Fri, 29 Aug 2025 09:58:21 +0000 (11:58 +0200)]
drm/amdgpu/amdkfd: Avoid a couple hundred -Wflex-array-member-not-at-end warnings

-Wflex-array-member-not-at-end was introduced in GCC-14, and we are
getting ready to enable it, globally.

Move the conflicting declarations to the end of the corresponding
structures. Notice that `struct dev_pagemap` is a flexible structure,
this is a structure that contains a flexible-array member.

struct dev_pagemap always has room for at least one range. amdgpu only
uses a single range. Therefore no change are needed to the allocation
of struct amdgpu_device.

Fix 283 of the following type of warnings:
    283 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h:111:28: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
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>
2 months agodrm/amd/amdgpu: Fix missing error return on kzalloc failure
Colin Ian King [Tue, 2 Sep 2025 12:40:50 +0000 (13:40 +0100)]
drm/amd/amdgpu: Fix missing error return on kzalloc failure

Currently the kzalloc failure check just sets reports the failure
and sets the variable ret to -ENOMEM, which is not checked later
for this specific error. Fix this by just returning -ENOMEM rather
than setting ret.

Fixes: 4fb930715468 ("drm/amd/amdgpu: remove redundant host to psp cmd buf allocations")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/pm: Print VCE clocks too in si_dpm (v3)
Timur Kristóf [Thu, 28 Aug 2025 15:11:12 +0000 (17:11 +0200)]
drm/amd/pm: Print VCE clocks too in si_dpm (v3)

They are part of a power state too and should be printed
alongside the rest of the data from the power state.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/pm: Remove wm_low and wm_high fields from amdgpu_crtc (v2)
Timur Kristóf [Thu, 28 Aug 2025 15:11:11 +0000 (17:11 +0200)]
drm/amd/pm: Remove wm_low and wm_high fields from amdgpu_crtc (v2)

These fields were only used by si_dpm and are not necessary
anymore. They also may have been incorrect because:
- wm_high was set to the LOW_WATERMARK field of watermark A.
- wm_low was not set on DCE 6 and was always zero.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/pm: Disable SCLK switching on Oland with high pixel clocks (v3)
Timur Kristóf [Thu, 28 Aug 2025 15:11:10 +0000 (17:11 +0200)]
drm/amd/pm: Disable SCLK switching on Oland with high pixel clocks (v3)

Port of commit 227545b9a08c ("drm/radeon/dpm: Disable sclk
switching on Oland when two 4K 60Hz monitors are connected")

This is an ad-hoc DPM fix, necessary because we don't have
proper bandwidth calculation for DCE 6.

We define "high pixelclock" for SI as higher than necessary
for 4K 30Hz. For example, 4K 60Hz and 1080p 144Hz fall into
this category.

When two high pixel clock displays are connected to Oland,
additionally disable shader clock switching, which results in
a higher voltage, thereby addressing some visible flickering.

v2:
Add more comments.
v3:
Split into two commits for easier review.

Fixes: 841686df9f7d ("drm/amdgpu: add SI DPM support (v4)")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/pm: Disable MCLK switching with non-DC at 120 Hz+ (v2)
Timur Kristóf [Thu, 28 Aug 2025 15:11:09 +0000 (17:11 +0200)]
drm/amd/pm: Disable MCLK switching with non-DC at 120 Hz+ (v2)

According to pp_pm_compute_clocks the non-DC display code
has "issues with mclk switching with refresh rates over 120 hz".
The workaround is to disable MCLK switching in this case.

Do the same for legacy DPM.

Fixes: 6ddbd37f1074 ("drm/amd/pm: optimize the amdgpu_pm_compute_clocks() implementations")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/pm: Treat zero vblank time as too short in si_dpm (v3)
Timur Kristóf [Thu, 28 Aug 2025 15:11:08 +0000 (17:11 +0200)]
drm/amd/pm: Treat zero vblank time as too short in si_dpm (v3)

Some parts of the code base expect that MCLK switching is turned
off when the vblank time is set to zero.

According to pp_pm_compute_clocks the non-DC code has issues
with MCLK switching with refresh rates over 120 Hz.

v3:
Add code comment to explain this better.
Add an if statement instead of changing the switch_limit.

Fixes: 841686df9f7d ("drm/amdgpu: add SI DPM support (v4)")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/pm: Adjust si_upload_smc_data register programming (v3)
Timur Kristóf [Thu, 28 Aug 2025 15:11:07 +0000 (17:11 +0200)]
drm/amd/pm: Adjust si_upload_smc_data register programming (v3)

Based on some comments in dm_pp_display_configuration
above the crtc_index and line_time fields, these values
are programmed to the SMC to work around an SMC hang
when it switches MCLK.

According to Alex, the Windows driver programs them to:
mclk_change_block_cp_min = 200 / line_time
mclk_change_block_cp_max = 100 / line_time
Let's use the same for the sake of consistency.

Previously we used the watermark values, but it seemed buggy
as the code was mixing up low/high and A/B watermarks, and
was not saving a low watermark value on DCE 6, so
mclk_change_block_cp_max would be always zero previously.

Split this change off from the previous si_upload_smc_data
to make it easier to bisect, in case it causes any issues.

Fixes: 841686df9f7d ("drm/amdgpu: add SI DPM support (v4)")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/pm: Fix si_upload_smc_data (v3)
Timur Kristóf [Thu, 28 Aug 2025 15:11:06 +0000 (17:11 +0200)]
drm/amd/pm: Fix si_upload_smc_data (v3)

The si_upload_smc_data function uses si_write_smc_soft_register
to set some register values in the SMC, and expects the result
to be PPSMC_Result_OK which is 1.

The PPSMC_Result_OK / PPSMC_Result_Failed values are used for
checking the result of a command sent to the SMC.
However, the si_write_smc_soft_register actually doesn't send
any commands to the SMC and returns zero on success,
so this check was incorrect.

Fix that by not checking the return value, just like other
calls to si_write_smc_soft_register.

v3:
Additionally, when no display is plugged in, there is no need
to restrict MCLK switching, so program the registers to zero.

Fixes: 841686df9f7d ("drm/amdgpu: add SI DPM support (v4)")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/pm: Increase SMC timeout on SI and warn (v3)
Timur Kristóf [Thu, 28 Aug 2025 15:11:05 +0000 (17:11 +0200)]
drm/amd/pm: Increase SMC timeout on SI and warn (v3)

The SMC can take an excessive amount of time to process some
messages under some conditions.

Background:
Sending a message to the SMC works by writing the message into
the mmSMC_MESSAGE_0 register and its optional parameter into
the mmSMC_SCRATCH0, and then polling mmSMC_RESP_0. Previously
the timeout was AMDGPU_MAX_USEC_TIMEOUT, ie. 100 ms.

Increase the timeout to 200 ms for all messages and to 1 sec for
a few messages which I've observed to be especially slow:
PPSMC_MSG_NoForcedLevel
PPSMC_MSG_SetEnabledLevels
PPSMC_MSG_SetForcedLevels
PPSMC_MSG_DisableULV
PPSMC_MSG_SwitchToSwState

This fixes the following problems on Tahiti when switching
from a lower clock power state to a higher clock state, such
as when DC turns on a display which was previously turned off.

* si_restrict_performance_levels_before_switch would fail
  (if the user previously forced high clocks using sysfs)
* si_set_sw_state would fail (always)

It turns out that both of those failures were SMC timeouts and
that the SMC actually didn't fail or hang, just needs more time
to process those.

Add a warning when there is an SMC timeout to make it easier to
identify this type of problem in the future.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/pm: Disable ULV even if unsupported (v3)
Timur Kristóf [Thu, 28 Aug 2025 15:11:04 +0000 (17:11 +0200)]
drm/amd/pm: Disable ULV even if unsupported (v3)

Always send PPSMC_MSG_DisableULV to the SMC, even if ULV mode
is unsupported, to make sure it is properly turned off.

v3:
Simplify si_disable_ulv further.
Always check the return value of amdgpu_si_send_msg_to_smc.

Fixes: 841686df9f7d ("drm/amdgpu: add SI DPM support (v4)")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Power up UVD 3 for FW validation (v2)
Timur Kristóf [Thu, 28 Aug 2025 15:11:03 +0000 (17:11 +0200)]
drm/amdgpu: Power up UVD 3 for FW validation (v2)

Unlike later versions, UVD 3 has firmware validation.
For this to work, the UVD should be powered up correctly.

When DPM is enabled and the display clock is off,
the SMU may choose a power state which doesn't power
the UVD, which can result in failure to initialize UVD.

v2:
Add code comments to explain about the UVD power state
and how UVD clock is turned on/off.

Fixes: b38f3e80ecec ("drm amdgpu: SI UVD v3_1 (v2)")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Allow kfd CRIU with no buffer objects
David Francis [Wed, 19 Feb 2025 15:01:32 +0000 (10:01 -0500)]
drm/amdgpu: Allow kfd CRIU with no buffer objects

The kfd CRIU checkpoint ioctl would return an error if trying
to checkpoint a process with no kfd buffer objects.

This is a normal case and should not be an error.

Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: David Francis <David.Francis@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Add mapping info option for GEM_OP ioctl
David Francis [Mon, 16 Jun 2025 13:49:33 +0000 (09:49 -0400)]
drm/amdgpu: Add mapping info option for GEM_OP ioctl

Add new GEM_OP_IOCTL option GET_MAPPING_INFO, which
returns a list of mappings associated with a given bo, along with
their positions and offsets.

Userspace for this and the previous change can be found at:
https://github.com/checkpoint-restore/criu/pull/2613

Signed-off-by: David Francis <David.Francis@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 ioctl to get all gem handles for a process
David Francis [Mon, 16 Jun 2025 13:47:42 +0000 (09:47 -0400)]
drm/amdgpu: Add ioctl to get all gem handles for a process

Add new ioctl DRM_IOCTL_AMDGPU_GEM_LIST_HANDLES.

This ioctl returns a list of bos with their handles, sizes,
and flags and domains.

This ioctl is meant to be used during CRIU checkpoint and
provide information needed to reconstruct the bos
in CRIU restore.

Userspace for this and the next change can be found at
https://github.com/checkpoint-restore/criu/pull/2613

Signed-off-by: David Francis <David.Francis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Allow more flags to be set on gem create.
David Francis [Tue, 12 Aug 2025 18:19:18 +0000 (14:19 -0400)]
drm/amdgpu: Allow more flags to be set on gem create.

The GEM create flag AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE
specifies that gem memory contains sensitive information and
should be cleared to prevent snooping.

The COHERENT and UNCACHED gem create flags enable memory
features related to sharing memory across devices.

For CRIU we need to re-create KFD BOs through the
GEM_CREATE IOCTL, so allow those KFD specific flags here as well.
This will also aid us in the future and allows to move
the KFD components over using the render node for allocations.

Signed-off-by: David Francis <David.Francis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agoMerge tag 'drm-intel-gt-next-2025-09-01' of https://gitlab.freedesktop.org/drm/i915...
Dave Airlie [Tue, 2 Sep 2025 01:23:39 +0000 (11:23 +1000)]
Merge tag 'drm-intel-gt-next-2025-09-01' of https://gitlab.freedesktop.org/drm/i915/kernel into drm-next

Driver Changes:

- Apply multiple JSL/EHL/Gen7/Gen6 workaround properly at context level (Sebastian)
- Protect against overflow in active_engine() (Krzysztof)
- Use try_cmpxchg64() in __active_lookup() (Uros)

- Enable GuC CT_DEAD output in regular debug builds (John)
- Static checker and style fixes (Sebastian)
- Selftest improvements (Krzysztof)

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://lore.kernel.org/r/aLWZoEZVlBj2d8J9@jlahtine-mobl
2 months agoMerge tag 'drm-xe-next-2025-08-29' of https://gitlab.freedesktop.org/drm/xe/kernel...
Dave Airlie [Tue, 2 Sep 2025 00:05:55 +0000 (10:05 +1000)]
Merge tag 'drm-xe-next-2025-08-29' of https://gitlab.freedesktop.org/drm/xe/kernel into drm-next

UAPI Changes:
 - Add madvise interface (Himal Prasad Ghimiray)
 - Add DRM_IOCTL_XE_VM_QUERY_MEMORY_RANGE_ATTRS to query VMA count and
   memory attributes (Himal Prasad Ghimiray)
 - Handle Firmware reported Hardware Errors notifying userspace with
   device wedged uevent (Riana Tauro)

Cross-subsystem Changes:

 - Add a vendor-specific recovery method to drm device wedged uevent
   (Riana Tauro)

Driver Changes:
 - Use same directory structure in debugfs as in sysfs (Michal Wajdeczko)
 - Cleanup and future-proof VRAM region initialization (Piotr Piórkowski)
 - Add G-states and PCIe link states to debugfs (Soham Purkait)
 - Cleanup eustall debug messages (Harish Chegondi)
 - Add SR-IOV support to restore Compression Control Surface (CCS) to
   Xe2 and later (Satyanarayana K V P)
 - Enable SR-IOV PF mode by default on supported platforms without
   needing CONFIG_DRM_XE_DEBUG and mark some platforms behind
   force_probe as supported (Michal Wajdeczko)
 - More targeted log messages (Michal Wajdeczko)
 - Cleanup STEER_SEMAPHORE/MCFG_MCR_SELECTOR usage (Nitin Gote)
 - Use common code to emit flush (Tvrtko Ursulin)
 - Add/extend more HW workarounds and tunings for Xe2 and Xe3
   (Sk Anirban, Tangudu Tilak Tirumalesh, Nitin Gote, Chaitanya Kumar Borah)
 - Add a generic dependency scheduler to help with TLB invalidations
   and future scenarios (Matthew Brost)
 - Use DRM scheduler for delayed GT TLB invalidations (Matthew Brost)
 - Error out on incorrect device use in configfs
   (Michal Wajdeczko, Lucas De Marchi)
 - Refactor configfs attributes (Michal Wajdeczko / Lucas De Marchi)
 - Allow configuring future VF devices via configfs (Michal Wajdeczko)
 - Implement some missing XeLP workarounds (Tvrtko Ursulin)
 - Generalize WA BB setup/emission and add support for
   mid context restore BB, aka indirect context (Tvrtko Ursulin)
 - Prepare the driver to expose mmio regions to userspace
   in future (Ilia Levi)
 - Add more GuC load error status codes (John Harrison)
 - Document DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING (Priyanka Dandamudi)
 - Disable CSC and RPM on VFs (Lukasz Laguna, Satyanarayana K V P)
 - Fix oops in xe_gem_fault with PREEMPT_RT (Maarten Lankhorst)
 - Skip LMTT update if no LMEM was provisioned (Michal Wajdeczko)
 - Add support to VF migration (Tomasz Lis)
 - Use a helper for guc_waklv_enable functions (Jonathan Cavitt)
 - Prepare GPU SVM for migration of THP (Francois Dugast)
 - Program LMTT directory pointer on all GTs within a tile
   (Piotr Piórkowski)
 - Rename XE_WA to XE_GT_WA to better convey its scope vs the device WAs
   (Matt Atwood)
 - Allow to match devices on PCI devid/vendorid only (Lucas De Marchi)
 - Improve PDE PAT index selection (Matthew Brost)
 - Consolidate ASID allocation in xe_vm_create() vs
   xe_vm_create_ioctl() (Piotr Piórkowski)
 - Resize VF BARS to max possible size according to number of VFs
   (Michał Winiarski)
 - Untangle vm_bind_ioctl cleanup order (Christoph Manszewski)
 - Start fixing usage of XE_PAGE_SIZE vs PAGE_SIZE to improve
   compatibility with non-x86 arch (Simon Richter)
 - Improve tile vs gt initialization order and accounting
   (Gustavo Sousa)
 - Extend WA kunit test to PTL
 - Ensure data is initialized before transferring to pcode
   (Stuart Summers)
 - Add PSMI support for HW validation (Lucas De Marchi,
   Vinay Belgaumkar, Badal Nilawar)
 - Improve xe_dma_buf test (Thomas Hellström, Marcin Bernatowicz)
 - Fix basename() usage in generator with !glibc (Carlos Llamas)
 - Ensure GT is in C0 during resumes (Xin Wang)
 - Add TLB invalidation abstraction (Matt Brost, Stuart Summers)
 - Make MI_TLB_INVALIDATE conditional on migrate (Matthew Auld)
 - Prepare xe_nvm to be initialized early for future use cases
   (Riana Tauro)

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://lore.kernel.org/r/nuejxdhnalyok7tzwkrj67dwjgdafwp4mhdejpyyqnrh4f2epq@nlldovuflnbx
2 months agoMerge tag 'amd-drm-next-6.18-2025-08-29' of https://gitlab.freedesktop.org/agd5f...
Dave Airlie [Mon, 1 Sep 2025 23:35:11 +0000 (09:35 +1000)]
Merge tag 'amd-drm-next-6.18-2025-08-29' of https://gitlab.freedesktop.org/agd5f/linux into drm-next

amd-drm-next-6.18-2025-08-29:

amdgpu:
- Replay fixes
- RAS updates
- VCN SRAM load fixes
- EDID read fixes
- eDP ALPM support
- AUX fixes
- Documenation updates
- Rework how PTE flags are generated
- DCE6 fixes
- VCN devcoredump cleanup
- MMHUB client id fixes
- SR-IOV fixes
- VRR fixes
- VCN 5.0.1 RAS support
- Backlight fixes
- UserQ fixes
- Misc code cleanups
- SMU 13.0.12 updates
- Expanded PCIe DPC support
- Expanded VCN reset support
- SMU 13.0.x Updates
- VPE per queue reset support
- Cusor rotation fix
- DSC fixes
- GC 12 MES TLB invalidation update
- Cursor fixes
- Non-DC TMDS clock validation fix

amdkfd:
- debugfs fixes
- Misc code cleanups
- Page migration fixes
- Partition fixes
- SVM fixes

radeon:
- Misc code cleanups

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Alex Deucher <alexander.deucher@amd.com>
Link: https://lore.kernel.org/r/20250829190848.1921648-1-alexander.deucher@amd.com
2 months agodrm/amdgpu: Respect max pixel clock for HDMI and DVI-D (v2)
Timur Kristóf [Thu, 28 Aug 2025 14:50:36 +0000 (16:50 +0200)]
drm/amdgpu: Respect max pixel clock for HDMI and DVI-D (v2)

Update the legacy (non-DC) display code to respect the maximum
pixel clock for HDMI and DVI-D. Reject modes that would require
a higher pixel clock than can be supported.

Also update the maximum supported HDMI clock value depending on
the ASIC type.

For reference, see the DC code:
check max_hdmi_pixel_clock in dce*_resource.c

v2:
Fix maximum clocks for DVI-D and DVI/HDMI adapters.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/display: Promote DC to 3.2.348
Taimur Hassan [Fri, 22 Aug 2025 21:17:11 +0000 (16:17 -0500)]
drm/amd/display: Promote DC to 3.2.348

Summary:

* Refactor bounding box values handling
* Fix incorrect condition to fail dto clk calculation
* Skip check downlink setting for a certain MST branch device
* Fix double cursor issue on dcn314

Signed-off-by: Taimur Hassan <Syed.Hassan@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/display: [FW Promotion] Release 0.1.25.0
Taimur Hassan [Fri, 22 Aug 2025 20:13:17 +0000 (16:13 -0400)]
drm/amd/display: [FW Promotion] Release 0.1.25.0

Signed-off-by: Taimur Hassan <Syed.Hassan@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/display: Skip Check Runtime Link Setting for Specific Branch Device
Fangzhi Zuo [Thu, 14 Aug 2025 18:41:44 +0000 (14:41 -0400)]
drm/amd/display: Skip Check Runtime Link Setting for Specific Branch Device

[why]
Read link setting inside mode validation is not always the final downlink setting.
It is found true in Synaptics branch device.

At bootup, the preferred mode being set right after 1080p is set. It occurred
before graphic load. That modeset switch in a short period of time makes
the branch device switch back and forth from lower and higher link rate,
observed at Synaptics branch device.
DP2 RTK hub on the other hand, sticks to highest available downlink rate after bootup.

Existing check of runtime downlink setting in mode validation shows asynchronous at
branch device link switch, i.e., downlink switch to higher link rate not yet complete
when the mode validation tries to probe the downlink setting. That makes mode validation
checking downlink setting making wrong decision by pruning modes that should pass the
validation after the downlink setting switch is complete.

[how]
If Synaptics is found at the last branch, skip checking downlink setting
at mode validation.

Reviewed-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Fangzhi Zuo <Jerry.Zuo@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/display: Clear the CUR_ENABLE register on DCN314 w/out DPP PG
Ivan Lipski [Wed, 20 Aug 2025 19:46:52 +0000 (15:46 -0400)]
drm/amd/display: Clear the CUR_ENABLE register on DCN314 w/out DPP PG

[Why&How]
ON DCN314, clearing DPP SW structure without power gating it can cause a
double cursor in full screen with non-native scaling.

A W/A that clears CURSOR0_CONTROL cursor_enable flag if
dcn10_plane_atomic_power_down is called and DPP power gating is disabled.

Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4168
Reviewed-by: Sun peng (Leo) Li <sunpeng.li@amd.com>
Signed-off-by: Ivan Lipski <ivan.lipski@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/display: incorrect conditions for failing dto calculations
Clay King [Wed, 20 Aug 2025 19:04:29 +0000 (15:04 -0400)]
drm/amd/display: incorrect conditions for failing dto calculations

[Why & How]
Previously, when calculating dto phase, we would incorrectly fail when phase
<=0 without additionally checking for the integer value. This meant that
calculations would incorrectly fail when the desired pixel clock was an exact
multiple of the reference clock.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Signed-off-by: Clay King <clayking@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/display: Add Component To Handle Bounding Box Values and IP Caps
Austin Zheng [Thu, 14 Aug 2025 13:54:45 +0000 (09:54 -0400)]
drm/amd/display: Add Component To Handle Bounding Box Values and IP Caps

[Why]
Bounding box values can be stored in multiple locations. (e.g. PMFW, VBIOS, DMUB).
The source and interpretation of these values can vary with DCN revision
so there should be a component that can gather these values and translate
them accordingly

[How]
Have component start with the statically defined values as a base.
Then update them as needed with DCN-specific logic
Guard this component with FPU flags since values need to be in float point.

Reviewed-by: Jun Lei <jun.lei@amd.com>
Signed-off-by: Austin Zheng <Austin.Zheng@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/display: Optimize custom brightness curve interpolation
Mario Limonciello [Tue, 19 Aug 2025 16:29:05 +0000 (11:29 -0500)]
drm/amd/display: Optimize custom brightness curve interpolation

[Why]
Custom brightness curve works by walking through all data points one
by one.  When the brightness value is at either extreme this is a lot
of data points to walk.  This is especially noticeable when moving a
brightness slider around how it can lag.

[How]
Bisect the data points to find the closest for interpolation.

Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/display: Increase minimum clock for TMDS 420 with pipe splitting
Relja Vojvodic [Thu, 14 Aug 2025 15:33:22 +0000 (11:33 -0400)]
drm/amd/display: Increase minimum clock for TMDS 420 with pipe splitting

[Why]
-Pipe splitting allows for clocks to be reduced, but when using TMDS 420,
reduced clocks lead to missed clocks cycles on clock resyncing

[How]
-Impose a minimum clock when using TMDS 420

Reviewed-by: Chris Park <chris.park@amd.com>
Signed-off-by: Relja Vojvodic <rvojvodi@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: drop hw access in non-DC audio fini
Alex Deucher [Wed, 6 Aug 2025 14:47:50 +0000 (10:47 -0400)]
drm/amdgpu: drop hw access in non-DC audio fini

We already disable the audio pins in hw_fini so
there is no need to do it again in sw_fini.

Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4481
Cc: oushixiong <oushixiong1025@163.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd: Re-enable common modes for eDP and LVDS
Mario Limonciello [Thu, 28 Aug 2025 14:37:05 +0000 (09:37 -0500)]
drm/amd: Re-enable common modes for eDP and LVDS

[Why]
Although compositors will add their own modes, Xorg won't use it's own
modes and will only stick to modes advertised by the driver. This mean a
user that used to pick 1024x768 could no longer access it unless the
panel's native resolution was 1024x768.

[How]
Revert commit 6d396e7ac1ce3 ("drm/amd/display: Disable common modes for
LVDS") and commit 7948afb46af92 ("drm/amd/display: Disable common modes
for eDP").

The panel will still use scaling for any non-native modes due to
commit 978fa2f6d0b12 ("drm/amd/display: Use scaling for non-native
resolutions on eDP")

Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4538
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://lore.kernel.org/r/20250828140856.2887993-1-superm1@kernel.org
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu/mes11: make MES_MISC_OP_CHANGE_CONFIG failure non-fatal
Alex Deucher [Wed, 27 Aug 2025 18:24:31 +0000 (14:24 -0400)]
drm/amdgpu/mes11: make MES_MISC_OP_CHANGE_CONFIG failure non-fatal

If the firmware is too old, just warn and return success.

Fixes: 27b791514789 ("drm/amdgpu/mes: keep enforce isolation up to date")
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4414
Cc: shaoyun.Liu@amd.com
Reviewed-by: Shaoyun.liu <Shaoyun.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/pm: Make use of __free for cleanup
Lijo Lazar [Mon, 18 Aug 2025 06:14:28 +0000 (11:44 +0530)]
drm/amd/pm: Make use of __free for cleanup

Use __free(kfree) for memory alloc cleanups in SMUv13.0.6

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>
2 months agodrm/amdgpu: Check vcn state before profile switch
Lijo Lazar [Thu, 14 Aug 2025 08:22:50 +0000 (13:52 +0530)]
drm/amdgpu: Check vcn state before profile switch

The patch uses power state of VCN instances for requesting video
profile.

In idle worker of a vcn instance, when there is no outstanding
submisssion or fence, the instance is put to power gated state. When
all instances are powered off that means video profile is no longer
required. A request is made to turn off video profile.

A job submission starts with begin_use of ring, and at that time
vcn instance state is changed to power on. Subsequently a check is
made for active video profile, and if not active, a request is made.

Fixes: 3b669df92c85 ("drm/amdgpu/vcn: adjust workload profile handling")
Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Sathishkumar S <sathishkumar.sundararaju@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Avoid vcn v5.0.1 poison irq call trace on sriov guest
Mangesh Gadre [Mon, 25 Aug 2025 13:22:30 +0000 (21:22 +0800)]
drm/amdgpu: Avoid vcn v5.0.1 poison irq call trace on sriov guest

Sriov guest side doesn't init ras feature hence the poison irq shouldn't
be put during hw fini

Signed-off-by: Mangesh Gadre <Mangesh.Gadre@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu: Avoid jpeg v5.0.1 poison irq call trace on sriov guest
Mangesh Gadre [Mon, 25 Aug 2025 13:18:42 +0000 (21:18 +0800)]
drm/amdgpu: Avoid jpeg v5.0.1 poison irq call trace on sriov guest

Sriov guest side doesn't init ras feature hence the poison irq shouldn't
be put during hw fini

Signed-off-by: Mangesh Gadre <Mangesh.Gadre@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amd/amdgpu: unified amdgpu ip block name
Yang Wang [Mon, 25 Aug 2025 01:38:32 +0000 (09:38 +0800)]
drm/amd/amdgpu: unified amdgpu ip block name

v1:
1. Unified amdgpu ip block name print with format
   "{ip_type}_v{major}_{minor}_{rev}"

2. Avoid IP block name conflicts for SMU/PSP ip block

v2:
Update IP block print format to keep legacy IP block name (Alex)
"{ip_type}_v{major}_{minor}_{rev} ({funcs->name})"

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 months agodrm/amdgpu/sdma: bump firmware version checks for user queue support
Jesse.Zhang [Wed, 27 Aug 2025 05:29:17 +0000 (13:29 +0800)]
drm/amdgpu/sdma: bump firmware version checks for user queue support

Using the previous firmware could lead to problems with
PROTECTED_FENCE_SIGNAL commands, specifically causing register
conflicts between MCU_DBG0 and MCU_DBG1.

The updated firmware versions ensure proper alignment
and unification of the SDMA_SUBOP_PROTECTED_FENCE_SIGNAL value with SDMA 7.x,
resolving these hardware coordination issues

Fixes: e8cca30d8b34 ("drm/amdgpu/sdma6: add ucode version checks for userq support")
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>