Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nirmoy Das <nirmoy.das@linux.intel.com>
To: Matthew Brost <matthew.brost@intel.com>, intel-xe@lists.freedesktop.org
Cc: nirmoy.das@intel.com, farah.kassabri@intel.com,
	michal.wajdeczko@intel.com
Subject: Re: [PATCH v2 01/11] drm/xe: Add xe_gt_tlb_invalidation_fence_init helper
Date: Tue, 9 Jul 2024 17:56:20 +0200	[thread overview]
Message-ID: <e381835e-a69d-48d4-81f9-185b2ee5124a@linux.intel.com> (raw)
In-Reply-To: <20240708040331.766264-2-matthew.brost@intel.com>


On 7/8/2024 6:03 AM, Matthew Brost wrote:
> Other layers should not be touching struct xe_gt_tlb_invalidation_fence
> directly, add helper for initialization.
>
> v2:
>   - Add dma_fence_get and list init to xe_gt_tlb_invalidation_fence_init
>
> Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
> ---
>   drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c | 36 +++++++++++++++++++++
>   drivers/gpu/drm/xe/xe_gt_tlb_invalidation.h |  3 ++
>   drivers/gpu/drm/xe/xe_pt.c                  | 26 +--------------
>   3 files changed, 40 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c b/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c
> index d9359976ab8b..92a18a0e4acd 100644
> --- a/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c
> +++ b/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c
> @@ -508,3 +508,39 @@ int xe_guc_tlb_invalidation_done_handler(struct xe_guc *guc, u32 *msg, u32 len)
>   
>   	return 0;
>   }
> +
> +static const char *
> +invalidation_fence_get_driver_name(struct dma_fence *dma_fence)
> +{
> +	return "xe";
> +}
> +
> +static const char *
> +invalidation_fence_get_timeline_name(struct dma_fence *dma_fence)
> +{
> +	return "invalidation_fence";
> +}
> +
> +static const struct dma_fence_ops invalidation_fence_ops = {
> +	.get_driver_name = invalidation_fence_get_driver_name,
> +	.get_timeline_name = invalidation_fence_get_timeline_name,
> +};
> +
> +/**
> + * xe_gt_tlb_invalidation_fence_init - Initialize TLB invalidation fence
> + * @gt: GT
> + * @fence: TLB invalidation fence to initialize
> + *
> + * Initialize TLB invalidation fence for use
> + */
> +void xe_gt_tlb_invalidation_fence_init(struct xe_gt *gt,
> +				       struct xe_gt_tlb_invalidation_fence *fence)
> +{
> +	spin_lock_irq(&gt->tlb_invalidation.lock);
> +	dma_fence_init(&fence->base, &invalidation_fence_ops,
> +		       &gt->tlb_invalidation.lock,
> +		       dma_fence_context_alloc(1), 1);
> +	spin_unlock_irq(&gt->tlb_invalidation.lock);
> +	INIT_LIST_HEAD(&fence->link);
> +	dma_fence_get(&fence->base);
> +}
> diff --git a/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.h b/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.h
> index bf3bebd9f985..948f4a2f5214 100644
> --- a/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.h
> +++ b/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.h
> @@ -26,4 +26,7 @@ int xe_gt_tlb_invalidation_range(struct xe_gt *gt,
>   int xe_gt_tlb_invalidation_wait(struct xe_gt *gt, int seqno);
>   int xe_guc_tlb_invalidation_done_handler(struct xe_guc *guc, u32 *msg, u32 len);
>   
> +void xe_gt_tlb_invalidation_fence_init(struct xe_gt *gt,
> +				       struct xe_gt_tlb_invalidation_fence *fence);
> +
>   #endif	/* _XE_GT_TLB_INVALIDATION_ */
> diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c
> index f391de908033..1caa99b22c73 100644
> --- a/drivers/gpu/drm/xe/xe_pt.c
> +++ b/drivers/gpu/drm/xe/xe_pt.c
> @@ -1317,23 +1317,6 @@ struct invalidation_fence {
>   	u32 asid;
>   };
>   
> -static const char *
> -invalidation_fence_get_driver_name(struct dma_fence *dma_fence)
> -{
> -	return "xe";
> -}
> -
> -static const char *
> -invalidation_fence_get_timeline_name(struct dma_fence *dma_fence)
> -{
> -	return "invalidation_fence";
> -}
> -
> -static const struct dma_fence_ops invalidation_fence_ops = {
> -	.get_driver_name = invalidation_fence_get_driver_name,
> -	.get_timeline_name = invalidation_fence_get_timeline_name,
> -};
> -
>   static void invalidation_fence_cb(struct dma_fence *fence,
>   				  struct dma_fence_cb *cb)
>   {
> @@ -1372,15 +1355,8 @@ static void invalidation_fence_init(struct xe_gt *gt,
>   
>   	trace_xe_gt_tlb_invalidation_fence_create(gt_to_xe(gt), &ifence->base);
>   
> -	spin_lock_irq(&gt->tlb_invalidation.lock);
> -	dma_fence_init(&ifence->base.base, &invalidation_fence_ops,
> -		       &gt->tlb_invalidation.lock,
> -		       dma_fence_context_alloc(1), 1);
> -	spin_unlock_irq(&gt->tlb_invalidation.lock);
> -
> -	INIT_LIST_HEAD(&ifence->base.link);
> +	xe_gt_tlb_invalidation_fence_init(gt, &ifence->base);
>   
> -	dma_fence_get(&ifence->base.base);	/* Ref for caller */
>   	ifence->fence = fence;
>   	ifence->gt = gt;
>   	ifence->start = start;

  reply	other threads:[~2024-07-09 15:56 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-08  4:03 [PATCH v2 00/11] Proper GT TLB invalidation layering and new coalescing feature Matthew Brost
2024-07-08  4:03 ` [PATCH v2 01/11] drm/xe: Add xe_gt_tlb_invalidation_fence_init helper Matthew Brost
2024-07-09 15:56   ` Nirmoy Das [this message]
2024-07-08  4:03 ` [PATCH v2 02/11] drm/xe: Drop xe_gt_tlb_invalidation_wait Matthew Brost
2024-07-09 15:57   ` Nirmoy Das
2024-07-08  4:03 ` [PATCH v2 03/11] drm/xe: s/tlb_invalidation.lock/tlb_invalidation.fence_lock Matthew Brost
2024-07-09 15:57   ` Nirmoy Das
2024-07-08  4:03 ` [PATCH v2 04/11] drm/xe: Add tlb_invalidation.seqno_lock Matthew Brost
2024-07-08  4:03 ` [PATCH v2 05/11] drm/xe: Add xe_gt_tlb_invalidation_done_handler Matthew Brost
2025-07-23 17:22   ` Summers, Stuart
2024-07-08  4:03 ` [PATCH v2 06/11] drm/xe: Add send tlb invalidation helpers Matthew Brost
2024-07-08  4:03 ` [PATCH v2 07/11] drm/xe: Add xe_guc_tlb_invalidation layer Matthew Brost
2024-07-09 21:31   ` Michal Wajdeczko
2024-07-10  4:02     ` Matthew Brost
2024-07-08  4:03 ` [PATCH v2 08/11] drm/xe: Add multi-client support for GT TLB invalidations Matthew Brost
2024-07-08  4:03 ` [PATCH v2 09/11] drm/xe: Add GT TLB invalidation coalescing Matthew Brost
2024-07-08  4:03 ` [PATCH v2 10/11] drm/xe: Add GT TLB invalidation coalesce tracepoints Matthew Brost
2024-07-08  4:03 ` [PATCH v2 11/11] drm/xe: Add GT TLB invalidation watermark debugfs Matthew Brost
2024-07-08  4:08 ` ✓ CI.Patch_applied: success for Proper GT TLB invalidation layering and new coalescing feature. (rev2) Patchwork
2024-07-08  4:09 ` ✗ CI.checkpatch: warning " Patchwork
2024-07-08  4:10 ` ✓ CI.KUnit: success " Patchwork
2024-07-08  4:22 ` ✓ CI.Build: " Patchwork
2024-07-08  4:24 ` ✓ CI.Hooks: " Patchwork
2024-07-08  4:25 ` ✓ CI.checksparse: " Patchwork
2024-07-08  4:51 ` ✓ CI.BAT: " Patchwork
2024-07-08  5:46 ` ✗ CI.FULL: failure " Patchwork
2024-07-09  9:57 ` [PATCH v2 00/11] Proper GT TLB invalidation layering and new coalescing feature Matthew Auld
2024-07-09 16:08   ` Nirmoy Das
2024-07-09 16:35     ` Matthew Brost
2024-07-09 16:42       ` Nirmoy Das
2024-07-09 21:23         ` Matthew Brost
2024-07-09 16:31   ` Matthew Brost

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=e381835e-a69d-48d4-81f9-185b2ee5124a@linux.intel.com \
    --to=nirmoy.das@linux.intel.com \
    --cc=farah.kassabri@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=michal.wajdeczko@intel.com \
    --cc=nirmoy.das@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox