Skip to content

Commit 66d4709

Browse files
committed
Merge tag 'amd-drm-fixes-6.13-2025-01-09' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes
amd-drm-fixes-6.13-2025-01-09: amdgpu: - Display interrupt fixes - Fix display max surface mismatches - Fix divide error in DM plane scale calcs - Display divide by 0 checks in dml helpers - SMU 13 AD/DC interrrupt handling fix - Fix locking around buddy trim handling amdkfd: - Fix page fault with shader debugger enabled - Fix eviction fence wq handling Signed-off-by: Dave Airlie <[email protected]> From: Alex Deucher <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 7ac9f33 + 75c8b70 commit 66d4709

File tree

15 files changed

+49
-51
lines changed

15 files changed

+49
-51
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,6 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
567567
else
568568
remaining_size -= size;
569569
}
570-
mutex_unlock(&mgr->lock);
571570

572571
if (bo->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS && adjust_dcc_size) {
573572
struct drm_buddy_block *dcc_block;
@@ -584,6 +583,7 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
584583
(u64)vres->base.size,
585584
&vres->blocks);
586585
}
586+
mutex_unlock(&mgr->lock);
587587

588588
vres->base.start = 0;
589589
size = max_t(u64, amdgpu_vram_mgr_blocks_size(&vres->blocks),

drivers/gpu/drm/amd/amdkfd/kfd_debug.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,27 @@ int kfd_dbg_set_mes_debug_mode(struct kfd_process_device *pdd, bool sq_trap_en)
350350
{
351351
uint32_t spi_dbg_cntl = pdd->spi_dbg_override | pdd->spi_dbg_launch_mode;
352352
uint32_t flags = pdd->process->dbg_flags;
353+
struct amdgpu_device *adev = pdd->dev->adev;
354+
int r;
353355

354356
if (!kfd_dbg_is_per_vmid_supported(pdd->dev))
355357
return 0;
356358

359+
if (!pdd->proc_ctx_cpu_ptr) {
360+
r = amdgpu_amdkfd_alloc_gtt_mem(adev,
361+
AMDGPU_MES_PROC_CTX_SIZE,
362+
&pdd->proc_ctx_bo,
363+
&pdd->proc_ctx_gpu_addr,
364+
&pdd->proc_ctx_cpu_ptr,
365+
false);
366+
if (r) {
367+
dev_err(adev->dev,
368+
"failed to allocate process context bo\n");
369+
return r;
370+
}
371+
memset(pdd->proc_ctx_cpu_ptr, 0, AMDGPU_MES_PROC_CTX_SIZE);
372+
}
373+
357374
return amdgpu_mes_set_shader_debugger(pdd->dev->adev, pdd->proc_ctx_gpu_addr, spi_dbg_cntl,
358375
pdd->watch_points, flags, sq_trap_en);
359376
}

drivers/gpu/drm/amd/amdkfd/kfd_process.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,8 @@ static void kfd_process_wq_release(struct work_struct *work)
11601160
*/
11611161
synchronize_rcu();
11621162
ef = rcu_access_pointer(p->ef);
1163-
dma_fence_signal(ef);
1163+
if (ef)
1164+
dma_fence_signal(ef);
11641165

11651166
kfd_process_remove_sysfs(p);
11661167

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

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8400,16 +8400,6 @@ static void manage_dm_interrupts(struct amdgpu_device *adev,
84008400
struct amdgpu_crtc *acrtc,
84018401
struct dm_crtc_state *acrtc_state)
84028402
{
8403-
/*
8404-
* We have no guarantee that the frontend index maps to the same
8405-
* backend index - some even map to more than one.
8406-
*
8407-
* TODO: Use a different interrupt or check DC itself for the mapping.
8408-
*/
8409-
int irq_type =
8410-
amdgpu_display_crtc_idx_to_irq_type(
8411-
adev,
8412-
acrtc->crtc_id);
84138403
struct drm_vblank_crtc_config config = {0};
84148404
struct dc_crtc_timing *timing;
84158405
int offdelay;
@@ -8435,28 +8425,7 @@ static void manage_dm_interrupts(struct amdgpu_device *adev,
84358425

84368426
drm_crtc_vblank_on_config(&acrtc->base,
84378427
&config);
8438-
8439-
amdgpu_irq_get(
8440-
adev,
8441-
&adev->pageflip_irq,
8442-
irq_type);
8443-
#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY)
8444-
amdgpu_irq_get(
8445-
adev,
8446-
&adev->vline0_irq,
8447-
irq_type);
8448-
#endif
84498428
} else {
8450-
#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY)
8451-
amdgpu_irq_put(
8452-
adev,
8453-
&adev->vline0_irq,
8454-
irq_type);
8455-
#endif
8456-
amdgpu_irq_put(
8457-
adev,
8458-
&adev->pageflip_irq,
8459-
irq_type);
84608429
drm_crtc_vblank_off(&acrtc->base);
84618430
}
84628431
}
@@ -11155,8 +11124,8 @@ dm_get_plane_scale(struct drm_plane_state *plane_state,
1115511124
int plane_src_w, plane_src_h;
1115611125

1115711126
dm_get_oriented_plane_size(plane_state, &plane_src_w, &plane_src_h);
11158-
*out_plane_scale_w = plane_state->crtc_w * 1000 / plane_src_w;
11159-
*out_plane_scale_h = plane_state->crtc_h * 1000 / plane_src_h;
11127+
*out_plane_scale_w = plane_src_w ? plane_state->crtc_w * 1000 / plane_src_w : 0;
11128+
*out_plane_scale_h = plane_src_h ? plane_state->crtc_h * 1000 / plane_src_h : 0;
1116011129
}
1116111130

1116211131
/*

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4510,7 +4510,7 @@ static bool commit_minimal_transition_based_on_current_context(struct dc *dc,
45104510
struct pipe_split_policy_backup policy;
45114511
struct dc_state *intermediate_context;
45124512
struct dc_state *old_current_state = dc->current_state;
4513-
struct dc_surface_update srf_updates[MAX_SURFACE_NUM] = {0};
4513+
struct dc_surface_update srf_updates[MAX_SURFACES] = {0};
45144514
int surface_count;
45154515

45164516
/*

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,9 @@ bool dc_state_add_plane(
483483
if (stream_status == NULL) {
484484
dm_error("Existing stream not found; failed to attach surface!\n");
485485
goto out;
486-
} else if (stream_status->plane_count == MAX_SURFACE_NUM) {
486+
} else if (stream_status->plane_count == MAX_SURFACES) {
487487
dm_error("Surface: can not attach plane_state %p! Maximum is: %d\n",
488-
plane_state, MAX_SURFACE_NUM);
488+
plane_state, MAX_SURFACES);
489489
goto out;
490490
} else if (!otg_master_pipe) {
491491
goto out;
@@ -600,7 +600,7 @@ bool dc_state_rem_all_planes_for_stream(
600600
{
601601
int i, old_plane_count;
602602
struct dc_stream_status *stream_status = NULL;
603-
struct dc_plane_state *del_planes[MAX_SURFACE_NUM] = { 0 };
603+
struct dc_plane_state *del_planes[MAX_SURFACES] = { 0 };
604604

605605
for (i = 0; i < state->stream_count; i++)
606606
if (state->streams[i] == stream) {
@@ -875,7 +875,7 @@ bool dc_state_rem_all_phantom_planes_for_stream(
875875
{
876876
int i, old_plane_count;
877877
struct dc_stream_status *stream_status = NULL;
878-
struct dc_plane_state *del_planes[MAX_SURFACE_NUM] = { 0 };
878+
struct dc_plane_state *del_planes[MAX_SURFACES] = { 0 };
879879

880880
for (i = 0; i < state->stream_count; i++)
881881
if (state->streams[i] == phantom_stream) {

drivers/gpu/drm/amd/display/dc/dc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ struct dmub_notification;
5757

5858
#define DC_VER "3.2.310"
5959

60-
#define MAX_SURFACES 3
60+
#define MAX_SURFACES 4
6161
#define MAX_PLANES 6
6262
#define MAX_STREAMS 6
6363
#define MIN_VIEWPORT_SIZE 12
@@ -1398,7 +1398,7 @@ struct dc_scratch_space {
13981398
* store current value in plane states so we can still recover
13991399
* a valid current state during dc update.
14001400
*/
1401-
struct dc_plane_state plane_states[MAX_SURFACE_NUM];
1401+
struct dc_plane_state plane_states[MAX_SURFACES];
14021402

14031403
struct dc_stream_state stream_state;
14041404
};

