mirror of
https://github.com/torvalds/linux.git
synced 2026-04-26 10:32:25 -04:00
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:c9474b726b("drm/xe: Wedge the entire device") Reviewed-by: Matthew Brost <matthew.brost@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250103001111.331684-2-lucas.demarchi@intel.com Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> (cherry picked from commit5001ef3af8) Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
41 lines
1.2 KiB
C
41 lines
1.2 KiB
C
/* SPDX-License-Identifier: MIT */
|
|
/*
|
|
* Copyright © 2023 Intel Corporation
|
|
*/
|
|
|
|
#ifndef _XE_GT_TLB_INVALIDATION_H_
|
|
#define _XE_GT_TLB_INVALIDATION_H_
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include "xe_gt_tlb_invalidation_types.h"
|
|
|
|
struct xe_gt;
|
|
struct xe_guc;
|
|
struct xe_vma;
|
|
|
|
int xe_gt_tlb_invalidation_init_early(struct xe_gt *gt);
|
|
|
|
void xe_gt_tlb_invalidation_reset(struct xe_gt *gt);
|
|
int xe_gt_tlb_invalidation_ggtt(struct xe_gt *gt);
|
|
int xe_gt_tlb_invalidation_vma(struct xe_gt *gt,
|
|
struct xe_gt_tlb_invalidation_fence *fence,
|
|
struct xe_vma *vma);
|
|
int xe_gt_tlb_invalidation_range(struct xe_gt *gt,
|
|
struct xe_gt_tlb_invalidation_fence *fence,
|
|
u64 start, u64 end, u32 asid);
|
|
int xe_guc_tlb_invalidation_done_handler(struct xe_guc *guc, u32 *msg, u32 len);
|
|
|
|
void xe_gt_tlb_invalidation_fence_init(struct xe_gt *gt,
|
|
struct xe_gt_tlb_invalidation_fence *fence,
|
|
bool stack);
|
|
void xe_gt_tlb_invalidation_fence_signal(struct xe_gt_tlb_invalidation_fence *fence);
|
|
|
|
static inline void
|
|
xe_gt_tlb_invalidation_fence_wait(struct xe_gt_tlb_invalidation_fence *fence)
|
|
{
|
|
dma_fence_wait(&fence->base, false);
|
|
}
|
|
|
|
#endif /* _XE_GT_TLB_INVALIDATION_ */
|