From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DB44606A323 for ; Wed, 2 Dec 2026 10:00:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=DfFLohw2 Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C4E9C112078; Wed, 2 Dec 2026 10:00:03 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id 68B8E112074 for ; Wed, 2 Dec 2026 09:59:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796205598; x=1827741598; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=q5lShkycw3nKTx8AZVFfVKaoNTISOm4nZg9jDBRRhN8=; b=DfFLohw24KAQWf6V2d8wfXFMIOP0TRzCdl3WqDaLPruND31Fakx1Wu36 5vUadgPJsRv9MWhstU6+4PB8Nm3zlsN41V+CiKbLBJA2ksfD14E6mEeq2 KuKSQ/ZOQ90OA/vxuGSrBELnl6FL/xOG8p8cngHiGy+Nd/pYwYnm+3Tm4 KKap+nZNKARTlUp55LLrzIIG24FivW4QmAWJqS0fDsfCej9IH+i3WWQV0 g9V7PHbrkUArKglIdkCHqPM2W36imAJMmU+Mtg2mQDxY9W2sz6bdJ4lt7 zGLFrCDipBhiIFdWo46vhIGlpZK9QgsvhbiLy4QrUU70OcYpSuE8NDD4S A==; X-CSE-ConnectionGUID: ztdKKUHvRG6dnivfzeT2pQ== X-CSE-MsgGUID: avXl4uiSRZ2qsf7uwpLcsQ== X-IronPort-AV: E=McAfee;i="6800,10657,11983"; a="5085391" X-IronPort-AV: E=Sophos;i="6.27,246,1787036400"; d="scan'208";a="5085391" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2026 01:59:58 -0800 X-CSE-ConnectionGUID: 7aV+wsRuScitk4c8zaaZMA== X-CSE-MsgGUID: NHIfKGKjTIOVQoiCrWImWA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,246,1787036400"; d="scan'208";a="14044344" Received: from fmsmsx901.amr.corp.intel.com ([10.18.126.90]) by fmviesa010.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2026 01:59:57 -0800 Received: from FMSMSX902.amr.corp.intel.com (10.18.126.91) by fmsmsx901.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Wed, 2 Dec 2026 01:59:56 -0800 Received: from fmsedg902.ED.cps.intel.com (10.1.192.144) by FMSMSX902.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57 via Frontend Transport; Wed, 2 Dec 2026 01:59:56 -0800 Received: from BN8PR05CU002.outbound.protection.outlook.com (52.101.57.0) by edgegateway.intel.com (192.55.55.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Wed, 2 Dec 2026 01:59:56 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UpcThIqVXeJkzQLcRzuFh+foCZdwKNpOZ/jLOUKV6QeJo8eqWIFf896JKlPfCKBpnZL+hDVbKXqJ+kpzHF0jE5qma4L54afFvCn4aVZdq9jm5G1raIfcdkTYQYRWRZ5YSzAdpo2KwjXNuZGcShqMBj3xFcYMyMKY7idYckzqbhOHWpfI2u8tvdKgeo9hBgqhQIyviBeIVcnPBFPJEPmQ0Phpzkgu2ZcMpVgaK/d6yEqNKUtPLej5O9yySETj6Akb5qC4wmW8zai2AsUDJwJUs6yIwEeB5A4kwON9SOzb9cEp90nCSIEqQZWI0lVj4tNXIaisVldTdIaWRe71Y87CBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=q5lShkycw3nKTx8AZVFfVKaoNTISOm4nZg9jDBRRhN8=; b=Zqne4yWNHVPZK2HZViRsSe1Yx4+4arWgS1A6manxBvgc+gANG++27GYkxK4hDFQqis5PtT1c2MNRghrsKKgtYwJw66m7Ay4KLXmoISM1WsCPALMt1XiXBExPngE0Haac1GFaufi0Qjgor+5tOuaU24R1Zkqeh844IQgBKYqj215FQV75uDTvB0P6vNZ0ozyJ2OcyAj0Ha38qTREzFC1XLyAzYOhoLGJNdVpwP4x56jlepNL4sZP5kKYUkat+Mtxi25JWNZSWASzVjVKt/cNRzARUj7gaPopotUQKg/G69XrZ8Ap6TrnbRJhKM3KYAt9xPCBexLwT0zgURMZh0DtqIg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from PH8PR11MB8039.namprd11.prod.outlook.com (2603:10b6:510:25f::18) by DM3PR11MB8760.namprd11.prod.outlook.com (2603:10b6:0:4b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.10; Wed, 2 Dec 2026 09:59:47 +0000 Received: from PH8PR11MB8039.namprd11.prod.outlook.com ([fe80::42df:f465:90a8:df92]) by PH8PR11MB8039.namprd11.prod.outlook.com ([fe80::42df:f465:90a8:df92%3]) with mapi id 15.21.0688.009; Wed, 2 Dec 2026 09:59:47 +0000 Date: Wed, 2 Dec 2026 10:59:43 +0100 From: Piotr =?utf-8?Q?Pi=C3=B3rkowski?= To: Lukasz Laguna CC: , , , Subject: Re: [PATCH 3/5] drm/xe/pf: Recover VF state after PF FLR Message-ID: <20261202095943.b65tlsysycalwrbs@intel.com> References: <20261130150315.1954064-1-lukasz.laguna@intel.com> <20261130150315.1954064-4-lukasz.laguna@intel.com> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20261130150315.1954064-4-lukasz.laguna@intel.com> X-ClientProxiedBy: VI1PR10CA0117.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::46) To PH8PR11MB8039.namprd11.prod.outlook.com (2603:10b6:510:25f::18) X-Archived-By: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH8PR11MB8039:EE_|DM3PR11MB8760:EE_ X-MS-Office365-Filtering-Correlation-Id: dbe54a86-6267-46c3-55e7-08df505aff60 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|376014|23010399003|22082099003|18002099003|6133799003|261009223027099003|261021121427099003|261022075727099003|261022105027099003|261102123227099003|261028144727099003|261026140227099003|261026121527099003|4143699003|11063799006|56012099006|10067099003; X-Microsoft-Antispam-Message-Info: pHvH04GbCpSrQ+PFoQv3O6Ah8yjTYQHCpwYTNJjrkeJGKJsWx8UCYv9L9VHYQ76sYPR8nuv+gKIRraHN5bjVxEvP4d7iwe1yut3b1Z2gSxkL5xZR5ixbz1GiKHVsJG4O/B3DM3jF+9wlibBGwVsUDF4+C+KtD91KOSZqmWXYPvIttgE6gPWJ8VgY+qsE2XwqupF2avKZS8zb9UtIqbcPKAmiyyDr+hkdRlogPexH1CRNqVQR0/qZDGc2dL9XPViXtS7QLGJWMiNrI1JRU5t/qV4XLcNbQLNbuHMT+hdax9hi3y+M+CFPJMnqFR6izpqQz7oxT3IuwZXYMHTBs2yeg2mJUobEAOjEij2B/tHDf0VDanoSeNk/UFOOvlUwvzkkQlysVDOCKvApw3+mmyaV/DZ16mR1nARRXXodTKHBI+bk7wpUmEHM411TY29yUvSs4Qsn2wDl7Uz8iJHkVqL8D5IvFm7qDVQ8TygGONHxb7iYMQ/cGaKgqwI3vzYTXnogm/+MdTa5caiQdERDIJhtXKaYCsE7QUmaD1xnTc/OpY3C7q3N8jCiG3FM6xKa8v79cXnNFG2TRpseZXvLr5E+NYl6RBFBbcMAVP2xGQWFM07xxNBl4D3CfMSn1TrmOv2YCGvrWkBN+XS8W/+3WXh5nUdOLZdznWbQaMborWFDAdc= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH8PR11MB8039.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014)(23010399003)(22082099003)(18002099003)(6133799003)(261009223027099003)(261021121427099003)(261022075727099003)(261022105027099003)(261102123227099003)(261028144727099003)(261026140227099003)(261026121527099003)(4143699003)(11063799006)(56012099006)(10067099003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZzJjNzhxS2gwYjRDR3dEVDlCcjN5L25kc2dTN3RnZzFpbXN5bjM2T3JOalRa?= =?utf-8?B?MEc0YlB1eHRNZUtQUjg0VFNNaWt4YnZpV3p4RkNwSk5ma2x4N1BWUEMxRmVF?= =?utf-8?B?V0VIbXY3NDVCMDczSC9zQUFtdzNpblpDRVJ3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UNGRndWpOVFdtVXpoSXdKWURKY2lqTlFMREVCbXhKY3VmM2t2YWkwMVNE?= =?utf-8?B?T0dNL1R3NjBVaVR1QjdoN1BFdGQzWmZjV2sva21iNm9WYk1DMXVIcnRtbFRq?= =?utf-8?B?TE92ekxwaG5SMFJ1Skp5Wm5FMVBYVEVOUDBLbFlmSTViSkpyZjNWRjl6dWRB?= =?utf-8?B?SlBZSjV0MUtudVc0bytRVDBVblFybStYK3dER2I1RkdmTzdzeGRFSTh3anJM?= =?utf-8?B?QmdpTFZ5eGE5bm1zVkN2RmlRclR2TUN3RGtaVlRBY0RvK3dUSTNWaThNeGxN?= =?utf-8?B?N1YyeDNsSzA0Z284eUVha2tZcFo0N1QzdUVzZDNYSmxlZlduNFR0eCtiY0hT?= =?utf-8?B?eXY1bW11RlBtUlBQR2N0dGh5aVlvTjFycG55WHF1M3Noa01rNHJEYkdUOSsy?= =?utf-8?Q?Qx076WFd3JlJzk/g=3D?= X-Exchange-RoutingPolicyChecked: ji52a+5RYXKnS9f1FemrPK86L5wKvXjqeOhxLrtiuWVzbiM4aCsZyBHyFHbrVroQl1NpPRhohhe1LULyiGntUtJnGnHdKOBOC2ymjiOhrMda9HXEkVqB6osOu3aUB8zZ5HEjAAz+DynVcPyUdOwRa89w6pheZTW/lOYTw+YK3h9r/ikdqLIYuSxxdkgQ0ZoJghted5xwPgy1+umaHP/KACAIgCSXGObh2jLG1Nz6/b5WdliEkj1NF4RlfAVBGdBAdDC9QJGvdGAw07y9AX2eYsO5op/gMIxtZARgyhlHJJADqQdOADUkiHIocR2u7KdwTS61PKotEqlZjRjbptlrZA== X-MS-Exchange-CrossTenant-Network-Message-Id: dbe54a86-6267-46c3-55e7-08df505aff60 X-MS-Exchange-CrossTenant-AuthSource: PH8PR11MB8039.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2026 09:59:47.3169 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: i5/GIhmm1tyk+zQlYnRzNFqOPM0ariWDGeQ1NWx8q5CNFKJQLGRXeZ5gKX3NsbgCyRZRLlY3CT7Q8TEAGRSt18v6evsX27r8dSV4qJLnd+I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR11MB8760 X-OriginatorOrg: intel.com X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Intel-xe" X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Lukasz Laguna wrote on pon [2026-lis-30 16:03:13 +0100]: > After PF FLR, VF-related state set up by the PF is lost, including VF > GGTT ownership and LMTT. This also applies to VFs that are provisioned > but not enabled. > > Recover VF GGTT ownership and LMTT from the existing VF provisioning > during device re-initialization, once LMEM is accessible and before > the GTs resume. This puts them in place before GT resume queues the > workers that push VF configurations to GuC. > > A failure to recover VF state only affects the VFs, so don't fail > the PF FLR because of it. > > Signed-off-by: Lukasz Laguna > --- > drivers/gpu/drm/xe/xe_device.c | 5 ++ > drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c | 77 ++++++++++++++++++++++ > drivers/gpu/drm/xe/xe_gt_sriov_pf_config.h | 1 + > drivers/gpu/drm/xe/xe_sriov_pf.c | 25 +++++++ > drivers/gpu/drm/xe/xe_sriov_pf.h | 2 + > 5 files changed, 110 insertions(+) > > diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c > index 36693df65594..a9e1b8782551 100644 > --- a/drivers/gpu/drm/xe/xe_device.c > +++ b/drivers/gpu/drm/xe/xe_device.c > @@ -71,6 +71,7 @@ > #include "xe_soc_remapper.h" > #include "xe_survivability_mode.h" > #include "xe_sriov.h" > +#include "xe_sriov_pf.h" > #include "xe_sriov_vf_ccs.h" > #include "xe_svm.h" > #include "xe_sysctrl.h" > @@ -1497,6 +1498,10 @@ int xe_device_resume(struct xe_device *xe, bool flr) > if (err) > return err; > > + /* Failed VF recovery only affects VFs, don't fail the PF FLR */ > + if (IS_SRIOV_PF(xe)) > + xe_sriov_pf_recover_vfs(xe); > + > for_each_gt(gt, xe, id) { > err = xe_gt_reinit(gt); > if (err) > diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c > index c848dd9e0a0d..f4ab16a380be 100644 > --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c > +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c > @@ -31,6 +31,7 @@ > #include "xe_lmtt.h" > #include "xe_migrate.h" > #include "xe_sriov.h" > +#include "xe_sriov_pf_helpers.h" > #include "xe_ttm_vram_mgr.h" > #include "xe_vram_types.h" > > @@ -3422,6 +3423,82 @@ int xe_gt_sriov_pf_config_init(struct xe_gt *gt) > return devm_add_action_or_reset(xe->drm.dev, fini_config, gt); > } > > +static void pf_reassign_ggtt(struct xe_tile *tile) > +{ > + struct xe_device *xe = tile_to_xe(tile); > + unsigned int total_vfs = xe_sriov_pf_get_totalvfs(xe); > + unsigned int n; > + > + xe_assert(xe, IS_SRIOV_PF(xe)); > + > + for (n = 1; n <= total_vfs; n++) { > + struct xe_gt *gt = tile->primary_gt; > + struct xe_gt_sriov_config *config; > + > + config = pf_pick_vf_config(gt, n); > + pf_sanitize_ggtt(config->ggtt_region, n); > + } > +} > + > +static int pf_rebuild_lmtt(struct xe_tile *tile) > +{ > + struct xe_lmtt *lmtt = &tile->sriov.pf.lmtt; > + struct xe_device *xe = tile_to_xe(tile); > + unsigned int total_vfs = xe_sriov_pf_get_totalvfs(xe); > + unsigned int n; > + int err; > + > + xe_assert(xe, xe_device_has_lmtt(xe)); > + xe_assert(xe, IS_SRIOV_PF(xe)); > + > + err = xe_lmtt_reinit_pages(lmtt); > + if (err) > + return err; > + > + for (n = 1; n <= total_vfs; n++) { > + err = pf_populate_lmtt_pages(tile, n); > + if (err) > + return err; > + } It seems to me that you need to call `xe_device_wmb()` here to ensure that the writes are written to the hardware. In the init path, this isn't necessary because we perform an invalidation there, which implicitly calls a barrier. Here, invalidation isn't needed, but a barrier would be useful. Thanks Piotr > + > + return 0; > +} > + > +/** > + * xe_gt_sriov_pf_config_recover() - Recover VF GGTT and LMTT after PF FLR. > + * @gt: the &xe_gt (can't be media) > + * > + * VF GGTT ownership and LMTT are lost on PF FLR. Restore them from the > + * existing VF provisioning, before VF configurations are pushed to GuC. > + * > + * This function can only be called on PF. > + * > + * Return: 0 on success or a negative error code on failure. > + */ > +int xe_gt_sriov_pf_config_recover(struct xe_gt *gt) > +{ > + struct xe_tile *tile = gt_to_tile(gt); > + struct xe_device *xe = gt_to_xe(gt); > + > + xe_gt_assert(gt, xe_gt_is_main_type(gt)); > + > + guard(mutex)(xe_gt_sriov_pf_master_mutex(gt)); > + > + pf_reassign_ggtt(tile); > + > + if (xe_device_has_lmtt(xe)) { > + int err; > + > + err = pf_rebuild_lmtt(tile); > + if (unlikely(err)) { > + xe_tile_sriov_err(tile, "Failed to rebuild LMTT (%pe)\n", ERR_PTR(err)); > + return err; > + } > + } > + > + return 0; > +} > + > /** > * xe_gt_sriov_pf_config_restart - Restart SR-IOV configurations after a GT reset. > * @gt: the &xe_gt > diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.h b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.h > index 0d45dc9672e7..658a5dcfa65f 100644 > --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.h > +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.h > @@ -109,6 +109,7 @@ int xe_gt_sriov_pf_config_ggtt_restore(struct xe_gt *gt, unsigned int vfid, > bool xe_gt_sriov_pf_config_is_empty(struct xe_gt *gt, unsigned int vfid); > > int xe_gt_sriov_pf_config_init(struct xe_gt *gt); > +int xe_gt_sriov_pf_config_recover(struct xe_gt *gt); > void xe_gt_sriov_pf_config_restart(struct xe_gt *gt); > > int xe_gt_sriov_pf_config_print_ggtt(struct xe_gt *gt, struct drm_printer *p); > diff --git a/drivers/gpu/drm/xe/xe_sriov_pf.c b/drivers/gpu/drm/xe/xe_sriov_pf.c > index ce0db26203ec..a6c70fe4ae03 100644 > --- a/drivers/gpu/drm/xe/xe_sriov_pf.c > +++ b/drivers/gpu/drm/xe/xe_sriov_pf.c > @@ -11,6 +11,7 @@ > #include "xe_configfs.h" > #include "xe_device.h" > #include "xe_gt_sriov_pf.h" > +#include "xe_gt_sriov_pf_config.h" > #include "xe_module.h" > #include "xe_sriov.h" > #include "xe_sriov_pf.h" > @@ -170,6 +171,30 @@ int xe_sriov_pf_wait_ready(struct xe_device *xe) > return 0; > } > > +/** > + * xe_sriov_pf_recover_vfs() - Recover provisioned VFs after PF FLR. > + * @xe: the PF &xe_device > + * > + * Call once LMEM is accessible and before the GTs resume. > + * > + * Return: 0 on success or the first error reported by a tile. > + */ > +int xe_sriov_pf_recover_vfs(struct xe_device *xe) > +{ > + struct xe_tile *tile; > + int ret = 0; > + u8 id; > + > + for_each_tile(tile, xe, id) { > + int err; > + > + err = xe_gt_sriov_pf_config_recover(tile->primary_gt); > + ret = ret ?: err; > + } > + > + return ret; > +} > + > /** > * xe_sriov_pf_arm_guard() - Arm the guard for exclusive/lockdown mode. > * @xe: the PF &xe_device > diff --git a/drivers/gpu/drm/xe/xe_sriov_pf.h b/drivers/gpu/drm/xe/xe_sriov_pf.h > index b4d050ad5b7c..0c6a404878c2 100644 > --- a/drivers/gpu/drm/xe/xe_sriov_pf.h > +++ b/drivers/gpu/drm/xe/xe_sriov_pf.h > @@ -17,6 +17,7 @@ bool xe_sriov_pf_readiness(struct xe_device *xe); > int xe_sriov_pf_init_early(struct xe_device *xe); > int xe_sriov_pf_init_late(struct xe_device *xe); > int xe_sriov_pf_wait_ready(struct xe_device *xe); > +int xe_sriov_pf_recover_vfs(struct xe_device *xe); > int xe_sriov_pf_lockdown(struct xe_device *xe); > void xe_sriov_pf_end_lockdown(struct xe_device *xe); > void xe_sriov_pf_print_vfs_summary(struct xe_device *xe, struct drm_printer *p); > @@ -24,6 +25,7 @@ void xe_sriov_pf_print_vfs_summary(struct xe_device *xe, struct drm_printer *p); > static inline bool xe_sriov_pf_readiness(struct xe_device *xe) { return false; } > static inline int xe_sriov_pf_init_early(struct xe_device *xe) { return 0; } > static inline int xe_sriov_pf_init_late(struct xe_device *xe) { return 0; } > +static inline int xe_sriov_pf_recover_vfs(struct xe_device *xe) { return 0; } > static inline int xe_sriov_pf_lockdown(struct xe_device *xe) { return 0; } > static inline void xe_sriov_pf_end_lockdown(struct xe_device *xe) { } > #endif > -- > 2.43.0 > --