[PATCH v2 22/26] drm/xe/pf: Handle VRAM migration data as part of PF control

Michał Winiarski posted 26 patches 3 months, 2 weeks ago
There is a newer version of this series
[PATCH v2 22/26] drm/xe/pf: Handle VRAM migration data as part of PF control
Posted by Michał Winiarski 3 months, 2 weeks ago
Connect the helpers to allow save and restore of VRAM migration data in
stop_copy / resume device state.

Co-developed-by: Lukasz Laguna <lukasz.laguna@intel.com>
Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
---
 drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c   |  18 ++
 .../gpu/drm/xe/xe_gt_sriov_pf_control_types.h |   2 +
 drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c | 222 ++++++++++++++++++
 drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.h |   6 +
 .../drm/xe/xe_gt_sriov_pf_migration_types.h   |   3 +
 drivers/gpu/drm/xe/xe_sriov_pf_control.c      |   3 +
 6 files changed, 254 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c
index e7156ad3d1839..680f2de44144b 100644
--- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c
+++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c
@@ -191,6 +191,7 @@ static const char *control_bit_to_string(enum xe_gt_sriov_control_bits bit)
 	CASE2STR(SAVE_DATA_GUC);
 	CASE2STR(SAVE_DATA_GGTT);
 	CASE2STR(SAVE_DATA_MMIO);
+	CASE2STR(SAVE_DATA_VRAM);
 	CASE2STR(SAVE_DATA_DONE);
 	CASE2STR(SAVE_FAILED);
 	CASE2STR(SAVED);
@@ -832,6 +833,7 @@ static void pf_exit_vf_save_wip(struct xe_gt *gt, unsigned int vfid)
 		pf_escape_vf_state(gt, vfid, XE_GT_SRIOV_STATE_SAVE_DATA_GGTT);
 		pf_escape_vf_state(gt, vfid, XE_GT_SRIOV_STATE_SAVE_DATA_MMIO);
 		pf_escape_vf_state(gt, vfid, XE_GT_SRIOV_STATE_SAVE_DATA_DONE);
+		pf_escape_vf_state(gt, vfid, XE_GT_SRIOV_STATE_SAVE_DATA_VRAM);
 	}
 }
 
@@ -885,6 +887,19 @@ static int pf_handle_vf_save_data(struct xe_gt *gt, unsigned int vfid)
 		ret = xe_gt_sriov_pf_migration_mmio_save(gt, vfid);
 		if (ret)
 			return ret;
+
+		pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_SAVE_DATA_VRAM);
+		return -EAGAIN;
+	}
+
+	if (pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_SAVE_DATA_VRAM)) {
+		if (xe_gt_sriov_pf_migration_vram_size(gt, vfid) > 0) {
+			ret = xe_gt_sriov_pf_migration_vram_save(gt, vfid);
+			if (ret == -EAGAIN)
+				pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_SAVE_DATA_VRAM);
+			if (ret)
+				return ret;
+		}
 	}
 
 	return 0;
@@ -1100,6 +1115,9 @@ pf_handle_vf_restore_data(struct xe_gt *gt, unsigned int vfid)
 	case XE_SRIOV_MIGRATION_DATA_TYPE_GUC:
 		ret = xe_gt_sriov_pf_migration_guc_restore(gt, vfid, data);
 		break;
+	case XE_SRIOV_MIGRATION_DATA_TYPE_VRAM:
+		ret = xe_gt_sriov_pf_migration_vram_restore(gt, vfid, data);
+		break;
 	default:
 		xe_gt_sriov_notice(gt, "Skipping VF%u unknown data type: %d\n", vfid, data->type);
 		break;
diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_control_types.h b/drivers/gpu/drm/xe/xe_gt_sriov_pf_control_types.h
index 9dfcebd5078ac..fba10136f7cc7 100644
--- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_control_types.h
+++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_control_types.h
@@ -36,6 +36,7 @@
  * @XE_GT_SRIOV_STATE_SAVE_DATA_GUC: indicates PF needs to save VF GuC migration data.
  * @XE_GT_SRIOV_STATE_SAVE_DATA_GGTT: indicates PF needs to save VF GGTT migration data.
  * @XE_GT_SRIOV_STATE_SAVE_DATA_MMIO: indicates PF needs to save VF MMIO migration data.
+ * @XE_GT_SRIOV_STATE_SAVE_DATA_VRAM: indicates PF needs to save VF VRAM migration data.
  * @XE_GT_SRIOV_STATE_SAVE_DATA_DONE: indicates that all migration data was produced by Xe.
  * @XE_GT_SRIOV_STATE_SAVE_FAILED: indicates that VF save operation has failed.
  * @XE_GT_SRIOV_STATE_SAVED: indicates that VF data is saved.
