Skip to content

Commit cd554e1

Browse files
mwajdeczThomas Hellström
authored andcommitted
drm/xe/pf: Assert LMEM provisioning is done only on DGFX
The Local Memory (aka VRAM) is only available on DGFX platforms. We shouldn't attempt to provision VFs with LMEM or attempt to update the LMTT on non-DGFX platforms. Add missing asserts that would enforce that and fix release code that could crash on iGFX due to uninitialized LMTT. Fixes: 0698ff5 ("drm/xe/pf: Update the LMTT when freeing VF GT config") Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Cc: Piotr Piórkowski <piotr.piorkowski@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240607153155.1592-1-michal.wajdeczko@intel.com (cherry picked from commit b321cb8) Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
1 parent 7c87711 commit cd554e1

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,6 +1274,9 @@ static void pf_reset_vf_lmtt(struct xe_device *xe, unsigned int vfid)
12741274
struct xe_tile *tile;
12751275
unsigned int tid;
12761276

1277+
xe_assert(xe, IS_DGFX(xe));
1278+
xe_assert(xe, IS_SRIOV_PF(xe));
1279+
12771280
for_each_tile(tile, xe, tid) {
12781281
lmtt = &tile->sriov.pf.lmtt;
12791282
xe_lmtt_drop_pages(lmtt, vfid);
@@ -1292,6 +1295,9 @@ static int pf_update_vf_lmtt(struct xe_device *xe, unsigned int vfid)
12921295
unsigned int tid;
12931296
int err;
12941297

1298+
xe_assert(xe, IS_DGFX(xe));
1299+
xe_assert(xe, IS_SRIOV_PF(xe));
1300+
12951301
total = 0;
12961302
for_each_tile(tile, xe, tid)
12971303
total += pf_get_vf_config_lmem(tile->primary_gt, vfid);
@@ -1337,6 +1343,7 @@ static int pf_update_vf_lmtt(struct xe_device *xe, unsigned int vfid)
13371343

13381344
static void pf_release_vf_config_lmem(struct xe_gt *gt, struct xe_gt_sriov_config *config)
13391345
{
1346+
xe_gt_assert(gt, IS_DGFX(gt_to_xe(gt)));
13401347
xe_gt_assert(gt, !xe_gt_is_media_type(gt));
13411348
lockdep_assert_held(xe_gt_sriov_pf_master_mutex(gt));
13421349

@@ -1355,6 +1362,7 @@ static int pf_provision_vf_lmem(struct xe_gt *gt, unsigned int vfid, u64 size)
13551362
int err;
13561363

13571364
xe_gt_assert(gt, vfid);
1365+
xe_gt_assert(gt, IS_DGFX(xe));
13581366
xe_gt_assert(gt, !xe_gt_is_media_type(gt));
13591367

13601368
size = round_up(size, pf_get_lmem_alignment(gt));
@@ -1745,11 +1753,14 @@ static void pf_reset_config_sched(struct xe_gt *gt, struct xe_gt_sriov_config *c
17451753
static void pf_release_vf_config(struct xe_gt *gt, unsigned int vfid)
17461754
{
17471755
struct xe_gt_sriov_config *config = pf_pick_vf_config(gt, vfid);
1756+
struct xe_device *xe = gt_to_xe(gt);
17481757

17491758
if (!xe_gt_is_media_type(gt)) {
17501759
pf_release_vf_config_ggtt(gt, config);
1751-
pf_release_vf_config_lmem(gt, config);
1752-
pf_update_vf_lmtt(gt_to_xe(gt), vfid);
1760+
if (IS_DGFX(xe)) {
1761+
pf_release_vf_config_lmem(gt, config);
1762+
pf_update_vf_lmtt(xe, vfid);
1763+
}
17531764
}
17541765
pf_release_config_ctxs(gt, config);
17551766
pf_release_config_dbs(gt, config);

0 commit comments

Comments
 (0)