Skip to content

Commit 95adee9

Browse files
committed
Merge tag 'drm-intel-gt-next-2026-01-16' of https://gitlab.freedesktop.org/drm/i915/kernel into drm-next
Driver Changes: - Bump recommended GuC version for DG2 and MTL - Fix for syzkaller found NULL deref in execbuf (Krzyssztof, Gangmin) - Use designated initializers in debugfs code (Sebastian) - Selftest and static checker fixes (Ard, Sk) Signed-off-by: Dave Airlie <[email protected]> From: Joonas Lahtinen <[email protected]> Link: https://patch.msgid.link/aWnzOx78S4Vh38QE@jlahtine-mobl
2 parents c098b1a + 9512d9f commit 95adee9

12 files changed

Lines changed: 75 additions & 52 deletions

drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -951,13 +951,13 @@ static int eb_lookup_vmas(struct i915_execbuffer *eb)
951951
vma = eb_lookup_vma(eb, eb->exec[i].handle);
952952
if (IS_ERR(vma)) {
953953
err = PTR_ERR(vma);
954-
goto err;
954+
return err;
955955
}
956956

957957
err = eb_validate_vma(eb, &eb->exec[i], vma);
958958
if (unlikely(err)) {
959959
i915_vma_put(vma);
960-
goto err;
960+
return err;
961961
}
962962

963963
err = eb_add_vma(eb, &current_batch, i, vma);
@@ -966,30 +966,15 @@ static int eb_lookup_vmas(struct i915_execbuffer *eb)
966966

967967
if (i915_gem_object_is_userptr(vma->obj)) {
968968
err = i915_gem_object_userptr_submit_init(vma->obj);
969-
if (err) {
970-
if (i + 1 < eb->buffer_count) {
971-
/*
972-
* Execbuffer code expects last vma entry to be NULL,
973-
* since we already initialized this entry,
974-
* set the next value to NULL or we mess up
975-
* cleanup handling.
976-
*/
977-
eb->vma[i + 1].vma = NULL;
978-
}
979-
969+
if (err)
980970
return err;
981-
}
982971

983972
eb->vma[i].flags |= __EXEC_OBJECT_USERPTR_INIT;
984973
eb->args->flags |= __EXEC_USERPTR_USED;
985974
}
986975
}
987976

988977
return 0;
989-
990-
err:
991-
eb->vma[i].vma = NULL;
992-
return err;
993978
}
994979

