All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 06/12] drm/xe: Rename xe_ggtt_node related functions
Date: Tue, 16 Jul 2024 17:24:04 +0000	[thread overview]
Message-ID: <ZpastMST3h00ILzL@DUT025-TGLU.fm.intel.com> (raw)
In-Reply-To: <20240711171155.173717-6-rodrigo.vivi@intel.com>

On Thu, Jul 11, 2024 at 01:11:49PM -0400, Rodrigo Vivi wrote:
> Bring some consistency and prepare for more xe_ggtt_node related
> functions to be introduced.
> 
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

Reviewed-by: Matthew Brost <matthew.brost@intel.com>

> ---
>  drivers/gpu/drm/xe/display/xe_fb_pin.c     |  8 +-
>  drivers/gpu/drm/xe/xe_ggtt.c               | 86 +++++++++++-----------
>  drivers/gpu/drm/xe/xe_ggtt.h               | 12 +--
>  drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c |  4 +-
>  4 files changed, 54 insertions(+), 56 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/display/xe_fb_pin.c b/drivers/gpu/drm/xe/display/xe_fb_pin.c
> index a93923fb8721..db74c3395ef8 100644
> --- a/drivers/gpu/drm/xe/display/xe_fb_pin.c
> +++ b/drivers/gpu/drm/xe/display/xe_fb_pin.c
> @@ -209,8 +209,7 @@ static int __xe_pin_fb_vma_ggtt(const struct intel_framebuffer *fb,
>  	} else if (view->type == I915_GTT_VIEW_NORMAL) {
>  		u32 x, size = bo->ttm.base.size;
>  
> -		ret = xe_ggtt_insert_special_node_locked(ggtt, &vma->node, size,
> -							 align, 0);
> +		ret = xe_ggtt_node_insert_locked(ggtt, &vma->node, size, align, 0);
>  		if (ret)
>  			goto out_unlock;
>  
> @@ -227,8 +226,7 @@ static int __xe_pin_fb_vma_ggtt(const struct intel_framebuffer *fb,
>  		/* display seems to use tiles instead of bytes here, so convert it back.. */
>  		u32 size = intel_rotation_info_size(rot_info) * XE_PAGE_SIZE;
>  
> -		ret = xe_ggtt_insert_special_node_locked(ggtt, &vma->node, size,
> -							 align, 0);
> +		ret = xe_ggtt_node_insert_locked(ggtt, &vma->node, size, align, 0);
>  		if (ret)
>  			goto out_unlock;
>  
> @@ -327,7 +325,7 @@ static void __xe_unpin_fb_vma(struct i915_vma *vma)
>  		xe_bo_unpin_map_no_vm(vma->dpt);
>  	else if (!drm_mm_node_allocated(&vma->bo->ggtt_node.base) ||
>  		 vma->bo->ggtt_node.base.start != vma->node.base.start)
> -		xe_ggtt_remove_node(ggtt, &vma->node, false);
> +		xe_ggtt_node_remove(ggtt, &vma->node, false);
>  
>  	ttm_bo_reserve(&vma->bo->ttm, false, false, NULL);
>  	ttm_bo_unpin(&vma->bo->ttm);
> diff --git a/drivers/gpu/drm/xe/xe_ggtt.c b/drivers/gpu/drm/xe/xe_ggtt.c
> index ea55c7eabee4..3ab29588a068 100644
> --- a/drivers/gpu/drm/xe/xe_ggtt.c
> +++ b/drivers/gpu/drm/xe/xe_ggtt.c
> @@ -403,7 +403,7 @@ void xe_ggtt_deballoon(struct xe_ggtt *ggtt, struct xe_ggtt_node *node)
>  }
>  
>  /**
> - * xe_ggtt_insert_special_node_locked - Locked version to insert a &xe_ggtt_node into the GGTT
> + * xe_ggtt_node_insert_locked - Locked version to insert a &xe_ggtt_node into the GGTT
>   * @ggtt: the &xe_ggtt where node will be inserted
>   * @node: the &xe_ggtt_node to be inserted
>   * @size: size of the node
> @@ -414,15 +414,15 @@ void xe_ggtt_deballoon(struct xe_ggtt *ggtt, struct xe_ggtt_node *node)
>   *
>   * Return: 0 on success or a negative error code on failure.
>   */
> -int xe_ggtt_insert_special_node_locked(struct xe_ggtt *ggtt, struct xe_ggtt_node *node,
> -				       u32 size, u32 align, u32 mm_flags)
> +int xe_ggtt_node_insert_locked(struct xe_ggtt *ggtt, struct xe_ggtt_node *node,
> +			       u32 size, u32 align, u32 mm_flags)
>  {
>  	return drm_mm_insert_node_generic(&ggtt->mm, &node->base, size, align, 0,
>  					  mm_flags);
>  }
>  
>  /**
> - * xe_ggtt_insert_special_node - Insert a &xe_ggtt_node into the GGTT
> + * xe_ggtt_node_insert - Insert a &xe_ggtt_node into the GGTT
>   * @ggtt: the &xe_ggtt where node will be inserted
>   * @node: the &xe_ggtt_node to be inserted
>   * @size: size of the node
> @@ -430,19 +430,53 @@ int xe_ggtt_insert_special_node_locked(struct xe_ggtt *ggtt, struct xe_ggtt_node
>   *
>   * Return: 0 on success or a negative error code on failure.
>   */
> -int xe_ggtt_insert_special_node(struct xe_ggtt *ggtt, struct xe_ggtt_node *node,
> -				u32 size, u32 align)
> +int xe_ggtt_node_insert(struct xe_ggtt *ggtt, struct xe_ggtt_node *node,
> +			u32 size, u32 align)
>  {
>  	int ret;
>  
>  	mutex_lock(&ggtt->lock);
> -	ret = xe_ggtt_insert_special_node_locked(ggtt, node, size,
> -						 align, DRM_MM_INSERT_HIGH);
> +	ret = xe_ggtt_node_insert_locked(ggtt, node, size,
> +					 align, DRM_MM_INSERT_HIGH);
>  	mutex_unlock(&ggtt->lock);
>  
>  	return ret;
>  }
>  
> +/**
> + * xe_ggtt_node_remove - Remove a &xe_ggtt_node from the GGTT
> + * @ggtt: the &xe_ggtt where node will be removed
> + * @node: the &xe_ggtt_node to be removed
> + * @invalidate: if node needs invalidation upon removal
> + */
> +void xe_ggtt_node_remove(struct xe_ggtt *ggtt, struct xe_ggtt_node *node,
> +			 bool invalidate)
> +{
> +	struct xe_device *xe = tile_to_xe(ggtt->tile);
> +	bool bound;
> +	int idx;
> +
> +	bound = drm_dev_enter(&xe->drm, &idx);
> +	if (bound)
> +		xe_pm_runtime_get_noresume(xe);
> +
> +	mutex_lock(&ggtt->lock);
> +	if (bound)
> +		xe_ggtt_clear(ggtt, node->base.start, node->base.size);
> +	drm_mm_remove_node(&node->base);
> +	node->base.size = 0;
> +	mutex_unlock(&ggtt->lock);
> +
> +	if (!bound)
> +		return;
> +
> +	if (invalidate)
> +		xe_ggtt_invalidate(ggtt);
> +
> +	xe_pm_runtime_put(xe);
> +	drm_dev_exit(idx);
> +}
> +
>  /**
>   * xe_ggtt_map_bo - Map the BO into GGTT
>   * @ggtt: the &xe_ggtt where node will be mapped
> @@ -522,40 +556,6 @@ int xe_ggtt_insert_bo(struct xe_ggtt *ggtt, struct xe_bo *bo)
>  	return __xe_ggtt_insert_bo_at(ggtt, bo, 0, U64_MAX);
>  }
>  
> -/**
> - * xe_ggtt_remove_node - Remove a &xe_ggtt_node from the GGTT
> - * @ggtt: the &xe_ggtt where node will be removed
> - * @node: the &xe_ggtt_node to be removed
> - * @invalidate: if node needs invalidation upon removal
> - */
> -void xe_ggtt_remove_node(struct xe_ggtt *ggtt, struct xe_ggtt_node *node,
> -			 bool invalidate)
> -{
> -	struct xe_device *xe = tile_to_xe(ggtt->tile);
> -	bool bound;
> -	int idx;
> -
> -	bound = drm_dev_enter(&xe->drm, &idx);
> -	if (bound)
> -		xe_pm_runtime_get_noresume(xe);
> -
> -	mutex_lock(&ggtt->lock);
> -	if (bound)
> -		xe_ggtt_clear(ggtt, node->base.start, node->base.size);
> -	drm_mm_remove_node(&node->base);
> -	node->base.size = 0;
> -	mutex_unlock(&ggtt->lock);
> -
> -	if (!bound)
> -		return;
> -
> -	if (invalidate)
> -		xe_ggtt_invalidate(ggtt);
> -
> -	xe_pm_runtime_put(xe);
> -	drm_dev_exit(idx);
> -}
> -
>  /**
>   * xe_ggtt_remove_bo - Remove a BO from the GGTT
>   * @ggtt: the &xe_ggtt where node will be removed
> @@ -569,7 +569,7 @@ void xe_ggtt_remove_bo(struct xe_ggtt *ggtt, struct xe_bo *bo)
>  	/* This BO is not currently in the GGTT */
>  	xe_tile_assert(ggtt->tile, bo->ggtt_node.base.size == bo->size);
>  
> -	xe_ggtt_remove_node(ggtt, &bo->ggtt_node,
> +	xe_ggtt_node_remove(ggtt, &bo->ggtt_node,
>  			    bo->flags & XE_BO_FLAG_GGTT_INVALIDATE);
>  }
>  
> diff --git a/drivers/gpu/drm/xe/xe_ggtt.h b/drivers/gpu/drm/xe/xe_ggtt.h
> index 30a521f7b075..5147930357de 100644
> --- a/drivers/gpu/drm/xe/xe_ggtt.h
> +++ b/drivers/gpu/drm/xe/xe_ggtt.h
> @@ -16,12 +16,12 @@ int xe_ggtt_init(struct xe_ggtt *ggtt);
>  int xe_ggtt_balloon(struct xe_ggtt *ggtt, u64 start, u64 size, struct xe_ggtt_node *node);
>  void xe_ggtt_deballoon(struct xe_ggtt *ggtt, struct xe_ggtt_node *node);
>  
> -int xe_ggtt_insert_special_node(struct xe_ggtt *ggtt, struct xe_ggtt_node *node,
> -				u32 size, u32 align);
> -int xe_ggtt_insert_special_node_locked(struct xe_ggtt *ggtt,
> -				       struct xe_ggtt_node *node,
> -				       u32 size, u32 align, u32 mm_flags);
> -void xe_ggtt_remove_node(struct xe_ggtt *ggtt, struct xe_ggtt_node *node,
> +int xe_ggtt_node_insert(struct xe_ggtt *ggtt, struct xe_ggtt_node *node,
> +			u32 size, u32 align);
> +int xe_ggtt_node_insert_locked(struct xe_ggtt *ggtt,
> +			       struct xe_ggtt_node *node,
> +			       u32 size, u32 align, u32 mm_flags);
> +void xe_ggtt_node_remove(struct xe_ggtt *ggtt, struct xe_ggtt_node *node,
>  			 bool invalidate);
>  void xe_ggtt_map_bo(struct xe_ggtt *ggtt, struct xe_bo *bo);
>  int xe_ggtt_insert_bo(struct xe_ggtt *ggtt, struct xe_bo *bo);
> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> index 3600468da013..dfa71bcd0f56 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> @@ -382,7 +382,7 @@ static void pf_release_ggtt(struct xe_tile *tile, struct xe_ggtt_node *node)
>  		 * is redundant, as PTE will be implicitly re-assigned to PF by
>  		 * the xe_ggtt_clear() called by below xe_ggtt_remove_node().
>  		 */
> -		xe_ggtt_remove_node(ggtt, node, false);
> +		xe_ggtt_node_remove(ggtt, node, false);
>  	}
>  }
>  
> @@ -418,7 +418,7 @@ static int pf_provision_vf_ggtt(struct xe_gt *gt, unsigned int vfid, u64 size)
>  	if (!size)
>  		return 0;
>  
> -	err = xe_ggtt_insert_special_node(ggtt, node, size, alignment);
> +	err = xe_ggtt_node_insert(ggtt, node, size, alignment);
>  	if (unlikely(err))
>  		return err;
>  
> -- 
> 2.45.2
> 

  reply	other threads:[~2024-07-16 17:24 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-11 17:11 [PATCH 01/12] drm/xe: Removed unused xe_ggtt_printk Rodrigo Vivi
2024-07-11 17:11 ` [PATCH 02/12] drm/xe: Introduce GGTT documentation Rodrigo Vivi
2024-07-11 19:41   ` Michal Wajdeczko
2024-07-11 17:11 ` [PATCH 03/12] drm/xe: Remove unnecessary drm_mm.h includes Rodrigo Vivi
2024-07-11 18:35   ` Cavitt, Jonathan
2024-07-11 17:11 ` [PATCH 04/12] drm/{i915, xe}: Avoid direct inspection of dpt_vma from outside dpt Rodrigo Vivi
2024-07-11 18:38   ` Cavitt, Jonathan
2024-07-11 17:11 ` [PATCH 05/12] drm/xe: Encapsulate drm_mm_node inside xe_ggtt_node Rodrigo Vivi
2024-07-11 19:51   ` Michal Wajdeczko
2024-07-16 17:16   ` Matthew Brost
2024-07-11 17:11 ` [PATCH 06/12] drm/xe: Rename xe_ggtt_node related functions Rodrigo Vivi
2024-07-16 17:24   ` Matthew Brost [this message]
2024-07-11 17:11 ` [PATCH 07/12] drm/xe: Limit drm_mm_node_allocated access to xe_ggtt_node Rodrigo Vivi
2024-07-17 23:27   ` Matthew Brost
2024-07-11 17:11 ` [PATCH 08/12] drm/xe: Introduce xe_ggtt_largest_hole Rodrigo Vivi
2024-07-11 20:00   ` Michal Wajdeczko
2024-08-09 21:33     ` Rodrigo Vivi
2024-07-11 17:11 ` [PATCH 09/12] drm/xe: Introduce xe_ggtt_print_holes Rodrigo Vivi
2024-07-11 18:43   ` Cavitt, Jonathan
2024-07-11 20:09   ` Michal Wajdeczko
2024-08-09 21:38     ` Rodrigo Vivi
2024-07-11 17:11 ` [PATCH 10/12] drm/xe: Rename xe_ggtt balloon functions to make the node clear Rodrigo Vivi
2024-07-11 20:17   ` Michal Wajdeczko
2024-08-09 21:42     ` Rodrigo Vivi
2024-07-11 17:11 ` [PATCH 11/12] drm/xe: Make xe_ggtt_node struct independent Rodrigo Vivi
2024-07-17 23:50   ` Matthew Brost
2024-07-11 17:11 ` [PATCH 12/12] drm/xe: Fix missing runtime outer protection for ggtt_remove_node Rodrigo Vivi
2024-07-16 17:32   ` Matthew Brost
2024-07-11 17:25 ` ✓ CI.Patch_applied: success for series starting with [01/12] drm/xe: Removed unused xe_ggtt_printk Patchwork
2024-07-11 17:26 ` ✓ CI.checkpatch: " Patchwork
2024-07-11 17:28 ` ✓ CI.KUnit: " Patchwork
2024-07-11 17:34 ` ✗ CI.Build: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2024-08-15 22:07 [PATCH 01/12] " Rodrigo Vivi
2024-08-15 22:07 ` [PATCH 06/12] drm/xe: Rename xe_ggtt_node related functions Rodrigo Vivi
2024-08-16 15:02 [PATCH 01/12] drm/xe: Removed unused xe_ggtt_printk Rodrigo Vivi
2024-08-16 15:02 ` [PATCH 06/12] drm/xe: Rename xe_ggtt_node related functions Rodrigo Vivi
2024-08-16 15:24   ` Lucas De Marchi
2024-08-17 10:35 [PATCH 01/12] drm/xe: Removed unused xe_ggtt_printk Rodrigo Vivi
2024-08-17 10:35 ` [PATCH 06/12] drm/xe: Rename xe_ggtt_node related functions Rodrigo Vivi
2024-08-20 20:25 [PATCH 01/12] drm/xe: Removed unused xe_ggtt_printk Rodrigo Vivi
2024-08-20 20:25 ` [PATCH 06/12] drm/xe: Rename xe_ggtt_node related functions Rodrigo Vivi
2024-08-21 19:38 [PATCH 01/12] drm/xe: Removed unused xe_ggtt_printk Rodrigo Vivi
2024-08-21 19:38 ` [PATCH 06/12] drm/xe: Rename xe_ggtt_node related functions Rodrigo Vivi

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=ZpastMST3h00ILzL@DUT025-TGLU.fm.intel.com \
    --to=matthew.brost@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=rodrigo.vivi@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.