@@ -82,6 +83,7 @@ enum xe_gt_sriov_control_bits {
 	XE_GT_SRIOV_STATE_SAVE_DATA_GUC,
 	XE_GT_SRIOV_STATE_SAVE_DATA_GGTT,
 	XE_GT_SRIOV_STATE_SAVE_DATA_MMIO,
+	XE_GT_SRIOV_STATE_SAVE_DATA_VRAM,
 	XE_GT_SRIOV_STATE_SAVE_DATA_DONE,
 	XE_GT_SRIOV_STATE_SAVE_FAILED,
 	XE_GT_SRIOV_STATE_SAVED,
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 41335b15ffdbe..2c6a86d98ee31 100644
--- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c
+++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c
@@ -17,6 +17,7 @@
 #include "xe_gt_sriov_printk.h"
 #include "xe_guc_buf.h"
 #include "xe_guc_ct.h"
+#include "xe_migrate.h"
 #include "xe_sriov.h"
 #include "xe_sriov_migration_data.h"
 #include "xe_sriov_pf_migration.h"
@@ -485,6 +486,220 @@ int xe_gt_sriov_pf_migration_mmio_restore(struct xe_gt *gt, unsigned int vfid,
 	return pf_restore_vf_mmio_mig_data(gt, vfid, data);
 }
 
+/**
+ * xe_gt_sriov_pf_migration_vram_size() - Get the size of VF VRAM migration data.
+ * @gt: the &xe_gt
+ * @vfid: the VF identifier
+ *
+ * This function is for PF only.
+ *
+ * Return: size in bytes or a negative error code on failure.
+ */
+ssize_t xe_gt_sriov_pf_migration_vram_size(struct xe_gt *gt, unsigned int vfid)
+{
+	if (gt != xe_root_mmio_gt(gt_to_xe(gt)))
+		return 0;
+
+	return xe_gt_sriov_pf_config_get_lmem(gt, vfid);
+}
+
+static struct dma_fence *__pf_save_restore_vram(struct xe_gt *gt, unsigned int vfid,
+						struct xe_bo *vram, u64 vram_offset,
+						struct xe_bo *sysmem, u64 sysmem_offset,
+						size_t size, bool save)
+{
+	struct dma_fence *ret = NULL;
+	struct drm_exec exec;
+	int err;
+
+	drm_exec_init(&exec, DRM_EXEC_INTERRUPTIBLE_WAIT, 0);
+	drm_exec_until_all_locked(&exec) {
+		err = drm_exec_lock_obj(&exec, &vram->ttm.base);
+		drm_exec_retry_on_contention(&exec);
+		if (err) {
+			ret = ERR_PTR(err);
+			goto err;
+		}
+
+		err = drm_exec_lock_obj(&exec, &sysmem->ttm.base);
+		drm_exec_retry_on_contention(&exec);
+		if (err) {
+			ret = ERR_PTR(err);
+			goto err;
+		}
+	}
+
+	ret = xe_migrate_vram_copy_chunk(vram, vram_offset, sysmem, sysmem_offset, size,
+					 save ? XE_MIGRATE_COPY_TO_SRAM : XE_MIGRATE_COPY_TO_VRAM);
+
+err:
+	drm_exec_fini(&exec);
+
+	return ret;
+}
+
+static int pf_save_vram_chunk(struct xe_gt *gt, unsigned int vfid,
+			      struct xe_bo *src_vram, u64 src_vram_offset,
+			      size_t size)
+{
+	struct xe_sriov_migration_data *data;
+	struct dma_fence *fence;
+	int ret;
+
+	data = xe_sriov_migration_data_alloc(gt_to_xe(gt));
+	if (!data)
+		return -ENOMEM;
+
+	ret = xe_sriov_migration_data_init(data, gt->tile->id, gt->info.id,
+					   XE_SRIOV_MIGRATION_DATA_TYPE_VRAM,
+					   src_vram_offset, size);
+	if (ret)
+		goto fail;
+
+	fence = __pf_save_restore_vram(gt, vfid,
+				       src_vram, src_vram_offset,
+				       data->bo, 0, size, true);
+
+	ret = dma_fence_wait_timeout(fence, false, 5 * HZ);
+	dma_fence_put(fence);
+	if (!ret) {
+		ret = -ETIME;
+		goto fail;
+	}
+
+	pf_dump_mig_data(gt, vfid, data);
+
+	ret = xe_gt_sriov_pf_migration_save_produce(gt, vfid, data);
+	if (ret)
+		goto fail;
+
+	return 0;
+
+fail:
+	xe_sriov_migration_data_free(data);
+	return ret;
+}
+
+#define VF_VRAM_STATE_CHUNK_MAX_SIZE SZ_512M
+static int pf_save_vf_vram_mig_data(struct xe_gt *gt, unsigned int vfid)
+{
+	struct xe_gt_sriov_migration_data *migration = pf_pick_gt_migration(gt, vfid);
+	loff_t *offset = &migration->vram_save_offset;
+	struct xe_bo *vram;
+	size_t vram_size, chunk_size;
+	int ret;
+
+	vram = xe_gt_sriov_pf_config_get_lmem_obj(gt, vfid);
+	if (!vram)
+		return -ENXIO;
+
+	vram_size = xe_bo_size(vram);
+	chunk_size = min(vram_size - *offset, VF_VRAM_STATE_CHUNK_MAX_SIZE);
+
+	ret = pf_save_vram_chunk(gt, vfid, vram, *offset, chunk_size);
+	if (ret)
+		goto fail;
+
+	*offset += chunk_size;
+
+	xe_bo_put(vram);
+
+	if (*offset < vram_size)
+		return -EAGAIN;
+
+	return 0;
+
+fail:
+	xe_bo_put(vram);
+	xe_gt_sriov_err(gt, "Failed to save VF%u VRAM data (%pe)\n", vfid, ERR_PTR(ret));
+	return ret;
+}
+
+static int pf_restore_vf_vram_mig_data(struct xe_gt *gt, unsigned int vfid,
+				       struct xe_sriov_migration_data *data)
+{
+	u64 end = data->hdr.offset + data->hdr.size;
+	struct dma_fence *fence;
+	struct xe_bo *vram;
+	size_t size;
+	int ret = 0;
+
+	vram = xe_gt_sriov_pf_config_get_lmem_obj(gt, vfid);
+	if (!vram)
+		return -ENXIO;
+
+	size = xe_bo_size(vram);
+
+	if (end > size || end < data->hdr.size) {
+		ret = -EINVAL;
+		goto err;
+	}
+
+	pf_dump_mig_data(gt, vfid, data);
+
+	fence = __pf_save_restore_vram(gt, vfid, vram, data->hdr.offset,
+				       data->bo, 0, data->hdr.size, false);
+	ret = dma_fence_wait_timeout(fence, false, 5 * HZ);
+	dma_fence_put(fence);
+	if (!ret) {
+		ret = -ETIME;
+		goto err;
+	}
+
+	return 0;
+err:
+	xe_bo_put(vram);
+	xe_gt_sriov_err(gt, "Failed to restore VF%u VRAM data (%pe)\n", vfid, ERR_PTR(ret));
+	return ret;
+}
+
+/**
+ * xe_gt_sriov_pf_migration_vram_save() - Save VF VRAM migration data.
+ * @gt: the &xe_gt
+ * @vfid: the VF identifier (can't be 0)
+ *
+ * This function is for PF only.
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int xe_gt_sriov_pf_migration_vram_save(struct xe_gt *gt, unsigned int vfid)
+{
+	xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt)));
+	xe_gt_assert(gt, vfid != PFID);
+	xe_gt_assert(gt, vfid <= xe_sriov_pf_get_totalvfs(gt_to_xe(gt)));
+
+	return pf_save_vf_vram_mig_data(gt, vfid);
+}
+
+/**
+ * xe_gt_sriov_pf_migration_vram_restore() - Restore VF VRAM migration data.
+ * @gt: the &xe_gt
+ * @vfid: the VF identifier (can't be 0)
+ *
+ * This function is for PF only.
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int xe_gt_sriov_pf_migration_vram_restore(struct xe_gt *gt, unsigned int vfid,
+					  struct xe_sriov_migration_data *data)
+{
+	xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt)));
+	xe_gt_assert(gt, vfid != PFID);
+	xe_gt_assert(gt, vfid <= xe_sriov_pf_get_totalvfs(gt_to_xe(gt)));
+
+	return pf_restore_vf_vram_mig_data(gt, vfid, data);
+}
+
+/**
+ * xe_gt_sriov_pf_migration_save_init() - Initialize per-GT migration related data.
+ * @gt: the &xe_gt
+ * @vfid: the VF identifier (can't be 0)
+ */
+void xe_gt_sriov_pf_migration_save_init(struct xe_gt *gt, unsigned int vfid)
+{
+	pf_pick_gt_migration(gt, vfid)->vram_save_offset = 0;
+}
+
 /**
  * xe_gt_sriov_pf_migration_size() - Total size of migration data from all components within a GT.
  * @gt: the &xe_gt
@@ -522,6 +737,13 @@ ssize_t xe_gt_sriov_pf_migration_size(struct xe_gt *gt, unsigned int vfid)
 		size += sizeof(struct xe_sriov_pf_migration_hdr);
 	total += size;
 
+	size = xe_gt_sriov_pf_migration_vram_size(gt, vfid);
+	if (size < 0)
+		return size;
+	else if (size > 0)
+		size += sizeof(struct xe_sriov_pf_migration_hdr);
+	total += size;
+
 	return total;
 }
 
diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.h b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.h
index 24a233c4cd0bb..ca518eda5429f 100644
--- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.h
+++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.h
@@ -27,6 +27,12 @@ ssize_t xe_gt_sriov_pf_migration_mmio_size(struct xe_gt *gt, unsigned int vfid);
 int xe_gt_sriov_pf_migration_mmio_save(struct xe_gt *gt, unsigned int vfid);
 int xe_gt_sriov_pf_migration_mmio_restore(struct xe_gt *gt, unsigned int vfid,
 					  struct xe_sriov_migration_data *data);
+ssize_t xe_gt_sriov_pf_migration_vram_size(struct xe_gt *gt, unsigned int vfid);
+int xe_gt_sriov_pf_migration_vram_save(struct xe_gt *gt, unsigned int vfid);
+int xe_gt_sriov_pf_migration_vram_restore(struct xe_gt *gt, unsigned int vfid,
+					  struct xe_sriov_migration_data *data);
+
+void xe_gt_sriov_pf_migration_save_init(struct xe_gt *gt, unsigned int vfid);
 
 ssize_t xe_gt_sriov_pf_migration_size(struct xe_gt *gt, unsigned int vfid);
 
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 75d8b94cbbefb..39a940c9b0a4b 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
@@ -16,6 +16,9 @@
 struct xe_gt_sriov_migration_data {
 	/** @ring: queue containing VF save / restore migration data */
 	struct ptr_ring ring;
+
+	/** @vram_save_offset: offset within VRAM, used for chunked VRAM save */
+	loff_t vram_save_offset;
 };
 
 #endif
