From: "Michał Winiarski" <michal.winiarski@intel.com>
To: "Alex Williamson" <alex@shazbot.org>,
"Lucas De Marchi" <lucas.demarchi@intel.com>,
"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Jason Gunthorpe" <jgg@ziepe.ca>,
"Yishai Hadas" <yishaih@nvidia.com>,
"Kevin Tian" <kevin.tian@intel.com>,
"Shameer Kolothum" <skolothumtho@nvidia.com>,
intel-xe@lists.freedesktop.org, linux-kernel@vger.kernel.org,
kvm@vger.kernel.org, "Matthew Brost" <matthew.brost@intel.com>,
"Michal Wajdeczko" <michal.wajdeczko@intel.com>
Cc: dri-devel@lists.freedesktop.org,
"Jani Nikula" <jani.nikula@linux.intel.com>,
"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
"Tvrtko Ursulin" <tursulin@ursulin.net>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Lukasz Laguna" <lukasz.laguna@intel.com>,
"Christoph Hellwig" <hch@infradead.org>,
"Michał Winiarski" <michal.winiarski@intel.com>
Subject: [PATCH v4 02/28] drm/xe: Move migration support to device-level struct
Date: Wed, 5 Nov 2025 16:10:00 +0100 [thread overview]
Message-ID: <20251105151027.540712-3-michal.winiarski@intel.com> (raw)
In-Reply-To: <20251105151027.540712-1-michal.winiarski@intel.com>
Upcoming changes will allow users to control VF state and obtain its
migration data with a device-level granularity (not tile/gt).
Change the data structures to reflect that and move the GT-level
migration init to happen after device-level init.
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
---
drivers/gpu/drm/xe/Makefile | 1 +
drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c | 12 +-----
.../drm/xe/xe_gt_sriov_pf_migration_types.h | 3 --
drivers/gpu/drm/xe/xe_sriov_pf.c | 5 +++
drivers/gpu/drm/xe/xe_sriov_pf_migration.c | 41 +++++++++++++++++++
drivers/gpu/drm/xe/xe_sriov_pf_migration.h | 16 ++++++++
.../gpu/drm/xe/xe_sriov_pf_migration_types.h | 19 +++++++++
drivers/gpu/drm/xe/xe_sriov_pf_types.h | 4 ++
8 files changed, 88 insertions(+), 13 deletions(-)
create mode 100644 drivers/gpu/drm/xe/xe_sriov_pf_migration.c
create mode 100644 drivers/gpu/drm/xe/xe_sriov_pf_migration.h
create mode 100644 drivers/gpu/drm/xe/xe_sriov_pf_migration_types.h
diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile
index 7b4ca591a4ae3..cb6b30fd8c2d8 100644
--- a/drivers/gpu/drm/xe/Makefile
+++ b/drivers/gpu/drm/xe/Makefile
@@ -177,6 +177,7 @@ xe-$(CONFIG_PCI_IOV) += \
xe_sriov_pf.o \
xe_sriov_pf_control.o \
xe_sriov_pf_debugfs.o \
+ xe_sriov_pf_migration.o \
xe_sriov_pf_provision.o \
xe_sriov_pf_service.o \
xe_sriov_pf_sysfs.o \
diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c
index a5bf327ef8889..ca28f45aaf481 100644
--- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c
+++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c
@@ -13,6 +13,7 @@
#include "xe_guc.h"
#include "xe_guc_ct.h"
#include "xe_sriov.h"
+#include "xe_sriov_pf_migration.h"
/* Return: number of dwords saved/restored/required or a negative error code on failure */
static int guc_action_vf_save_restore(struct xe_guc *guc, u32 vfid, u32 opcode,
@@ -115,8 +116,7 @@ static int pf_send_guc_restore_vf_state(struct xe_gt *gt, unsigned int vfid,
static bool pf_migration_supported(struct xe_gt *gt)
{
- xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt)));
- return gt->sriov.pf.migration.supported;
+ return xe_sriov_pf_migration_supported(gt_to_xe(gt));
}
static struct mutex *pf_migration_mutex(struct xe_gt *gt)
@@ -382,12 +382,6 @@ ssize_t xe_gt_sriov_pf_migration_write_guc_state(struct xe_gt *gt, unsigned int
}
#endif /* CONFIG_DEBUG_FS */
-static bool pf_check_migration_support(struct xe_gt *gt)
-{
- /* XXX: for now this is for feature enabling only */
- return IS_ENABLED(CONFIG_DRM_XE_DEBUG);
-}
-
/**
* xe_gt_sriov_pf_migration_init() - Initialize support for VF migration.
* @gt: the &xe_gt
@@ -403,8 +397,6 @@ int xe_gt_sriov_pf_migration_init(struct xe_gt *gt)
xe_gt_assert(gt, IS_SRIOV_PF(xe));
- gt->sriov.pf.migration.supported = pf_check_migration_support(gt);
-
if (!pf_migration_supported(gt))
return 0;
diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration_types.h b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration_types.h
index 1f3110b6d44fa..9d672feac5f04 100644
--- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration_types.h
+++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration_types.h
@@ -30,9 +30,6 @@ struct xe_gt_sriov_state_snapshot {
* Used by the PF driver to maintain non-VF specific per-GT data.
*/
struct xe_gt_sriov_pf_migration {
- /** @supported: indicates whether the feature is supported */
- bool supported;
-
/** @snapshot_lock: protects all VFs snapshots */
struct mutex snapshot_lock;
};
diff --git a/drivers/gpu/drm/xe/xe_sriov_pf.c b/drivers/gpu/drm/xe/xe_sriov_pf.c
index b8af93eb5b5f5..a6023c2e4b12d 100644
--- a/drivers/gpu/drm/xe/xe_sriov_pf.c
+++ b/drivers/gpu/drm/xe/xe_sriov_pf.c
@@ -15,6 +15,7 @@
#include "xe_sriov.h"
#include "xe_sriov_pf.h"
#include "xe_sriov_pf_helpers.h"
+#include "xe_sriov_pf_migration.h"
#include "xe_sriov_pf_service.h"
#include "xe_sriov_pf_sysfs.h"
#include "xe_sriov_printk.h"
@@ -102,6 +103,10 @@ int xe_sriov_pf_init_early(struct xe_device *xe)
if (err)
return err;
+ err = xe_sriov_pf_migration_init(xe);
+ if (err)
+ return err;
+
xe_sriov_pf_service_init(xe);
return 0;
diff --git a/drivers/gpu/drm/xe/xe_sriov_pf_migration.c b/drivers/gpu/drm/xe/xe_sriov_pf_migration.c
new file mode 100644
index 0000000000000..8c523c392f98b
--- /dev/null
+++ b/drivers/gpu/drm/xe/xe_sriov_pf_migration.c
@@ -0,0 +1,41 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2025 Intel Corporation
+ */
+
+#include "xe_sriov.h"
+#include "xe_sriov_pf_migration.h"
+
+/**
+ * xe_sriov_pf_migration_supported() - Check if SR-IOV VF migration is supported by the device
+ * @xe: the &xe_device
+ *
+ * Return: true if migration is supported, false otherwise
+ */
+bool xe_sriov_pf_migration_supported(struct xe_device *xe)
+{
+ xe_assert(xe, IS_SRIOV_PF(xe));
+
+ return xe->sriov.pf.migration.supported;
+}
+
+static bool pf_check_migration_support(struct xe_device *xe)
+{
+ /* XXX: for now this is for feature enabling only */
+ return IS_ENABLED(CONFIG_DRM_XE_DEBUG);
+}
+
+/**
+ * xe_sriov_pf_migration_init() - Initialize support for SR-IOV VF migration.
+ * @xe: the &xe_device
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int xe_sriov_pf_migration_init(struct xe_device *xe)
+{
+ xe_assert(xe, IS_SRIOV_PF(xe));
+
+ xe->sriov.pf.migration.supported = pf_check_migration_support(xe);
+
+ return 0;
+}
diff --git a/drivers/gpu/drm/xe/xe_sriov_pf_migration.h b/drivers/gpu/drm/xe/xe_sriov_pf_migration.h
new file mode 100644
index 0000000000000..d2b4a24165438
--- /dev/null
+++ b/drivers/gpu/drm/xe/xe_sriov_pf_migration.h
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2025 Intel Corporation
+ */
+
+#ifndef _XE_SRIOV_PF_MIGRATION_H_
+#define _XE_SRIOV_PF_MIGRATION_H_
+
+#include <linux/types.h>
+
+struct xe_device;
+
+int xe_sriov_pf_migration_init(struct xe_device *xe);
+bool xe_sriov_pf_migration_supported(struct xe_device *xe);
+
+#endif
diff --git a/drivers/gpu/drm/xe/xe_sriov_pf_migration_types.h b/drivers/gpu/drm/xe/xe_sriov_pf_migration_types.h
new file mode 100644
index 0000000000000..43ca60b8982c7
--- /dev/null
+++ b/drivers/gpu/drm/xe/xe_sriov_pf_migration_types.h
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2025 Intel Corporation
+ */
+
+#ifndef _XE_SRIOV_PF_MIGRATION_TYPES_H_
+#define _XE_SRIOV_PF_MIGRATION_TYPES_H_
+
+#include <linux/types.h>
+
+/**
+ * struct xe_sriov_pf_migration - Xe device level VF migration data
+ */
+struct xe_sriov_pf_migration {
+ /** @supported: indicates whether VF migration feature is supported */
+ bool supported;
+};
+
+#endif
diff --git a/drivers/gpu/drm/xe/xe_sriov_pf_types.h b/drivers/gpu/drm/xe/xe_sriov_pf_types.h
index b3cd9797194b0..b15d8ca2894c2 100644
--- a/drivers/gpu/drm/xe/xe_sriov_pf_types.h
+++ b/drivers/gpu/drm/xe/xe_sriov_pf_types.h
@@ -9,6 +9,7 @@
#include <linux/mutex.h>
#include <linux/types.h>
+#include "xe_sriov_pf_migration_types.h"
#include "xe_sriov_pf_provision_types.h"
#include "xe_sriov_pf_service_types.h"
@@ -44,6 +45,9 @@ struct xe_device_pf {
/** @provision: device level provisioning data. */
struct xe_sriov_pf_provision provision;
+ /** @migration: device level migration data. */
+ struct xe_sriov_pf_migration migration;
+
/** @service: device level service data. */
struct xe_sriov_pf_service service;
--
2.51.2
next prev parent reply other threads:[~2025-11-05 15:11 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-05 15:09 [PATCH v4 00/28] vfio/xe: Add driver variant for Xe VF migration Michał Winiarski
2025-11-05 15:09 ` [PATCH v4 01/28] drm/xe/pf: Remove GuC version check for migration support Michał Winiarski
2025-11-05 15:10 ` Michał Winiarski [this message]
2025-11-05 15:10 ` [PATCH v4 03/28] drm/xe/pf: Convert control state to bitmap Michał Winiarski
2025-11-05 18:51 ` Michal Wajdeczko
2025-11-05 15:10 ` [PATCH v4 04/28] drm/xe/pf: Add save/restore control state stubs and connect to debugfs Michał Winiarski
2025-11-05 15:10 ` [PATCH v4 05/28] drm/xe/pf: Add data structures and handlers for migration rings Michał Winiarski
2025-11-05 20:17 ` Michal Wajdeczko
2025-11-06 11:24 ` Michał Winiarski
2025-11-05 15:10 ` [PATCH v4 06/28] drm/xe/pf: Add helpers for migration data packet allocation / free Michał Winiarski
2025-11-05 21:12 ` Michal Wajdeczko
2025-11-06 11:30 ` Michał Winiarski
2025-11-05 15:10 ` [PATCH v4 07/28] drm/xe/pf: Add support for encap/decap of bitstream to/from packet Michał Winiarski
2025-11-05 15:10 ` [PATCH v4 08/28] drm/xe/pf: Add minimalistic migration descriptor Michał Winiarski
2025-11-05 15:10 ` [PATCH v4 09/28] drm/xe/pf: Expose VF migration data size over debugfs Michał Winiarski
2025-11-05 15:10 ` [PATCH v4 10/28] drm/xe: Add sa/guc_buf_cache sync interface Michał Winiarski
2025-11-05 15:10 ` [PATCH v4 11/28] drm/xe: Allow the caller to pass guc_buf_cache size Michał Winiarski
2025-11-05 15:10 ` [PATCH v4 12/28] drm/xe/pf: Increase PF GuC Buffer Cache size and use it for VF migration Michał Winiarski
2025-11-05 15:10 ` [PATCH v4 13/28] drm/xe/pf: Remove GuC migration data save/restore from GT debugfs Michał Winiarski
2025-11-05 15:10 ` [PATCH v4 14/28] drm/xe/pf: Don't save GuC VF migration data on pause Michał Winiarski
2025-11-05 15:10 ` [PATCH v4 15/28] drm/xe/pf: Switch VF migration GuC save/restore to struct migration data Michał Winiarski
2025-11-05 15:10 ` [PATCH v4 16/28] drm/xe/pf: Handle GuC migration data as part of PF control Michał Winiarski
2025-11-05 15:10 ` [PATCH v4 17/28] drm/xe/pf: Add helpers for VF GGTT migration data handling Michał Winiarski
2025-11-05 21:45 ` Michal Wajdeczko
2025-11-06 11:31 ` Michał Winiarski
2025-11-05 15:10 ` [PATCH v4 18/28] drm/xe/pf: Handle GGTT migration data as part of PF control Michał Winiarski
2025-11-05 15:10 ` [PATCH v4 19/28] drm/xe/pf: Handle MMIO " Michał Winiarski
2025-11-05 15:10 ` [PATCH v4 20/28] drm/xe/pf: Add helper to retrieve VF's LMEM object Michał Winiarski
2025-11-05 15:10 ` [PATCH v4 21/28] drm/xe/migrate: Add function to copy of VRAM data in chunks Michał Winiarski
2025-11-05 15:10 ` [PATCH v4 22/28] drm/xe/pf: Handle VRAM migration data as part of PF control Michał Winiarski
2025-11-08 4:31 ` Matthew Brost
2025-11-05 15:10 ` [PATCH v4 23/28] drm/xe/pf: Add wait helper for VF FLR Michał Winiarski
2025-11-05 15:10 ` [PATCH v4 24/28] drm/xe/pf: Enable SR-IOV VF migration Michał Winiarski
2025-11-05 15:10 ` [PATCH v4 25/28] drm/xe/pci: Introduce a helper to allow VF access to PF xe_device Michał Winiarski
2025-11-05 15:10 ` [PATCH v4 26/28] drm/xe/pf: Export helpers for VFIO Michał Winiarski
2025-11-05 15:10 ` [PATCH v4 27/28] drm/intel/bmg: Allow device ID usage with single-argument macros Michał Winiarski
2025-11-07 14:51 ` Lucas De Marchi
2025-11-05 15:10 ` [PATCH v4 28/28] vfio/xe: Add device specific vfio_pci driver variant for Intel graphics Michał Winiarski
2025-11-06 8:20 ` Tian, Kevin
2025-11-06 10:55 ` Winiarski, Michal
2025-11-07 3:10 ` Tian, Kevin
2025-11-08 0:47 ` Jason Gunthorpe
2025-11-08 1:05 ` Tian, Kevin
2025-11-08 1:11 ` Jason Gunthorpe
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=20251105151027.540712-3-michal.winiarski@intel.com \
--to=michal.winiarski@intel.com \
--cc=airlied@gmail.com \
--cc=alex@shazbot.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=hch@infradead.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=jgg@ziepe.ca \
--cc=joonas.lahtinen@linux.intel.com \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lucas.demarchi@intel.com \
--cc=lukasz.laguna@intel.com \
--cc=matthew.brost@intel.com \
--cc=michal.wajdeczko@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=simona@ffwll.ch \
--cc=skolothumtho@nvidia.com \
--cc=thomas.hellstrom@linux.intel.com \
--cc=tursulin@ursulin.net \
--cc=yishaih@nvidia.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;
as well as URLs for NNTP newsgroup(s).