Skip to content

Commit 8d2ad05

Browse files
committed
Merge tag 'amd-drm-fixes-6.16-2025-07-17' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes
amd-drm-fixes-6.16-2025-07-17: amdgpu: - Fix a DC memory leak - DCN 4.0.1 degamma LUT fix - Fix reset counter handling for soft recovery - GC 8 fix radeon: - Drop console locks when suspending/resuming Signed-off-by: Dave Airlie <[email protected]> From: Alex Deucher <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2 parents fbefd8a + 8326193 commit 8d2ad05

File tree

5 files changed

+26
-21
lines changed

5 files changed

+26
-21
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ bool amdgpu_ring_soft_recovery(struct amdgpu_ring *ring, unsigned int vmid,
427427
{
428428
unsigned long flags;
429429
ktime_t deadline;
430+
bool ret;
430431

431432
if (unlikely(ring->adev->debug_disable_soft_recovery))
432433
return false;
@@ -441,12 +442,16 @@ bool amdgpu_ring_soft_recovery(struct amdgpu_ring *ring, unsigned int vmid,
441442
dma_fence_set_error(fence, -ENODATA);
442443
spin_unlock_irqrestore(fence->lock, flags);
443444

444-
atomic_inc(&ring->adev->gpu_reset_counter);
445445
while (!dma_fence_is_signaled(fence) &&
446446
ktime_to_ns(ktime_sub(deadline, ktime_get())) > 0)
447447
ring->funcs->soft_recovery(ring, vmid);
448448

449-
return dma_fence_is_signaled(fence);
449+
ret = dma_fence_is_signaled(fence);
450+
/* increment the counter only if soft reset worked */
451+
if (ret)
452+
atomic_inc(&ring->adev->gpu_reset_counter);
453+
454+
return ret;
450455
}
451456

452457
/*

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4640,6 +4640,7 @@ static int gfx_v8_0_kcq_init_queue(struct amdgpu_ring *ring)
46404640
memcpy(mqd, adev->gfx.mec.mqd_backup[mqd_idx], sizeof(struct vi_mqd_allocation));
46414641
/* reset ring buffer */
46424642
ring->wptr = 0;
4643+
atomic64_set((atomic64_t *)ring->wptr_cpu_addr, 0);
46434644
amdgpu_ring_clear_ring(ring);
46444645
}
46454646
return 0;

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,16 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
728728
* support programmable degamma anywhere.
729729
*/
730730
is_dcn = dm->adev->dm.dc->caps.color.dpp.dcn_arch;
731-
drm_crtc_enable_color_mgmt(&acrtc->base, is_dcn ? MAX_COLOR_LUT_ENTRIES : 0,
731+
/* Dont't enable DRM CRTC degamma property for DCN401 since the
732+
* pre-blending degamma LUT doesn't apply to cursor, and therefore
733+
* can't work similar to a post-blending degamma LUT as in other hw
734+
* versions.
735+
* TODO: revisit it once KMS plane color API is merged.
736+
*/
737+
drm_crtc_enable_color_mgmt(&acrtc->base,
738+
(is_dcn &&
739+
dm->adev->dm.dc->ctx->dce_version != DCN_VERSION_4_01) ?
740+
MAX_COLOR_LUT_ENTRIES : 0,
732741
true, MAX_COLOR_LUT_ENTRIES);
733742

734743
drm_mode_crtc_set_gamma_size(&acrtc->base, MAX_COLOR_LEGACY_LUT_ENTRIES);

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1565,7 +1565,7 @@ struct clk_mgr_internal *dcn401_clk_mgr_construct(
15651565
clk_mgr->base.bw_params = kzalloc(sizeof(*clk_mgr->base.bw_params), GFP_KERNEL);
15661566
if (!clk_mgr->base.bw_params) {
15671567
BREAK_TO_DEBUGGER();
1568-
kfree(clk_mgr);
1568+
kfree(clk_mgr401);
15691569
return NULL;
15701570
}
15711571

@@ -1576,6 +1576,7 @@ struct clk_mgr_internal *dcn401_clk_mgr_construct(
15761576
if (!clk_mgr->wm_range_table) {
15771577
BREAK_TO_DEBUGGER();
15781578
kfree(clk_mgr->base.bw_params);
1579+
kfree(clk_mgr401);
15791580
return NULL;
15801581
}
15811582

drivers/gpu/drm/radeon/radeon_device.c

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
* Jerome Glisse
2727
*/
2828

29-
#include <linux/console.h>
3029
#include <linux/efi.h>
3130
#include <linux/pci.h>
3231
#include <linux/pm_runtime.h>
@@ -1635,11 +1634,9 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend,
16351634
pci_set_power_state(pdev, PCI_D3hot);
16361635
}
16371636

1638-
if (notify_clients) {
1639-
console_lock();
1640-
drm_client_dev_suspend(dev, true);
1641-
console_unlock();
1642-
}
1637+
if (notify_clients)
1638+
drm_client_dev_suspend(dev, false);
1639+
16431640
return 0;
16441641
}
16451642

@@ -1661,17 +1658,11 @@ int radeon_resume_kms(struct drm_device *dev, bool resume, bool notify_clients)
16611658
if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
16621659
return 0;
16631660

1664-
if (notify_clients) {
1665-
console_lock();
1666-
}
16671661
if (resume) {
16681662
pci_set_power_state(pdev, PCI_D0);
16691663
pci_restore_state(pdev);
1670-
if (pci_enable_device(pdev)) {
1671-
if (notify_clients)
1672-
console_unlock();
1664+
if (pci_enable_device(pdev))
16731665
return -1;
1674-
}
16751666
}
16761667
/* resume AGP if in use */
16771668
radeon_agp_resume(rdev);
@@ -1747,10 +1738,8 @@ int radeon_resume_kms(struct drm_device *dev, bool resume, bool notify_clients)
17471738
if ((rdev->pm.pm_method == PM_METHOD_DPM) && rdev->pm.dpm_enabled)
17481739
radeon_pm_compute_clocks(rdev);
17491740

1750-
if (notify_clients) {
1751-
drm_client_dev_resume(dev, true);
1752-
console_unlock();
1753-
}
1741+
if (notify_clients)
1742+
drm_client_dev_resume(dev, false);
17541743

17551744
return 0;
17561745
}

0 commit comments

Comments
 (0)