[PATCH 3/3] drm/xe/guc: Don't overuse ct_to_xe()

Matthew Brost matthew.brost at intel.com
Wed Apr 10 16:27:49 UTC 2024


On Thu, Apr 04, 2024 at 09:36:47PM +0200, Michal Wajdeczko wrote:
> Pointer to xe_device might be already available or could be added.
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>

This is going to clash with [1] so I'd drop this for now and then
revisit once [1] is merged since [1] is an actual functiona change that
Rodrigo has been working on for a while now.

Matt

[1] https://patchwork.freedesktop.org/series/132240/

> ---
>  drivers/gpu/drm/xe/xe_guc_ct.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
> index 06952b0480f7..ae255dab6516 100644
> --- a/drivers/gpu/drm/xe/xe_guc_ct.c
> +++ b/drivers/gpu/drm/xe/xe_guc_ct.c
> @@ -1210,8 +1210,8 @@ void xe_guc_ct_fast_path(struct xe_guc_ct *ct)
>  	bool ongoing;
>  	int len;
>  
> -	ongoing = xe_device_mem_access_get_if_ongoing(ct_to_xe(ct));
> -	if (!ongoing && xe_pm_read_callback_task(ct_to_xe(ct)) == NULL)
> +	ongoing = xe_device_mem_access_get_if_ongoing(xe);
> +	if (!ongoing && xe_pm_read_callback_task(xe) == NULL)
>  		return;
>  
>  	spin_lock(&ct->fast_lock);
> @@ -1254,6 +1254,7 @@ static int dequeue_one_g2h(struct xe_guc_ct *ct)
>  static void g2h_worker_func(struct work_struct *w)
>  {
>  	struct xe_guc_ct *ct = container_of(w, struct xe_guc_ct, g2h_worker);
> +	struct xe_device *xe = ct_to_xe(ct);
>  	struct xe_gt *gt = ct_to_gt(ct);
>  	bool ongoing;
>  	int ret;
> @@ -1281,8 +1282,8 @@ static void g2h_worker_func(struct work_struct *w)
>  	 * responses, if the worker here is blocked on those callbacks
>  	 * completing, creating a deadlock.
>  	 */
> -	ongoing = xe_device_mem_access_get_if_ongoing(ct_to_xe(ct));
> -	if (!ongoing && xe_pm_read_callback_task(ct_to_xe(ct)) == NULL)
> +	ongoing = xe_device_mem_access_get_if_ongoing(xe);
> +	if (!ongoing && xe_pm_read_callback_task(xe) == NULL)
>  		return;
>  
>  	do {
> @@ -1299,7 +1300,7 @@ static void g2h_worker_func(struct work_struct *w)
>  	} while (ret == 1);
>  
>  	if (ongoing)
> -		xe_device_mem_access_put(ct_to_xe(ct));
> +		xe_device_mem_access_put(xe);
>  }
>  
>  static void guc_ctb_snapshot_capture(struct xe_device *xe, struct guc_ctb *ctb,
> -- 
> 2.43.0
> 


More information about the Intel-xe mailing list