Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "K V P, Satyanarayana" <satyanarayana.k.v.p@intel.com>
To: Matthew Brost <matthew.brost@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH v2 33/34] drm/xe/vf: Rebase CCS save/restore BB GGTT addresses
Date: Wed, 24 Sep 2025 12:06:22 +0530	[thread overview]
Message-ID: <72a3a014-3e58-4a9f-8677-db9f12c3725c@intel.com> (raw)
In-Reply-To: <aNOQmwNz1AN2vBXd@lstrano-desk.jf.intel.com>



On 24-09-2025 12:02, Matthew Brost wrote:
> On Wed, Sep 24, 2025 at 09:34:25AM +0530, K V P, Satyanarayana wrote:
>>
>>
>> On 24-09-2025 06:46, Matthew Brost wrote:
>>> Rebase the CCS save/restore BB's GGTT addresses during VF post-migration
>>> recovery by setting the software ring tail to zero, the LRC ring head to
>>> zero, and rewriting the jump-to-BB instructions.
>>>
>>> Signed-off-by: Matthew Brost <matthew.brost@intel.com>
>>> ---
>>>    drivers/gpu/drm/xe/xe_gt_sriov_vf.c  |  4 ++++
>>>    drivers/gpu/drm/xe/xe_sriov_vf_ccs.c | 24 ++++++++++++++++++++++++
>>>    drivers/gpu/drm/xe/xe_sriov_vf_ccs.h |  1 +
>>>    3 files changed, 29 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_vf.c b/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
>>> index 46d1d1fa91b2..d8d96dd76c73 100644
>>> --- a/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
>>> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
>>> @@ -34,6 +34,7 @@
>>>    #include "xe_pm.h"
>>>    #include "xe_sriov.h"
>>>    #include "xe_sriov_vf.h"
>>> +#include "xe_sriov_vf_ccs.h"
>>>    #include "xe_tile_sriov_vf.h"
>>>    #include "xe_tlb_inval.h"
>>>    #include "xe_uc_fw.h"
>>> @@ -1228,6 +1229,9 @@ static int vf_post_migration_fixups(struct xe_gt *gt)
>>>    	if (err)
>>>    		return err;
>>> +	if (xe_gt_is_main_type(gt))
>>> +		xe_sriov_vf_ccs_rebase(gt_to_xe(gt));
>>> +
>>>    	xe_gt_sriov_vf_default_lrcs_hwsp_rebase(gt);
>>>    	err = xe_guc_contexts_hwsp_rebase(&gt->uc.guc, buf);
>>>    	if (err)
>>> diff --git a/drivers/gpu/drm/xe/xe_sriov_vf_ccs.c b/drivers/gpu/drm/xe/xe_sriov_vf_ccs.c
>>> index 8dec616c37c9..bffad45e655f 100644
>>> --- a/drivers/gpu/drm/xe/xe_sriov_vf_ccs.c
>>> +++ b/drivers/gpu/drm/xe/xe_sriov_vf_ccs.c
>>> @@ -175,6 +175,15 @@ static void ccs_rw_update_ring(struct xe_sriov_vf_ccs_ctx *ctx)
>>>    	struct xe_lrc *lrc = xe_exec_queue_lrc(ctx->mig_q);
>>>    	u32 dw[10], i = 0;
>>> +	/*
>>> +	 * XXX: Save/restore fixes — for some reason, the GuC only accepts the
>>> +	 * save/restore context if the LRC head pointer is zero. This is evident
>>> +	 * from repeated VF migrations failing when the LRC head pointer is
>>> +	 * non-zero.
>>> +	 */
>>> +	lrc->ring.tail = 0;
>>> +	xe_lrc_set_ring_head(lrc, 0);
>>> +
>> On lrc_init(), the ring may be pre-populated with some GPU instructions.
>> Should not we keep them as it is? Making tail=0 will overwrite the
>> pre-populated GPU instructions (May be some WAs??).
>> -Satya.>   	dw[i++] = MI_ARB_ON_OFF | MI_ARB_ENABLE;
> 
> I’ve thought about that. W/A should be applied through a W/A BB
> mechanism, not via the ring. If I recall correctly, the original code
> for programming instructions in the ring came from Faith’s original Xe
> PoC code from over four years ago, which we’ve never really revisited.
> 
> In my opinion, that code should be removed.
> 
> I could include the removal in this series, but I’d prefer not to expand
> its scope. We can address it in a follow-up. I also don’t want this
> series to grow in complexity by retaining what is almost certainly
> useless code.
> 
> Matt
LGTM.
Reviewed-by: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>>
>>>    	dw[i++] = MI_BATCH_BUFFER_START | XE_INSTR_NUM_DW(3);
>>>    	dw[i++] = lower_32_bits(addr);
>>> @@ -186,6 +195,21 @@ static void ccs_rw_update_ring(struct xe_sriov_vf_ccs_ctx *ctx)
>>>    	xe_lrc_set_ring_tail(lrc, lrc->ring.tail);
>>>    }
>>> +void xe_sriov_vf_ccs_rebase(struct xe_device *xe)
>>> +{
>>> +	enum xe_sriov_vf_ccs_rw_ctxs ctx_id;
>>> +
>>> +	if (!IS_VF_CCS_READY(xe))
>>> +		return;
>>> +
>>> +	for_each_ccs_rw_ctx(ctx_id) {
>>> +		struct xe_sriov_vf_ccs_ctx *ctx =
>>> +			&xe->sriov.vf.ccs.contexts[ctx_id];
>>> +
>>> +		ccs_rw_update_ring(ctx);
>>> +	}
>>> +}
>>> +
>>>    static int register_save_restore_context(struct xe_sriov_vf_ccs_ctx *ctx)
>>>    {
>>>    	int ctx_type;
>>> diff --git a/drivers/gpu/drm/xe/xe_sriov_vf_ccs.h b/drivers/gpu/drm/xe/xe_sriov_vf_ccs.h
>>> index 0745c0ff0228..f8ca6efce9ee 100644
>>> --- a/drivers/gpu/drm/xe/xe_sriov_vf_ccs.h
>>> +++ b/drivers/gpu/drm/xe/xe_sriov_vf_ccs.h
>>> @@ -18,6 +18,7 @@ int xe_sriov_vf_ccs_init(struct xe_device *xe);
>>>    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);
>>> +void xe_sriov_vf_ccs_rebase(struct xe_device *xe);
>>>    void xe_sriov_vf_ccs_print(struct xe_device *xe, struct drm_printer *p);
>>>    static inline bool xe_sriov_vf_ccs_ready(struct xe_device *xe)
>>


  reply	other threads:[~2025-09-24  6:36 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-24  1:15 [PATCH v2 00/34] VF migration redesign Matthew Brost
2025-09-24  1:15 ` [PATCH v2 01/34] drm/xe/vf: Lock querying GGTT config during driver init Matthew Brost
2025-09-24  9:29   ` Michal Wajdeczko
2025-09-24 20:23     ` Matthew Brost
2025-09-30  0:42       ` Lis, Tomasz
2025-09-24  1:15 ` [PATCH v2 02/34] Revert "drm/xe/vf: Rebase exec queue parallel commands during migration recovery" Matthew Brost
2025-09-24  9:32   ` Michal Wajdeczko
2025-09-24 20:17     ` Matthew Brost
2025-09-24  1:15 ` [PATCH v2 03/34] Revert "drm/xe/vf: Post migration, repopulate ring area for pending request" Matthew Brost
2025-09-24  1:15 ` [PATCH v2 04/34] Revert "drm/xe/vf: Fixup CTB send buffer messages after migration" Matthew Brost
2025-09-24  1:15 ` [PATCH v2 05/34] drm/xe: Save off position in ring in which a job was programmed Matthew Brost
2025-09-24  1:15 ` [PATCH v2 06/34] drm/xe/guc: Track pending-enable source in submission state Matthew Brost
2025-09-24  1:15 ` [PATCH v2 07/34] drm/xe: Track LR jobs in DRM scheduler pending list Matthew Brost
2025-09-24  1:15 ` [PATCH v2 08/34] drm/xe: Don't change LRC ring head on job resubmission Matthew Brost
2025-09-24 15:14   ` Lis, Tomasz
2025-09-25 16:12     ` Matthew Brost
2025-09-24  1:15 ` [PATCH v2 09/34] drm/xe: Make LRC W/A scratch buffer usage consistent Matthew Brost
2025-09-24 14:23   ` Lis, Tomasz
2025-09-24 18:01   ` Lucas De Marchi
2025-09-25 20:25     ` Matthew Brost
2025-09-24  1:15 ` [PATCH v2 10/34] drm/xe/guc: Document GuC submission backend Matthew Brost
2025-09-24  9:35   ` Michal Wajdeczko
2025-09-24 20:20     ` Matthew Brost
2025-09-24  1:15 ` [PATCH v2 11/34] drm/xe/vf: Add xe_gt_sriov_vf_recovery_inprogress helper Matthew Brost
2025-09-24 10:14   ` Michal Wajdeczko
2025-09-24 19:39     ` Matthew Brost
2025-09-24 20:12       ` Michal Wajdeczko
2025-09-24 20:30         ` Matthew Brost
2025-09-24  1:15 ` [PATCH v2 12/34] drm/xe/vf: Make VF recovery run on per-GT worker Matthew Brost
2025-09-24 10:49   ` Michal Wajdeczko
2025-09-24 19:50     ` Matthew Brost
2025-09-24 20:21       ` Michal Wajdeczko
2025-09-24 20:35         ` Matthew Brost
2025-09-25 16:27           ` Lis, Tomasz
2025-09-25 16:56             ` Matthew Brost
2025-09-24  1:15 ` [PATCH v2 13/34] drm/xe/vf: Abort H2G sends during VF post-migration recovery Matthew Brost
2025-09-24 11:00   ` Michal Wajdeczko
2025-09-24 20:01     ` Matthew Brost
2025-09-24  1:15 ` [PATCH v2 14/34] drm/xe/vf: Remove memory allocations from VF post migration recovery Matthew Brost
2025-09-26  1:35   ` Lis, Tomasz
2025-09-26  1:43     ` Matthew Brost
2025-09-24  1:15 ` [PATCH v2 15/34] drm/xe/vf: Close multi-GT GGTT shift race Matthew Brost
2025-09-26  2:33   ` Lis, Tomasz
2025-09-26 19:09     ` Matthew Brost
2025-09-24  1:15 ` [PATCH v2 16/34] drm/xe/vf: Teardown VF post migration worker on driver unload Matthew Brost
2025-09-26 15:40   ` Lis, Tomasz
2025-09-26 19:13     ` Matthew Brost
2025-09-24  1:15 ` [PATCH v2 17/34] drm/xe/vf: Don't allow GT reset to be queued during VF post migration recovery Matthew Brost
2025-09-27  2:59   ` Lis, Tomasz
2025-09-27 22:33     ` Matthew Brost
2025-09-24  1:15 ` [PATCH v2 18/34] drm/xe/vf: Wakeup in GuC backend on " Matthew Brost
2025-09-25 19:06   ` Matthew Brost
2025-09-24  1:15 ` [PATCH v2 19/34] drm/xe/vf: Extra debug on GGTT shift Matthew Brost
2025-09-27  3:16   ` Lis, Tomasz
2025-09-27 11:06   ` Michal Wajdeczko
2025-09-27 22:56     ` Matthew Brost
2025-09-24  1:15 ` [PATCH v2 20/34] drm/xe/vf: Use GUC_HXG_TYPE_EVENT for GuC context register Matthew Brost
2025-09-24 11:15   ` Michal Wajdeczko
2025-09-24 20:16     ` Matthew Brost
2025-09-24  1:15 ` [PATCH v2 21/34] drm/xe/vf: Stop and flush CTs in VF post migration recovery Matthew Brost
2025-09-24 11:21   ` Michal Wajdeczko
2025-09-24 20:12     ` Matthew Brost
2025-09-24  1:15 ` [PATCH v2 22/34] drm/xe/vf: Reset TLB invalidations during " Matthew Brost
2025-09-27  3:43   ` Lis, Tomasz
2025-09-27 22:29     ` Matthew Brost
2025-09-24  1:15 ` [PATCH v2 23/34] drm/xe/vf: Kickstart after resfix in " Matthew Brost
2025-09-27 11:21   ` Lis, Tomasz
2025-09-24  1:15 ` [PATCH v2 24/34] drm/xe/vf: Start CTs before resfix " Matthew Brost
2025-09-24 11:50   ` Michal Wajdeczko
2025-09-24 20:10     ` Matthew Brost
2025-09-24  1:15 ` [PATCH v2 25/34] drm/xe/vf: Abort VF post migration recovery on failure Matthew Brost
2025-09-27 11:54   ` Lis, Tomasz
2025-09-27 22:38     ` Matthew Brost
2025-09-24  1:15 ` [PATCH v2 26/34] drm/xe/vf: Replay GuC submission state on pause / unpause Matthew Brost
2025-09-27 13:33   ` Lis, Tomasz
2025-09-27 23:11     ` Matthew Brost
2025-09-24  1:15 ` [PATCH v2 27/34] drm/xe: Move queue init before LRC creation Matthew Brost
2025-09-24  1:15 ` [PATCH v2 28/34] drm/xe/vf: Add debug prints for GuC replaying state during VF recovery Matthew Brost
2025-09-24  1:15 ` [PATCH v2 29/34] drm/xe/vf: Workaround for race condition in GuC firmware during VF pause Matthew Brost
2025-09-24  1:15 ` [PATCH v2 30/34] drm/xe: Use PPGTT addresses for TLB invalidation to avoid GGTT fixups Matthew Brost
2025-09-24  1:15 ` [PATCH v2 31/34] drm/xe/vf: Use primary GT ordered work queue on media GT on PTL VF Matthew Brost
2025-09-24  1:15 ` [PATCH v2 32/34] drm/xe/vf: Ensure media GT VF recovery runs after primary GT on PTL Matthew Brost
2025-09-24  1:16 ` [PATCH v2 33/34] drm/xe/vf: Rebase CCS save/restore BB GGTT addresses Matthew Brost
2025-09-24  4:04   ` K V P, Satyanarayana
2025-09-24  6:32     ` Matthew Brost
2025-09-24  6:36       ` K V P, Satyanarayana [this message]
2025-09-24  1:16 ` [PATCH v2 34/34] drm/xe/guc: Increase wait timeout to 2sec after BUSY reply from GuC Matthew Brost
2025-09-24  1:29 ` ✓ CI.KUnit: success for VF migration redesign (rev2) Patchwork
2025-09-24  2:14 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-09-24  7:37 ` ✗ Xe.CI.Full: " Patchwork

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=72a3a014-3e58-4a9f-8677-db9f12c3725c@intel.com \
    --to=satyanarayana.k.v.p@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@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