diff --git a/drivers/gpu/drm/xe/xe_sriov_pf_control.c b/drivers/gpu/drm/xe/xe_sriov_pf_control.c
index c2768848daba1..aac8ecb861545 100644
--- a/drivers/gpu/drm/xe/xe_sriov_pf_control.c
+++ b/drivers/gpu/drm/xe/xe_sriov_pf_control.c
@@ -5,6 +5,7 @@
 
 #include "xe_device.h"
 #include "xe_gt_sriov_pf_control.h"
+#include "xe_gt_sriov_pf_migration.h"
 #include "xe_sriov_migration_data.h"
 #include "xe_sriov_pf_control.h"
 #include "xe_sriov_printk.h"
@@ -171,6 +172,8 @@ int xe_sriov_pf_control_trigger_save_vf(struct xe_device *xe, unsigned int vfid)
 		return ret;
 
 	for_each_gt(gt, xe, id) {
+		xe_gt_sriov_pf_migration_save_init(gt, vfid);
+
 		ret = xe_gt_sriov_pf_control_trigger_save_vf(gt, vfid);
 		if (ret)
 			return ret;
-- 
2.50.1

Re: [PATCH v2 22/26] drm/xe/pf: Handle VRAM migration data as part of PF control
Posted by Michal Wajdeczko 3 months, 2 weeks ago

On 10/22/2025 12:41 AM, Michał Winiarski wrote:
> Connect the helpers to allow save and restore of VRAM migration data in
> stop_copy / resume device state.
> 
> Co-developed-by: Lukasz Laguna <lukasz.laguna@intel.com>
> Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
> Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c   |  18 ++
>  .../gpu/drm/xe/xe_gt_sriov_pf_control_types.h |   2 +
>  drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c | 222 ++++++++++++++++++
>  drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.h |   6 +
>  .../drm/xe/xe_gt_sriov_pf_migration_types.h   |   3 +
>  drivers/gpu/drm/xe/xe_sriov_pf_control.c      |   3 +
>  6 files changed, 254 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c
> index e7156ad3d1839..680f2de44144b 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c
> @@ -191,6 +191,7 @@ static const char *control_bit_to_string(enum xe_gt_sriov_control_bits bit)
>  	CASE2STR(SAVE_DATA_GUC);
>  	CASE2STR(SAVE_DATA_GGTT);
>  	CASE2STR(SAVE_DATA_MMIO);
> +	CASE2STR(SAVE_DATA_VRAM);
>  	CASE2STR(SAVE_DATA_DONE);
>  	CASE2STR(SAVE_FAILED);
>  	CASE2STR(SAVED);
> @@ -832,6 +833,7 @@ static void pf_exit_vf_save_wip(struct xe_gt *gt, unsigned int vfid)
>  		pf_escape_vf_state(gt, vfid, XE_GT_SRIOV_STATE_SAVE_DATA_GGTT);
>  		pf_escape_vf_state(gt, vfid, XE_GT_SRIOV_STATE_SAVE_DATA_MMIO);
>  		pf_escape_vf_state(gt, vfid, XE_GT_SRIOV_STATE_SAVE_DATA_DONE);
> +		pf_escape_vf_state(gt, vfid, XE_GT_SRIOV_STATE_SAVE_DATA_VRAM);
>  	}
>  }
>  
> @@ -885,6 +887,19 @@ static int pf_handle_vf_save_data(struct xe_gt *gt, unsigned int vfid)
>  		ret = xe_gt_sriov_pf_migration_mmio_save(gt, vfid);
>  		if (ret)
>  			return ret;
> +
> +		pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_SAVE_DATA_VRAM);
> +		return -EAGAIN;
> +	}
> +
> +	if (pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_SAVE_DATA_VRAM)) {
> +		if (xe_gt_sriov_pf_migration_vram_size(gt, vfid) > 0) {
> +			ret = xe_gt_sriov_pf_migration_vram_save(gt, vfid);
> +			if (ret == -EAGAIN)
> +				pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_SAVE_DATA_VRAM);
> +			if (ret)
> +				return ret;
> +		}
>  	}
>  
>  	return 0;
> @@ -1100,6 +1115,9 @@ pf_handle_vf_restore_data(struct xe_gt *gt, unsigned int vfid)
>  	case XE_SRIOV_MIGRATION_DATA_TYPE_GUC:
>  		ret = xe_gt_sriov_pf_migration_guc_restore(gt, vfid, data);
>  		break;
> +	case XE_SRIOV_MIGRATION_DATA_TYPE_VRAM:
> +		ret = xe_gt_sriov_pf_migration_vram_restore(gt, vfid, data);
> +		break;
>  	default:
>  		xe_gt_sriov_notice(gt, "Skipping VF%u unknown data type: %d\n", vfid, data->type);
>  		break;
> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_control_types.h b/drivers/gpu/drm/xe/xe_gt_sriov_pf_control_types.h
> index 9dfcebd5078ac..fba10136f7cc7 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_control_types.h
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_control_types.h
> @@ -36,6 +36,7 @@
>   * @XE_GT_SRIOV_STATE_SAVE_DATA_GUC: indicates PF needs to save VF GuC migration data.
>   * @XE_GT_SRIOV_STATE_SAVE_DATA_GGTT: indicates PF needs to save VF GGTT migration data.
>   * @XE_GT_SRIOV_STATE_SAVE_DATA_MMIO: indicates PF needs to save VF MMIO migration data.
> + * @XE_GT_SRIOV_STATE_SAVE_DATA_VRAM: indicates PF needs to save VF VRAM migration data.
>   * @XE_GT_SRIOV_STATE_SAVE_DATA_DONE: indicates that all migration data was produced by Xe.
>   * @XE_GT_SRIOV_STATE_SAVE_FAILED: indicates that VF save operation has failed.
>   * @XE_GT_SRIOV_STATE_SAVED: indicates that VF data is saved.
> @@ -82,6 +83,7 @@ enum xe_gt_sriov_control_bits {
>  	XE_GT_SRIOV_STATE_SAVE_DATA_GUC,
>  	XE_GT_SRIOV_STATE_SAVE_DATA_GGTT,
>  	XE_GT_SRIOV_STATE_SAVE_DATA_MMIO,
> +	XE_GT_SRIOV_STATE_SAVE_DATA_VRAM,
>  	XE_GT_SRIOV_STATE_SAVE_DATA_DONE,
>  	XE_GT_SRIOV_STATE_SAVE_FAILED,
>  	XE_GT_SRIOV_STATE_SAVED,
> 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 41335b15ffdbe..2c6a86d98ee31 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c
> @@ -17,6 +17,7 @@
>  #include "xe_gt_sriov_printk.h"
>  #include "xe_guc_buf.h"
>  #include "xe_guc_ct.h"
> +#include "xe_migrate.h"
>  #include "xe_sriov.h"
>  #include "xe_sriov_migration_data.h"
>  #include "xe_sriov_pf_migration.h"
> @@ -485,6 +486,220 @@ int xe_gt_sriov_pf_migration_mmio_restore(struct xe_gt *gt, unsigned int vfid,
>  	return pf_restore_vf_mmio_mig_data(gt, vfid, data);
>  }
>  
> +/**
> + * xe_gt_sriov_pf_migration_vram_size() - Get the size of VF VRAM migration data.
> + * @gt: the &xe_gt
> + * @vfid: the VF identifier
> + *
> + * This function is for PF only.
> + *
> + * Return: size in bytes or a negative error code on failure.
> + */
> +ssize_t xe_gt_sriov_pf_migration_vram_size(struct xe_gt *gt, unsigned int vfid)
> +{
> +	if (gt != xe_root_mmio_gt(gt_to_xe(gt)))

probably you mean

	if (!xe_gt_is_main_type(gt))

> +		return 0;
> +
> +	return xe_gt_sriov_pf_config_get_lmem(gt, vfid);
> +}
> +
> +static struct dma_fence *__pf_save_restore_vram(struct xe_gt *gt, unsigned int vfid,
> +						struct xe_bo *vram, u64 vram_offset,
> +						struct xe_bo *sysmem, u64 sysmem_offset,
> +						size_t size, bool save)
> +{
> +	struct dma_fence *ret = NULL;
> +	struct drm_exec exec;
> +	int err;
> +
> +	drm_exec_init(&exec, DRM_EXEC_INTERRUPTIBLE_WAIT, 0);
> +	drm_exec_until_all_locked(&exec) {
> +		err = drm_exec_lock_obj(&exec, &vram->ttm.base);
> +		drm_exec_retry_on_contention(&exec);
> +		if (err) {
> +			ret = ERR_PTR(err);
> +			goto err;
> +		}
> +
> +		err = drm_exec_lock_obj(&exec, &sysmem->ttm.base);
> +		drm_exec_retry_on_contention(&exec);
> +		if (err) {
> +			ret = ERR_PTR(err);
> +			goto err;
> +		}
> +	}
> +
> +	ret = xe_migrate_vram_copy_chunk(vram, vram_offset, sysmem, sysmem_offset, size,
> +					 save ? XE_MIGRATE_COPY_TO_SRAM : XE_MIGRATE_COPY_TO_VRAM);
> +
> +err:
> +	drm_exec_fini(&exec);
> +
> +	return ret;
> +}
> +
> +static int pf_save_vram_chunk(struct xe_gt *gt, unsigned int vfid,
> +			      struct xe_bo *src_vram, u64 src_vram_offset,
> +			      size_t size)
> +{
> +	struct xe_sriov_migration_data *data;
> +	struct dma_fence *fence;
> +	int ret;
> +
> +	data = xe_sriov_migration_data_alloc(gt_to_xe(gt));
> +	if (!data)
> +		return -ENOMEM;
> +
> +	ret = xe_sriov_migration_data_init(data, gt->tile->id, gt->info.id,
> +					   XE_SRIOV_MIGRATION_DATA_TYPE_VRAM,
> +					   src_vram_offset, size);
> +	if (ret)
> +		goto fail;
> +
> +	fence = __pf_save_restore_vram(gt, vfid,
> +				       src_vram, src_vram_offset,
> +				       data->bo, 0, size, true);
> +
> +	ret = dma_fence_wait_timeout(fence, false, 5 * HZ);
> +	dma_fence_put(fence);
> +	if (!ret) {
> +		ret = -ETIME;
> +		goto fail;
> +	}
> +
> +	pf_dump_mig_data(gt, vfid, data);
> +
> +	ret = xe_gt_sriov_pf_migration_save_produce(gt, vfid, data);
> +	if (ret)
> +		goto fail;
> +
> +	return 0;
> +
> +fail:
> +	xe_sriov_migration_data_free(data);
> +	return ret;
> +}
> +
> +#define VF_VRAM_STATE_CHUNK_MAX_SIZE SZ_512M
> +static int pf_save_vf_vram_mig_data(struct xe_gt *gt, unsigned int vfid)
> +{
> +	struct xe_gt_sriov_migration_data *migration = pf_pick_gt_migration(gt, vfid);
> +	loff_t *offset = &migration->vram_save_offset;
> +	struct xe_bo *vram;
> +	size_t vram_size, chunk_size;
> +	int ret;
> +
> +	vram = xe_gt_sriov_pf_config_get_lmem_obj(gt, vfid);
> +	if (!vram)
> +		return -ENXIO;

no error message ?

> +
> +	vram_size = xe_bo_size(vram);
> +	chunk_size = min(vram_size - *offset, VF_VRAM_STATE_CHUNK_MAX_SIZE);

what if *offset > vram_size ?

> +
> +	ret = pf_save_vram_chunk(gt, vfid, vram, *offset, chunk_size);
> +	if (ret)
> +		goto fail;
> +
> +	*offset += chunk_size;
> +
> +	xe_bo_put(vram);
> +
> +	if (*offset < vram_size)
> +		return -EAGAIN;
> +
> +	return 0;
> +
> +fail:
> +	xe_bo_put(vram);
> +	xe_gt_sriov_err(gt, "Failed to save VF%u VRAM data (%pe)\n", vfid, ERR_PTR(ret));
> +	return ret;
> +}
> +
> +static int pf_restore_vf_vram_mig_data(struct xe_gt *gt, unsigned int vfid,
> +				       struct xe_sriov_migration_data *data)
> +{
> +	u64 end = data->hdr.offset + data->hdr.size;
> +	struct dma_fence *fence;
> +	struct xe_bo *vram;
> +	size_t size;
> +	int ret = 0;
> +
> +	vram = xe_gt_sriov_pf_config_get_lmem_obj(gt, vfid);
> +	if (!vram)
> +		return -ENXIO;

no error message ? other errors are reported

> +
> +	size = xe_bo_size(vram);
> +
> +	if (end > size || end < data->hdr.size) {
> +		ret = -EINVAL;
> +		goto err;
> +	}
> +
> +	pf_dump_mig_data(gt, vfid, data);
> +
> +	fence = __pf_save_restore_vram(gt, vfid, vram, data->hdr.offset,
> +				       data->bo, 0, data->hdr.size, false);
> +	ret = dma_fence_wait_timeout(fence, false, 5 * HZ);

define this timeout at least as macro (if not as helper function, as this might be platform/settings specific)

> +	dma_fence_put(fence);
> +	if (!ret) {
> +		ret = -ETIME;
> +		goto err;
> +	}
> +
> +	return 0;
> +err:
> +	xe_bo_put(vram);
> +	xe_gt_sriov_err(gt, "Failed to restore VF%u VRAM data (%pe)\n", vfid, ERR_PTR(ret));
> +	return ret;
> +}
> +
> +/**
> + * xe_gt_sriov_pf_migration_vram_save() - Save VF VRAM migration data.
> + * @gt: the &xe_gt
> + * @vfid: the VF identifier (can't be 0)
> + *
> + * This function is for PF only.
> + *
> + * Return: 0 on success or a negative error code on failure.
> + */
> +int xe_gt_sriov_pf_migration_vram_save(struct xe_gt *gt, unsigned int vfid)
> +{
> +	xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt)));
> +	xe_gt_assert(gt, vfid != PFID);
> +	xe_gt_assert(gt, vfid <= xe_sriov_pf_get_totalvfs(gt_to_xe(gt)));
> +
> +	return pf_save_vf_vram_mig_data(gt, vfid);
> +}
> +
> +/**
> + * xe_gt_sriov_pf_migration_vram_restore() - Restore VF VRAM migration data.
> + * @gt: the &xe_gt
> + * @vfid: the VF identifier (can't be 0)
> + *
> + * This function is for PF only.
> + *
> + * Return: 0 on success or a negative error code on failure.
> + */
> +int xe_gt_sriov_pf_migration_vram_restore(struct xe_gt *gt, unsigned int vfid,
> +					  struct xe_sriov_migration_data *data)
> +{
> +	xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt)));
> +	xe_gt_assert(gt, vfid != PFID);
> +	xe_gt_assert(gt, vfid <= xe_sriov_pf_get_totalvfs(gt_to_xe(gt)));
> +
> +	return pf_restore_vf_vram_mig_data(gt, vfid, data);
> +}
> +
> +/**
> + * xe_gt_sriov_pf_migration_save_init() - Initialize per-GT migration related data.
> + * @gt: the &xe_gt
> + * @vfid: the VF identifier (can't be 0)
> + */
> +void xe_gt_sriov_pf_migration_save_init(struct xe_gt *gt, unsigned int vfid)
> +{
> +	pf_pick_gt_migration(gt, vfid)->vram_save_offset = 0;
> +}
> +
>  /**
>   * xe_gt_sriov_pf_migration_size() - Total size of migration data from all components within a GT.
>   * @gt: the &xe_gt
> @@ -522,6 +737,13 @@ ssize_t xe_gt_sriov_pf_migration_size(struct xe_gt *gt, unsigned int vfid)
>  		size += sizeof(struct xe_sriov_pf_migration_hdr);
>  	total += size;
>  
> +	size = xe_gt_sriov_pf_migration_vram_size(gt, vfid);
> +	if (size < 0)
> +		return size;
> +	else if (size > 0)

"else" not needed

> +		size += sizeof(struct xe_sriov_pf_migration_hdr);
> +	total += size;
> +
>  	return total;
>  }
>  
> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.h b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.h
> index 24a233c4cd0bb..ca518eda5429f 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.h
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.h
> @@ -27,6 +27,12 @@ ssize_t xe_gt_sriov_pf_migration_mmio_size(struct xe_gt *gt, unsigned int vfid);
>  int xe_gt_sriov_pf_migration_mmio_save(struct xe_gt *gt, unsigned int vfid);
>  int xe_gt_sriov_pf_migration_mmio_restore(struct xe_gt *gt, unsigned int vfid,
>  					  struct xe_sriov_migration_data *data);
> +ssize_t xe_gt_sriov_pf_migration_vram_size(struct xe_gt *gt, unsigned int vfid);
> +int xe_gt_sriov_pf_migration_vram_save(struct xe_gt *gt, unsigned int vfid);
> +int xe_gt_sriov_pf_migration_vram_restore(struct xe_gt *gt, unsigned int vfid,
> +					  struct xe_sriov_migration_data *data);
> +
> +void xe_gt_sriov_pf_migration_save_init(struct xe_gt *gt, unsigned int vfid);
>  
>  ssize_t xe_gt_sriov_pf_migration_size(struct xe_gt *gt, unsigned int vfid);
>  
> 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 75d8b94cbbefb..39a940c9b0a4b 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
> @@ -16,6 +16,9 @@
>  struct xe_gt_sriov_migration_data {
>  	/** @ring: queue containing VF save / restore migration data */
>  	struct ptr_ring ring;
> +
> +	/** @vram_save_offset: offset within VRAM, used for chunked VRAM save */

