Skip to content

Commit d6fd281

Browse files
lucasdemarchimehmetb0
authored andcommitted
drm/xe: Fix tlb invalidation when wedging
BugLink: https://bugs.launchpad.net/bugs/2098165 [ Upstream commit 9ab4981 ] If GuC fails to load, the driver wedges, but in the process it tries to do stuff that may not be initialized yet. This moves the xe_gt_tlb_invalidation_init() to be done earlier: as its own doc says, it's a software-only initialization and should had been named with the _early() suffix. Move it to be called by xe_gt_init_early(), so the locks and seqno are initialized, avoiding a NULL ptr deref when wedging: xe 0000:03:00.0: [drm] *ERROR* GT0: load failed: status: Reset = 0, BootROM = 0x50, UKernel = 0x00, MIA = 0x00, Auth = 0x01 xe 0000:03:00.0: [drm] *ERROR* GT0: firmware signature verification failed xe 0000:03:00.0: [drm] *ERROR* CRITICAL: Xe has declared device 0000:03:00.0 as wedged. ... BUG: kernel NULL pointer dereference, address: 0000000000000000 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: Oops: 0000 [#1] PREEMPT SMP NOPTI CPU: 9 UID: 0 PID: 3908 Comm: modprobe Tainted: G U W 6.13.0-rc4-xe+ #3 Tainted: [U]=USER, [W]=WARN Hardware name: Intel Corporation Alder Lake Client Platform/AlderLake-S ADP-S DDR5 UDIMM CRB, BIOS ADLSFWI1.R00.3275.A00.2207010640 07/01/2022 RIP: 0010:xe_gt_tlb_invalidation_reset+0x75/0x110 [xe] This can be easily triggered by poking the GuC binary to force a signature failure. There will still be an extra message, xe 0000:03:00.0: [drm] *ERROR* GT0: GuC mmio request 0x4100: no reply 0x4100 but that's better than a NULL ptr deref. Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/3956 Fixes: c9474b7 ("drm/xe: Wedge the entire device") Reviewed-by: Matthew Brost <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Lucas De Marchi <[email protected]> (cherry picked from commit 5001ef3) Signed-off-by: Thomas Hellström <[email protected]> Signed-off-by: Sasha Levin <[email protected]> CVE-2025-21644 Signed-off-by: Koichiro Den <[email protected]>
1 parent 43ccbaa commit d6fd281

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

drivers/gpu/drm/xe/xe_gt.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,10 @@ int xe_gt_init_early(struct xe_gt *gt)
387387
xe_force_wake_init_gt(gt, gt_to_fw(gt));
388388
spin_lock_init(&gt->global_invl_lock);
389389

390+
err = xe_gt_tlb_invalidation_init_early(gt);
391+
if (err)
392+
return err;
393+
390394
return 0;
391395
}
392396

@@ -586,10 +590,6 @@ int xe_gt_init(struct xe_gt *gt)
586590
xe_hw_fence_irq_init(&gt->fence_irq[i]);
587591
}
588592

589-
err = xe_gt_tlb_invalidation_init(gt);
590-
if (err)
591-
return err;
592-
593593
err = xe_gt_pagefault_init(gt);
594594
if (err)
595595
return err;

drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,15 @@ static void xe_gt_tlb_fence_timeout(struct work_struct *work)
105105
}
106106

107107
/**
108-
* xe_gt_tlb_invalidation_init - Initialize GT TLB invalidation state
108+
* xe_gt_tlb_invalidation_init_early - Initialize GT TLB invalidation state
109109
* @gt: graphics tile
110110
*
111111
* Initialize GT TLB invalidation state, purely software initialization, should
112112
* be called once during driver load.
113113
*
114114
* Return: 0 on success, negative error code on error.
115115
*/
116-
int xe_gt_tlb_invalidation_init(struct xe_gt *gt)
116+
int xe_gt_tlb_invalidation_init_early(struct xe_gt *gt)
117117
{
118118
gt->tlb_invalidation.seqno = 1;
119119
INIT_LIST_HEAD(&gt->tlb_invalidation.pending_fences);

drivers/gpu/drm/xe/xe_gt_tlb_invalidation.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ struct xe_gt;
1414
struct xe_guc;
1515
struct xe_vma;
1616

17-
int xe_gt_tlb_invalidation_init(struct xe_gt *gt);
17+
int xe_gt_tlb_invalidation_init_early(struct xe_gt *gt);
18+
1819
void xe_gt_tlb_invalidation_reset(struct xe_gt *gt);
1920
int xe_gt_tlb_invalidation_ggtt(struct xe_gt *gt);
2021
int xe_gt_tlb_invalidation_vma(struct xe_gt *gt,

0 commit comments

Comments
 (0)