]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe/rtp: Pass xe_device parameter to FUNC matches
authorMatt Roper <matthew.d.roper@intel.com>
Mon, 13 Oct 2025 20:09:59 +0000 (13:09 -0700)
committerMatt Roper <matthew.d.roper@intel.com>
Tue, 14 Oct 2025 14:45:17 +0000 (07:45 -0700)
FUNC matches in RTP only pass the GT and hwe, preventing them from being
used effectively in device workarounds.  Add an additional xe_device
parameter so that we can use them in device workarounds where a GT may
not be available.

Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
Link: https://lore.kernel.org/r/20251013200944.2499947-41-matthew.d.roper@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
drivers/gpu/drm/xe/tests/xe_rtp_test.c
drivers/gpu/drm/xe/xe_hw_engine.c
drivers/gpu/drm/xe/xe_reg_whitelist.c
drivers/gpu/drm/xe/xe_rtp.c
drivers/gpu/drm/xe/xe_rtp.h
drivers/gpu/drm/xe/xe_rtp_types.h

index b0254b014fe45013aa0c5b3fbbe7a58fe8584a31..d2255a59e58f919fa9a09e8a383a29d60dab9527 100644 (file)
@@ -48,12 +48,14 @@ struct rtp_test_case {
        const struct xe_rtp_entry *entries;
 };
 
-static bool match_yes(const struct xe_gt *gt, const struct xe_hw_engine *hwe)
+static bool match_yes(const struct xe_device *xe, const struct xe_gt *gt,
+                     const struct xe_hw_engine *hwe)
 {
        return true;
 }
 
-static bool match_no(const struct xe_gt *gt, const struct xe_hw_engine *hwe)
+static bool match_no(const struct xe_device *xe, const struct xe_gt *gt,
+                    const struct xe_hw_engine *hwe)
 {
        return false;
 }
index 1cf623b4a5bcc75c90f931915c044efc640f38c3..cba4375525c7e05f24748f666af32cf9e98db397 100644 (file)
@@ -346,17 +346,19 @@ void xe_hw_engine_enable_ring(struct xe_hw_engine *hwe)
        xe_hw_engine_mmio_read32(hwe, RING_MI_MODE(0));
 }
 
