Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 629D110F2867 for ; Fri, 27 Mar 2026 20:40:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2BF4910EEA9; Fri, 27 Mar 2026 20:40:12 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="ncXagwcC"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8303410EEA9 for ; Fri, 27 Mar 2026 20:40:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1774644011; x=1806180011; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ufftHruQEu1aKSEkdBYW+5GXwKHMkGAdCEDv+OTW+k4=; b=ncXagwcCnUUEA2N+GeakZpXyBsOXHiukS+Wm6SnG31uEOnooJpy2goqj SrAxe/OeJ+REizSVoJxq5DlTBbRwbI7k/i6dCGoy/BA1MvntTDiWITark IFQK0yISOhTZEQgCOVx/Hf7FJaJLQIeAh1Ly4QV8GCGHYmKrQMZef5SOO GfnhmoAXLv+TEaN+eBkGY0ScD/Ye1f7RR0xN+E+xSVyB+ywbXtjWKe7ik Rroo6OZAqLAXz42knpEGhlT+SyMaDhZSzuMJni/GRfiTTZx+Ulooa+jhu I8kuTPJeFvFNnxypk+34TKgkHX/koRRfsE9SYcrxH3+5lFe35/Vs2IiXp Q==; X-CSE-ConnectionGUID: cTyQA8rLSXKyf13waAbxEQ== X-CSE-MsgGUID: 5qnUgr45SZ+iR/fAmFBhhQ== X-IronPort-AV: E=McAfee;i="6800,10657,11742"; a="93110369" X-IronPort-AV: E=Sophos;i="6.23,144,1770624000"; d="scan'208";a="93110369" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2026 13:40:11 -0700 X-CSE-ConnectionGUID: IzKmUfrMTImL2uSbxo7lng== X-CSE-MsgGUID: 7iSV5zArT3+BwC9WyyOh8Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,144,1770624000"; d="scan'208";a="218794432" Received: from jraag-z790m-itx-wifi.iind.intel.com ([10.190.239.23]) by fmviesa009.fm.intel.com with ESMTP; 27 Mar 2026 13:40:07 -0700 From: Raag Jadav To: intel-xe@lists.freedesktop.org Cc: matthew.brost@intel.com, rodrigo.vivi@intel.com, thomas.hellstrom@linux.intel.com, riana.tauro@intel.com, michal.wajdeczko@intel.com, matthew.d.roper@intel.com, michal.winiarski@intel.com, matthew.auld@intel.com, maarten@lankhorst.se, jani.nikula@intel.com, lukasz.laguna@intel.com, zhanjun.dong@intel.com, Raag Jadav Subject: [PATCH v4 8/9] drm/xe/migrate: Introduce xe_migrate_reinit() Date: Sat, 28 Mar 2026 02:06:19 +0530 Message-ID: <20260327203620.809353-9-raag.jadav@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260327203620.809353-1-raag.jadav@intel.com> References: <20260327203620.809353-1-raag.jadav@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" In preparation of usecases which require re-initializing migrate context after PCIe FLR, introduce xe_migrate_reinit() helper. Migrate exec queue and pt_bo already exist in migrate structure but since their contents live on VRAM, they are lost on PCIe FLR and need re-initialization. Signed-off-by: Raag Jadav Reviewed-by: Matthew Brost --- v2: Re-initialize migrate context (Matthew Brost) --- drivers/gpu/drm/xe/xe_gt.c | 10 ++++++++++ drivers/gpu/drm/xe/xe_migrate.c | 12 ++++++++++++ drivers/gpu/drm/xe/xe_migrate.h | 1 + 3 files changed, 23 insertions(+) diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c index c395d8cc3b5a..eb0045f33d55 100644 --- a/drivers/gpu/drm/xe/xe_gt.c +++ b/drivers/gpu/drm/xe/xe_gt.c @@ -1025,6 +1025,16 @@ void xe_gt_flr_prepare(struct xe_gt *gt) */ int xe_gt_flr_done(struct xe_gt *gt) { + int err; + + if (xe_gt_is_main_type(gt)) { + struct xe_tile *tile = gt_to_tile(gt); + + err = xe_migrate_reinit(tile->migrate); + if (err) + return err; + } + return xe_uc_flr_done(>->uc); } diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c index fc918b4fba54..ffe7e3e3b919 100644 --- a/drivers/gpu/drm/xe/xe_migrate.c +++ b/drivers/gpu/drm/xe/xe_migrate.c @@ -452,6 +452,18 @@ static int xe_migrate_lock_prepare_vm(struct xe_tile *tile, struct xe_migrate *m return err; } +/** + * xe_migrate_reinit() - Re-initialize a migrate context + * @m: The migration context + * + * Returns: 0 on success, negative error code otherwise. + */ +int xe_migrate_reinit(struct xe_migrate *m) +{ + xe_migrate_prepare_vm(m->tile, m, m->q->vm, NULL); + return xe_exec_queue_reinit(m->q); +} + /** * xe_migrate_init() - Initialize a migrate context * @m: The migration context diff --git a/drivers/gpu/drm/xe/xe_migrate.h b/drivers/gpu/drm/xe/xe_migrate.h index 169279d9d8c2..41e06bf398b1 100644 --- a/drivers/gpu/drm/xe/xe_migrate.h +++ b/drivers/gpu/drm/xe/xe_migrate.h @@ -112,6 +112,7 @@ struct xe_migrate_pt_update { struct xe_migrate *xe_migrate_alloc(struct xe_tile *tile); int xe_migrate_init(struct xe_migrate *m); +int xe_migrate_reinit(struct xe_migrate *m); struct dma_fence *xe_migrate_to_vram(struct xe_migrate *m, unsigned long npages, -- 2.43.0