Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "K V P, Satyanarayana" <satyanarayana.k.v.p@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>,
	<intel-xe@lists.freedesktop.org>
Cc: Matthew Brost <matthew.brost@intel.com>
Subject: Re: [PATCH 4/5] drm/xe/vf: Use single check when calling VF CCS functions
Date: Fri, 5 Sep 2025 13:10:46 +0530	[thread overview]
Message-ID: <bb0e2af6-4324-4060-a5ce-eb58d207bf49@intel.com> (raw)
In-Reply-To: <20250904192918.7346-5-michal.wajdeczko@intel.com>



On 05-09-2025 00:59, Michal Wajdeczko wrote:
> All xe_sriov_vf_ccs() functions but init() expect to be called
> when initialization was successful and CCS handling is ready.
> 
> Update IS_VF_CCS_READY macro and use it as single entry guard.
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> ---
>   drivers/gpu/drm/xe/xe_bo.c                 |  8 ++++----
>   drivers/gpu/drm/xe/xe_gt_debugfs.c         |  1 +
>   drivers/gpu/drm/xe/xe_pm.c                 |  4 ++--
>   drivers/gpu/drm/xe/xe_sriov_vf_ccs.c       | 10 +++++-----
>   drivers/gpu/drm/xe/xe_sriov_vf_ccs.h       | 15 +++++++++++++++
>   drivers/gpu/drm/xe/xe_sriov_vf_ccs_types.h |  6 ------
>   6 files changed, 27 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
> index 4faf15d5fa6d..228574e90f18 100644
> --- a/drivers/gpu/drm/xe/xe_bo.c
> +++ b/drivers/gpu/drm/xe/xe_bo.c
> @@ -972,11 +972,11 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict,
>   	 * CCS meta data is migrated from TT -> SMEM. So, let us detach the
>   	 * BBs from BO as it is no longer needed.
>   	 */
> -	if (IS_VF_CCS_BB_VALID(xe, bo) && old_mem_type == XE_PL_TT &&
> +	if (IS_VF_CCS_READY(xe) && old_mem_type == XE_PL_TT &&
>   	    new_mem->mem_type == XE_PL_SYSTEM)
>   		xe_sriov_vf_ccs_detach_bo(bo);
>   
> -	if (IS_SRIOV_VF(xe) &&
> +	if (IS_VF_CCS_READY(xe) &&
>   	    ((move_lacks_source && new_mem->mem_type == XE_PL_TT) ||
>   	     (old_mem_type == XE_PL_SYSTEM && new_mem->mem_type == XE_PL_TT)) &&
>   	    handle_system_ccs)
> @@ -992,7 +992,7 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict,
>   		if (timeout < 0)
>   			ret = timeout;
>   
> -		if (IS_VF_CCS_BB_VALID(xe, bo))
> +		if (IS_VF_CCS_READY(xe))
>   			xe_sriov_vf_ccs_detach_bo(bo);
>   
>   		xe_tt_unmap_sg(xe, ttm_bo->ttm);
> @@ -1527,7 +1527,7 @@ static void xe_ttm_bo_delete_mem_notify(struct ttm_buffer_object *ttm_bo)
>   	if (!xe_bo_is_xe_bo(ttm_bo))
>   		return;
>   
> -	if (IS_VF_CCS_BB_VALID(ttm_to_xe_device(ttm_bo->bdev), bo))
> +	if (IS_VF_CCS_READY(ttm_to_xe_device(ttm_bo->bdev)))
>   		xe_sriov_vf_ccs_detach_bo(bo);
>   
>   	/*
> diff --git a/drivers/gpu/drm/xe/xe_gt_debugfs.c b/drivers/gpu/drm/xe/xe_gt_debugfs.c
> index 5aa1eded278d..f6f2c14b642d 100644
> --- a/drivers/gpu/drm/xe/xe_gt_debugfs.c
> +++ b/drivers/gpu/drm/xe/xe_gt_debugfs.c
> @@ -31,6 +31,7 @@
>   #include "xe_reg_whitelist.h"
>   #include "xe_sa.h"
>   #include "xe_sriov.h"
> +#include "xe_sriov_vf_ccs.h"
>   #include "xe_tuning.h"
>   #include "xe_uc_debugfs.h"
>   #include "xe_wa.h"
> diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c
> index a2e85030b7f4..c184097584cf 100644
> --- a/drivers/gpu/drm/xe/xe_pm.c
> +++ b/drivers/gpu/drm/xe/xe_pm.c
> @@ -212,7 +212,7 @@ int xe_pm_resume(struct xe_device *xe)
>   
>   	xe_pxp_pm_resume(xe->pxp);
>   
> -	if (IS_SRIOV_VF(xe))
> +	if (IS_VF_CCS_READY(xe))
>   		xe_sriov_vf_ccs_register_context(xe);
>   
>   	drm_dbg(&xe->drm, "Device resumed\n");
> @@ -572,7 +572,7 @@ int xe_pm_runtime_resume(struct xe_device *xe)
>   
>   	xe_pxp_pm_resume(xe->pxp);
>   
> -	if (IS_SRIOV_VF(xe))
> +	if (IS_VF_CCS_READY(xe))
>   		xe_sriov_vf_ccs_register_context(xe);
>   
>   out:
> diff --git a/drivers/gpu/drm/xe/xe_sriov_vf_ccs.c b/drivers/gpu/drm/xe/xe_sriov_vf_ccs.c
> index b01bb3660fb1..30aea958a337 100644
> --- a/drivers/gpu/drm/xe/xe_sriov_vf_ccs.c
> +++ b/drivers/gpu/drm/xe/xe_sriov_vf_ccs.c
> @@ -220,8 +220,7 @@ int xe_sriov_vf_ccs_register_context(struct xe_device *xe)
>   	struct xe_tile_vf_ccs *ctx;
>   	int err;
>   
> -	if (!IS_VF_CCS_READY(xe))
> -		return 0;
> +	xe_assert(xe, IS_VF_CCS_READY(xe));
>   
>   	for_each_ccs_rw_ctx(ctx_id) {
>   		ctx = &tile->sriov.vf.ccs[ctx_id];
> @@ -331,8 +330,7 @@ int xe_sriov_vf_ccs_attach_bo(struct xe_bo *bo)
>   	struct xe_bb *bb;
>   	int err = 0;
>   
> -	if (!IS_VF_CCS_READY(xe))
> -		return 0;
> +	xe_assert(xe, IS_VF_CCS_READY(xe));
>   
>   	tile = xe_device_get_root_tile(xe);
>   
> @@ -363,7 +361,9 @@ int xe_sriov_vf_ccs_detach_bo(struct xe_bo *bo)
>   	enum xe_sriov_vf_ccs_rw_ctxs ctx_id;
>   	struct xe_bb *bb;
>   
> -	if (!IS_VF_CCS_READY(xe))
> +	xe_assert(xe, IS_VF_CCS_READY(xe));
> +
> +	if (!IS_VF_CCS_BB_VALID(xe, bo))
>   		return 0;
>   
>   	for_each_ccs_rw_ctx(ctx_id) {
> diff --git a/drivers/gpu/drm/xe/xe_sriov_vf_ccs.h b/drivers/gpu/drm/xe/xe_sriov_vf_ccs.h
> index 1f1baf685fec..f0e1189b417a 100644
> --- a/drivers/gpu/drm/xe/xe_sriov_vf_ccs.h
> +++ b/drivers/gpu/drm/xe/xe_sriov_vf_ccs.h
> @@ -6,6 +6,10 @@
>   #ifndef _XE_SRIOV_VF_CCS_H_
>   #define _XE_SRIOV_VF_CCS_H_
>   
> +#include "xe_device_types.h"
> +#include "xe_sriov.h"
> +#include "xe_sriov_vf_ccs_types.h"
> +
>   struct xe_device;
>   struct xe_bo;
>   
> @@ -14,4 +18,15 @@ int xe_sriov_vf_ccs_attach_bo(struct xe_bo *bo);
>   int xe_sriov_vf_ccs_detach_bo(struct xe_bo *bo);
>   int xe_sriov_vf_ccs_register_context(struct xe_device *xe);
>   
> +static inline bool xe_sriov_vf_ccs_ready(struct xe_device *xe)
> +{
> +	xe_assert(xe, IS_SRIOV_VF(xe));
> +	return xe->sriov.vf.ccs.initialized;
> +}
> +
> +#define IS_VF_CCS_READY(xe) ({ \
> +	struct xe_device *xe__ = (xe); \
> +	IS_SRIOV_VF(xe__) && xe_sriov_vf_ccs_ready(xe__); \
> +	})
> +
>   #endif
> diff --git a/drivers/gpu/drm/xe/xe_sriov_vf_ccs_types.h b/drivers/gpu/drm/xe/xe_sriov_vf_ccs_types.h
> index 0df6b4130e7c..79092e386c4a 100644
> --- a/drivers/gpu/drm/xe/xe_sriov_vf_ccs_types.h
> +++ b/drivers/gpu/drm/xe/xe_sriov_vf_ccs_types.h
> @@ -9,12 +9,6 @@
>   #define for_each_ccs_rw_ctx(id__) \
>   	for ((id__) = 0; (id__) < XE_SRIOV_VF_CCS_CTX_COUNT; (id__)++)
>   
> -#define IS_VF_CCS_READY(xe) ({ \
> -		struct xe_device *___xe = (xe); \
> -		xe_assert(___xe, IS_SRIOV_VF(___xe)); \
> -		___xe->sriov.vf.ccs.initialized; \
> -		})
> -
>   enum xe_sriov_vf_ccs_rw_ctxs {
>   	XE_SRIOV_VF_CCS_READ_CTX,
>   	XE_SRIOV_VF_CCS_WRITE_CTX,
LGTM.
Reviewed-by: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>


  reply	other threads:[~2025-09-05  7:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04 19:29 [PATCH 0/5] Small improvements around VF CCS Michal Wajdeczko
2025-09-04 19:29 ` [PATCH 1/5] drm/xe/guc: Rename xe_guc_register_exec_queue Michal Wajdeczko
2025-09-05  7:05   ` K V P, Satyanarayana
2025-09-04 19:29 ` [PATCH 2/5] drm/xe/guc: Use proper flag definitions when registering context Michal Wajdeczko
2025-09-04 19:36   ` Matthew Brost
2025-09-04 19:29 ` [PATCH 3/5] drm/xe/vf: Drop IS_VF_CCS_INIT_NEEDED macro Michal Wajdeczko
2025-09-05  3:27   ` Matthew Brost
2025-09-05  7:18   ` K V P, Satyanarayana
2025-09-04 19:29 ` [PATCH 4/5] drm/xe/vf: Use single check when calling VF CCS functions Michal Wajdeczko
2025-09-05  7:40   ` K V P, Satyanarayana [this message]
2025-09-04 19:29 ` [PATCH 5/5] drm/xe/bo: Add xe_bo_has_valid_ccs_bb helper Michal Wajdeczko
2025-09-04 20:31   ` Matthew Brost
2025-09-05  7:42   ` K V P, Satyanarayana
2025-09-04 19:36 ` ✓ CI.KUnit: success for Small improvements around VF CCS Patchwork
2025-09-04 20:19 ` ✓ Xe.CI.BAT: " Patchwork
2025-09-05 11:55 ` ✗ Xe.CI.Full: failure " Patchwork
2025-09-05 12:34   ` Michal Wajdeczko

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=bb0e2af6-4324-4060-a5ce-eb58d207bf49@intel.com \
    --to=satyanarayana.k.v.p@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=michal.wajdeczko@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