Skip to content

Commit b1913ff

Browse files
committed
Merge tag 'amd-drm-fixes-6.4-2023-06-07' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes
amd-drm-fixes-6.4-2023-06-07: amdgpu: - S0ix fixes - GPU reset fixes - SMU13 fixes - SMU11 fixes - Misc Display fixes - Revert RV/RV2/PCO clock counter changes - Fix Stoney xclk value - Fix reserved vram debug info radeon: - Fix a potential use after free Signed-off-by: Dave Airlie <[email protected]> From: Alex Deucher <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 9561de3 + e1a6002 commit b1913ff

File tree

13 files changed

+162
-79
lines changed

13 files changed

+162
-79
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,16 +1092,20 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
10921092
* S0ix even though the system is suspending to idle, so return false
10931093
* in that case.
10941094
*/
1095-
if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
1096-
dev_warn_once(adev->dev,
1095+
if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) {
1096+
dev_err_once(adev->dev,
10971097
"Power consumption will be higher as BIOS has not been configured for suspend-to-idle.\n"
10981098
"To use suspend-to-idle change the sleep mode in BIOS setup.\n");
1099+
return false;
1100+
}
10991101

11001102
#if !IS_ENABLED(CONFIG_AMD_PMC)
1101-
dev_warn_once(adev->dev,
1103+
dev_err_once(adev->dev,
11021104
"Power consumption will be higher as the kernel has not been compiled with CONFIG_AMD_PMC.\n");
1103-
#endif /* CONFIG_AMD_PMC */
1105+
return false;
1106+
#else
11041107
return true;
1108+
#endif /* CONFIG_AMD_PMC */
11051109
}
11061110

