Skip to content

Commit dd9d739

Browse files
committed
Merge tag 'drm-fixes-2024-07-05' of https://gitlab.freedesktop.org/drm/kernel
Pull drm fixes from Daniel Vetter: "Just small fixes all over here, all quiet as it should. drivers: - amd: mostly amdgpu display fixes + radeon vm NULL deref fix - xe: migration error handling + typoed register name in gt setup - i915: usb-c fix to shut up warnings on MTL+ - panthor: fix sync-only jobs + ioctl validation fix to not EINVAL wrongly - panel quirks - nouveau: NULL deref in get_modes drm core: - fbdev big endian fix for the dma memory backed variant drivers/firmware: - fix sysfb refcounting" * tag 'drm-fixes-2024-07-05' of https://gitlab.freedesktop.org/drm/kernel: drm/xe/mcr: Avoid clobbering DSS steering drm/xe: fix error handling in xe_migrate_update_pgtables drm/ttm: Always take the bo delayed cleanup path for imported bos drm/fbdev-generic: Fix framebuffer on big endian devices drm/panthor: Fix sync-only jobs drm/panthor: Don't check the array stride on empty uobj arrays drm/amdgpu/atomfirmware: silence UBSAN warning drm/radeon: check bo_va->bo is non-NULL before using it drm/amd/display: Fix array-index-out-of-bounds in dml2/FCLKChangeSupport drm/amd/display: Update efficiency bandwidth for dcn351 drm/amd/display: Fix refresh rate range for some panel drm/amd/display: Account for cursor prefetch BW in DML1 mode support drm/amd/display: Add refresh rate range check drm/amd/display: Reset freesync config before update new state drm: panel-orientation-quirks: Add labels for both Valve Steam Deck revisions drm: panel-orientation-quirks: Add quirk for Valve Galileo drm/i915/display: For MTL+ platforms skip mg dp programming drm/nouveau: fix null pointer dereference in nouveau_connector_get_modes firmware: sysfb: Fix reference count of sysfb parent device
2 parents 9684607 + 3c6f5af commit dd9d739

File tree

17 files changed

+132
-31
lines changed

17 files changed

+132
-31
lines changed

drivers/firmware/sysfb.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,10 @@ static __init struct device *sysfb_parent_dev(const struct screen_info *si)
101101
if (IS_ERR(pdev)) {
102102
return ERR_CAST(pdev);
103103
} else if (pdev) {
104-
if (!sysfb_pci_dev_is_enabled(pdev))
104+
if (!sysfb_pci_dev_is_enabled(pdev)) {
105+
pci_dev_put(pdev);
105106
return ERR_PTR(-ENODEV);
107+
}
106108
return &pdev->dev;
107109
}
108110

@@ -137,7 +139,7 @@ static __init int sysfb_init(void)
137139
if (compatible) {
138140
pd = sysfb_create_simplefb(si, &mode, parent);
139141
if (!IS_ERR(pd))
140-
goto unlock_mutex;
142+
goto put_device;
141143
}
142144

143145
/* if the FB is incompatible, create a legacy framebuffer device */
@@ -155,7 +157,7 @@ static __init int sysfb_init(void)
155157
pd = platform_device_alloc(name, 0);
156158
if (!pd) {
157159
ret = -ENOMEM;
158-
goto unlock_mutex;
160+
goto put_device;
159161
}
160162

161163
pd->dev.parent = parent;
@@ -170,9 +172,11 @@ static __init int sysfb_init(void)
170172
if (ret)
171173
goto err;
172174

173-
goto unlock_mutex;
175+
goto put_device;
174176
err:
175177
platform_device_put(pd);
178+
put_device:
179+
put_device(parent);
176180
unlock_mutex:
177181
mutex_unlock(&disable_lock);
178182
return ret;

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

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10048,6 +10048,7 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
1004810048
}
1004910049

1005010050
/* Update Freesync settings. */
10051+
reset_freesync_config_for_crtc(dm_new_crtc_state);
1005110052
get_freesync_config_for_crtc(dm_new_crtc_state,
1005210053
dm_new_conn_state);
1005310054