"last saved offset" ?
> +	loff_t vram_save_offset;
>  };
>  
>  #endif
> diff --git a/drivers/gpu/drm/xe/xe_sriov_pf_control.c b/drivers/gpu/drm/xe/xe_sriov_pf_control.c
> index c2768848daba1..aac8ecb861545 100644
> --- a/drivers/gpu/drm/xe/xe_sriov_pf_control.c
> +++ b/drivers/gpu/drm/xe/xe_sriov_pf_control.c
> @@ -5,6 +5,7 @@
>  
>  #include "xe_device.h"
>  #include "xe_gt_sriov_pf_control.h"
> +#include "xe_gt_sriov_pf_migration.h"
>  #include "xe_sriov_migration_data.h"
>  #include "xe_sriov_pf_control.h"
>  #include "xe_sriov_printk.h"
> @@ -171,6 +172,8 @@ int xe_sriov_pf_control_trigger_save_vf(struct xe_device *xe, unsigned int vfid)
>  		return ret;
>  
>  	for_each_gt(gt, xe, id) {
> +		xe_gt_sriov_pf_migration_save_init(gt, vfid);
> +
>  		ret = xe_gt_sriov_pf_control_trigger_save_vf(gt, vfid);
>  		if (ret)
>  			return ret;

Re: [PATCH v2 22/26] drm/xe/pf: Handle VRAM migration data as part of PF control
Posted by Michał Winiarski 3 months, 1 week ago
On Thu, Oct 23, 2025 at 09:54:02PM +0200, Michal Wajdeczko wrote:
> 
> 
> On 10/22/2025 12:41 AM, Michał Winiarski wrote:
> > Connect the helpers to allow save and restore of VRAM migration data in
> > stop_copy / resume device state.
> > 
> > Co-developed-by: Lukasz Laguna <lukasz.laguna@intel.com>
> > Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
> > Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
> > ---
> >  drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c   |  18 ++
> >  .../gpu/drm/xe/xe_gt_sriov_pf_control_types.h |   2 +
> >  drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c | 222 ++++++++++++++++++
> >  drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.h |   6 +
> >  .../drm/xe/xe_gt_sriov_pf_migration_types.h   |   3 +
> >  drivers/gpu/drm/xe/xe_sriov_pf_control.c      |   3 +
> >  6 files changed, 254 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c
> > index e7156ad3d1839..680f2de44144b 100644
> > --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c
> > +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c
> > @@ -191,6 +191,7 @@ static const char *control_bit_to_string(enum xe_gt_sriov_control_bits bit)
> >  	CASE2STR(SAVE_DATA_GUC);
> >  	CASE2STR(SAVE_DATA_GGTT);
> >  	CASE2STR(SAVE_DATA_MMIO);
> > +	CASE2STR(SAVE_DATA_VRAM);
> >  	CASE2STR(SAVE_DATA_DONE);
> >  	CASE2STR(SAVE_FAILED);
> >  	CASE2STR(SAVED);
> > @@ -832,6 +833,7 @@ static void pf_exit_vf_save_wip(struct xe_gt *gt, unsigned int vfid)
> >  		pf_escape_vf_state(gt, vfid, XE_GT_SRIOV_STATE_SAVE_DATA_GGTT);
> >  		pf_escape_vf_state(gt, vfid, XE_GT_SRIOV_STATE_SAVE_DATA_MMIO);
> >  		pf_escape_vf_state(gt, vfid, XE_GT_SRIOV_STATE_SAVE_DATA_DONE);
> > +		pf_escape_vf_state(gt, vfid, XE_GT_SRIOV_STATE_SAVE_DATA_VRAM);
> >  	}
> >  }
> >  
> > @@ -885,6 +887,19 @@ static int pf_handle_vf_save_data(struct xe_gt *gt, unsigned int vfid)
> >  		ret = xe_gt_sriov_pf_migration_mmio_save(gt, vfid);
> >  		if (ret)
> >  			return ret;
> > +
> > +		pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_SAVE_DATA_VRAM);
> > +		return -EAGAIN;
> > +	}
> > +
> > +	if (pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_SAVE_DATA_VRAM)) {
> > +		if (xe_gt_sriov_pf_migration_vram_size(gt, vfid) > 0) {
> > +			ret = xe_gt_sriov_pf_migration_vram_save(gt, vfid);
> > +			if (ret == -EAGAIN)
> > +				pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_SAVE_DATA_VRAM);
> > +			if (ret)
> > +				return ret;
> > +		}
> >  	}
> >  
> >  	return 0;
> > @@ -1100,6 +1115,9 @@ pf_handle_vf_restore_data(struct xe_gt *gt, unsigned int vfid)
> >  	case XE_SRIOV_MIGRATION_DATA_TYPE_GUC:
> >  		ret = xe_gt_sriov_pf_migration_guc_restore(gt, vfid, data);
> >  		break;
> > +	case XE_SRIOV_MIGRATION_DATA_TYPE_VRAM:
> > +		ret = xe_gt_sriov_pf_migration_vram_restore(gt, vfid, data);
> > +		break;
> >  	default:
> >  		xe_gt_sriov_notice(gt, "Skipping VF%u unknown data type: %d\n", vfid, data->type);
> >  		break;
> > diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_control_types.h b/drivers/gpu/drm/xe/xe_gt_sriov_pf_control_types.h
> > index 9dfcebd5078ac..fba10136f7cc7 100644
> > --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_control_types.h
> > +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_control_types.h
> > @@ -36,6 +36,7 @@
> >   * @XE_GT_SRIOV_STATE_SAVE_DATA_GUC: indicates PF needs to save VF GuC migration data.
> >   * @XE_GT_SRIOV_STATE_SAVE_DATA_GGTT: indicates PF needs to save VF GGTT migration data.
> >   * @XE_GT_SRIOV_STATE_SAVE_DATA_MMIO: indicates PF needs to save VF MMIO migration data.
> > + * @XE_GT_SRIOV_STATE_SAVE_DATA_VRAM: indicates PF needs to save VF VRAM migration data.
> >   * @XE_GT_SRIOV_STATE_SAVE_DATA_DONE: indicates that all migration data was produced by Xe.
> >   * @XE_GT_SRIOV_STATE_SAVE_FAILED: indicates that VF save operation has failed.
> >   * @XE_GT_SRIOV_STATE_SAVED: indicates that VF data is saved.
> > @@ -82,6 +83,7 @@ enum xe_gt_sriov_control_bits {
> >  	XE_GT_SRIOV_STATE_SAVE_DATA_GUC,
> >  	XE_GT_SRIOV_STATE_SAVE_DATA_GGTT,
> >  	XE_GT_SRIOV_STATE_SAVE_DATA_MMIO,
> > +	XE_GT_SRIOV_STATE_SAVE_DATA_VRAM,
> >  	XE_GT_SRIOV_STATE_SAVE_DATA_DONE,
> >  	XE_GT_SRIOV_STATE_SAVE_FAILED,
> >  	XE_GT_SRIOV_STATE_SAVED,
> > 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 41335b15ffdbe..2c6a86d98ee31 100644
> > --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c
> > +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c
> > @@ -17,6 +17,7 @@
> >  #include "xe_gt_sriov_printk.h"
> >  #include "xe_guc_buf.h"
> >  #include "xe_guc_ct.h"
> > +#include "xe_migrate.h"
> >  #include "xe_sriov.h"
> >  #include "xe_sriov_migration_data.h"
> >  #include "xe_sriov_pf_migration.h"
> > @@ -485,6 +486,220 @@ int xe_gt_sriov_pf_migration_mmio_restore(struct xe_gt *gt, unsigned int vfid,
> >  	return pf_restore_vf_mmio_mig_data(gt, vfid, data);
> >  }
> >  
> > +/**
> > + * xe_gt_sriov_pf_migration_vram_size() - Get the size of VF VRAM migration data.
> > + * @gt: the &xe_gt
> > + * @vfid: the VF identifier
> > + *
> > + * This function is for PF only.
> > + *
> > + * Return: size in bytes or a negative error code on failure.
> > + */
> > +ssize_t xe_gt_sriov_pf_migration_vram_size(struct xe_gt *gt, unsigned int vfid)
> > +{
> > +	if (gt != xe_root_mmio_gt(gt_to_xe(gt)))
> 
> probably you mean
> 
> 	if (!xe_gt_is_main_type(gt))

Yes - I'll use it.

> 
> > +		return 0;
> > +
> > +	return xe_gt_sriov_pf_config_get_lmem(gt, vfid);
> > +}
> > +
> > +static struct dma_fence *__pf_save_restore_vram(struct xe_gt *gt, unsigned int vfid,
> > +						struct xe_bo *vram, u64 vram_offset,
> > +						struct xe_bo *sysmem, u64 sysmem_offset,
> > +						size_t size, bool save)
> > +{
> > +	struct dma_fence *ret = NULL;
> > +	struct drm_exec exec;
> > +	int err;
> > +
> > +	drm_exec_init(&exec, DRM_EXEC_INTERRUPTIBLE_WAIT, 0);
> > +	drm_exec_until_all_locked(&exec) {
> > +		err = drm_exec_lock_obj(&exec, &vram->ttm.base);
> > +		drm_exec_retry_on_contention(&exec);
> > +		if (err) {
> > +			ret = ERR_PTR(err);
> > +			goto err;
> > +		}
> > +
> > +		err = drm_exec_lock_obj(&exec, &sysmem->ttm.base);
> > +		drm_exec_retry_on_contention(&exec);
> > +		if (err) {
> > +			ret = ERR_PTR(err);
> > +			goto err;
> > +		}
> > +	}
> > +
> > +	ret = xe_migrate_vram_copy_chunk(vram, vram_offset, sysmem, sysmem_offset, size,
> > +					 save ? XE_MIGRATE_COPY_TO_SRAM : XE_MIGRATE_COPY_TO_VRAM);
> > +
> > +err:
> > +	drm_exec_fini(&exec);
> > +
> > +	return ret;
> > +}
> > +
> > +static int pf_save_vram_chunk(struct xe_gt *gt, unsigned int vfid,
> > +			      struct xe_bo *src_vram, u64 src_vram_offset,
> > +			      size_t size)
> > +{
> > +	struct xe_sriov_migration_data *data;
> > +	struct dma_fence *fence;
> > +	int ret;
> > +
> > +	data = xe_sriov_migration_data_alloc(gt_to_xe(gt));
> > +	if (!data)
> > +		return -ENOMEM;
> > +
> > +	ret = xe_sriov_migration_data_init(data, gt->tile->id, gt->info.id,
> > +					   XE_SRIOV_MIGRATION_DATA_TYPE_VRAM,
> > +					   src_vram_offset, size);
> > +	if (ret)
> > +		goto fail;
> > +
> > +	fence = __pf_save_restore_vram(gt, vfid,
> > +				       src_vram, src_vram_offset,
> > +				       data->bo, 0, size, true);
> > +
> > +	ret = dma_fence_wait_timeout(fence, false, 5 * HZ);
> > +	dma_fence_put(fence);
> > +	if (!ret) {
> > +		ret = -ETIME;
> > +		goto fail;
> > +	}
> > +
> > +	pf_dump_mig_data(gt, vfid, data);
> > +
> > +	ret = xe_gt_sriov_pf_migration_save_produce(gt, vfid, data);
> > +	if (ret)
> > +		goto fail;
> > +
> > +	return 0;
> > +
> > +fail:
> > +	xe_sriov_migration_data_free(data);
> > +	return ret;
> > +}
> > +
> > +#define VF_VRAM_STATE_CHUNK_MAX_SIZE SZ_512M
> > +static int pf_save_vf_vram_mig_data(struct xe_gt *gt, unsigned int vfid)
> > +{
> > +	struct xe_gt_sriov_migration_data *migration = pf_pick_gt_migration(gt, vfid);
> > +	loff_t *offset = &migration->vram_save_offset;
> > +	struct xe_bo *vram;
> > +	size_t vram_size, chunk_size;
> > +	int ret;
> > +
> > +	vram = xe_gt_sriov_pf_config_get_lmem_obj(gt, vfid);
> > +	if (!vram)
> > +		return -ENXIO;
> 
> no error message ?

Well, this should be converted to assert after we block re-provisioning,
so I don't think it's needed (or know what to print out :) ).

> 
> > +
> > +	vram_size = xe_bo_size(vram);
> > +	chunk_size = min(vram_size - *offset, VF_VRAM_STATE_CHUNK_MAX_SIZE);
> 
> what if *offset > vram_size ?

We control the offset - I'll add an assert.

> 
> > +
> > +	ret = pf_save_vram_chunk(gt, vfid, vram, *offset, chunk_size);
> > +	if (ret)
> > +		goto fail;
> > +
> > +	*offset += chunk_size;
> > +
> > +	xe_bo_put(vram);
> > +
> > +	if (*offset < vram_size)
> > +		return -EAGAIN;
> > +
> > +	return 0;
> > +
> > +fail:
> > +	xe_bo_put(vram);
> > +	xe_gt_sriov_err(gt, "Failed to save VF%u VRAM data (%pe)\n", vfid, ERR_PTR(ret));
> > +	return ret;
> > +}
> > +
> > +static int pf_restore_vf_vram_mig_data(struct xe_gt *gt, unsigned int vfid,
> > +				       struct xe_sriov_migration_data *data)
> > +{
> > +	u64 end = data->hdr.offset + data->hdr.size;
> > +	struct dma_fence *fence;
> > +	struct xe_bo *vram;
> > +	size_t size;
> > +	int ret = 0;
> > +
> > +	vram = xe_gt_sriov_pf_config_get_lmem_obj(gt, vfid);
> > +	if (!vram)
> > +		return -ENXIO;
> 
> no error message ? other errors are reported

Same as above.

> 
> > +
> > +	size = xe_bo_size(vram);
> > +
> > +	if (end > size || end < data->hdr.size) {
> > +		ret = -EINVAL;
> > +		goto err;
> > +	}
> > +
> > +	pf_dump_mig_data(gt, vfid, data);
> > +
> > +	fence = __pf_save_restore_vram(gt, vfid, vram, data->hdr.offset,
> > +				       data->bo, 0, data->hdr.size, false);
> > +	ret = dma_fence_wait_timeout(fence, false, 5 * HZ);
> 
> define this timeout at least as macro (if not as helper function, as this might be platform/settings specific)

I'll use a macro for now.

> 
> > +	dma_fence_put(fence);
> > +	if (!ret) {
> > +		ret = -ETIME;
> > +		goto err;
> > +	}
> > +
> > +	return 0;
> > +err:
> > +	xe_bo_put(vram);
> > +	xe_gt_sriov_err(gt, "Failed to restore VF%u VRAM data (%pe)\n", vfid, ERR_PTR(ret));
> > +	return ret;
> > +}
> > +
> > +/**
> > + * xe_gt_sriov_pf_migration_vram_save() - Save VF VRAM migration data.
> > + * @gt: the &xe_gt
> > + * @vfid: the VF identifier (can't be 0)
> > + *
> > + * This function is for PF only.
> > + *
> > + * Return: 0 on success or a negative error code on failure.
> > + */
> > +int xe_gt_sriov_pf_migration_vram_save(struct xe_gt *gt, unsigned int vfid)
> > +{
> > +	xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt)));
> > +	xe_gt_assert(gt, vfid != PFID);
> > +	xe_gt_assert(gt, vfid <= xe_sriov_pf_get_totalvfs(gt_to_xe(gt)));
> > +
> > +	return pf_save_vf_vram_mig_data(gt, vfid);
> > +}
> > +
> > +/**
> > + * xe_gt_sriov_pf_migration_vram_restore() - Restore VF VRAM migration data.
> > + * @gt: the &xe_gt
> > + * @vfid: the VF identifier (can't be 0)
> > + *
> > + * This function is for PF only.
> > + *
> > + * Return: 0 on success or a negative error code on failure.
> > + */
> > +int xe_gt_sriov_pf_migration_vram_restore(struct xe_gt *gt, unsigned int vfid,
> > +					  struct xe_sriov_migration_data *data)
> > +{
> > +	xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt)));
> > +	xe_gt_assert(gt, vfid != PFID);
> > +	xe_gt_assert(gt, vfid <= xe_sriov_pf_get_totalvfs(gt_to_xe(gt)));
> > +
> > +	return pf_restore_vf_vram_mig_data(gt, vfid, data);
> > +}
> > +
> > +/**
> > + * xe_gt_sriov_pf_migration_save_init() - Initialize per-GT migration related data.
> > + * @gt: the &xe_gt
> > + * @vfid: the VF identifier (can't be 0)
> > + */
> > +void xe_gt_sriov_pf_migration_save_init(struct xe_gt *gt, unsigned int vfid)
> > +{
> > +	pf_pick_gt_migration(gt, vfid)->vram_save_offset = 0;
> > +}
> > +
> >  /**
> >   * xe_gt_sriov_pf_migration_size() - Total size of migration data from all components within a GT.
> >   * @gt: the &xe_gt
> > @@ -522,6 +737,13 @@ ssize_t xe_gt_sriov_pf_migration_size(struct xe_gt *gt, unsigned int vfid)
> >  		size += sizeof(struct xe_sriov_pf_migration_hdr);
> >  	total += size;
> >  
> > +	size = xe_gt_sriov_pf_migration_vram_size(gt, vfid);
> > +	if (size < 0)
> > +		return size;
> > +	else if (size > 0)
> 
> "else" not needed

Ok.

> 
> > +		size += sizeof(struct xe_sriov_pf_migration_hdr);
> > +	total += size;
> > +
> >  	return total;
> >  }
> >  
> > diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.h b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.h
> > index 24a233c4cd0bb..ca518eda5429f 100644
> > --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.h
> > +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.h
> > @@ -27,6 +27,12 @@ ssize_t xe_gt_sriov_pf_migration_mmio_size(struct xe_gt *gt, unsigned int vfid);
> >  int xe_gt_sriov_pf_migration_mmio_save(struct xe_gt *gt, unsigned int vfid);
> >  int xe_gt_sriov_pf_migration_mmio_restore(struct xe_gt *gt, unsigned int vfid,
> >  					  struct xe_sriov_migration_data *data);
> > +ssize_t xe_gt_sriov_pf_migration_vram_size(struct xe_gt *gt, unsigned int vfid);
> > +int xe_gt_sriov_pf_migration_vram_save(struct xe_gt *gt, unsigned int vfid);
> > +int xe_gt_sriov_pf_migration_vram_restore(struct xe_gt *gt, unsigned int vfid,
> > +					  struct xe_sriov_migration_data *data);
> > +
> > +void xe_gt_sriov_pf_migration_save_init(struct xe_gt *gt, unsigned int vfid);
> >  
> >  ssize_t xe_gt_sriov_pf_migration_size(struct xe_gt *gt, unsigned int vfid);
> >  
> > 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 75d8b94cbbefb..39a940c9b0a4b 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
> > @@ -16,6 +16,9 @@
> >  struct xe_gt_sriov_migration_data {
> >  	/** @ring: queue containing VF save / restore migration data */
> >  	struct ptr_ring ring;
> > +
> > +	/** @vram_save_offset: offset within VRAM, used for chunked VRAM save */
> 
> "last saved offset" ?

