Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>,
	Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH 1/2] drm/xe/rtp: Prepare RTP for VF rules
Date: Fri, 14 Jun 2024 23:48:20 +0200	[thread overview]
Message-ID: <20240614214821.2252-2-michal.wajdeczko@intel.com> (raw)
In-Reply-To: <20240614214821.2252-1-michal.wajdeczko@intel.com>

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

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/xe/xe_rtp.c       | 13 ++++++++++++-
 drivers/gpu/drm/xe/xe_rtp.h       | 16 ++++++++++++++++
 drivers/gpu/drm/xe/xe_rtp_types.h |  2 ++
 3 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_rtp.c b/drivers/gpu/drm/xe/xe_rtp.c
index eff1c9c2f5cc..0bea1f374f6a 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
@@ -36,6 +37,8 @@ static bool rule_matches(const struct xe_device *xe,
 {
 	const struct xe_rtp_rule *r;
 	unsigned int i;
+	bool is_vf = IS_SRIOV_VF(gt_to_xe(gt));
+	bool match_vf = false;
 	bool match;
 
 	for (r = rules, i = 0; i < n_rules; r = &rules[++i]) {
@@ -96,6 +99,14 @@ static bool rule_matches(const struct xe_device *xe,
 		case XE_RTP_MATCH_FUNC:
 			match = r->match_func(gt, hwe);
 			break;
+		case XE_RTP_MATCH_VF_READY:
+			match_vf = true;
+			match = true;
+			break;
+		case XE_RTP_MATCH_VF_ONLY:
+			match_vf = true;
+			match = is_vf;
+			break;
 		default:
 			drm_warn(&xe->drm, "Invalid RTP match %u\n",
 				 r->match_type);
@@ -106,7 +117,7 @@ static bool rule_matches(const struct xe_device *xe,
 			return false;
 	}
 
-	return true;
+	return is_vf ? match_vf : true;
 }
 
 static void rtp_add_sr_entry(const struct xe_rtp_action *action,
diff --git a/drivers/gpu/drm/xe/xe_rtp.h b/drivers/gpu/drm/xe/xe_rtp.h
index 337b1ef1959c..5a4194d0d208 100644
--- a/drivers/gpu/drm/xe/xe_rtp.h
+++ b/drivers/gpu/drm/xe/xe_rtp.h
@@ -179,6 +179,22 @@ struct xe_reg_sr;
 #define XE_RTP_RULE_IS_DISCRETE							\
 	{ .match_type = XE_RTP_MATCH_DISCRETE }
 
+/**
+ * XE_RTP_RULE_VF_READY - Create a rule matching also virtual function device
+ *
+ * Refer to XE_RTP_RULES() for expected usage.
+ */
+#define XE_RTP_RULE_VF_READY							\
+	{ .match_type = XE_RTP_MATCH_VF_READY }
+
+/**
+ * XE_RTP_RULE_VF_ONLY - Create a rule matching only virtual function device
+ *
+ * Refer to XE_RTP_RULES() for expected usage.
+ */
+#define XE_RTP_RULE_VF_ONLY							\
+	{ .match_type = XE_RTP_MATCH_VF_ONLY }
+
 /**
  * XE_RTP_ACTION_WR - Helper to write a value to the register, overriding all
  *                    the bits
diff --git a/drivers/gpu/drm/xe/xe_rtp_types.h b/drivers/gpu/drm/xe/xe_rtp_types.h
index 637acc7626a4..f322c8f273ea 100644
--- a/drivers/gpu/drm/xe/xe_rtp_types.h
+++ b/drivers/gpu/drm/xe/xe_rtp_types.h
@@ -51,6 +51,8 @@ enum {
 	XE_RTP_MATCH_ENGINE_CLASS,
 	XE_RTP_MATCH_NOT_ENGINE_CLASS,
 	XE_RTP_MATCH_FUNC,
+	XE_RTP_MATCH_VF_READY,
+	XE_RTP_MATCH_VF_ONLY,
 };
 
 /** struct xe_rtp_rule - match rule for processing entry */
-- 
2.43.0


  reply	other threads:[~2024-06-14 21:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-14 21:48 [PATCH 0/2] Prepare RTP for VF rules Michal Wajdeczko
2024-06-14 21:48 ` Michal Wajdeczko [this message]
2024-06-14 21:48 ` [PATCH 2/2] drm/xe/kunit: Update RTP test to check " Michal Wajdeczko
2024-06-17 14:48   ` Lucas De Marchi
2024-06-17 15:12     ` Michal Wajdeczko
2024-06-14 23:25 ` ✓ CI.Patch_applied: success for Prepare RTP for " Patchwork
2024-06-14 23:25 ` ✓ CI.checkpatch: " Patchwork
2024-06-14 23:26 ` ✓ CI.KUnit: " Patchwork
2024-06-14 23:38 ` ✓ CI.Build: " Patchwork
2024-06-14 23:40 ` ✗ CI.Hooks: failure " Patchwork
2024-06-14 23:42 ` ✓ CI.checksparse: success " Patchwork
2024-06-15  0:08 ` ✗ CI.BAT: failure " Patchwork
2024-06-15 17:55 ` ✓ CI.FULL: success " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240614214821.2252-2-michal.wajdeczko@intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox