From mboxrd@z Thu Jan 1 00:00:00 1970 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 0D3F7CFB45D for ; Mon, 7 Oct 2024 20:16:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D573810E41F; Mon, 7 Oct 2024 20:16:41 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="mjaaTfW1"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1914510E41B for ; Mon, 7 Oct 2024 20:16:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1728332197; x=1759868197; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gvTBMsi6IpM3DDrXjbGzdaZDZ9gyr0TtOC/yCBpdaRs=; b=mjaaTfW1Z61S3u+KQtsFAK5oloCDr3AjtpF52u3+d9YVzthneW0Gp/lN TBxGcc6HBNBwHjF3/Ej1eeqnUzB+67LdHb+UTDIt+Zy4OmHbJ+RKU+XVf qfCtQLY44gTj25ue2hHXpQAuRZJeBRv7pFQWF+7kZDaAkfT5890xN4hyz 7Ocg426C4dbniA0fzmTOSAndLb7OmFzj+/9wHlZ378c2AHqRu3aM5Wyao 6jXhyVYAsvlyVCI9t/jYkd3YWiZhJ9l0bxQMgeHfR+J1iqlQBcw9SNlvX q7EiThJB6Q6F1OSjdjgX5c/bkTc6OlxS6tlt2UIfwOrXLMKS7pr4jwFrg A==; X-CSE-ConnectionGUID: mrb/fPt4QuGftA4mnmXWOw== X-CSE-MsgGUID: Q/GFDKAZT8GSEmcB/R/jRA== X-IronPort-AV: E=McAfee;i="6700,10204,11218"; a="44968867" X-IronPort-AV: E=Sophos;i="6.11,184,1725346800"; d="scan'208";a="44968867" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2024 13:16:37 -0700 X-CSE-ConnectionGUID: NWhr9KsrS4Op2ocCuUUVtg== X-CSE-MsgGUID: Wl8VeaQrQeODo6Ng1qSAIQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,184,1725346800"; d="scan'208";a="75964176" Received: from gkczarna.igk.intel.com ([10.102.139.130]) by fmviesa010.fm.intel.com with ESMTP; 07 Oct 2024 13:16:36 -0700 From: Tomasz Lis To: intel-xe@lists.freedesktop.org Cc: =?UTF-8?q?Micha=C5=82=20Winiarski?= , =?UTF-8?q?Micha=C5=82=20Wajdeczko?= Subject: [PATCH v4 3/4] drm/xe/vf: Start post-migration fixups with provisinoning query Date: Mon, 7 Oct 2024 22:16:30 +0200 Message-Id: <20241007201631.3369513-4-tomasz.lis@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241007201631.3369513-1-tomasz.lis@intel.com> References: <20241007201631.3369513-1-tomasz.lis@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" During post-migration recovery, only MMIO communication to GuC is allowed. The VF KMD needs to use that channel to ask for the new provisioning, which includes a new GGTT range assigned to the VF. v2: query config only instead of handshake; no need to get pm ref as it's now kept through whole recovery (Michal) v3: switched names of 'err' and 'ret' (Michal) Signed-off-by: Tomasz Lis --- drivers/gpu/drm/xe/xe_sriov_vf.c | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/gpu/drm/xe/xe_sriov_vf.c b/drivers/gpu/drm/xe/xe_sriov_vf.c index c8cbd17d88d3..97ab66edd711 100644 --- a/drivers/gpu/drm/xe/xe_sriov_vf.c +++ b/drivers/gpu/drm/xe/xe_sriov_vf.c @@ -25,6 +25,31 @@ void xe_sriov_vf_init_early(struct xe_device *xe) INIT_WORK(&xe->sriov.vf.migration.worker, migration_worker_func); } +/** + * vf_post_migration_requery_guc - Re-query GuC for current VF provisioning. + * @xe: the &xe_device struct instance + * + * After migration, we need to re-query all VF configuration to make sure + * they match previous provisioning. Note that most of VF provisioning + * shall be the same, except GGTT range, since GGTT is not virtualized per-VF. + * + * Returns: 0 if the operation completed successfully, or a negative error + * code otherwise. + */ +static int vf_post_migration_requery_guc(struct xe_device *xe) +{ + struct xe_gt *gt; + unsigned int id; + int err, ret = 0; + + for_each_gt(gt, xe, id) { + err = xe_gt_sriov_vf_query_config(gt); + ret = ret ?: err; + } + + return ret; +} + /* * vf_post_migration_notify_resfix_done - Notify all GuCs about resource fixups apply finished. * @xe: the &xe_device struct instance @@ -45,12 +70,23 @@ static void vf_post_migration_notify_resfix_done(struct xe_device *xe) static void vf_post_migration_recovery(struct xe_device *xe) { + int err; + drm_dbg(&xe->drm, "migration recovery in progress\n"); xe_pm_runtime_get(xe); + err = vf_post_migration_requery_guc(xe); + if (unlikely(err)) + goto fail; + /* FIXME: add the recovery steps */ vf_post_migration_notify_resfix_done(xe); xe_pm_runtime_put(xe); drm_notice(&xe->drm, "migration recovery ended\n"); + return; +fail: + xe_pm_runtime_put(xe); + drm_err(&xe->drm, "migration recovery failed (%pe)\n", ERR_PTR(err)); + xe_device_declare_wedged(xe); } static void migration_worker_func(struct work_struct *w) -- 2.25.1