[Intel-xe] [PATCH v3 14/14] drm/xe: Move policy on preemption from WAs to tunings

Lucas De Marchi lucas.demarchi at intel.com
Tue Mar 14 00:30:12 UTC 2023


The fake WA FtrPerCtxtPreemptionGranularityControl is documented in i915
and is not a true WA: it's a policy chosen to allow preemption settings
to be controlled on a per-context basis by userspace. Move it to
xe_tuning.c since it's more in line with what his is doing. However
since it's not something suggested by the spec, prefix it with "Policy"
rather than "Tuning".

Also, there's no reason to apply this policy only between graphics
version 1200 and 1250. Apply it to all versions, like i915.

v2: Apply for all graphics versions, not only [1200, 1250]

Suggested-by: Matt Roper <matthew.d.roper at intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
---
 drivers/gpu/drm/xe/xe_hw_engine.c |  2 ++
 drivers/gpu/drm/xe/xe_tuning.c    | 23 +++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_tuning.h    |  1 +
 drivers/gpu/drm/xe/xe_wa.c        |  6 ------
 4 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_hw_engine.c b/drivers/gpu/drm/xe/xe_hw_engine.c
index 63a4efd5edcc..53dc342cc3a3 100644
--- a/drivers/gpu/drm/xe/xe_hw_engine.c
+++ b/drivers/gpu/drm/xe/xe_hw_engine.c
@@ -22,6 +22,7 @@
 #include "xe_mmio.h"
 #include "xe_reg_sr.h"
 #include "xe_sched_job.h"
+#include "xe_tuning.h"
 #include "xe_wa.h"
 
 #define MAX_MMIO_BASES 3
@@ -293,6 +294,7 @@ static void hw_engine_init_early(struct xe_gt *gt, struct xe_hw_engine *hwe,
 
 	xe_reg_sr_init(&hwe->reg_sr, hwe->name, gt_to_xe(gt));
 	xe_wa_process_engine(hwe);
+	xe_tuning_process_engine(hwe);
 
 	xe_reg_sr_init(&hwe->reg_whitelist, hwe->name, gt_to_xe(gt));
 	xe_reg_whitelist_process_engine(hwe);
diff --git a/drivers/gpu/drm/xe/xe_tuning.c b/drivers/gpu/drm/xe/xe_tuning.c
index 7ff5eb762da5..c8045872c0a1 100644
--- a/drivers/gpu/drm/xe/xe_tuning.c
+++ b/drivers/gpu/drm/xe/xe_tuning.c
@@ -27,6 +27,16 @@ static const struct xe_rtp_entry gt_tunings[] = {
 	{}
 };
 
+static const struct xe_rtp_entry engine_tunings[] = {
+	{ XE_RTP_NAME("Policy: FtrPerCtxtPreemptionGranularityControl"),
+	  XE_RTP_RULES(ENGINE_CLASS(RENDER)),
+	  XE_RTP_ACTIONS(SET(GEN7_FF_SLICE_CS_CHICKEN1,
+			     GEN9_FFSC_PERCTX_PREEMPT_CTRL,
+			     XE_RTP_ACTION_FLAG(MASKED_REG)))
+	},
+	{}
+};
+
 static const struct xe_rtp_entry lrc_tunings[] = {
 	{ XE_RTP_NAME("Tuning: ganged timer, also known as 16011163337"),
 	  XE_RTP_RULES(GRAPHICS_VERSION_RANGE(1200, 1210)),
@@ -63,6 +73,19 @@ void xe_tuning_process_gt(struct xe_gt *gt)
 	xe_rtp_process(gt_tunings, &gt->reg_sr, gt, NULL);
 }
 
+/**
+ * xe_tuning_process_engine - process engine tuning table
+ * @hwe: engine instance to process tunings for
+ *
+ * Process engine table for this platform, saving in @hwe all the
+ * tunings that need to be applied at the engine level that match this
+ * engine.
+ */
+void xe_tuning_process_engine(struct xe_hw_engine *hwe)
+{
+	xe_rtp_process(engine_tunings, &hwe->reg_sr, hwe->gt, hwe);
+}
+
 /**
  * xe_tuning_process_lrc - process lrc tunings
  * @hwe: engine instance to process tunings for
diff --git a/drivers/gpu/drm/xe/xe_tuning.h b/drivers/gpu/drm/xe/xe_tuning.h
index 2b95b0c8effc..4f9c3ac3b516 100644
--- a/drivers/gpu/drm/xe/xe_tuning.h
+++ b/drivers/gpu/drm/xe/xe_tuning.h
@@ -10,6 +10,7 @@ struct xe_gt;
 struct xe_hw_engine;
 
 void xe_tuning_process_gt(struct xe_gt *gt);
+void xe_tuning_process_engine(struct xe_hw_engine *hwe);
 void xe_tuning_process_lrc(struct xe_hw_engine *hwe);
 
 #endif
diff --git a/drivers/gpu/drm/xe/xe_wa.c b/drivers/gpu/drm/xe/xe_wa.c
index 59d2daab5929..a607f476a6ed 100644
--- a/drivers/gpu/drm/xe/xe_wa.c
+++ b/drivers/gpu/drm/xe/xe_wa.c
@@ -272,12 +272,6 @@ static const struct xe_rtp_entry engine_was[] = {
 	  XE_RTP_ACTIONS(SET(GEN10_SAMPLER_MODE, ENABLE_SMALLPL,
 			     XE_RTP_ACTION_FLAG(MASKED_REG)))
 	},
-	{ XE_RTP_NAME("FtrPerCtxtPreemptionGranularityControl"),
-	  XE_RTP_RULES(GRAPHICS_VERSION_RANGE(1200, 1250), ENGINE_CLASS(RENDER)),
-	  XE_RTP_ACTIONS(SET(GEN7_FF_SLICE_CS_CHICKEN1,
-			     GEN9_FFSC_PERCTX_PREEMPT_CTRL,
-			     XE_RTP_ACTION_FLAG(MASKED_REG)))
-	},
 
 	/* TGL */
 
-- 
2.39.0



More information about the Intel-xe mailing list