[PATCH v2 1/2] drm/xe/rtp: Prepare RTP for VF actions

Michal Wajdeczko michal.wajdeczko at intel.com
Tue Jun 18 22:00:25 UTC 2024


We don't want any current RTP actions to be processed by the VF
drivers, but instead of blocking them completely, add new flags
that would allow VF-ready or VF-only actions to be added later.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
Cc: Lucas De Marchi <lucas.demarchi at intel.com>
Cc: Matt Roper <matthew.d.roper at intel.com>
---
v2: use entry->flags instead of rules (Lucas)
---
 drivers/gpu/drm/xe/xe_rtp.c       | 18 ++++++++++++++++++
 drivers/gpu/drm/xe/xe_rtp_types.h |  2 ++
 2 files changed, 20 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_rtp.c b/drivers/gpu/drm/xe/xe_rtp.c
index ac31cba1dbea..a9525e056019 100644
--- a/drivers/gpu/drm/xe/xe_rtp.c
+++ b/drivers/gpu/drm/xe/xe_rtp.c
@@ -13,6 +13,7 @@
 #include "xe_gt_topology.h"
 #include "xe_macros.h"
 #include "xe_reg_sr.h"
+#include "xe_sriov.h"
 
 /**
  * DOC: Register Table Processing
@@ -233,6 +234,17 @@ static void rtp_mark_active(struct xe_device *xe,
 		bitmap_set(ctx->active_entries, first, last - first + 2);
 }
 
+static bool rtp_check_entry_flags(u8 flags, bool is_vf)
+{
+	if (flags & XE_RTP_ENTRY_FLAG_VF_READY)
+		return true;
+
+	if (flags & XE_RTP_ENTRY_FLAG_VF_ONLY)
+		return is_vf;
+
+	return !is_vf;
+}
+
 /**
  * xe_rtp_process_to_sr - Process all rtp @entries, adding the matching ones to
  *                        the save-restore argument.
@@ -254,12 +266,18 @@ void xe_rtp_process_to_sr(struct xe_rtp_process_ctx *ctx,
 	struct xe_hw_engine *hwe = NULL;
 	struct xe_gt *gt = NULL;
 	struct xe_device *xe = NULL;
+	bool is_vf;
 
 	rtp_get_context(ctx, &hwe, &gt, &xe);
 
+	is_vf = IS_SRIOV_VF(xe);
+
 	for (entry = entries; entry && entry->name; entry++) {
 		bool match = false;
 
+		if (!rtp_check_entry_flags(entry->flags, is_vf))
+			continue;
+
 		if (entry->flags & XE_RTP_ENTRY_FLAG_FOREACH_ENGINE) {
 			struct xe_hw_engine *each_hwe;
 			enum xe_hw_engine_id id;
diff --git a/drivers/gpu/drm/xe/xe_rtp_types.h b/drivers/gpu/drm/xe/xe_rtp_types.h
index 1b76b947c706..f802ac26e01c 100644
--- a/drivers/gpu/drm/xe/xe_rtp_types.h
+++ b/drivers/gpu/drm/xe/xe_rtp_types.h
@@ -99,6 +99,8 @@ struct xe_rtp_entry_sr {
 	u8 n_rules;
 	u8 n_actions;
 #define XE_RTP_ENTRY_FLAG_FOREACH_ENGINE	BIT(0)
+#define XE_RTP_ENTRY_FLAG_VF_READY		BIT(1)
+#define XE_RTP_ENTRY_FLAG_VF_ONLY		BIT(2)
 	u8 flags;
 };
 
-- 
2.43.0



More information about the Intel-xe mailing list