Commit cbc0a0ee authored by Piotr Piórkowski's avatar Piotr Piórkowski Committed by Michal Wajdeczko
Browse files

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: default avatarPiotr Piórkowski <piotr.piorkowski@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Michał Winiarski <michal.winiarski@intel.com>
Cc: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
Reviewed-by: default avatarTejas Upadhyay <tejas.upadhyay@intel.com>
Reviewed-by: default avatarSatyanarayana K V P <satyanarayana.k.v.p@intel.com>
Signed-off-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250207113111.853821-2-piotr.piorkowski@intel.com
parent 6bb05b36
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -170,6 +170,11 @@ static inline bool xe_device_uses_memirq(struct xe_device *xe)
	return xe_device_has_memirq(xe) && (IS_SRIOV_VF(xe) || xe_device_has_msix(xe));
}

static inline bool xe_device_has_lmtt(struct xe_device *xe)
{
	return IS_DGFX(xe);
}

u32 xe_device_ccs_bytes(struct xe_device *xe, u64 size);

void xe_device_snapshot_print(struct xe_device *xe, struct drm_printer *p);
+13 −8
Original line number Diff line number Diff line
@@ -1336,7 +1336,7 @@ static void pf_reset_vf_lmtt(struct xe_device *xe, unsigned int vfid)
	struct xe_tile *tile;
	unsigned int tid;

	xe_assert(xe, IS_DGFX(xe));
	xe_assert(xe, xe_device_has_lmtt(xe));
	xe_assert(xe, IS_SRIOV_PF(xe));

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

	xe_assert(xe, IS_DGFX(xe));
	xe_assert(xe, xe_device_has_lmtt(xe));
	xe_assert(xe, IS_SRIOV_PF(xe));

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

		if (xe_device_has_lmtt(xe))
			pf_reset_vf_lmtt(xe, vfid);
		pf_release_vf_config_lmem(gt, config);
	}
@@ -1454,9 +1455,11 @@ static int pf_provision_vf_lmem(struct xe_gt *gt, unsigned int vfid, u64 size)

	config->lmem_obj = bo;

	if (xe_device_has_lmtt(xe)) {
		err = pf_update_vf_lmtt(xe, vfid);
		if (unlikely(err))
			goto release;
	}

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

reset_lmtt:
	if (xe_device_has_lmtt(xe))
		pf_reset_vf_lmtt(xe, vfid);
release:
	pf_release_vf_config_lmem(gt, config);
@@ -1981,6 +1985,7 @@ static void pf_release_vf_config(struct xe_gt *gt, unsigned int vfid)
		pf_release_vf_config_ggtt(gt, config);
		if (IS_DGFX(xe)) {
			pf_release_vf_config_lmem(gt, config);
			if (xe_device_has_lmtt(xe))
				pf_update_vf_lmtt(xe, vfid);
		}
	}
+2 −2
Original line number Diff line number Diff line
@@ -164,7 +164,7 @@ int xe_lmtt_init(struct xe_lmtt *lmtt)
	lmtt_assert(lmtt, IS_SRIOV_PF(xe));
	lmtt_assert(lmtt, !lmtt->ops);

	if (!IS_DGFX(xe))
	if (!xe_device_has_lmtt(xe))
		return 0;

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

	lmtt_assert(lmtt, IS_SRIOV_PF(lmtt_to_xe(lmtt)));
	lmtt_assert(lmtt, IS_DGFX(lmtt_to_xe(lmtt)));
	lmtt_assert(lmtt, xe_device_has_lmtt(lmtt_to_xe(lmtt)));
	lmtt_assert(lmtt, lmtt->ops);

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