Skip to content

Commit cbc0a0e

Browse files
piorkovmwajdecz
authored andcommitted
drm/xe/pf: Use an explicit check to see if the device has LMTT
So far, the main condition for using LMTT has been to check that the device is a discrete gfx. Let's add a dedicated function to check if the device supports LMTT as not all future discrete GPU platforms will require LMTT. v2: - use xe_has_device_lmtt only when necessary - leave IS_DGFX for other things related to LMEM provisioning v3: - remove IS_SRIOV_PF condition from xe_device_has_lmtt (Michal Wajdeczko) - keep IS_SRIOV_PF asserts in LMTT-related code (Michal Wajdeczko) v4: - update commit description Signed-off-by: Piotr Piórkowski <[email protected]> Cc: Michal Wajdeczko <[email protected]> Cc: Michał Winiarski <[email protected]> Cc: Satyanarayana K V P <[email protected]> Reviewed-by: Tejas Upadhyay <[email protected]> Reviewed-by: Satyanarayana K V P <[email protected]> Signed-off-by: Michal Wajdeczko <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 6bb05b3 commit cbc0a0e

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

drivers/gpu/drm/xe/xe_device.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@ static inline bool xe_device_uses_memirq(struct xe_device *xe)
170170
return xe_device_has_memirq(xe) && (IS_SRIOV_VF(xe) || xe_device_has_msix(xe));
171171
}
172172

173+
static inline bool xe_device_has_lmtt(struct xe_device *xe)
174+
{
175+
return IS_DGFX(xe);
176+
}
177+
173178
u32 xe_device_ccs_bytes(struct xe_device *xe, u64 size);
174179

175180
void xe_device_snapshot_print(struct xe_device *xe, struct drm_printer *p);

drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,7 +1336,7 @@ static void pf_reset_vf_lmtt(struct xe_device *xe, unsigned int vfid)
13361336
struct xe_tile *tile;
13371337
unsigned int tid;
13381338

1339-
xe_assert(xe, IS_DGFX(xe));
1339+
xe_assert(xe, xe_device_has_lmtt(xe));
13401340
xe_assert(xe, IS_SRIOV_PF(xe));
13411341

13421342
for_each_tile(tile, xe, tid) {
@@ -1357,7 +1357,7 @@ static int pf_update_vf_lmtt(struct xe_device *xe, unsigned int vfid)
13571357
unsigned int tid;
13581358
int err;
13591359

1360-
xe_assert(xe, IS_DGFX(xe));
1360+
xe_assert(xe, xe_device_has_lmtt(xe));
13611361
xe_assert(xe, IS_SRIOV_PF(xe));
13621362

13631363
total = 0;
@@ -1434,7 +1434,8 @@ static int pf_provision_vf_lmem(struct xe_gt *gt, unsigned int vfid, u64 size)
14341434
if (unlikely(err))
14351435
return err;
14361436

1437-
pf_reset_vf_lmtt(xe, vfid);
1437+
if (xe_device_has_lmtt(xe))
1438+
pf_reset_vf_lmtt(xe, vfid);
14381439
pf_release_vf_config_lmem(gt, config);
14391440
}
14401441
xe_gt_assert(gt, !config->lmem_obj);
@@ -1454,9 +1455,11 @@ static int pf_provision_vf_lmem(struct xe_gt *gt, unsigned int vfid, u64 size)
14541455

14551456
config->lmem_obj = bo;
14561457

1457-
err = pf_update_vf_lmtt(xe, vfid);
1458-
if (unlikely(err))
1459-
goto release;
1458+
if (xe_device_has_lmtt(xe)) {
1459+
err = pf_update_vf_lmtt(xe, vfid);
1460+
if (unlikely(err))
1461+
goto release;
1462+
}
14601463

14611464
err = pf_push_vf_cfg_lmem(gt, vfid, bo->size);
14621465
if (unlikely(err))
@@ -1467,7 +1470,8 @@ static int pf_provision_vf_lmem(struct xe_gt *gt, unsigned int vfid, u64 size)
14671470
return 0;
14681471

14691472
reset_lmtt:
1470-
pf_reset_vf_lmtt(xe, vfid);
1473+
if (xe_device_has_lmtt(xe))
1474+
pf_reset_vf_lmtt(xe, vfid);
14711475
release:
14721476
pf_release_vf_config_lmem(gt, config);
14731477
return err;
@@ -1981,7 +1985,8 @@ static void pf_release_vf_config(struct xe_gt *gt, unsigned int vfid)
19811985
pf_release_vf_config_ggtt(gt, config);
19821986
if (IS_DGFX(xe)) {
19831987
pf_release_vf_config_lmem(gt, config);
1984-
pf_update_vf_lmtt(xe, vfid);
1988+
if (xe_device_has_lmtt(xe))
1989+
pf_update_vf_lmtt(xe, vfid);
19851990
}
19861991
}
19871992
pf_release_config_ctxs(gt, config);

drivers/gpu/drm/xe/xe_lmtt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ int xe_lmtt_init(struct xe_lmtt *lmtt)
164164
lmtt_assert(lmtt, IS_SRIOV_PF(xe));
165165
lmtt_assert(lmtt, !lmtt->ops);
166166

167-
if (!IS_DGFX(xe))
167+
if (!xe_device_has_lmtt(xe))
168168
return 0;
169169

170170
if (xe_has_multi_level_lmtt(xe))
@@ -486,7 +486,7 @@ u64 xe_lmtt_estimate_pt_size(struct xe_lmtt *lmtt, u64 size)
486486
u64 pt_size;
487487

488488
lmtt_assert(lmtt, IS_SRIOV_PF(lmtt_to_xe(lmtt)));
489-
lmtt_assert(lmtt, IS_DGFX(lmtt_to_xe(lmtt)));
489+
lmtt_assert(lmtt, xe_device_has_lmtt(lmtt_to_xe(lmtt)));
490490
lmtt_assert(lmtt, lmtt->ops);
491491

492492
pt_size = PAGE_ALIGN(lmtt->ops->lmtt_pte_size(level) *

0 commit comments

Comments
 (0)