Skip to content

Commit 80e12f3

Browse files
committed
Merge tag 'amd-drm-fixes-6.15-2025-05-08' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes
amd-drm-fixes-6.15-2025-05-08: amdgpu: - DC FP fixes - Freesync fix - DMUB AUX fixes - VCN fix - Hibernation fixes - HDP fixes Signed-off-by: Dave Airlie <airlied@redhat.com> From: Alex Deucher <alexander.deucher@amd.com> Link: https://lore.kernel.org/r/20250508194102.3242372-1-alexander.deucher@amd.com
2 parents 20a4c81 + 5a11a27 commit 80e12f3

22 files changed

+103
-101
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,11 +1614,9 @@ static inline void amdgpu_acpi_get_backlight_caps(struct amdgpu_dm_backlight_cap
16141614
#if defined(CONFIG_ACPI) && defined(CONFIG_SUSPEND)
16151615
bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev);
16161616
bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev);
1617-
void amdgpu_choose_low_power_state(struct amdgpu_device *adev);
16181617
#else
16191618
static inline bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) { return false; }
16201619
static inline bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev) { return false; }
1621-
static inline void amdgpu_choose_low_power_state(struct amdgpu_device *adev) { }
16221620
#endif
16231621

16241622
void amdgpu_register_gpu_instance(struct amdgpu_device *adev);

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

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,22 +1533,4 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
15331533
#endif /* CONFIG_AMD_PMC */
15341534
}
15351535

1536-
/**
1537-
* amdgpu_choose_low_power_state
1538-
*
1539-
* @adev: amdgpu_device_pointer
1540-
*
1541-
* Choose the target low power state for the GPU
1542-
*/
1543-
void amdgpu_choose_low_power_state(struct amdgpu_device *adev)
1544-
{
1545-
if (adev->in_runpm)
1546-
return;
1547-
1548-
if (amdgpu_acpi_is_s0ix_active(adev))
1549-
adev->in_s0ix = true;
1550-
else if (amdgpu_acpi_is_s3_active(adev))
1551-
adev->in_s3 = true;
1552-
}
1553-
15541536
#endif /* CONFIG_SUSPEND */

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

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4907,28 +4907,20 @@ static int amdgpu_device_evict_resources(struct amdgpu_device *adev)
49074907
* @data: data
49084908
*
49094909
* This function is called when the system is about to suspend or hibernate.
4910-
* It is used to evict resources from the device before the system goes to
4911-
* sleep while there is still access to swap.
4910+
* It is used to set the appropriate flags so that eviction can be optimized
4911+
* in the pm prepare callback.
49124912
*/
49134913
static int amdgpu_device_pm_notifier(struct notifier_block *nb, unsigned long mode,
49144914
void *data)
49154915
{
49164916
struct amdgpu_device *adev = container_of(nb, struct amdgpu_device, pm_nb);
4917-
int r;
49184917

49194918
switch (mode) {
49204919
case PM_HIBERNATION_PREPARE:
49214920
adev->in_s4 = true;
4922-
fallthrough;
4923-
case PM_SUSPEND_PREPARE:
4924-
r = amdgpu_device_evict_resources(adev);
4925-
/*
4926-
* This is considered non-fatal at this time because
4927-
* amdgpu_device_prepare() will also fatally evict resources.
4928-
* See https://gitlab.freedesktop.org/drm/amd/-/issues/3781
4929-
*/
4930-
if (r)
4931-
drm_warn(adev_to_drm(adev), "Failed to evict resources, freeze active processes if problems occur: %d\n", r);
4921+
break;
4922+
case PM_POST_HIBERNATION:
4923+
adev->in_s4 = false;
49324924
break;
49334925
}
49344926

@@ -4949,15 +4941,13 @@ int amdgpu_device_prepare(struct drm_device *dev)
49494941
struct amdgpu_device *adev = drm_to_adev(dev);
49504942
int i, r;
49514943

4952-
amdgpu_choose_low_power_state(adev);
4953-
49544944
if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
49554945
return 0;
49564946

49574947
/* Evict the majority of BOs before starting suspend sequence */
49584948
r = amdgpu_device_evict_resources(adev);
49594949
if (r)
4960-
goto unprepare;
4950+
return r;
49614951

49624952
flush_delayed_work(&adev->gfx.gfx_off_delay_work);
49634953

@@ -4968,15 +4958,10 @@ int amdgpu_device_prepare(struct drm_device *dev)
49684958
continue;
49694959
r = adev->ip_blocks[i].version->funcs->prepare_suspend(&adev->ip_blocks[i]);
49704960
if (r)
4971-
goto unprepare;
4961+
return r;
49724962
}
49734963

49744964
return 0;
4975-
4976-
unprepare:
4977-
adev->in_s0ix = adev->in_s3 = adev->in_s4 = false;
4978-
4979-
return r;
49804965
}
49814966

