Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Roper <matthew.d.roper@intel.com>
To: Gustavo Sousa <gustavo.sousa@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 11/12] drm/xe/mcr: Extract reg_in_steering_type_ranges()
Date: Wed, 28 Jan 2026 13:11:28 -0800	[thread overview]
Message-ID: <20260128211128.GV458797@mdroper-desk1.amr.corp.intel.com> (raw)
In-Reply-To: <20260116-rtp-mcr-check-v1-11-d420b9c1a327@intel.com>

On Fri, Jan 16, 2026 at 07:12:19PM -0300, Gustavo Sousa wrote:
> 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().
> 
> Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com>

Reviewed-by: Matt Roper <matthew.d.roper@intel.com>

> ---
>  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 7c1fe9ac120d..e7eb3c6da234 100644
> --- a/drivers/gpu/drm/xe/xe_gt_mcr.c
> +++ b/drivers/gpu/drm/xe/xe_gt_mcr.c
> @@ -609,6 +609,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(&gt->mmio, &gt->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
> @@ -630,30 +644,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(&gt->mmio, &gt->steering[type].ranges[i], reg)) {
> -				drm_WARN(&gt_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(&gt_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(&gt->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.52.0
> 

-- 
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation

  reply	other threads:[~2026-01-28 21:11 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-16 22:12 [PATCH 00/12] Fix MCR inconsistencies in RTP tables Gustavo Sousa
2026-01-16 22:12 ` [PATCH 01/12] drm/xe: Define CACHE_MODE_1 as MCR register Gustavo Sousa
2026-01-21  0:04   ` Matt Roper
2026-01-16 22:12 ` [PATCH 02/12] drm/xe: Define and use MCR version of COMMON_SLICE_CHICKEN1 Gustavo Sousa
2026-01-21  0:06   ` Matt Roper
2026-01-16 22:12 ` [PATCH 03/12] drm/xe: Define and use MCR version of COMMON_SLICE_CHICKEN4 Gustavo Sousa
2026-01-21  0:08   ` Matt Roper
2026-01-16 22:12 ` [PATCH 04/12] drm/xe/kunit: Add xe_kunit_is_live_test() Gustavo Sousa
2026-01-16 22:59   ` Michal Wajdeczko
2026-05-05 18:32     ` Gustavo Sousa
2026-01-16 22:12 ` [PATCH 05/12] drm/xe/kunit: Abort test if MMIO operation is attempted Gustavo Sousa
2026-01-16 23:15   ` Michal Wajdeczko
2026-05-05 19:11     ` Gustavo Sousa
2026-01-16 22:12 ` [PATCH 06/12] drm/xe/kunit: Allow intercepting MMIO operations Gustavo Sousa
2026-01-16 22:12 ` [PATCH 07/12] drm/xe: Extract xe_hw_engine_setup_reg_lrc() Gustavo Sousa
2026-01-21  0:12   ` Matt Roper
2026-01-16 22:12 ` [PATCH 08/12] drm/xe: Extract xe_hw_engines_setup_runtime_mask() Gustavo Sousa
2026-01-28 18:07   ` Matt Roper
2026-01-16 22:12 ` [PATCH 09/12] drm/xe/kunit: Use KUNIT_EXPECT_EQ() in xe_wa_gt() Gustavo Sousa
2026-01-16 23:29   ` Michal Wajdeczko
2026-01-28 18:09   ` Matt Roper
2026-01-16 22:12 ` [PATCH 10/12] drm/xe/kunit: Include hw_engines in xe_wa test Gustavo Sousa
2026-01-28 21:08   ` Matt Roper
2026-01-16 22:12 ` [PATCH 11/12] drm/xe/mcr: Extract reg_in_steering_type_ranges() Gustavo Sousa
2026-01-28 21:11   ` Matt Roper [this message]
2026-01-16 22:12 ` [PATCH 12/12] drm/xe/reg_sr: Do sanity check for MCR vs non-MCR Gustavo Sousa
2026-01-28 23:59   ` Matt Roper
2026-05-05 19:39     ` Gustavo Sousa
2026-05-08 21:52       ` Gustavo Sousa
2026-01-16 23:15 ` ✗ CI.checkpatch: warning for Fix MCR inconsistencies in RTP tables Patchwork
2026-01-16 23:16 ` ✓ CI.KUnit: 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=20260128211128.GV458797@mdroper-desk1.amr.corp.intel.com \
    --to=matthew.d.roper@intel.com \
    --cc=gustavo.sousa@intel.com \
    --cc=intel-xe@lists.freedesktop.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