[Intel-xe] [PATCH 5/7] drm/xe/rtp: Let rule_matches() receive xe_device

Rodrigo Vivi rodrigo.vivi at kernel.org
Thu May 4 16:17:46 UTC 2023


On Thu, May 04, 2023 at 12:32:48AM -0700, Lucas De Marchi wrote:
> Since some rules use xe_gt, rule_matches() uses that for matching the
> rules, even if most of them are actually checking flags in the
> device/platform layer. In order to allow the device-centric rules to be
> checked for out-of-band WAs, let's pass the pointer to xe_device, too.

why? if we can infer that from gt...

> 
> Also group the simple rules together to make it easier to separate the
> ones checking the device info from others checking gt or hwe.
> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
> ---
>  drivers/gpu/drm/xe/xe_rtp.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_rtp.c b/drivers/gpu/drm/xe/xe_rtp.c
> index f2a0e8eb4936..88eaea597cf7 100644
> --- a/drivers/gpu/drm/xe/xe_rtp.c
> +++ b/drivers/gpu/drm/xe/xe_rtp.c
> @@ -23,11 +23,11 @@
>   * the values to the registers that have matching rules.
>   */
>  
> -static bool rule_matches(struct xe_gt *gt,
> +static bool rule_matches(const struct xe_device *xe,
> +			 struct xe_gt *gt,
>  			 struct xe_hw_engine *hwe,
>  			 const struct xe_rtp_entry *entry)
>  {
> -	const struct xe_device *xe = gt_to_xe(gt);
>  	const struct xe_rtp_rule *r;
>  	unsigned int i;
>  	bool match;
> @@ -62,6 +62,12 @@ static bool rule_matches(struct xe_gt *gt,
>  			match = xe->info.step.graphics >= r->step_start &&
>  				xe->info.step.graphics < r->step_end;
>  			break;
> +		case XE_RTP_MATCH_INTEGRATED:
> +			match = !xe->info.is_dgfx;
> +			break;
> +		case XE_RTP_MATCH_DISCRETE:
> +			match = xe->info.is_dgfx;
> +			break;
>  		case XE_RTP_MATCH_ENGINE_CLASS:
>  			match = hwe->class == r->engine_class;
>  			break;
> @@ -71,13 +77,6 @@ static bool rule_matches(struct xe_gt *gt,
>  		case XE_RTP_MATCH_FUNC:
>  			match = r->match_func(gt, hwe);
>  			break;
> -		case XE_RTP_MATCH_INTEGRATED:
> -			match = !xe->info.is_dgfx;
> -			break;
> -		case XE_RTP_MATCH_DISCRETE:
> -			match = xe->info.is_dgfx;
> -			break;
> -
>  		default:
>  			XE_WARN_ON(r->match_type);
>  		}
> @@ -108,11 +107,12 @@ static void rtp_add_sr_entry(const struct xe_rtp_action *action,
>  static void rtp_process_one(const struct xe_rtp_entry *entry, struct xe_gt *gt,
>  			    struct xe_hw_engine *hwe, struct xe_reg_sr *sr)
>  {
> +	const struct xe_device *xe = gt_to_xe(gt);
>  	const struct xe_rtp_action *action;
>  	u32 mmio_base;
>  	unsigned int i;
>  
> -	if (!rule_matches(gt, hwe, entry))
> +	if (!rule_matches(xe, gt, hwe, entry))
>  		return;
>  
>  	for (action = &entry->actions[0]; i < entry->n_actions; action++, i++) {
> -- 
> 2.40.1
> 


More information about the Intel-xe mailing list