11071111
#endif /* CONFIG_SUSPEND */

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,10 @@ static void amdgpu_bo_user_destroy(struct ttm_buffer_object *tbo)
7979
static void amdgpu_bo_vm_destroy(struct ttm_buffer_object *tbo)
8080
{
8181
struct amdgpu_device *adev = amdgpu_ttm_adev(tbo->bdev);
82-
struct amdgpu_bo *bo = ttm_to_amdgpu_bo(tbo);
82+
struct amdgpu_bo *shadow_bo = ttm_to_amdgpu_bo(tbo), *bo;
8383
struct amdgpu_bo_vm *vmbo;
8484

85+
bo = shadow_bo->parent;
8586
vmbo = to_amdgpu_bo_vm(bo);
8687
/* in case amdgpu_device_recover_vram got NULL of bo->parent */
8788
if (!list_empty(&vmbo->shadow_list)) {
@@ -694,11 +695,6 @@ int amdgpu_bo_create_vm(struct amdgpu_device *adev,
694695
return r;
695696

696697
*vmbo_ptr = to_amdgpu_bo_vm(bo_ptr);
697-
INIT_LIST_HEAD(&(*vmbo_ptr)->shadow_list);
698-
/* Set destroy callback to amdgpu_bo_vm_destroy after vmbo->shadow_list
699-
* is initialized.
700-
*/
701-
bo_ptr->tbo.destroy = &amdgpu_bo_vm_destroy;
702698
return r;
703699
}
704700

@@ -715,6 +711,8 @@ void amdgpu_bo_add_to_shadow_list(struct amdgpu_bo_vm *vmbo)
715711

716712
mutex_lock(&adev->shadow_list_lock);
717713
list_add_tail(&vmbo->shadow_list, &adev->shadow_list);
714+
vmbo->shadow->parent = amdgpu_bo_ref(&vmbo->bo);
715+
vmbo->shadow->tbo.destroy = &amdgpu_bo_vm_destroy;
718716
mutex_unlock(&adev->shadow_list_lock);
719717
}
720718

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,6 @@ int amdgpu_vm_pt_create(struct amdgpu_device *adev, struct amdgpu_vm *vm,
564564
return r;
565565
}
566566

567-
(*vmbo)->shadow->parent = amdgpu_bo_ref(bo);
568567
amdgpu_bo_add_to_shadow_list(*vmbo);
569568

570569
return 0;

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ static void amdgpu_vram_mgr_debug(struct ttm_resource_manager *man,
800800
{
801801
struct amdgpu_vram_mgr *mgr = to_vram_mgr(man);
802802
struct drm_buddy *mm = &mgr->mm;
803-
struct drm_buddy_block *block;
803+
struct amdgpu_vram_reservation *rsv;
804804

805805
drm_printf(printer, " vis usage:%llu\n",
806806
amdgpu_vram_mgr_vis_usage(mgr));
@@ -812,8 +812,9 @@ static void amdgpu_vram_mgr_debug(struct ttm_resource_manager *man,
812812
drm_buddy_print(mm, printer);
813813

814814
drm_printf(printer, "reserved:\n");
815-
list_for_each_entry(block, &mgr->reserved_pages, link)
816-
drm_buddy_block_print(mm, block, printer);
815+
list_for_each_entry(rsv, &mgr->reserved_pages, blocks)
816+
drm_printf(printer, "%#018llx-%#018llx: %llu\n",
817+
rsv->start, rsv->start + rsv->size, rsv->size);
817818
mutex_unlock(&mgr->lock);
818819
}
819820

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

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -149,16 +149,6 @@ MODULE_FIRMWARE("amdgpu/aldebaran_sjt_mec2.bin");
149149
#define mmGOLDEN_TSC_COUNT_LOWER_Renoir 0x0026
150150
#define mmGOLDEN_TSC_COUNT_LOWER_Renoir_BASE_IDX 1
151151

152-
#define mmGOLDEN_TSC_COUNT_UPPER_Raven 0x007a
153-
#define mmGOLDEN_TSC_COUNT_UPPER_Raven_BASE_IDX 0
154-
#define mmGOLDEN_TSC_COUNT_LOWER_Raven 0x007b
155-
#define mmGOLDEN_TSC_COUNT_LOWER_Raven_BASE_IDX 0
156-
157-
#define mmGOLDEN_TSC_COUNT_UPPER_Raven2 0x0068
158-
#define mmGOLDEN_TSC_COUNT_UPPER_Raven2_BASE_IDX 0
159-
#define mmGOLDEN_TSC_COUNT_LOWER_Raven2 0x0069
160-
#define mmGOLDEN_TSC_COUNT_LOWER_Raven2_BASE_IDX 0
161-
162152
enum ta_ras_gfx_subblock {
163153
/*CPC*/
164154
TA_RAS_BLOCK__GFX_CPC_INDEX_START = 0,
@@ -4004,31 +3994,6 @@ static uint64_t gfx_v9_0_get_gpu_clock_counter(struct amdgpu_device *adev)
40043994
preempt_enable();
40053995
clock = clock_lo | (clock_hi << 32ULL);
40063996
break;
4007-
case IP_VERSION(9, 1, 0):
4008-
case IP_VERSION(9, 2, 2):
4009-
preempt_disable();
4010-
if (adev->rev_id >= 0x8) {
4011-
clock_hi = RREG32_SOC15_NO_KIQ(PWR, 0, mmGOLDEN_TSC_COUNT_UPPER_Raven2);
4012-
clock_lo = RREG32_SOC15_NO_KIQ(PWR, 0, mmGOLDEN_TSC_COUNT_LOWER_Raven2);
4013-
hi_check = RREG32_SOC15_NO_KIQ(PWR, 0, mmGOLDEN_TSC_COUNT_UPPER_Raven2);
4014-
} else {
4015-
clock_hi = RREG32_SOC15_NO_KIQ(PWR, 0, mmGOLDEN_TSC_COUNT_UPPER_Raven);
4016-
clock_lo = RREG32_SOC15_NO_KIQ(PWR, 0, mmGOLDEN_TSC_COUNT_LOWER_Raven);
4017-
hi_check = RREG32_SOC15_NO_KIQ(PWR, 0, mmGOLDEN_TSC_COUNT_UPPER_Raven);
4018-
}
4019-
/* The PWR TSC clock frequency is 100MHz, which sets 32-bit carry over
4020-
* roughly every 42 seconds.
4021-
*/
4022-
if (hi_check != clock_hi) {
4023-
if (adev->rev_id >= 0x8)
4024-
clock_lo = RREG32_SOC15_NO_KIQ(PWR, 0, mmGOLDEN_TSC_COUNT_LOWER_Raven2);
4025-
else
4026-
clock_lo = RREG32_SOC15_NO_KIQ(PWR, 0, mmGOLDEN_TSC_COUNT_LOWER_Raven);
4027-
clock_hi = hi_check;
4028-
}
4029-
preempt_enable();
4030-
clock = clock_lo | (clock_hi << 32ULL);
4031-
break;
40323997
default:
40333998
amdgpu_gfx_off_ctrl(adev, false);
40343999
mutex_lock(&adev->gfx.gpu_clock_mutex);

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,11 @@ static u32 soc15_get_xclk(struct amdgpu_device *adev)
301301
u32 reference_clock = adev->clock.spll.reference_freq;
302302

303303
if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(12, 0, 0) ||
304-
adev->ip_versions[MP1_HWIP][0] == IP_VERSION(12, 0, 1) ||
305-
adev->ip_versions[MP1_HWIP][0] == IP_VERSION(10, 0, 0) ||
306-
adev->ip_versions[MP1_HWIP][0] == IP_VERSION(10, 0, 1))
304+
adev->ip_versions[MP1_HWIP][0] == IP_VERSION(12, 0, 1))
307305
return 10000;
306+
if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(10, 0, 0) ||
307+
adev->ip_versions[MP1_HWIP][0] == IP_VERSION(10, 0, 1))
308+
return reference_clock / 4;
308309

309310
return reference_clock;
310311
}

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,15 @@ static u32 vi_get_xclk(struct amdgpu_device *adev)
542542
u32 reference_clock = adev->clock.spll.reference_freq;
543543
u32 tmp;
544544