drivers/gpu/drm/amd/display/dc/dc_stream.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct dc_stream_status {
5656
int plane_count;
5757
int audio_inst;
5858
struct timing_sync_info timing_sync_info;
59-
struct dc_plane_state *plane_states[MAX_SURFACE_NUM];
59+
struct dc_plane_state *plane_states[MAX_SURFACES];
6060
bool is_abm_supported;
6161
struct mall_stream_config mall_stream_config;
6262
bool fpo_in_use;

drivers/gpu/drm/amd/display/dc/dc_types.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ struct dc_perf_trace {
7676
unsigned long last_entry_write;
7777
};
7878

79-
#define MAX_SURFACE_NUM 6
8079
#define NUM_PIXEL_FORMATS 10
8180

8281
enum tiling_mode {

drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,15 @@ static inline double dml_max5(double a, double b, double c, double d, double e)
6666

6767
static inline double dml_ceil(double a, double granularity)
6868
{
69+
if (granularity == 0)
70+
return 0;
6971
return (double) dcn_bw_ceil2(a, granularity);
7072
}
7173

7274
static inline double dml_floor(double a, double granularity)
7375
{
76+
if (granularity == 0)
77+
return 0;
7478
return (double) dcn_bw_floor2(a, granularity);
7579
}
7680

@@ -114,11 +118,15 @@ static inline double dml_ceil_2(double f)
114118

115119
static inline double dml_ceil_ex(double x, double granularity)
116120
{
121+
if (granularity == 0)
122+
return 0;
117123
return (double) dcn_bw_ceil2(x, granularity);
118124
}
119125

120126
static inline double dml_floor_ex(double x, double granularity)
121127
{
128+
if (granularity == 0)
129+
return 0;
122130
return (double) dcn_bw_floor2(x, granularity);
123131
}
124132

drivers/gpu/drm/amd/display/dc/dml2/dml2_mall_phantom.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ static bool remove_all_phantom_planes_for_stream(struct dml2_context *ctx, struc
813813
{
814814
int i, old_plane_count;
815815
struct dc_stream_status *stream_status = NULL;
816-
struct dc_plane_state *del_planes[MAX_SURFACE_NUM] = { 0 };
816+
struct dc_plane_state *del_planes[MAX_SURFACES] = { 0 };
817817

818818
for (i = 0; i < context->stream_count; i++)
819819
if (context->streams[i] == stream) {

drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,5 +303,7 @@ int smu_v13_0_set_wbrf_exclusion_ranges(struct smu_context *smu,
303303
int smu_v13_0_get_boot_freq_by_index(struct smu_context *smu,
304304
enum smu_clk_type clk_type,
305305
uint32_t *value);
306+
307+
void smu_v13_0_interrupt_work(struct smu_context *smu);
306308
#endif
307309
#endif

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,11 +1320,11 @@ static int smu_v13_0_set_irq_state(struct amdgpu_device *adev,
13201320
return 0;
13211321
}
13221322

1323-
static int smu_v13_0_ack_ac_dc_interrupt(struct smu_context *smu)
1323+
void smu_v13_0_interrupt_work(struct smu_context *smu)
13241324
{
1325-
return smu_cmn_send_smc_msg(smu,
1326-
SMU_MSG_ReenableAcDcInterrupt,
1327-
NULL);
1325+
smu_cmn_send_smc_msg(smu,
1326+
SMU_MSG_ReenableAcDcInterrupt,
1327+
NULL);
13281328
}
13291329

13301330
#define THM_11_0__SRCID__THM_DIG_THERM_L2H 0 /* ASIC_TEMP > CG_THERMAL_INT.DIG_THERM_INTH */
@@ -1377,12 +1377,12 @@ static int smu_v13_0_irq_process(struct amdgpu_device *adev,
13771377
switch (ctxid) {
13781378
case SMU_IH_INTERRUPT_CONTEXT_ID_AC:
13791379
dev_dbg(adev->dev, "Switched to AC mode!\n");
1380-
smu_v13_0_ack_ac_dc_interrupt(smu);
1380+
schedule_work(&smu->interrupt_work);
13811381
adev->pm.ac_power = true;
13821382
break;
13831383
case SMU_IH_INTERRUPT_CONTEXT_ID_DC:
13841384
dev_dbg(adev->dev, "Switched to DC mode!\n");
1385-
smu_v13_0_ack_ac_dc_interrupt(smu);
1385+
schedule_work(&smu->interrupt_work);
13861386
adev->pm.ac_power = false;
13871387
break;
13881388
case SMU_IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING:

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3219,6 +3219,7 @@ static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {
32193219
.is_asic_wbrf_supported = smu_v13_0_0_wbrf_support_check,
32203220
.enable_uclk_shadow = smu_v13_0_enable_uclk_shadow,
32213221
.set_wbrf_exclusion_ranges = smu_v13_0_set_wbrf_exclusion_ranges,
3222+
.interrupt_work = smu_v13_0_interrupt_work,
32223223
};
32233224

32243225
void smu_v13_0_0_set_ppt_funcs(struct smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2797,6 +2797,7 @@ static const struct pptable_funcs smu_v13_0_7_ppt_funcs = {
27972797
.is_asic_wbrf_supported = smu_v13_0_7_wbrf_support_check,
27982798
.enable_uclk_shadow = smu_v13_0_enable_uclk_shadow,
27992799
.set_wbrf_exclusion_ranges = smu_v13_0_set_wbrf_exclusion_ranges,
2800+
.interrupt_work = smu_v13_0_interrupt_work,
28002801
};
28012802

28022803
void smu_v13_0_7_set_ppt_funcs(struct smu_context *smu)

0 commit comments

Comments
 (0)