Skip to content

Commit 23e98bb

Browse files
committed
Merge tag 'drm-xe-fixes-2026-07-02' of https://gitlab.freedesktop.org/drm/xe/kernel into drm-fixes
Driver Changes: - Wedge from the timeout handler only after releasing the queue (Rodrigo) - Fix a NULL pointer dereference (Francois) - Remove redundant exec_queue_suspended (Lu) - RTP / OA whitelist fixes (Ashutosh, Gustavo, Thomas) - Return error on non-migratable faults requiring devmem (Matt Brost) - Skip FORCE_WC and vm_bound check for external dma-bufs (Matt Auld) - Hold notifier lock for write on inject test path (Shuicheng) - Drop bogus static from finish in force_invalidate (Shuicheng) - Fix double-free of managed BO in error path (Shuicheng) - Don't attempt to process FAST_REQ or EVENT relays (Michal) - Fix NPD in bo_meminfo (Matthew Auld) - Prevent invalid cursor access for purged BOs (Matthew Auld) - Fix offset alignment for MERT WHITELST_OA_MERT_MMIO_TRG (Ashutosh) Signed-off-by: Dave Airlie <airlied@redhat.com> From: Thomas Hellstrom <thomas.hellstrom@linux.intel.com> Link: https://patch.msgid.link/akZ_UbrL94G4F2iA@fedora
2 parents 7e21dc0 + 959b501 commit 23e98bb

22 files changed

Lines changed: 376 additions & 204 deletions

