From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Gustavo Sousa <gustavo.sousa@intel.com>,
Matt Roper <matthew.d.roper@intel.com>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.18.y 2/6] drm/xe/mcr: Extract reg_in_steering_type_ranges()
Date: Fri, 31 Jul 2026 23:03:26 -0400 [thread overview]
Message-ID: <20260801030332.859236-2-sashal@kernel.org> (raw)
In-Reply-To: <20260801030332.859236-1-sashal@kernel.org>
From: Gustavo Sousa <gustavo.sousa@intel.com>
[ Upstream commit cdf8489533f4dd9639fd0c266dd2ec8f7a543e34 ]
The logic to check if a register falls within one of the ranges for a
steering type is already duplicated in
xe_gt_mcr_get_nonterminated_steering(). We will also want to use that
same logic in another upcoming function. Let's factor out that logic
and put it into a function named reg_in_steering_type_ranges().
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patch.msgid.link/20260514-rtp-mcr-check-v3-6-30dd47855fee@intel.com
Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com>
Stable-dep-of: 31e243756162 ("drm/xe/rtp: Maintain OA whitelists separately")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/xe/xe_gt_mcr.c | 43 +++++++++++++++++++---------------
1 file changed, 24 insertions(+), 19 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_gt_mcr.c b/drivers/gpu/drm/xe/xe_gt_mcr.c
index 8fb1cae91724..c7164604846f 100644
--- a/drivers/gpu/drm/xe/xe_gt_mcr.c
+++ b/drivers/gpu/drm/xe/xe_gt_mcr.c
@@ -542,6 +542,20 @@ void xe_gt_mcr_set_implicit_defaults(struct xe_gt *gt)
}
}
+static bool reg_in_steering_type_ranges(struct xe_gt *gt,
+ struct xe_reg reg,
+ int type)
+{
+ if (!gt->steering[type].ranges)
+ return false;
+
+ for (int i = 0; gt->steering[type].ranges[i].end > 0; i++)
+ if (xe_mmio_in_range(>->mmio, >->steering[type].ranges[i], reg))
+ return true;
+
+ return false;
+}
+
/*
* xe_gt_mcr_get_nonterminated_steering - find group/instance values that
* will steer a register to a non-terminated instance
@@ -563,30 +577,21 @@ bool xe_gt_mcr_get_nonterminated_steering(struct xe_gt *gt,
u8 *group, u8 *instance)
{
const struct xe_reg reg = to_xe_reg(reg_mcr);
- const struct xe_mmio_range *implicit_ranges;
for (int type = 0; type < IMPLICIT_STEERING; type++) {
- if (!gt->steering[type].ranges)
- continue;
-
- for (int i = 0; gt->steering[type].ranges[i].end > 0; i++) {
- if (xe_mmio_in_range(>->mmio, >->steering[type].ranges[i], reg)) {
- drm_WARN(>_to_xe(gt)->drm, !gt->steering[type].initialized,
- "Uninitialized usage of MCR register %s/%#x\n",
- xe_steering_types[type].name, reg.addr);
-
- *group = gt->steering[type].group_target;
- *instance = gt->steering[type].instance_target;
- return true;
- }
+ if (reg_in_steering_type_ranges(gt, reg, type)) {
+ drm_WARN(>_to_xe(gt)->drm, !gt->steering[type].initialized,
+ "Uninitialized usage of MCR register %s/%#x\n",
+ xe_steering_types[type].name, reg.addr);
+
+ *group = gt->steering[type].group_target;
+ *instance = gt->steering[type].instance_target;
+ return true;
}
}
- implicit_ranges = gt->steering[IMPLICIT_STEERING].ranges;
- if (implicit_ranges)
- for (int i = 0; implicit_ranges[i].end > 0; i++)
- if (xe_mmio_in_range(>->mmio, &implicit_ranges[i], reg))
- return false;
+ if (reg_in_steering_type_ranges(gt, reg, IMPLICIT_STEERING))
+ return false;
/*
* Not found in a steering table and not a register with implicit
--
2.53.0
next prev parent reply other threads:[~2026-08-01 3:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-29 10:58 FAILED: patch "[PATCH] drm/xe/rtp: Maintain OA whitelists separately" failed to apply to 6.18-stable tree gregkh
2026-08-01 3:03 ` [PATCH 6.18.y 1/6] drm/xe/lrc: Refactor out engine id to hwe conversion Sasha Levin
2026-08-01 3:03 ` Sasha Levin [this message]
2026-08-01 3:03 ` [PATCH 6.18.y 3/6] drm/xe/reg_sr: Do sanity check for MCR vs non-MCR Sasha Levin
2026-08-01 3:03 ` [PATCH 6.18.y 4/6] drm/xe/rtp: Drop rule matching cases from rtp_to_sr_cases and rtp_cases Sasha Levin
2026-08-01 3:03 ` [PATCH 6.18.y 5/6] drm/xe/rtp: Add struct types for RTP tables Sasha Levin
2026-08-01 3:03 ` [PATCH 6.18.y 6/6] drm/xe/rtp: Maintain OA whitelists separately Sasha Levin
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=20260801030332.859236-2-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=gustavo.sousa@intel.com \
--cc=matthew.d.roper@intel.com \
--cc=stable@vger.kernel.org \
/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