545-
if (adev->flags & AMD_IS_APU)
546-
return reference_clock;
545+
if (adev->flags & AMD_IS_APU) {
546+
switch (adev->asic_type) {
547+
case CHIP_STONEY:
548+
/* vbios says 48Mhz, but the actual freq is 100Mhz */
549+
return 10000;
550+
default:
551+
return reference_clock;
552+
}
553+
}
547554

548555
tmp = RREG32_SMC(ixCG_CLKPIN_CNTL_2);
549556
if (REG_GET_FIELD(tmp, CG_CLKPIN_CNTL_2, MUX_TCLK_TO_XCLK))

drivers/gpu/drm/amd/display/dc/core/dc.c

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1981,6 +1981,9 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c
19811981
return result;
19821982
}
19831983

1984+
static bool commit_minimal_transition_state(struct dc *dc,
1985+
struct dc_state *transition_base_context);
1986+
19841987
/**
19851988
* dc_commit_streams - Commit current stream state
19861989
*
@@ -2002,6 +2005,8 @@ enum dc_status dc_commit_streams(struct dc *dc,
20022005
struct dc_state *context;
20032006
enum dc_status res = DC_OK;
20042007
struct dc_validation_set set[MAX_STREAMS] = {0};
2008+
struct pipe_ctx *pipe;
2009+
bool handle_exit_odm2to1 = false;
20052010

20062011
if (dc->ctx->dce_environment == DCE_ENV_VIRTUAL_HW)
20072012
return res;
@@ -2026,6 +2031,22 @@ enum dc_status dc_commit_streams(struct dc *dc,
20262031
}
20272032
}
20282033

2034+
/* Check for case where we are going from odm 2:1 to max
2035+
* pipe scenario. For these cases, we will call
2036+
* commit_minimal_transition_state() to exit out of odm 2:1
2037+
* first before processing new streams
2038+
*/
2039+
if (stream_count == dc->res_pool->pipe_count) {
2040+
for (i = 0; i < dc->res_pool->pipe_count; i++) {
2041+
pipe = &dc->current_state->res_ctx.pipe_ctx[i];
2042+
if (pipe->next_odm_pipe)
2043+
handle_exit_odm2to1 = true;
2044+
}
2045+
}
2046+
2047+
if (handle_exit_odm2to1)
2048+
res = commit_minimal_transition_state(dc, dc->current_state);
2049+
20292050
context = dc_create_state(dc);
20302051
if (!context)
20312052
goto context_alloc_fail;
@@ -3872,6 +3893,7 @@ static bool commit_minimal_transition_state(struct dc *dc,
38723893
unsigned int i, j;
38733894
unsigned int pipe_in_use = 0;
38743895
bool subvp_in_use = false;
3896+
bool odm_in_use = false;
38753897

38763898
if (!transition_context)
38773899
return false;
@@ -3900,6 +3922,18 @@ static bool commit_minimal_transition_state(struct dc *dc,
39003922
}
39013923
}
39023924

3925+
/* If ODM is enabled and we are adding or removing planes from any ODM
3926+
* pipe, we must use the minimal transition.
3927+
*/
3928+
for (i = 0; i < dc->res_pool->pipe_count; i++) {
3929+
struct pipe_ctx *pipe = &dc->current_state->res_ctx.pipe_ctx[i];
3930+
3931+
if (pipe->stream && pipe->next_odm_pipe) {
3932+
odm_in_use = true;
3933+
break;
3934+
}
3935+
}
3936+
39033937
/* When the OS add a new surface if we have been used all of pipes with odm combine
39043938
* and mpc split feature, it need use commit_minimal_transition_state to transition safely.
39053939
* After OS exit MPO, it will back to use odm and mpc split with all of pipes, we need
@@ -3908,7 +3942,7 @@ static bool commit_minimal_transition_state(struct dc *dc,
39083942
* Reduce the scenarios to use dc_commit_state_no_check in the stage of flip. Especially
39093943
* enter/exit MPO when DCN still have enough resources.
39103944
*/
3911-
if (pipe_in_use != dc->res_pool->pipe_count && !subvp_in_use) {
3945+
if (pipe_in_use != dc->res_pool->pipe_count && !subvp_in_use && !odm_in_use) {
39123946
dc_release_state(transition_context);
39133947
return true;
39143948
}

drivers/gpu/drm/amd/display/dc/core/dc_resource.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,6 +1444,26 @@ static int acquire_first_split_pipe(
14441444
split_pipe->plane_res.mpcc_inst = pool->dpps[i]->inst;
14451445
split_pipe->pipe_idx = i;
14461446

1447+
split_pipe->stream = stream;
1448+
return i;
1449+
} else if (split_pipe->prev_odm_pipe &&
1450+
split_pipe->prev_odm_pipe->plane_state == split_pipe->plane_state) {
1451+
split_pipe->prev_odm_pipe->next_odm_pipe = split_pipe->next_odm_pipe;
1452+
if (split_pipe->next_odm_pipe)
1453+
split_pipe->next_odm_pipe->prev_odm_pipe = split_pipe->prev_odm_pipe;
1454+
1455+
if (split_pipe->prev_odm_pipe->plane_state)
1456+
resource_build_scaling_params(split_pipe->prev_odm_pipe);
1457+
1458+
memset(split_pipe, 0, sizeof(*split_pipe));
1459+
split_pipe->stream_res.tg = pool->timing_generators[i];
1460+
split_pipe->plane_res.hubp = pool->hubps[i];
1461+
split_pipe->plane_res.ipp = pool->ipps[i];
1462+
split_pipe->plane_res.dpp = pool->dpps[i];
1463+
split_pipe->stream_res.opp = pool->opps[i];
1464+
split_pipe->plane_res.mpcc_inst = pool->dpps[i]->inst;
1465+
split_pipe->pipe_idx = i;
1466+
14471467
split_pipe->stream = stream;
14481468
return i;
14491469
}

drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ struct _vcs_dpi_soc_bounding_box_st dcn3_2_soc = {
138138
.urgent_out_of_order_return_per_channel_pixel_only_bytes = 4096,
139139
.urgent_out_of_order_return_per_channel_pixel_and_vm_bytes = 4096,
140140
.urgent_out_of_order_return_per_channel_vm_only_bytes = 4096,
141-
.pct_ideal_sdp_bw_after_urgent = 100.0,
141+
.pct_ideal_sdp_bw_after_urgent = 90.0,
142142
.pct_ideal_fabric_bw_after_urgent = 67.0,
143143
.pct_ideal_dram_sdp_bw_after_urgent_pixel_only = 20.0,
144144
.pct_ideal_dram_sdp_bw_after_urgent_pixel_and_vm = 60.0, // N/A, for now keep as is until DML implemented

0 commit comments

Comments
 (0)