Skip to content

Commit b30bed9

Browse files
committed
Merge tag 'amd-drm-fixes-6.8-2024-02-08' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes
amd-drm-fixes-6.8-2024-02-08: amdgpu: - Misc NULL/bounds check fixes - ODM pipe policy fix - Aborted suspend fixes - JPEG 4.0.5 fix - DCN 3.5 fixes - PSP fix - DP MST fix - Phantom pipe fix - VRAM vendor fix - Clang fix - SR-IOV fix Signed-off-by: Dave Airlie <airlied@redhat.com> From: Alex Deucher <alexander.deucher@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240208165500.4887-1-alexander.deucher@amd.com
2 parents 9da93fe + 534c8a5 commit b30bed9

28 files changed

+220
-98
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,6 +1078,8 @@ struct amdgpu_device {
10781078
bool in_s3;
10791079
bool in_s4;
10801080
bool in_s0ix;
1081+
/* indicate amdgpu suspension status */
1082+
bool suspend_complete;
10811083

10821084
enum pp_mp1_state mp1_state;
10831085
struct amdgpu_doorbell_index doorbell_index;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2476,6 +2476,7 @@ static int amdgpu_pmops_suspend(struct device *dev)
24762476
struct drm_device *drm_dev = dev_get_drvdata(dev);
24772477
struct amdgpu_device *adev = drm_to_adev(drm_dev);
24782478

2479+
adev->suspend_complete = false;
24792480
if (amdgpu_acpi_is_s0ix_active(adev))
24802481
adev->in_s0ix = true;
24812482
else if (amdgpu_acpi_is_s3_active(adev))
@@ -2490,6 +2491,7 @@ static int amdgpu_pmops_suspend_noirq(struct device *dev)
24902491
struct drm_device *drm_dev = dev_get_drvdata(dev);
24912492
struct amdgpu_device *adev = drm_to_adev(drm_dev);
24922493

2494+
adev->suspend_complete = true;
24932495
if (amdgpu_acpi_should_gpu_reset(adev))
24942496
return amdgpu_asic_reset(adev);
24952497

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ static ssize_t ta_if_invoke_debugfs_write(struct file *fp, const char *buf, size
362362
}
363363
}
364364

365-
if (copy_to_user((char *)buf, context->mem_context.shared_buf, shared_buf_len))
365+
if (copy_to_user((char *)&buf[copy_pos], context->mem_context.shared_buf, shared_buf_len))
366366
ret = -EFAULT;
367367

368368
err_free_shared_buf:

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3034,6 +3034,14 @@ static int gfx_v9_0_cp_gfx_start(struct amdgpu_device *adev)
30343034

30353035
gfx_v9_0_cp_gfx_enable(adev, true);
30363036

3037+
/* Now only limit the quirk on the APU gfx9 series and already
3038+
* confirmed that the APU gfx10/gfx11 needn't such update.
3039+
*/
3040+
if (adev->flags & AMD_IS_APU &&
3041+
adev->in_s3 && !adev->suspend_complete) {
3042+
DRM_INFO(" Will skip the CSB packet resubmit\n");
3043+
return 0;
3044+
}
30373045
r = amdgpu_ring_alloc(ring, gfx_v9_0_get_csb_size(adev) + 4 + 3);
30383046
if (r) {
30393047
DRM_ERROR("amdgpu: cp failed to lock ring (%d).\n", r);

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1947,14 +1947,6 @@ static int gmc_v9_0_init_mem_ranges(struct amdgpu_device *adev)
19471947

19481948
static void gmc_v9_4_3_init_vram_info(struct amdgpu_device *adev)
19491949
{
1950-
static const u32 regBIF_BIOS_SCRATCH_4 = 0x50;
1951-
u32 vram_info;
1952-
1953-
/* Only for dGPU, vendor informaton is reliable */
1954-
if (!amdgpu_sriov_vf(adev) && !(adev->flags & AMD_IS_APU)) {
1955-
vram_info = RREG32(regBIF_BIOS_SCRATCH_4);
1956-
adev->gmc.vram_vendor = vram_info & 0xF;
1957-
}
19581950
adev->gmc.vram_type = AMDGPU_VRAM_TYPE_HBM;
19591951
adev->gmc.vram_width = 128 * 64;
19601952
}

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -674,14 +674,6 @@ static int jpeg_v4_0_set_powergating_state(void *handle,
674674
return ret;
675675
}
676676

677-
static int jpeg_v4_0_set_interrupt_state(struct amdgpu_device *adev,
678-
struct amdgpu_irq_src *source,
679-
unsigned type,
680-
enum amdgpu_interrupt_state state)
681-
{
682-
return 0;
683-
}
684-
685677
static int jpeg_v4_0_set_ras_interrupt_state(struct amdgpu_device *adev,
686678
struct amdgpu_irq_src *source,
687679
unsigned int type,
@@ -765,7 +757,6 @@ static void jpeg_v4_0_set_dec_ring_funcs(struct amdgpu_device *adev)
765757
}
766758

767759
static const struct amdgpu_irq_src_funcs jpeg_v4_0_irq_funcs = {
768-
.set = jpeg_v4_0_set_interrupt_state,
769760
.process = jpeg_v4_0_process_interrupt,
770761
};
771762

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ static int jpeg_v4_0_5_hw_fini(void *handle)
181181
RREG32_SOC15(JPEG, 0, regUVD_JRBC_STATUS))
182182
jpeg_v4_0_5_set_powergating_state(adev, AMD_PG_STATE_GATE);
183183
}
184-
amdgpu_irq_put(adev, &adev->jpeg.inst->irq, 0);
185184