-static bool xe_hw_engine_match_fixed_cslice_mode(const struct xe_gt *gt,
+static bool xe_hw_engine_match_fixed_cslice_mode(const struct xe_device *xe,
+                                                const struct xe_gt *gt,
                                                 const struct xe_hw_engine *hwe)
 {
        return xe_gt_ccs_mode_enabled(gt) &&
-              xe_rtp_match_first_render_or_compute(gt, hwe);
+              xe_rtp_match_first_render_or_compute(xe, gt, hwe);
 }
 
-static bool xe_rtp_cfeg_wmtp_disabled(const struct xe_gt *gt,
+static bool xe_rtp_cfeg_wmtp_disabled(const struct xe_device *xe,
+                                     const struct xe_gt *gt,
                                      const struct xe_hw_engine *hwe)
 {
-       if (GRAPHICS_VER(gt_to_xe(gt)) < 20)
+       if (GRAPHICS_VER(xe) < 20)
                return false;
 
        if (hwe->class != XE_ENGINE_CLASS_COMPUTE &&
index 23f6c81d99946f97413e411289116aaa10365f3f..690bc327a363923e5bd30b82afc459865f4f1684 100644 (file)
@@ -19,7 +19,8 @@
 #undef XE_REG_MCR
 #define XE_REG_MCR(...)     XE_REG(__VA_ARGS__, .mcr = 1)
 
-static bool match_not_render(const struct xe_gt *gt,
+static bool match_not_render(const struct xe_device *xe,
+                            const struct xe_gt *gt,
                             const struct xe_hw_engine *hwe)
 {
        return hwe->class != XE_ENGINE_CLASS_RENDER;
index b5f430d59f8055758adbfc45b50d06fcce4cb3d3..66707cc89ec9764abdb7ad31d2198285d2019125 100644 (file)
@@ -133,10 +133,7 @@ static bool rule_matches(const struct xe_device *xe,
                        match = hwe->class != r->engine_class;
                        break;
                case XE_RTP_MATCH_FUNC:
-                       if (drm_WARN_ON(&xe->drm, !gt))
-                               return false;
-
-                       match = r->match_func(gt, hwe);
+                       match = r->match_func(xe, gt, hwe);
                        break;
                default:
                        drm_warn(&xe->drm, "Invalid RTP match %u\n",
@@ -343,13 +340,15 @@ void xe_rtp_process(struct xe_rtp_process_ctx *ctx,
 }
 EXPORT_SYMBOL_IF_KUNIT(xe_rtp_process);
 
-bool xe_rtp_match_even_instance(const struct xe_gt *gt,
+bool xe_rtp_match_even_instance(const struct xe_device *xe,
+                               const struct xe_gt *gt,
                                const struct xe_hw_engine *hwe)
 {
        return hwe->instance % 2 == 0;
 }
 
-bool xe_rtp_match_first_render_or_compute(const struct xe_gt *gt,
+bool xe_rtp_match_first_render_or_compute(const struct xe_device *xe,
+                                         const struct xe_gt *gt,
                                          const struct xe_hw_engine *hwe)
 {
        u64 render_compute_mask = gt->info.engine_mask &
@@ -359,19 +358,22 @@ bool xe_rtp_match_first_render_or_compute(const struct xe_gt *gt,
                hwe->engine_id == __ffs(render_compute_mask);
 }
 
-bool xe_rtp_match_not_sriov_vf(const struct xe_gt *gt,
+bool xe_rtp_match_not_sriov_vf(const struct xe_device *xe,
+                              const struct xe_gt *gt,
                               const struct xe_hw_engine *hwe)
 {
-       return !IS_SRIOV_VF(gt_to_xe(gt));
+       return !IS_SRIOV_VF(xe);
 }
 
-bool xe_rtp_match_psmi_enabled(const struct xe_gt *gt,
+bool xe_rtp_match_psmi_enabled(const struct xe_device *xe,
+                              const struct xe_gt *gt,
                               const struct xe_hw_engine *hwe)
 {
-       return xe_configfs_get_psmi_enabled(to_pci_dev(gt_to_xe(gt)->drm.dev));
+       return xe_configfs_get_psmi_enabled(to_pci_dev(xe->drm.dev));
 }
 
-bool xe_rtp_match_gt_has_discontiguous_dss_groups(const struct xe_gt *gt,
+bool xe_rtp_match_gt_has_discontiguous_dss_groups(const struct xe_device *xe,
+                                                 const struct xe_gt *gt,
                                                  const struct xe_hw_engine *hwe)
 {
        return xe_gt_has_discontiguous_dss_groups(gt);
index ac12ddf6cde6d1d4dff2e4f5e071173c34c52e90..e5b8a9452e29eabbf2a46c750f968c0eb27fd6a4 100644 (file)
@@ -440,18 +440,21 @@ void xe_rtp_process(struct xe_rtp_process_ctx *ctx,
 
 /**
  * xe_rtp_match_even_instance - Match if engine instance is even
+ * @xe: Device structure
  * @gt: GT structure
  * @hwe: Engine instance
  *
  * Returns: true if engine instance is even, false otherwise
  */
-bool xe_rtp_match_even_instance(const struct xe_gt *gt,
+bool xe_rtp_match_even_instance(const struct xe_device *xe,
+                               const struct xe_gt *gt,
                                const struct xe_hw_engine *hwe);
 
 /*
  * xe_rtp_match_first_render_or_compute - Match if it's first render or compute
  * engine in the GT
  *
+ * @xe: Device structure
  * @gt: GT structure
  * @hwe: Engine instance
  *
@@ -463,24 +466,29 @@ bool xe_rtp_match_even_instance(const struct xe_gt *gt,
  * Returns: true if engine id is the first to match the render reset domain,
  * false otherwise.
  */
-bool xe_rtp_match_first_render_or_compute(const struct xe_gt *gt,
+bool xe_rtp_match_first_render_or_compute(const struct xe_device *xe,
+                                         const struct xe_gt *gt,
                                          const struct xe_hw_engine *hwe);
 
 /*
  * xe_rtp_match_not_sriov_vf - Match when not on SR-IOV VF device
  *
+ * @xe: Device structure
  * @gt: GT structure
  * @hwe: Engine instance
  *
  * Returns: true if device is not VF, false otherwise.
  */
-bool xe_rtp_match_not_sriov_vf(const struct xe_gt *gt,
+bool xe_rtp_match_not_sriov_vf(const struct xe_device *xe,
+                              const struct xe_gt *gt,
                               const struct xe_hw_engine *hwe);
 
-bool xe_rtp_match_psmi_enabled(const struct xe_gt *gt,
+bool xe_rtp_match_psmi_enabled(const struct xe_device *xe,
+                              const struct xe_gt *gt,
                               const struct xe_hw_engine *hwe);
 
-bool xe_rtp_match_gt_has_discontiguous_dss_groups(const struct xe_gt *gt,
+bool xe_rtp_match_gt_has_discontiguous_dss_groups(const struct xe_device *xe,
+                                                 const struct xe_gt *gt,
                                                  const struct xe_hw_engine *hwe);
 
 #endif
index f4cf30e298cf0e7bc2c21776b536ca2d27997d04..6ba7f226c2274ea37569af65c3d540de69a5317e 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "regs/xe_reg_defs.h"
 
+struct xe_device;
 struct xe_hw_engine;
 struct xe_gt;
 
@@ -86,7 +87,8 @@ struct xe_rtp_rule {
                        u8 engine_class;
                };
                /* MATCH_FUNC */
-               bool (*match_func)(const struct xe_gt *gt,
+               bool (*match_func)(const struct xe_device *xe,
+                                  const struct xe_gt *gt,
                                   const struct xe_hw_engine *hwe);
        };
 };