Skip to content

Commit 73834d0

Browse files
mwiniarsThomas Hellström
authored andcommitted
drm/xe/pf: Enable SR-IOV VF migration
All of the necessary building blocks are now in place to support SR-IOV VF migration. Flip the enable/disable logic to match VF code and disable the feature only for platforms that don't meet the necessary prerequisites. To allow more testing and experiments, on DEBUG builds any missing prerequisites will be ignored. Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Link: https://patch.msgid.link/20251127093934.1462188-2-michal.winiarski@intel.com Signed-off-by: Michał Winiarski <michal.winiarski@intel.com> (cherry picked from commit 01c724a) Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
1 parent 50a5923 commit 73834d0

4 files changed

Lines changed: 42 additions & 7 deletions

File tree

drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "xe_gt_sriov_pf_helpers.h"
1818
#include "xe_gt_sriov_pf_migration.h"
1919
#include "xe_gt_sriov_printk.h"
20+
#include "xe_guc.h"
2021
#include "xe_guc_buf.h"
2122
#include "xe_guc_ct.h"
2223
#include "xe_migrate.h"
@@ -1023,6 +1024,12 @@ static void action_ring_cleanup(void *arg)
10231024
ptr_ring_cleanup(r, destroy_pf_packet);
10241025
}
10251026

1027+
static void pf_gt_migration_check_support(struct xe_gt *gt)
1028+
{
1029+
if (GUC_FIRMWARE_VER(&gt->uc.guc) < MAKE_GUC_VER(70, 54, 0))
1030+
xe_sriov_pf_migration_disable(gt_to_xe(gt), "requires GuC version >= 70.54.0");
1031+
}
1032+
10261033
/**
10271034
* xe_gt_sriov_pf_migration_init() - Initialize support for VF migration.
10281035
* @gt: the &xe_gt
@@ -1039,6 +1046,8 @@ int xe_gt_sriov_pf_migration_init(struct xe_gt *gt)
10391046

10401047
xe_gt_assert(gt, IS_SRIOV_PF(xe));
10411048

1049+
pf_gt_migration_check_support(gt);
1050+
10421051
if (!pf_migration_supported(gt))
10431052
return 0;
10441053

drivers/gpu/drm/xe/xe_sriov_pf_migration.c

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,37 @@ bool xe_sriov_pf_migration_supported(struct xe_device *xe)
4646
{
4747
xe_assert(xe, IS_SRIOV_PF(xe));
4848

49-
return xe->sriov.pf.migration.supported;
49+
return IS_ENABLED(CONFIG_DRM_XE_DEBUG) || !xe->sriov.pf.migration.disabled;
5050
}
5151

52-
static bool pf_check_migration_support(struct xe_device *xe)
52+
/**
53+
* xe_sriov_pf_migration_disable() - Turn off SR-IOV VF migration support on PF.
54+
* @xe: the &xe_device instance.
55+
* @fmt: format string for the log message, to be combined with following VAs.
56+
*/
57+
void xe_sriov_pf_migration_disable(struct xe_device *xe, const char *fmt, ...)
58+
{
59+
struct va_format vaf;
60+
va_list va_args;
61+
62+
xe_assert(xe, IS_SRIOV_PF(xe));
63+
64+
va_start(va_args, fmt);
65+
vaf.fmt = fmt;
66+
vaf.va = &va_args;
67+
xe_sriov_notice(xe, "migration %s: %pV\n",
68+
IS_ENABLED(CONFIG_DRM_XE_DEBUG) ?
69+
"missing prerequisite" : "disabled",
70+
&vaf);
71+
va_end(va_args);
72+
73+
xe->sriov.pf.migration.disabled = true;
74+
}
75+
76+
static void pf_migration_check_support(struct xe_device *xe)
5377
{
54-
/* XXX: for now this is for feature enabling only */
55-
return IS_ENABLED(CONFIG_DRM_XE_DEBUG);
78+
if (!xe_device_has_memirq(xe))
79+
xe_sriov_pf_migration_disable(xe, "requires memory-based IRQ support");
5680
}
5781

5882
static void pf_migration_cleanup(void *arg)
@@ -77,7 +101,8 @@ int xe_sriov_pf_migration_init(struct xe_device *xe)
77101

78102
xe_assert(xe, IS_SRIOV_PF(xe));
79103

80-
xe->sriov.pf.migration.supported = pf_check_migration_support(xe);
104+
pf_migration_check_support(xe);
105+
81106
if (!xe_sriov_pf_migration_supported(xe))
82107
return 0;
83108

drivers/gpu/drm/xe/xe_sriov_pf_migration.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ struct xe_sriov_packet;
1414

1515
int xe_sriov_pf_migration_init(struct xe_device *xe);
1616
bool xe_sriov_pf_migration_supported(struct xe_device *xe);
17+
void xe_sriov_pf_migration_disable(struct xe_device *xe, const char *fmt, ...);
1718
int xe_sriov_pf_migration_restore_produce(struct xe_device *xe, unsigned int vfid,
1819
struct xe_sriov_packet *data);
1920
struct xe_sriov_packet *

drivers/gpu/drm/xe/xe_sriov_pf_migration_types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
* struct xe_sriov_pf_migration - Xe device level VF migration data
1515
*/
1616
struct xe_sriov_pf_migration {
17-
/** @supported: indicates whether VF migration feature is supported */
18-
bool supported;
17+
/** @disabled: indicates whether VF migration feature is disabled */
18+
bool disabled;
1919
};
2020

2121
/**

0 commit comments

Comments
 (0)