186185
return 0;
187186
}
@@ -516,14 +515,6 @@ static int jpeg_v4_0_5_set_powergating_state(void *handle,
516515
return ret;
517516
}
518517

519-
static int jpeg_v4_0_5_set_interrupt_state(struct amdgpu_device *adev,
520-
struct amdgpu_irq_src *source,
521-
unsigned type,
522-
enum amdgpu_interrupt_state state)
523-
{
524-
return 0;
525-
}
526-
527518
static int jpeg_v4_0_5_process_interrupt(struct amdgpu_device *adev,
528519
struct amdgpu_irq_src *source,
529520
struct amdgpu_iv_entry *entry)
@@ -603,7 +594,6 @@ static void jpeg_v4_0_5_set_dec_ring_funcs(struct amdgpu_device *adev)
603594
}
604595

605596
static const struct amdgpu_irq_src_funcs jpeg_v4_0_5_irq_funcs = {
606-
.set = jpeg_v4_0_5_set_interrupt_state,
607597
.process = jpeg_v4_0_5_process_interrupt,
608598
};
609599

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,12 @@ static void nbio_v7_9_init_registers(struct amdgpu_device *adev)
431431
u32 inst_mask;
432432
int i;
433433

434+
if (amdgpu_sriov_vf(adev))
435+
adev->rmmio_remap.reg_offset =
436+
SOC15_REG_OFFSET(
437+
NBIO, 0,
438+
regBIF_BX_DEV0_EPF0_VF0_HDP_MEM_COHERENCY_FLUSH_CNTL)
439+
<< 2;
434440
WREG32_SOC15(NBIO, 0, regXCC_DOORBELL_FENCE,
435441
0xff & ~(adev->gfx.xcc_mask));
436442

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,10 +1298,32 @@ static int soc15_common_suspend(void *handle)
12981298
return soc15_common_hw_fini(adev);
12991299
}
13001300

1301+
static bool soc15_need_reset_on_resume(struct amdgpu_device *adev)
1302+
{
1303+
u32 sol_reg;
1304+
1305+
sol_reg = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81);
1306+
1307+
/* Will reset for the following suspend abort cases.
1308+
* 1) Only reset limit on APU side, dGPU hasn't checked yet.
1309+
* 2) S3 suspend abort and TOS already launched.
1310+
*/
1311+
if (adev->flags & AMD_IS_APU && adev->in_s3 &&
1312+
!adev->suspend_complete &&
1313+
sol_reg)
1314+
return true;
1315+
1316+
return false;
1317+
}
1318+
13011319
static int soc15_common_resume(void *handle)
13021320
{
13031321
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
13041322

1323+
if (soc15_need_reset_on_resume(adev)) {
1324+
dev_info(adev->dev, "S3 suspend abort case, let's reset ASIC.\n");
1325+
soc15_asic_reset(adev);
1326+
}
13051327
return soc15_common_hw_init(adev);
13061328
}
13071329

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10731,11 +10731,13 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
1073110731
goto fail;
1073210732
}
1073310733

10734-
ret = compute_mst_dsc_configs_for_state(state, dm_state->context, vars);
10735-
if (ret) {
10736-
DRM_DEBUG_DRIVER("compute_mst_dsc_configs_for_state() failed\n");
10737-
ret = -EINVAL;
10738-
goto fail;
10734+
if (dc_resource_is_dsc_encoding_supported(dc)) {
10735+
ret = compute_mst_dsc_configs_for_state(state, dm_state->context, vars);
10736+
if (ret) {
10737+
DRM_DEBUG_DRIVER("compute_mst_dsc_configs_for_state() failed\n");
10738+
ret = -EINVAL;
10739+
goto fail;
10740+
}
1073910741
}
1074010742

1074110743
ret = dm_update_mst_vcpi_slots_for_dsc(state, dm_state->context, vars);

0 commit comments

Comments
 (0)