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

Matt Roper matthew.d.roper at intel.com
Tue Jun 18 23:04:05 UTC 2024


On Wed, Jun 19, 2024 at 12:00:25AM +0200, Michal Wajdeczko wrote:
> 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.

I suspect that if we ever wind up having VF-and-PF or VF-only RTP
programming, we're actually going to need some additional changes to RTP
beyond this series.  As far as I know, the only registers that the VF
exposes for CPU access reside in the sgunit (e.g., bspec 53221), and RTP
doesn't currently have the ability to process programming for registers
outside the GT.  I.e., XE_RTP_PROCESS_CTX_INITIALIZER() currently only
accepts either an xe_gt or an xe_hw_engine as the scope of RTP -> SR
processing and both the GT and engine registers are outside the domain
of the VF KMD.

While we could certainly update RTP to work at the tile level (which
would also allow us to convert xe_wa_apply_tile_workarounds() to RTP),
I'm wondering if we'd ever use it given how few registers the VF KMD
actually has access to and how unlikely those specific registers are to
be the target of a workaround.

Personally I think it might be worth just sitting on this until we have
a specific workaround or tuning that requires RTP inside the VF.  Then
we'll have a better idea of what kind of other changes we need to
support such workarounds/tuning and we can upstream and review
everything together.


Matt

> 
> 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
> 

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


More information about the Intel-xe mailing list