995980
static int eb_lock_vmas(struct i915_execbuffer *eb)
@@ -3375,7 +3360,8 @@ i915_gem_do_execbuffer(struct drm_device *dev,
33753360

33763361
eb.exec = exec;
33773362
eb.vma = (struct eb_vma *)(exec + args->buffer_count + 1);
3378-
eb.vma[0].vma = NULL;
3363+
memset(eb.vma, 0, (args->buffer_count + 1) * sizeof(struct eb_vma));
3364+
33793365
eb.batch_pool = NULL;
33803366

33813367
eb.invalid_flags = __EXEC_OBJECT_UNKNOWN_FLAGS;
@@ -3584,7 +3570,18 @@ i915_gem_execbuffer2_ioctl(struct drm_device *dev, void *data,
35843570
if (err)
35853571
return err;
35863572

3587-
/* Allocate extra slots for use by the command parser */
3573+
/*
3574+
* Allocate extra slots for use by the command parser.
3575+
*
3576+
* Note that this allocation handles two different arrays (the
3577+
* exec2_list array, and the eventual eb.vma array introduced in
3578+
* i915_gem_do_execbuffer()), that reside in virtually contiguous
3579+
* memory. Also note that the allocation intentionally doesn't fill the
3580+
* area with zeros, because the exec2_list part doesn't need to be, as
3581+
* it's immediately overwritten by user data a few lines below.
3582+
* However, the eb.vma part is explicitly zeroed later in
3583+
* i915_gem_do_execbuffer().
3584+
*/
35883585
exec2_list = kvmalloc_array(count + 2, eb_element_size(),
35893586
__GFP_NOWARN | GFP_KERNEL);
35903587
if (exec2_list == NULL) {

drivers/gpu/drm/i915/gt/intel_gt_debugfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ DEFINE_INTEL_GT_DEBUGFS_ATTRIBUTE(steering);
7575
static void gt_debugfs_register(struct intel_gt *gt, struct dentry *root)
7676
{
7777
static const struct intel_gt_debugfs_file files[] = {
78-
{ "reset", &reset_fops, NULL },
79-
{ "steering", &steering_fops },
78+
{ .name = "reset", .fops = &reset_fops },
79+
{ .name = "steering", .fops = &steering_fops },
8080
};
8181

8282
intel_gt_debugfs_register_files(root, files, ARRAY_SIZE(files), gt);

drivers/gpu/drm/i915/gt/intel_gt_engines_debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ DEFINE_INTEL_GT_DEBUGFS_ATTRIBUTE(engines);
2929
void intel_gt_engines_debugfs_register(struct intel_gt *gt, struct dentry *root)
3030
{
3131
static const struct intel_gt_debugfs_file files[] = {
32-
{ "engines", &engines_fops },
32+
{ .name = "engines", .fops = &engines_fops },
3333
};
3434

3535
intel_gt_debugfs_register_files(root, files, ARRAY_SIZE(files), gt);

drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -588,13 +588,14 @@ DEFINE_SIMPLE_ATTRIBUTE(perf_limit_reasons_fops, perf_limit_reasons_get,
588588
void intel_gt_pm_debugfs_register(struct intel_gt *gt, struct dentry *root)
589589
{
590590
static const struct intel_gt_debugfs_file files[] = {
591-
{ "drpc", &drpc_fops, NULL },
592-
{ "frequency", &frequency_fops, NULL },
593-
{ "forcewake", &fw_domains_fops, NULL },
594-
{ "forcewake_user", &forcewake_user_fops, NULL},
595-
{ "llc", &llc_fops, llc_eval },
596-
{ "rps_boost", &rps_boost_fops, rps_eval },
597-
{ "perf_limit_reasons", &perf_limit_reasons_fops, perf_limit_reasons_eval },
591+
{ .name = "drpc", .fops = &drpc_fops },
592+
{ .name = "frequency", .fops = &frequency_fops },
593+
{ .name = "forcewake", .fops = &fw_domains_fops },
594+
{ .name = "forcewake_user", .fops = &forcewake_user_fops},
595+
{ .name = "llc", .fops = &llc_fops, .eval = llc_eval },
596+
{ .name = "rps_boost", .fops = &rps_boost_fops, .eval = rps_eval },
597+
{ .name = "perf_limit_reasons", .fops = &perf_limit_reasons_fops,
598+
.eval = perf_limit_reasons_eval },
598599
};
599600

600601
intel_gt_debugfs_register_files(root, files, ARRAY_SIZE(files), gt);

drivers/gpu/drm/i915/gt/intel_sseu_debugfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@ DEFINE_INTEL_GT_DEBUGFS_ATTRIBUTE(sseu_topology);
293293
void intel_sseu_debugfs_register(struct intel_gt *gt, struct dentry *root)
294294
{
295295
static const struct intel_gt_debugfs_file files[] = {
296-
{ "sseu_status", &sseu_status_fops, NULL },
297-
{ "sseu_topology", &sseu_topology_fops, NULL },
296+
{ .name = "sseu_status", .fops = &sseu_status_fops },
297+
{ .name = "sseu_topology", .fops = &sseu_topology_fops },
298298
};
299299

300300
intel_gt_debugfs_register_files(root, files, ARRAY_SIZE(files), gt);

drivers/gpu/drm/i915/gt/selftest_rps.c

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ int live_rps_control(void *arg)
378378
enum intel_engine_id id;
379379
struct igt_spinner spin;
380380
intel_wakeref_t wakeref;
381+
u32 throttle;
381382
int err = 0;
382383

383384
/*
@@ -463,6 +464,9 @@ int live_rps_control(void *arg)
463464
max = rps_set_check(rps, limit);
464465
max_dt = ktime_sub(ktime_get(), max_dt);
465466

467+
throttle = intel_uncore_read(gt->uncore, intel_gt_perf_limit_reasons_reg(gt));
468+
throttle &= GT0_PERF_LIMIT_REASONS_MASK;
469+
466470
min_dt = ktime_get();
467471
min = rps_set_check(rps, rps->min_freq);
468472
min_dt = ktime_sub(ktime_get(), min_dt);
@@ -478,11 +482,9 @@ int live_rps_control(void *arg)
478482
min, max, ktime_to_ns(min_dt), ktime_to_ns(max_dt));
479483

480484
if (limit != rps->max_freq) {
481-
u32 throttle = intel_uncore_read(gt->uncore,
482-
intel_gt_perf_limit_reasons_reg(gt));
483-
484-
pr_warn("%s: GPU throttled with reasons 0x%08x\n",
485-
engine->name, throttle & GT0_PERF_LIMIT_REASONS_MASK);
485+
if (throttle)
486+
pr_warn("%s: GPU throttled with reasons 0x%08x\n",
487+
engine->name, throttle);
486488
show_pstate_limits(rps);
487489
}
488490

@@ -1138,6 +1140,7 @@ int live_rps_power(void *arg)
11381140
struct intel_engine_cs *engine;
11391141
enum intel_engine_id id;
11401142
struct igt_spinner spin;
1143+
u32 throttle;
11411144
int err = 0;
11421145

11431146
/*
@@ -1195,6 +1198,9 @@ int live_rps_power(void *arg)
11951198
max.freq = rps->max_freq;
11961199
max.power = measure_power_at(rps, &max.freq);
11971200

1201+
throttle = intel_uncore_read(gt->uncore, intel_gt_perf_limit_reasons_reg(gt));
1202+
throttle &= GT0_PERF_LIMIT_REASONS_MASK;
1203+
11981204
min.freq = rps->min_freq;
11991205
min.power = measure_power_at(rps, &min.freq);
12001206

@@ -1210,12 +1216,21 @@ int live_rps_power(void *arg)
12101216
pr_notice("Could not control frequency, ran at [%d:%uMHz, %d:%uMhz]\n",
12111217
min.freq, intel_gpu_freq(rps, min.freq),
12121218
max.freq, intel_gpu_freq(rps, max.freq));
1219+
1220+
if (throttle)
1221+
pr_warn("%s: GPU throttled with reasons 0x%08x\n",
1222+
engine->name, throttle);
12131223
continue;
12141224
}
12151225

12161226
if (11 * min.power > 10 * max.power) {
12171227
pr_err("%s: did not conserve power when setting lower frequency!\n",
12181228
engine->name);
1229+
1230+
if (throttle)
1231+
pr_warn("%s: GPU throttled with reasons 0x%08x\n",
1232+
engine->name, throttle);
1233+
12191234
err = -EINVAL;
12201235
break;
12211236
}
@@ -1241,6 +1256,7 @@ int live_rps_dynamic(void *arg)
12411256
struct intel_engine_cs *engine;
12421257
enum intel_engine_id id;
12431258
struct igt_spinner spin;
1259+
u32 throttle;
12441260
int err = 0;
12451261

12461262
/*
@@ -1293,6 +1309,9 @@ int live_rps_dynamic(void *arg)
12931309
max.freq = wait_for_freq(rps, rps->max_freq, 500);
12941310
max.dt = ktime_sub(ktime_get(), max.dt);
12951311

1312+
throttle = intel_uncore_read(gt->uncore, intel_gt_perf_limit_reasons_reg(gt));
1313+
throttle &= GT0_PERF_LIMIT_REASONS_MASK;
1314+
12961315
igt_spinner_end(&spin);
12971316

12981317
min.dt = ktime_get();
@@ -1308,6 +1327,11 @@ int live_rps_dynamic(void *arg)
13081327
if (min.freq >= max.freq) {
13091328
pr_err("%s: dynamic reclocking of spinner failed\n!",
13101329
engine->name);
1330+
1331+
if (throttle)
1332+
pr_warn("%s: GPU throttled with reasons 0x%08x\n",
1333+
engine->name, throttle);
1334+
13111335
err = -EINVAL;
13121336
}
13131337

drivers/gpu/drm/i915/gt/uc/intel_gsc_uc_debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ DEFINE_INTEL_GT_DEBUGFS_ATTRIBUTE(gsc_info);
2929
void intel_gsc_uc_debugfs_register(struct intel_gsc_uc *gsc_uc, struct dentry *root)
3030
{
3131
static const struct intel_gt_debugfs_file files[] = {
32-
{ "gsc_info", &gsc_info_fops, NULL },
32+
{ .name = "gsc_info", .fops = &gsc_info_fops },
3333
};
3434

3535
if (!intel_gsc_uc_is_supported(gsc_uc))

drivers/gpu/drm/i915/gt/uc/intel_guc_debugfs.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,13 @@ DEFINE_SIMPLE_ATTRIBUTE(guc_sched_disable_gucid_threshold_fops,
132132
void intel_guc_debugfs_register(struct intel_guc *guc, struct dentry *root)
133133
{
134134
static const struct intel_gt_debugfs_file files[] = {
135-
{ "guc_info", &guc_info_fops, NULL },
136-
{ "guc_registered_contexts", &guc_registered_contexts_fops, NULL },
137-
{ "guc_slpc_info", &guc_slpc_info_fops, &intel_eval_slpc_support},
138-
{ "guc_sched_disable_delay_ms", &guc_sched_disable_delay_ms_fops, NULL },
139-
{ "guc_sched_disable_gucid_threshold", &guc_sched_disable_gucid_threshold_fops,
140-
NULL },
135+
{ .name = "guc_info", .fops = &guc_info_fops },
136+
{ .name = "guc_registered_contexts", .fops = &guc_registered_contexts_fops },
137+
{ .name = "guc_slpc_info", .fops = &guc_slpc_info_fops,
138+
.eval = intel_eval_slpc_support },
139+
{ .name = "guc_sched_disable_delay_ms", .fops = &guc_sched_disable_delay_ms_fops },
140+
{ .name = "guc_sched_disable_gucid_threshold",
141+
.fops = &guc_sched_disable_gucid_threshold_fops },
141142
};
142143

143144
if (!intel_guc_is_supported(guc))

drivers/gpu/drm/i915/gt/uc/intel_guc_log_debugfs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@ void intel_guc_log_debugfs_register(struct intel_guc_log *log,
162162
struct dentry *root)
163163
{
164164
static const struct intel_gt_debugfs_file files[] = {
165-
{ "guc_log_dump", &guc_log_dump_fops, NULL },
166-
{ "guc_load_err_log_dump", &guc_load_err_log_dump_fops, NULL },
167-
{ "guc_log_level", &guc_log_level_fops, NULL },
168-
{ "guc_log_relay", &guc_log_relay_fops, NULL },
165+
{ .name = "guc_log_dump", .fops = &guc_log_dump_fops },
166+
{ .name = "guc_load_err_log_dump", .fops = &guc_load_err_log_dump_fops},
167+
{ .name = "guc_log_level", .fops = &guc_log_level_fops },
168+
{ .name = "guc_log_relay", .fops = &guc_log_relay_fops },
169169
};
170170

171171
if (!intel_guc_is_supported(log_to_guc(log)))

drivers/gpu/drm/i915/gt/uc/intel_huc_debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ DEFINE_INTEL_GT_DEBUGFS_ATTRIBUTE(huc_info);
2626
void intel_huc_debugfs_register(struct intel_huc *huc, struct dentry *root)
2727
{
2828
static const struct intel_gt_debugfs_file files[] = {
29-
{ "huc_info", &huc_info_fops, NULL },
29+
{ .name = "huc_info", .fops = &huc_info_fops },
3030
};
3131

3232
if (!intel_huc_is_supported(huc))

0 commit comments

Comments
 (0)