Ok.

Thanks,
-Michał

> > +	loff_t vram_save_offset;
> >  };
> >  
> >  #endif
> > diff --git a/drivers/gpu/drm/xe/xe_sriov_pf_control.c b/drivers/gpu/drm/xe/xe_sriov_pf_control.c
> > index c2768848daba1..aac8ecb861545 100644
> > --- a/drivers/gpu/drm/xe/xe_sriov_pf_control.c
> > +++ b/drivers/gpu/drm/xe/xe_sriov_pf_control.c
> > @@ -5,6 +5,7 @@
> >  
> >  #include "xe_device.h"
> >  #include "xe_gt_sriov_pf_control.h"
> > +#include "xe_gt_sriov_pf_migration.h"
> >  #include "xe_sriov_migration_data.h"
> >  #include "xe_sriov_pf_control.h"
> >  #include "xe_sriov_printk.h"
> > @@ -171,6 +172,8 @@ int xe_sriov_pf_control_trigger_save_vf(struct xe_device *xe, unsigned int vfid)
> >  		return ret;
> >  
> >  	for_each_gt(gt, xe, id) {
> > +		xe_gt_sriov_pf_migration_save_init(gt, vfid);
> > +
> >  		ret = xe_gt_sriov_pf_control_trigger_save_vf(gt, vfid);
> >  		if (ret)
> >  			return ret;
> 
Re: [PATCH v2 22/26] drm/xe/pf: Handle VRAM migration data as part of PF control
Posted by kernel test robot 3 months, 2 weeks ago
Hi Michał,

kernel test robot noticed the following build errors:

[auto build test ERROR on drm-xe/drm-xe-next]
[also build test ERROR on next-20251023]
[cannot apply to awilliam-vfio/next awilliam-vfio/for-linus drm-i915/for-linux-next drm-i915/for-linux-next-fixes linus/master v6.18-rc2]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Micha-Winiarski/drm-xe-pf-Remove-GuC-version-check-for-migration-support/20251022-064617
base:   https://gitlab.freedesktop.org/drm/xe/kernel.git drm-xe-next
patch link:    https://lore.kernel.org/r/20251021224133.577765-23-michal.winiarski%40intel.com
patch subject: [PATCH v2 22/26] drm/xe/pf: Handle VRAM migration data as part of PF control
config: arm-randconfig-r072-20251023 (https://download.01.org/0day-ci/archive/20251023/202510231918.XlOqymLC-lkp@intel.com/config)
compiler: clang version 16.0.6 (https://github.com/llvm/llvm-project 7cbf1a2591520c2491aa35339f227775f4d3adf6)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251023/202510231918.XlOqymLC-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202510231918.XlOqymLC-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c:212:2: error: duplicate case value: 'XE_GT_SRIOV_STATE_RESTORE_DATA_DONE' and 'XE_GT_SRIOV_STATE_MISMATCH' both equal '31'
           CASE2STR(MISMATCH);
           ^
   drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c:170:7: note: expanded from macro 'CASE2STR'
           case XE_GT_SRIOV_STATE_##_X: return #_X
                ^
   <scratch space>:58:1: note: expanded from here
   XE_GT_SRIOV_STATE_MISMATCH
   ^
   drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c:201:2: note: previous case defined here
           CASE2STR(RESTORE_DATA_DONE);
           ^
   drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c:170:7: note: expanded from macro 'CASE2STR'
           case XE_GT_SRIOV_STATE_##_X: return #_X
                ^
   <scratch space>:36:1: note: expanded from here
   XE_GT_SRIOV_STATE_RESTORE_DATA_DONE
   ^
   1 error generated.


vim +212 drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c

aed2c1d70aa008 Michal Wajdeczko 2024-03-26   99  
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  100  /**
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  101   * DOC: The VF state machine
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  102   *
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  103   * The simplified VF state machine could be presented as::
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  104   *
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  105   *	               pause--------------------------o
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  106   *	              /                               |
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  107   *	             /                                v
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  108   *	      (READY)<------------------resume-----(PAUSED)
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  109   *	         ^   \                             /    /
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  110   *	         |    \                           /    /
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  111   *	         |     stop---->(STOPPED)<----stop    /
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  112   *	         |                  /                /
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  113   *	         |                 /                /
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  114   *	         o--------<-----flr                /
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  115   *	          \                               /
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  116   *	           o------<--------------------flr
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  117   *
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  118   * Where:
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  119   *
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  120   * * READY - represents a state in which VF is fully operable
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  121   * * PAUSED - represents a state in which VF activity is temporarily suspended
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  122   * * STOPPED - represents a state in which VF activity is definitely halted
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  123   * * pause - represents a request to temporarily suspend VF activity
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  124   * * resume - represents a request to resume VF activity
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  125   * * stop - represents a request to definitely halt VF activity
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  126   * * flr - represents a request to perform VF FLR to restore VF activity
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  127   *
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  128   * However, each state transition requires additional steps that involves
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  129   * communication with GuC that might fail or be interrupted by other requests::
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  130   *
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  131   *	                   .................................WIP....
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  132   *	                   :                                      :
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  133   *	          pause--------------------->PAUSE_WIP----------------------------o
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  134   *	         /         :                /         \           :               |
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  135   *	        /          :    o----<---stop          flr--o     :               |
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  136   *	       /           :    |           \         /     |     :               V
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  137   *	(READY,RESUMED)<--------+------------RESUME_WIP<----+--<-----resume--(PAUSED)
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  138   *	  ^ \  \           :    |                           |     :          /   /
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  139   *	  |  \  \          :    |                           |     :         /   /
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  140   *	  |   \  \         :    |                           |     :        /   /
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  141   *	  |    \  \        :    o----<----------------------+--<-------stop   /
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  142   *	  |     \  \       :    |                           |     :          /
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  143   *	  |      \  \      :    V                           |     :         /
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  144   *	  |       \  stop----->STOP_WIP---------flr--->-----o     :        /
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  145   *	  |        \       :    |                           |     :       /
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  146   *	  |         \      :    |                           V     :      /
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  147   *	  |          flr--------+----->----------------->FLR_WIP<-----flr
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  148   *	  |                :    |                        /  ^     :
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  149   *	  |                :    |                       /   |     :
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  150   *	  o--------<-------:----+-----<----------------o    |     :
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  151   *	                   :    |                           |     :
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  152   *	                   :....|...........................|.....:
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  153   *	                        |                           |
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  154   *	                        V                           |
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  155   *	                     (STOPPED)--------------------flr
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  156   *
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  157   * For details about each internal WIP state machine see:
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  158   *
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  159   * * `The VF PAUSE state machine`_
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  160   * * `The VF RESUME state machine`_
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  161   * * `The VF STOP state machine`_
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  162   * * `The VF FLR state machine`_
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  163   */
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  164  
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  165  #ifdef CONFIG_DRM_XE_DEBUG_SRIOV
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  166  static const char *control_bit_to_string(enum xe_gt_sriov_control_bits bit)
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  167  {
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  168  	switch (bit) {
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  169  #define CASE2STR(_X) \
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  170  	case XE_GT_SRIOV_STATE_##_X: return #_X
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  171  	CASE2STR(WIP);
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  172  	CASE2STR(FLR_WIP);
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  173  	CASE2STR(FLR_SEND_START);
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  174  	CASE2STR(FLR_WAIT_GUC);
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  175  	CASE2STR(FLR_GUC_DONE);
2a8fcf7cc950e6 Michal Wajdeczko 2025-10-01  176  	CASE2STR(FLR_SYNC);
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  177  	CASE2STR(FLR_RESET_CONFIG);
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  178  	CASE2STR(FLR_RESET_DATA);
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  179  	CASE2STR(FLR_RESET_MMIO);
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  180  	CASE2STR(FLR_SEND_FINISH);
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  181  	CASE2STR(FLR_FAILED);
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  182  	CASE2STR(PAUSE_WIP);
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  183  	CASE2STR(PAUSE_SEND_PAUSE);
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  184  	CASE2STR(PAUSE_WAIT_GUC);
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  185  	CASE2STR(PAUSE_GUC_DONE);
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  186  	CASE2STR(PAUSE_FAILED);
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  187  	CASE2STR(PAUSED);
ed3b410584ff58 Michał Winiarski 2025-10-22  188  	CASE2STR(SAVE_WIP);
008ba8d0525f68 Michał Winiarski 2025-10-22  189  	CASE2STR(SAVE_PROCESS_DATA);
008ba8d0525f68 Michał Winiarski 2025-10-22  190  	CASE2STR(SAVE_WAIT_DATA);
33cfbd2b4f240a Michał Winiarski 2025-10-22  191  	CASE2STR(SAVE_DATA_GUC);
994e46306a1791 Michał Winiarski 2025-10-22  192  	CASE2STR(SAVE_DATA_GGTT);
bdbad7e79b97c4 Michał Winiarski 2025-10-22  193  	CASE2STR(SAVE_DATA_MMIO);
afa80586c0896a Michał Winiarski 2025-10-22  194  	CASE2STR(SAVE_DATA_VRAM);
008ba8d0525f68 Michał Winiarski 2025-10-22  195  	CASE2STR(SAVE_DATA_DONE);
ed3b410584ff58 Michał Winiarski 2025-10-22  196  	CASE2STR(SAVE_FAILED);
ed3b410584ff58 Michał Winiarski 2025-10-22  197  	CASE2STR(SAVED);
ed3b410584ff58 Michał Winiarski 2025-10-22  198  	CASE2STR(RESTORE_WIP);
008ba8d0525f68 Michał Winiarski 2025-10-22  199  	CASE2STR(RESTORE_PROCESS_DATA);
008ba8d0525f68 Michał Winiarski 2025-10-22  200  	CASE2STR(RESTORE_WAIT_DATA);
008ba8d0525f68 Michał Winiarski 2025-10-22  201  	CASE2STR(RESTORE_DATA_DONE);
ed3b410584ff58 Michał Winiarski 2025-10-22  202  	CASE2STR(RESTORE_FAILED);
ed3b410584ff58 Michał Winiarski 2025-10-22  203  	CASE2STR(RESTORED);
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  204  	CASE2STR(RESUME_WIP);
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  205  	CASE2STR(RESUME_SEND_RESUME);
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  206  	CASE2STR(RESUME_FAILED);
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  207  	CASE2STR(RESUMED);
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  208  	CASE2STR(STOP_WIP);
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  209  	CASE2STR(STOP_SEND_STOP);
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  210  	CASE2STR(STOP_FAILED);
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  211  	CASE2STR(STOPPED);
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28 @212  	CASE2STR(MISMATCH);
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  213  #undef  CASE2STR
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  214  	default: return "?";
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  215  	}
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  216  }
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  217  #endif
2bd87f0fc24ae2 Michal Wajdeczko 2024-08-28  218  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki