diff --git a/kernel-patches/patches/0001-drm-i915-guc-invalidate-tlb-only-if-guc-submission-is-.drm b/kernel-patches/patches/0001-drm-i915-guc-invalidate-tlb-only-if-guc-submission-is-.drm new file mode 100644 index 00000000..234f35bf --- /dev/null +++ b/kernel-patches/patches/0001-drm-i915-guc-invalidate-tlb-only-if-guc-submission-is-.drm @@ -0,0 +1,48 @@ +From 4a129142a97f831bbe99a8f9f94921db80d2d885 Mon Sep 17 00:00:00 2001 +From: Junxiao Chang +Date: Mon, 8 Jul 2024 08:25:39 +0800 +Subject: [PATCH] drm/i915/guc: invalidate tlb only if guc submission is + enabled +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +xa_alloc for guc tlb_lookup is initialized in guc submission. For +some platform which guc submission is not enabled by default, +xa_alloc for guc tlb_lookup might crash kernel. + +Signed-off-by: Krystian GarliƄski +Signed-off-by: Junxiao Chang +--- + drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +index a84c717981d0..bd524fa3e2a4 100644 +--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c ++++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +@@ -1983,7 +1983,7 @@ static int number_mlrc_guc_id(struct intel_guc *guc); + bool intel_guc_tlb_invalidation_is_available(struct intel_guc *guc) + { + return HAS_GUC_TLB_INVALIDATION(guc_to_gt(guc)->i915) && +- intel_guc_is_ready(guc); ++ intel_guc_is_ready(guc) && guc_submission_initialized(guc); + } + + static int init_tlb_lookup(struct intel_guc *guc) +@@ -4906,6 +4906,12 @@ static int guc_send_invalidate_tlb(struct intel_guc *guc, + if (!intel_gt_is_enabled(gt)) + return -EINVAL; + ++ /* If guc submission is not initialized, guc tlb lookup couldn't be ++ * accessed either. ++ */ ++ if (!guc_submission_initialized(guc)) ++ return -EINVAL; ++ + init_waitqueue_head(&_wq.wq); + + if (xa_alloc_cyclic_irq(&guc->tlb_lookup, &seqno, wq, +-- +2.34.1 + diff --git a/kernel-patches/patches/series b/kernel-patches/patches/series index 836dd452..4728fe46 100644 --- a/kernel-patches/patches/series +++ b/kernel-patches/patches/series @@ -475,6 +475,7 @@ 0001-drm-i915-mtl-Update-workaround-14018575942.drm 0001-drm-i915-Update-ADL-N-PCI-IDs.drm 0002-drm-i915-Don-t-apply-border-when-no-border-requested.drm +0001-drm-i915-guc-invalidate-tlb-only-if-guc-submission-is-.drm #tsn 0001-net-phylink-Add-module_exit.tsn 0001-net-stmmac-Set-mac_managed_pm-flag-from-stmmac-to-reso.tsn