@@ -11181,6 +11182,49 @@ static bool parse_edid_cea(struct amdgpu_dm_connector *aconnector,
1118111182
return ret;
1118211183
}
1118311184

11185+
static void parse_edid_displayid_vrr(struct drm_connector *connector,
11186+
struct edid *edid)
11187+
{
11188+
u8 *edid_ext = NULL;
11189+
int i;
11190+
int j = 0;
11191+
u16 min_vfreq;
11192+
u16 max_vfreq;
11193+
11194+
if (edid == NULL || edid->extensions == 0)
11195+
return;
11196+
11197+
/* Find DisplayID extension */
11198+
for (i = 0; i < edid->extensions; i++) {
11199+
edid_ext = (void *)(edid + (i + 1));
11200+
if (edid_ext[0] == DISPLAYID_EXT)
11201+
break;
11202+
}
11203+
11204+
if (edid_ext == NULL)
11205+
return;
11206+
11207+
while (j < EDID_LENGTH) {
11208+
/* Get dynamic video timing range from DisplayID if available */
11209+
if (EDID_LENGTH - j > 13 && edid_ext[j] == 0x25 &&
11210+
(edid_ext[j+1] & 0xFE) == 0 && (edid_ext[j+2] == 9)) {
11211+
min_vfreq = edid_ext[j+9];
11212+
if (edid_ext[j+1] & 7)
11213+
max_vfreq = edid_ext[j+10] + ((edid_ext[j+11] & 3) << 8);
11214+
else
11215+
max_vfreq = edid_ext[j+10];
11216+
11217+
if (max_vfreq && min_vfreq) {
11218+
connector->display_info.monitor_range.max_vfreq = max_vfreq;
11219+
connector->display_info.monitor_range.min_vfreq = min_vfreq;
11220+
11221+
return;
11222+
}
11223+
}
11224+
j++;
11225+
}
11226+
}
11227+
1118411228
static int parse_amd_vsdb(struct amdgpu_dm_connector *aconnector,
1118511229
struct edid *edid, struct amdgpu_hdmi_vsdb_info *vsdb_info)
1118611230
{
@@ -11302,16 +11346,23 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector,
1130211346
if (!adev->dm.freesync_module)
1130311347
goto update;
1130411348

11349+
/* Some eDP panels only have the refresh rate range info in DisplayID */
11350+
if ((connector->display_info.monitor_range.min_vfreq == 0 ||
11351+
connector->display_info.monitor_range.max_vfreq == 0))
11352+
parse_edid_displayid_vrr(connector, edid);
11353+
1130511354
if (edid && (sink->sink_signal == SIGNAL_TYPE_DISPLAY_PORT ||
1130611355
sink->sink_signal == SIGNAL_TYPE_EDP)) {
1130711356
bool edid_check_required = false;
1130811357

1130911358
if (is_dp_capable_without_timing_msa(adev->dm.dc,
1131011359
amdgpu_dm_connector)) {
1131111360
if (edid->features & DRM_EDID_FEATURE_CONTINUOUS_FREQ) {
11312-
freesync_capable = true;
1131311361
amdgpu_dm_connector->min_vfreq = connector->display_info.monitor_range.min_vfreq;
1131411362
amdgpu_dm_connector->max_vfreq = connector->display_info.monitor_range.max_vfreq;
11363+
if (amdgpu_dm_connector->max_vfreq -
11364+
amdgpu_dm_connector->min_vfreq > 10)
11365+
freesync_capable = true;
1131511366
} else {
1131611367
edid_check_required = edid->version > 1 ||
1131711368
(edid->version == 1 &&

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3364,6 +3364,9 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
33643364
&mode_lib->vba.UrgentBurstFactorLumaPre[k],
33653365
&mode_lib->vba.UrgentBurstFactorChromaPre[k],
33663366
&mode_lib->vba.NotUrgentLatencyHidingPre[k]);
3367+
3368+
v->cursor_bw_pre[k] = mode_lib->vba.NumberOfCursors[k] * mode_lib->vba.CursorWidth[k][0] * mode_lib->vba.CursorBPP[k][0] /
3369+
8.0 / (mode_lib->vba.HTotal[k] / mode_lib->vba.PixelClock[k]) * v->VRatioPreY[i][j][k];
33673370
}
33683371

33693372
{

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ void dml2_init_socbb_params(struct dml2_context *dml2, const struct dc *in_dc, s
234234
out->round_trip_ping_latency_dcfclk_cycles = 106;
235235
out->smn_latency_us = 2;
236236
out->dispclk_dppclk_vco_speed_mhz = 3600;
237+
out->pct_ideal_dram_bw_after_urgent_pixel_only = 65.0;
237238
break;
238239

239240
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ void dml2_calculate_rq_and_dlg_params(const struct dc *dc, struct dc_state *cont
294294
context->bw_ctx.bw.dcn.clk.dcfclk_deep_sleep_khz = (unsigned int)in_ctx->v20.dml_core_ctx.mp.DCFCLKDeepSleep * 1000;
295295
context->bw_ctx.bw.dcn.clk.dppclk_khz = 0;
296296

297-
if (in_ctx->v20.dml_core_ctx.ms.support.FCLKChangeSupport[in_ctx->v20.scratch.mode_support_params.out_lowest_state_idx] == dml_fclock_change_unsupported)
297+
if (in_ctx->v20.dml_core_ctx.ms.support.FCLKChangeSupport[0] == dml_fclock_change_unsupported)
298298
context->bw_ctx.bw.dcn.clk.fclk_p_state_change_support = false;
299299
else
300300
context->bw_ctx.bw.dcn.clk.fclk_p_state_change_support = true;

drivers/gpu/drm/amd/include/atomfirmware.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ struct atom_gpio_pin_lut_v2_1
734734
{
735735
struct atom_common_table_header table_header;
736736
/*the real number of this included in the structure is calcualted by using the (whole structure size - the header size)/size of atom_gpio_pin_lut */
737-
struct atom_gpio_pin_assignment gpio_pin[8];
737+
struct atom_gpio_pin_assignment gpio_pin[];
738738
};
739739

740740

drivers/gpu/drm/drm_fbdev_generic.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ static int drm_fbdev_generic_helper_fb_probe(struct drm_fb_helper *fb_helper,
8484
sizes->surface_width, sizes->surface_height,
8585
sizes->surface_bpp);
8686

87-
format = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth);
87+
format = drm_driver_legacy_fb_format(dev, sizes->surface_bpp,
88+
sizes->surface_depth);
8889
buffer = drm_client_framebuffer_create(client, sizes->surface_width,
8990
sizes->surface_height, format);
9091
if (IS_ERR(buffer))

drivers/gpu/drm/drm_panel_orientation_quirks.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,13 +420,20 @@ static const struct dmi_system_id orientation_data[] = {
420420
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Galaxy Book 10.6"),
421421
},
422422
.driver_data = (void *)&lcd1280x1920_rightside_up,
423-
}, { /* Valve Steam Deck */
423+
}, { /* Valve Steam Deck (Jupiter) */
424424
.matches = {
425425
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Valve"),
426426
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Jupiter"),
427427
DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "1"),
428428
},
429429
.driver_data = (void *)&lcd800x1280_rightside_up,
430+
}, { /* Valve Steam Deck (Galileo) */
431+
.matches = {
432+
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Valve"),
433+
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Galileo"),
434+
DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "1"),
435+
},
436+
.driver_data = (void *)&lcd800x1280_rightside_up,
430437
}, { /* VIOS LTH17 */
431438
.matches = {
432439
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "VIOS"),

drivers/gpu/drm/i915/display/intel_ddi.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2088,6 +2088,9 @@ icl_program_mg_dp_mode(struct intel_digital_port *dig_port,
20882088
u32 ln0, ln1, pin_assignment;
20892089
u8 width;
20902090

2091+
if (DISPLAY_VER(dev_priv) >= 14)
2092+
return;
2093+
20912094
if (!intel_encoder_is_tc(&dig_port->base) ||
20922095
intel_tc_port_in_tbt_alt_mode(dig_port))
20932096
return;

drivers/gpu/drm/nouveau/nouveau_connector.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,9 @@ nouveau_connector_get_modes(struct drm_connector *connector)
10011001
struct drm_display_mode *mode;
10021002

10031003
mode = drm_mode_duplicate(dev, nv_connector->native_mode);
1004+
if (!mode)
1005+
return 0;
1006+
10041007
drm_mode_probed_add(connector, mode);
10051008
ret = 1;
10061009
}

drivers/gpu/drm/panthor/panthor_drv.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ panthor_get_uobj_array(const struct drm_panthor_obj_array *in, u32 min_stride,
8686
int ret = 0;
8787
void *out_alloc;
8888

89+
if (!in->count)
90+
return NULL;
91+
8992
/* User stride must be at least the minimum object size, otherwise it might
9093
* lack useful information.
9194
*/
9295
if (in->stride < min_stride)
9396
return ERR_PTR(-EINVAL);
9497

95-
if (!in->count)
96-
return NULL;
97-
9898
out_alloc = kvmalloc_array(in->count, obj_size, GFP_KERNEL);
9999
if (!out_alloc)
100100
return ERR_PTR(-ENOMEM);

drivers/gpu/drm/panthor/panthor_sched.c

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,16 @@ struct panthor_queue {
458458
/** @seqno: Sequence number of the last initialized fence. */
459459
atomic64_t seqno;
460460

461+
/**
462+
* @last_fence: Fence of the last submitted job.
463+
*
464+
* We return this fence when we get an empty command stream.
465+
* This way, we are guaranteed that all earlier jobs have completed
466+
* when drm_sched_job::s_fence::finished without having to feed
467+
* the CS ring buffer with a dummy job that only signals the fence.
468+
*/
469+
struct dma_fence *last_fence;
470+
461471
/**
462472
* @in_flight_jobs: List containing all in-flight jobs.
463473
*
@@ -829,6 +839,9 @@ static void group_free_queue(struct panthor_group *group, struct panthor_queue *
829839
panthor_kernel_bo_destroy(queue->ringbuf);
830840
panthor_kernel_bo_destroy(queue->iface.mem);
831841

842+
/* Release the last_fence we were holding, if any. */
843+
dma_fence_put(queue->fence_ctx.last_fence);
844+
832845
kfree(queue);
833846
}
834847

@@ -2784,9 +2797,6 @@ static void group_sync_upd_work(struct work_struct *work)
27842797

27852798
spin_lock(&queue->fence_ctx.lock);
27862799
list_for_each_entry_safe(job, job_tmp, &queue->fence_ctx.in_flight_jobs, node) {
2787-
if (!job->call_info.size)
2788-
continue;
2789-
27902800
if (syncobj->seqno < job->done_fence->seqno)
27912801
break;
27922802

@@ -2865,11 +2875,14 @@ queue_run_job(struct drm_sched_job *sched_job)
28652875
static_assert(sizeof(call_instrs) % 64 == 0,
28662876
"call_instrs is not aligned on a cacheline");
28672877

2868-
/* Stream size is zero, nothing to do => return a NULL fence and let
2869-
* drm_sched signal the parent.
2878+
/* Stream size is zero, nothing to do except making sure all previously
2879+
* submitted jobs are done before we signal the
2880+
* drm_sched_job::s_fence::finished fence.
28702881
*/
2871-
if (!job->call_info.size)
2872-
return NULL;
2882+
if (!job->call_info.size) {
2883+
job->done_fence = dma_fence_get(queue->fence_ctx.last_fence);
2884+
return dma_fence_get(job->done_fence);
2885+
}
28732886

28742887
ret = pm_runtime_resume_and_get(ptdev->base.dev);
28752888
if (drm_WARN_ON(&ptdev->base, ret))
@@ -2928,6 +2941,10 @@ queue_run_job(struct drm_sched_job *sched_job)
29282941
}
29292942
}
29302943

2944+
/* Update the last fence. */
2945+
dma_fence_put(queue->fence_ctx.last_fence);
2946+
queue->fence_ctx.last_fence = dma_fence_get(job->done_fence);
2947+
29312948
done_fence = dma_fence_get(job->done_fence);
29322949

29332950
out_unlock:
@@ -3378,10 +3395,15 @@ panthor_job_create(struct panthor_file *pfile,
33783395
goto err_put_job;
33793396
}
33803397

3381-
job->done_fence = kzalloc(sizeof(*job->done_fence), GFP_KERNEL);
3382-
if (!job->done_fence) {
3383-
ret = -ENOMEM;
3384-
goto err_put_job;
3398+
/* Empty command streams don't need a fence, they'll pick the one from
3399+
* the previously submitted job.
3400+
*/
3401+
if (job->call_info.size) {
3402+
job->done_fence = kzalloc(sizeof(*job->done_fence), GFP_KERNEL);
3403+
if (!job->done_fence) {
3404+
ret = -ENOMEM;
3405+
goto err_put_job;
3406+
}
33853407
}
33863408

33873409
ret = drm_sched_job_init(&job->base,

drivers/gpu/drm/radeon/radeon_gem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ static void radeon_gem_va_update_vm(struct radeon_device *rdev,
642642
if (r)
643643
goto error_unlock;
644644

645-
if (bo_va->it.start)
645+
if (bo_va->it.start && bo_va->bo)
646646
r = radeon_vm_bo_update(rdev, bo_va, bo_va->bo->tbo.resource);
647647

648648
error_unlock:

drivers/gpu/drm/ttm/ttm_bo.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ static void ttm_bo_release(struct kref *kref)
346346
if (!dma_resv_test_signaled(bo->base.resv,
347347
DMA_RESV_USAGE_BOOKKEEP) ||
348348
(want_init_on_free() && (bo->ttm != NULL)) ||
349+
bo->type == ttm_bo_type_sg ||
349350
!dma_resv_trylock(bo->base.resv)) {
350351
/* The BO is not idle, resurrect it for delayed destroy */
351352
ttm_bo_flush_all_fences(bo);

drivers/gpu/drm/xe/xe_gt_mcr.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ static void init_steering_oaddrm(struct xe_gt *gt)
342342
else
343343
gt->steering[OADDRM].group_target = 1;
344344

345-
gt->steering[DSS].instance_target = 0; /* unused */
345+
gt->steering[OADDRM].instance_target = 0; /* unused */
346346
}
347347

348348
static void init_steering_sqidi_psmi(struct xe_gt *gt)
@@ -357,8 +357,8 @@ static void init_steering_sqidi_psmi(struct xe_gt *gt)
357357

358358
static void init_steering_inst0(struct xe_gt *gt)
359359
{
360-
gt->steering[DSS].group_target = 0; /* unused */
361-
gt->steering[DSS].instance_target = 0; /* unused */
360+
gt->steering[INSTANCE0].group_target = 0; /* unused */
361+
gt->steering[INSTANCE0].instance_target = 0; /* unused */
362362
}
363363

364364
static const struct {

drivers/gpu/drm/xe/xe_migrate.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,7 @@ xe_migrate_update_pgtables(struct xe_migrate *m,
13341334
GFP_KERNEL, true, 0);
13351335
if (IS_ERR(sa_bo)) {
13361336
err = PTR_ERR(sa_bo);
1337-
goto err;
1337+
goto err_bb;
13381338
}
13391339

13401340
ppgtt_ofs = NUM_KERNEL_PDE +
@@ -1385,7 +1385,7 @@ xe_migrate_update_pgtables(struct xe_migrate *m,
13851385
update_idx);
13861386
if (IS_ERR(job)) {
13871387
err = PTR_ERR(job);
1388-
goto err_bb;
1388+
goto err_sa;
13891389
}
13901390

13911391
/* Wait on BO move */
@@ -1434,12 +1434,12 @@ xe_migrate_update_pgtables(struct xe_migrate *m,
14341434

14351435
err_job:
14361436
xe_sched_job_put(job);
1437+
err_sa:
1438+
drm_suballoc_free(sa_bo, NULL);
14371439
err_bb:
14381440
if (!q)
14391441
mutex_unlock(&m->job_mutex);
14401442
xe_bb_free(bb, NULL);
1441-
err:
1442-
drm_suballoc_free(sa_bo, NULL);
14431443
return ERR_PTR(err);
14441444
}
14451445

0 commit comments

Comments
 (0)