]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/xe/guc: Exclude indirect ring state page from ADS engine state size
authorSatyanarayana K V P <satyanarayana.k.v.p@intel.com>
Mon, 4 May 2026 09:49:26 +0000 (09:49 +0000)
committerMatthew Brost <matthew.brost@intel.com>
Tue, 5 May 2026 23:15:04 +0000 (16:15 -0700)
The engine state size reported to GuC via ADS should only include the
engine state portion and should not include the indirect ring state page
that comes after it in the context image. The GuC uses this size to
overwrite the engine state in the LRC on watchdog resets and we don't
want it to overwrite the indirect ring state as well.

Fixes: d6219e1cd5e3 ("drm/xe: Add Indirect Ring State support")
Suggested-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Link: https://patch.msgid.link/20260504094924.3760713-4-satyanarayana.k.v.p@intel.com
(cherry picked from commit 3ec5f003f6c377beda8bd5438941f5a7795e1848)
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
drivers/gpu/drm/xe/xe_guc_ads.c
drivers/gpu/drm/xe/xe_lrc.c
drivers/gpu/drm/xe/xe_lrc.h

index 81b5f01b1f65ccbdd0acd419629299c17c8bca5e..2b835d48b5652fbc4ca4b071a1a35829cdc9d111 100644 (file)
@@ -512,12 +512,9 @@ static void guc_golden_lrc_init(struct xe_guc_ads *ads)
                 * that starts after the execlists LRC registers. This is
                 * required to allow the GuC to restore just the engine state
                 * when a watchdog reset occurs.
-                * We calculate the engine state size by removing the size of
-                * what comes before it in the context image (which is identical
-                * on all engines).
                 */
                ads_blob_write(ads, ads.eng_state_size[guc_class],
-                              real_size - xe_lrc_skip_size(xe));
+                              xe_lrc_engine_state_size(gt, class));
                ads_blob_write(ads, ads.golden_context_lrca[guc_class],
                               addr_ggtt);
 
index c725cde4508d2082955436ca0cbf84f37a202252..4af9f0d7c6f3ba4932e56c73511f3dc930bf3f12 100644 (file)
@@ -746,9 +746,16 @@ size_t xe_lrc_reg_size(struct xe_device *xe)
                return 80 * sizeof(u32);
 }
 
-size_t xe_lrc_skip_size(struct xe_device *xe)
+/**
+ * xe_lrc_engine_state_size() - Get size of the engine state within LRC
+ * @gt: the &xe_gt struct instance
+ * @class: Hardware engine class
+ *
+ * Returns: Size of the engine state
+ */
+size_t xe_lrc_engine_state_size(struct xe_gt *gt, enum xe_engine_class class)
 {
-       return LRC_PPHWSP_SIZE + xe_lrc_reg_size(xe);
+       return xe_gt_lrc_hang_replay_size(gt, class) - xe_lrc_reg_size(gt_to_xe(gt));
 }
 
 static inline u32 __xe_lrc_seqno_offset(struct xe_lrc *lrc)
index e7c975f9e2d97583ae6d3731929ccf5a48b65c94..5440663183f6d7a3b48e17499a850e80afa9e8b4 100644 (file)
@@ -130,7 +130,7 @@ u32 xe_lrc_parallel_ggtt_addr(struct xe_lrc *lrc);
 struct iosys_map xe_lrc_parallel_map(struct xe_lrc *lrc);
 
 size_t xe_lrc_reg_size(struct xe_device *xe);
-size_t xe_lrc_skip_size(struct xe_device *xe);
+size_t xe_lrc_engine_state_size(struct xe_gt *gt, enum xe_engine_class class);
 
 void xe_lrc_dump_default(struct drm_printer *p,
                         struct xe_gt *gt,