[Intel-xe] [PATCH] drm/xe: Move policy on preemption from WAs to tunings
Lucas De Marchi
lucas.demarchi at intel.com
Sat Mar 11 17:15:51 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".
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 | 22 ++++++++++++++++++++++
drivers/gpu/drm/xe/xe_tuning.h | 1 +
drivers/gpu/drm/xe/xe_wa.c | 6 ------
4 files changed, 25 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 2861a014c85c..5d3febd0b97e 100644
--- a/drivers/gpu/drm/xe/xe_tuning.c
+++ b/drivers/gpu/drm/xe/xe_tuning.c
@@ -23,6 +23,15 @@ static const struct xe_rtp_entry gt_tunings[] = {
{}
};
+static const struct xe_rtp_entry engine_tunings[] = {
+ { XE_RTP_NAME("Policy: 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)))
+ },
+};
+
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)),
@@ -39,6 +48,19 @@ void xe_tuning_process_gt(struct xe_gt *gt)
xe_rtp_process(gt_tunings, >->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 67539f9d70b4..76c603dfc030 100644
--- a/drivers/gpu/drm/xe/xe_wa.c
+++ b/drivers/gpu/drm/xe/xe_wa.c
@@ -236,12 +236,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)))
- },
{}
};
--
2.39.0
More information about the Intel-xe
mailing list