49824967
/**

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2615,13 +2615,8 @@ static int amdgpu_pmops_freeze(struct device *dev)
26152615
static int amdgpu_pmops_thaw(struct device *dev)
26162616
{
26172617
struct drm_device *drm_dev = dev_get_drvdata(dev);
2618-
struct amdgpu_device *adev = drm_to_adev(drm_dev);
2619-
int r;
2620-
2621-
r = amdgpu_device_resume(drm_dev, true);
2622-
adev->in_s4 = false;
26232618

2624-
return r;
2619+
return amdgpu_device_resume(drm_dev, true);
26252620
}
26262621

26272622
static int amdgpu_pmops_poweroff(struct device *dev)
@@ -2634,9 +2629,6 @@ static int amdgpu_pmops_poweroff(struct device *dev)
26342629
static int amdgpu_pmops_restore(struct device *dev)
26352630
{
26362631
struct drm_device *drm_dev = dev_get_drvdata(dev);
2637-
struct amdgpu_device *adev = drm_to_adev(drm_dev);
2638-
2639-
adev->in_s4 = false;
26402632

26412633
return amdgpu_device_resume(drm_dev, true);
26422634
}

drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
#define VCN_ENC_CMD_REG_WAIT 0x0000000c
6767

6868
#define VCN_AON_SOC_ADDRESS_2_0 0x1f800
69-
#define VCN1_AON_SOC_ADDRESS_3_0 0x48000
7069
#define VCN_VID_IP_ADDRESS_2_0 0x0
7170
#define VCN_AON_IP_ADDRESS_2_0 0x30000
7271

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ static void hdp_v4_0_flush_hdp(struct amdgpu_device *adev,
4141
{
4242
if (!ring || !ring->funcs->emit_wreg) {
4343
WREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);
44-
RREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2);
44+
/* We just need to read back a register to post the write.
45+
* Reading back the remapped register causes problems on
46+
* some platforms so just read back the memory size register.
47+
*/
48+
if (adev->nbio.funcs->get_memsize)
49+
adev->nbio.funcs->get_memsize(adev);
4550
} else {
4651
amdgpu_ring_emit_wreg(ring, (adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);
4752
}

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ static void hdp_v5_0_flush_hdp(struct amdgpu_device *adev,
3232
{
3333
if (!ring || !ring->funcs->emit_wreg) {
3434
WREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);
35-
RREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2);
35+
/* We just need to read back a register to post the write.
36+
* Reading back the remapped register causes problems on
37+
* some platforms so just read back the memory size register.
38+
*/
39+
if (adev->nbio.funcs->get_memsize)
40+
adev->nbio.funcs->get_memsize(adev);
3641
} else {
3742
amdgpu_ring_emit_wreg(ring, (adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);
3843
}

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,17 @@ static void hdp_v5_2_flush_hdp(struct amdgpu_device *adev,
3333
if (!ring || !ring->funcs->emit_wreg) {
3434
WREG32_NO_KIQ((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2,
3535
0);
36-
RREG32_NO_KIQ((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2);
36+
if (amdgpu_sriov_vf(adev)) {
37+
/* this is fine because SR_IOV doesn't remap the register */
38+
RREG32_NO_KIQ((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2);
39+
} else {
40+
/* We just need to read back a register to post the write.
41+
* Reading back the remapped register causes problems on
42+
* some platforms so just read back the memory size register.
43+
*/
44+
if (adev->nbio.funcs->get_memsize)
45+
adev->nbio.funcs->get_memsize(adev);
46+
}
3747
} else {
3848
amdgpu_ring_emit_wreg(ring,
3949
(adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2,

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ static void hdp_v6_0_flush_hdp(struct amdgpu_device *adev,
3535
{
3636
if (!ring || !ring->funcs->emit_wreg) {
3737
WREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);
38-
RREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2);
38+
/* We just need to read back a register to post the write.
39+
* Reading back the remapped register causes problems on
40+
* some platforms so just read back the memory size register.
41+
*/
42+
if (adev->nbio.funcs->get_memsize)
43+
adev->nbio.funcs->get_memsize(adev);
3944
} else {
4045
amdgpu_ring_emit_wreg(ring, (adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);
4146
}

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ static void hdp_v7_0_flush_hdp(struct amdgpu_device *adev,
3232
{
3333
if (!ring || !ring->funcs->emit_wreg) {
3434
WREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);
35-
RREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2);
35+
/* We just need to read back a register to post the write.
36+
* Reading back the remapped register causes problems on
37+
* some platforms so just read back the memory size register.
38+
*/
39+
if (adev->nbio.funcs->get_memsize)
40+
adev->nbio.funcs->get_memsize(adev);
3641
} else {
3742
amdgpu_ring_emit_wreg(ring, (adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);
3843
}

0 commit comments

Comments
 (0)