drivers/gpu/drm/xe/display/xe_display_bo.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ static int xe_display_bo_framebuffer_init(struct drm_gem_object *obj,
4848
if (ret)
4949
goto err;
5050

51-
if (!(bo->flags & XE_BO_FLAG_FORCE_WC)) {
51+
if (!(bo->flags & XE_BO_FLAG_FORCE_WC) &&
52+
bo->ttm.type != ttm_bo_type_sg) {
5253
/*
5354
* XE_BO_FLAG_FORCE_WC should ideally be set at creation, or is
5455
* automatically set when creating FB. We cannot change caching

drivers/gpu/drm/xe/display/xe_fb_pin.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,8 @@ static struct i915_vma *__xe_pin_fb_vma(struct drm_gem_object *obj, bool is_dpt,
331331
int ret = 0;
332332

333333
/* We reject creating !SCANOUT fb's, so this is weird.. */
334-
drm_WARN_ON(bo->ttm.base.dev, !(bo->flags & XE_BO_FLAG_FORCE_WC));
334+
drm_WARN_ON(bo->ttm.base.dev, !(bo->flags & XE_BO_FLAG_FORCE_WC) &&
335+
bo->ttm.type != ttm_bo_type_sg);
335336

336337
if (!vma)
337338
return ERR_PTR(-ENODEV);

drivers/gpu/drm/xe/tests/xe_rtp_test.c

Lines changed: 40 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ struct rtp_to_sr_test_case {
5454
unsigned long expected_count_sr_entries;
5555
unsigned int expected_sr_errors;
5656
unsigned long expected_active;
57-
const struct xe_rtp_entry_sr *entries;
57+
const struct xe_rtp_table_sr table;
5858
};
5959

6060
struct rtp_test_case {
6161
const char *name;
6262
unsigned long expected_active;
63-
const struct xe_rtp_entry *entries;
63+
const struct xe_rtp_table table;
6464
};
6565

6666
static bool fake_xe_gt_mcr_check_reg(struct xe_gt *gt, struct xe_reg reg)
@@ -289,7 +289,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {
289289
.expected_active = BIT(0) | BIT(1),
290290
.expected_count_sr_entries = 1,
291291
/* Different bits on the same register: create a single entry */
292-
.entries = (const struct xe_rtp_entry_sr[]) {
292+
.table = XE_RTP_TABLE_SR(
293293
{ XE_RTP_NAME("basic-1"),
294294
XE_RTP_RULES(FUNC(match_yes)),
295295
XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(0)))
@@ -298,8 +298,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {
298298
XE_RTP_RULES(FUNC(match_yes)),
299299
XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(1)))
300300
},
301-
{}
302-
},
301+
),
303302
},
304303
{
305304
.name = "no-match-no-add",
@@ -309,7 +308,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {
309308
.expected_active = BIT(0),
310309
.expected_count_sr_entries = 1,
311310
/* Don't coalesce second entry since rules don't match */
312-
.entries = (const struct xe_rtp_entry_sr[]) {
311+
.table = XE_RTP_TABLE_SR(
313312
{ XE_RTP_NAME("basic-1"),
314313
XE_RTP_RULES(FUNC(match_yes)),
315314
XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(0)))
@@ -318,8 +317,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {
318317
XE_RTP_RULES(FUNC(match_no)),
319318
XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(1)))
320319
},
321-
{}
322-
},
320+
),
323321
},
324322
{
325323
.name = "two-regs-two-entries",
@@ -329,7 +327,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {
329327
.expected_active = BIT(0) | BIT(1),
330328
.expected_count_sr_entries = 2,
331329
/* Same bits on different registers are not coalesced */
332-
.entries = (const struct xe_rtp_entry_sr[]) {
330+
.table = XE_RTP_TABLE_SR(
333331
{ XE_RTP_NAME("basic-1"),
334332
XE_RTP_RULES(FUNC(match_yes)),
335333
XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(0)))
@@ -338,8 +336,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {
338336
XE_RTP_RULES(FUNC(match_yes)),
339337
XE_RTP_ACTIONS(SET(REGULAR_REG2, REG_BIT(0)))
340338
},
341-
{}
342-
},
339+
),
343340
},
344341
{
345342
.name = "clr-one-set-other",
@@ -349,7 +346,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {
349346
.expected_active = BIT(0) | BIT(1),
350347
.expected_count_sr_entries = 1,
351348
/* Check clr vs set actions on different bits */
352-
.entries = (const struct xe_rtp_entry_sr[]) {
349+
.table = XE_RTP_TABLE_SR(
353350
{ XE_RTP_NAME("basic-1"),
354351
XE_RTP_RULES(FUNC(match_yes)),
355352
XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(0)))
@@ -358,8 +355,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {
358355
XE_RTP_RULES(FUNC(match_yes)),
359356
XE_RTP_ACTIONS(CLR(REGULAR_REG1, REG_BIT(1)))
360357
},
361-
{}
362-
},
358+
),
363359
},
364360
{
365361
#define TEMP_MASK REG_GENMASK(10, 8)
@@ -371,14 +367,13 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {
371367
.expected_active = BIT(0),
372368
.expected_count_sr_entries = 1,
373369
/* Check FIELD_SET works */
374-
.entries = (const struct xe_rtp_entry_sr[]) {
370+
.table = XE_RTP_TABLE_SR(
375371
{ XE_RTP_NAME("basic-1"),
376372
XE_RTP_RULES(FUNC(match_yes)),
377373
XE_RTP_ACTIONS(FIELD_SET(REGULAR_REG1,
378374
TEMP_MASK, TEMP_FIELD))
379375
},
380-
{}
381-
},
376+
),
382377
#undef TEMP_MASK
383378
#undef TEMP_FIELD
384379
},
@@ -390,7 +385,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {
390385
.expected_active = BIT(0) | BIT(1),
391386
.expected_count_sr_entries = 1,
392387
.expected_sr_errors = 1,
393-
.entries = (const struct xe_rtp_entry_sr[]) {
388+
.table = XE_RTP_TABLE_SR(
394389
{ XE_RTP_NAME("basic-1"),
395390
XE_RTP_RULES(FUNC(match_yes)),
396391
XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(0)))
@@ -400,8 +395,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {
400395
XE_RTP_RULES(FUNC(match_yes)),
401396
XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(0)))
402397
},
403-
{}
404-
},
398+
),
405399
},
406400
{
407401
.name = "conflict-not-disjoint",
@@ -411,7 +405,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {
411405
.expected_active = BIT(0) | BIT(1),
412406
.expected_count_sr_entries = 1,
413407
.expected_sr_errors = 1,
414-
.entries = (const struct xe_rtp_entry_sr[]) {
408+
.table = XE_RTP_TABLE_SR(
415409
{ XE_RTP_NAME("basic-1"),
416410
XE_RTP_RULES(FUNC(match_yes)),
417411
XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(0)))
@@ -421,8 +415,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {
421415
XE_RTP_RULES(FUNC(match_yes)),
422416
XE_RTP_ACTIONS(CLR(REGULAR_REG1, REG_GENMASK(1, 0)))
423417
},
424-
{}
425-
},
418+
),
426419
},
427420
{
428421
.name = "conflict-reg-type",
@@ -432,7 +425,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {
432425
.expected_active = BIT(0) | BIT(1) | BIT(2),
433426
.expected_count_sr_entries = 1,
434427
.expected_sr_errors = 2,
435-
.entries = (const struct xe_rtp_entry_sr[]) {
428+
.table = XE_RTP_TABLE_SR(
436429
{ XE_RTP_NAME("basic-1"),
437430
XE_RTP_RULES(FUNC(match_yes)),
438431
XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(0)))
@@ -447,8 +440,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {
447440
XE_RTP_RULES(FUNC(match_yes)),
448441
XE_RTP_ACTIONS(SET(MASKED_REG1, REG_BIT(0)))
449442
},
450-
{}
451-
},
443+
),
452444
},
453445
{
454446
.name = "bad-mcr-reg-forced-to-regular",
@@ -458,13 +450,12 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {
458450
.expected_active = BIT(0),
459451
.expected_count_sr_entries = 1,
460452
.expected_sr_errors = 1,
461-
.entries = (const struct xe_rtp_entry_sr[]) {
453+
.table = XE_RTP_TABLE_SR(
462454
{ XE_RTP_NAME("bad-mcr-regular-reg"),
463455
XE_RTP_RULES(FUNC(match_yes)),
464456
XE_RTP_ACTIONS(SET(BAD_MCR_REG4, REG_BIT(0)))
465457
},
466-
{}
467-
},
458+
),
468459
},
469460
{
470461
.name = "bad-regular-reg-forced-to-mcr",
@@ -474,13 +465,12 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {
474465
.expected_active = BIT(0),
475466
.expected_count_sr_entries = 1,
476467
.expected_sr_errors = 1,
477-
.entries = (const struct xe_rtp_entry_sr[]) {
468+
.table = XE_RTP_TABLE_SR(
478469
{ XE_RTP_NAME("bad-regular-reg"),
479470
XE_RTP_RULES(FUNC(match_yes)),
480471
XE_RTP_ACTIONS(SET(BAD_REGULAR_REG5, REG_BIT(0)))
481472
},
482-
{}
483-
},
473+
),
484474
},
485475
};
486476

@@ -492,16 +482,12 @@ static void xe_rtp_process_to_sr_tests(struct kunit *test)
492482
struct xe_reg_sr *reg_sr = &gt->reg_sr;
493483
const struct xe_reg_sr_entry *sre, *sr_entry = NULL;
494484
struct xe_rtp_process_ctx ctx = XE_RTP_PROCESS_CTX_INITIALIZER(gt);
495-
unsigned long idx, count_sr_entries = 0, count_rtp_entries = 0, active = 0;
485+
unsigned long idx, count_sr_entries = 0, active = 0;
496486

497487
xe_reg_sr_init(reg_sr, "xe_rtp_to_sr_tests", xe);
498488

499-
while (param->entries[count_rtp_entries].rules)
500-
count_rtp_entries++;
501-
502-
xe_rtp_process_ctx_enable_active_tracking(&ctx, &active, count_rtp_entries);
503-
xe_rtp_process_to_sr(&ctx, param->entries, count_rtp_entries,
504-
reg_sr, false);
489+
xe_rtp_process_ctx_enable_active_tracking(&ctx, &active, param->table.n_entries);
490+
xe_rtp_process_to_sr(&ctx, &param->table, reg_sr, false);
505491

506492
xa_for_each(&reg_sr->xa, idx, sre) {
507493
if (idx == param->expected_reg.addr)
@@ -534,56 +520,52 @@ static const struct rtp_test_case rtp_cases[] = {
534520
{
535521
.name = "active1",
536522
.expected_active = BIT(0),
537-
.entries = (const struct xe_rtp_entry[]) {
523+
.table = XE_RTP_TABLE(
538524
{ XE_RTP_NAME("r1"),
539525
XE_RTP_RULES(FUNC(match_yes)),
540526
},
541-
{}
542-
},
527+
),
543528
},
544529
{
545530
.name = "active2",
546531
.expected_active = BIT(0) | BIT(1),
547-
.entries = (const struct xe_rtp_entry[]) {
532+
.table = XE_RTP_TABLE(
548533
{ XE_RTP_NAME("r1"),
549534
XE_RTP_RULES(FUNC(match_yes)),
550535
},
551536
{ XE_RTP_NAME("r2"),
552537
XE_RTP_RULES(FUNC(match_yes)),
553538
},
554-
{}
555-
},
539+
),
556540
},
557541
{
558542
.name = "active-inactive",
559543
.expected_active = BIT(0),
560-
.entries = (const struct xe_rtp_entry[]) {
544+
.table = XE_RTP_TABLE(
561545
{ XE_RTP_NAME("r1"),
562546
XE_RTP_RULES(FUNC(match_yes)),
563547
},
564548
{ XE_RTP_NAME("r2"),
565549
XE_RTP_RULES(FUNC(match_no)),
566550
},
567-
{}
568-
},
551+
),
569552
},
570553
{
571554
.name = "inactive-active",
572555
.expected_active = BIT(1),
573-
.entries = (const struct xe_rtp_entry[]) {
556+
.table = XE_RTP_TABLE(
574557
{ XE_RTP_NAME("r1"),
575558
XE_RTP_RULES(FUNC(match_no)),
576559
},
577560
{ XE_RTP_NAME("r2"),
578561
XE_RTP_RULES(FUNC(match_yes)),
579562
},
580-
{}
581-
},
563+
),
582564
},
583565
{
584566
.name = "inactive-active-inactive",
585567
.expected_active = BIT(1),
586-
.entries = (const struct xe_rtp_entry[]) {
568+
.table = XE_RTP_TABLE(
587569
{ XE_RTP_NAME("r1"),
588570
XE_RTP_RULES(FUNC(match_no)),
589571
},
@@ -593,13 +575,12 @@ static const struct rtp_test_case rtp_cases[] = {
593575
{ XE_RTP_NAME("r3"),
594576
XE_RTP_RULES(FUNC(match_no)),
595577
},
596-
{}
597-
},
578+
),
598579
},
599580
{
600581
.name = "inactive-inactive-inactive",
601582
.expected_active = 0,
602-
.entries = (const struct xe_rtp_entry[]) {
583+
.table = XE_RTP_TABLE(
603584
{ XE_RTP_NAME("r1"),
604585
XE_RTP_RULES(FUNC(match_no)),
605586
},
@@ -609,8 +590,7 @@ static const struct rtp_test_case rtp_cases[] = {
609590
{ XE_RTP_NAME("r3"),
610591
XE_RTP_RULES(FUNC(match_no)),
611592
},
612-
{}
613-
},
593+
),
614594
},
615595
};
616596

@@ -620,13 +600,10 @@ static void xe_rtp_process_tests(struct kunit *test)
620600
struct xe_device *xe = test->priv;
621601
struct xe_gt *gt = xe_device_get_root_tile(xe)->primary_gt;
622602
struct xe_rtp_process_ctx ctx = XE_RTP_PROCESS_CTX_INITIALIZER(gt);
623-
unsigned long count_rtp_entries = 0, active = 0;
624-
625-
while (param->entries[count_rtp_entries].rules)
626-
count_rtp_entries++;
603+
unsigned long active = 0;
627604

628-
xe_rtp_process_ctx_enable_active_tracking(&ctx, &active, count_rtp_entries);
629-
xe_rtp_process(&ctx, param->entries);
605+
xe_rtp_process_ctx_enable_active_tracking(&ctx, &active, param->table.n_entries);
606+
xe_rtp_process(&ctx, &param->table);
630607

631608
KUNIT_EXPECT_EQ(test, active, param->expected_active);
632609
}

drivers/gpu/drm/xe/xe_drm_client.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,20 @@ static void bo_meminfo(struct xe_bo *bo,
168168
struct drm_memory_stats stats[TTM_NUM_MEM_TYPES])
169169
{
170170
u64 sz = xe_bo_size(bo);
171-
u32 mem_type = bo->ttm.resource->mem_type;
171+
u32 mem_type;
172172

173173
xe_bo_assert_held(bo);
174174

175+
/*
176+
* The resource can be NULL if the BO has been purged, plus maybe some
177+
* other cases. Either way there shouldn't be any memory to account for,
178+
* or a current resource to account this against, so skip for now.
179+
*/
180+
if (!bo->ttm.resource)
181+
return;
182+
183+
mem_type = bo->ttm.resource->mem_type;
184+
175185
if (drm_gem_object_is_shared_for_memory_stats(&bo->ttm.base))
176186
stats[mem_type].shared += sz;
177187
else

drivers/gpu/drm/xe/xe_gt_debugfs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,10 @@ static int register_save_restore(struct xe_gt *gt, struct drm_printer *p)
149149
drm_printf(p, "\n");
150150

151151
drm_printf(p, "Whitelist\n");
152-
for_each_hw_engine(hwe, gt, id)
152+
for_each_hw_engine(hwe, gt, id) {
153153
xe_reg_whitelist_dump(&hwe->reg_whitelist, p);
154+
xe_reg_whitelist_dump(&hwe->oa_whitelist, p);
155+
}
154156

155157
return 0;
156158
}

0 commit comments

Comments
 (0)