drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
Extension
.c
Size
97190 bytes
Lines
3522
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (tile->primary_gt == gt) {
			err = pf_push_vf_cfg_lmem(gt, vfid, size);
		} else {
			u64 lmem = pf_get_vf_config_lmem(tile->primary_gt, vfid);

			if (!lmem)
				continue;
			err = pf_push_vf_cfg_lmem(gt, vfid, lmem);
		}
		if (unlikely(err))
			return err;
	}
	return 0;
}

static void pf_force_lmtt_invalidate(struct xe_device *xe)
{
	struct xe_lmtt *lmtt;
	struct xe_tile *tile;
	unsigned int tid;

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

	for_each_tile(tile, xe, tid) {
		lmtt = &tile->sriov.pf.lmtt;
		xe_lmtt_invalidate_hw(lmtt);
	}
}

static void pf_reset_vf_lmtt(struct xe_device *xe, unsigned int vfid)
{
	struct xe_lmtt *lmtt;
	struct xe_tile *tile;
	unsigned int tid;

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

	for_each_tile(tile, xe, tid) {
		lmtt = &tile->sriov.pf.lmtt;
		xe_lmtt_drop_pages(lmtt, vfid);
	}
}

static int pf_update_vf_lmtt(struct xe_device *xe, unsigned int vfid)
{
	struct xe_gt_sriov_config *config;
	struct xe_tile *tile;
	struct xe_lmtt *lmtt;
	struct xe_bo *bo;
	struct xe_gt *gt;
	u64 total, offset;
	unsigned int gtid;
	unsigned int tid;
	int err;

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

	total = 0;
	for_each_tile(tile, xe, tid)
		total += pf_get_vf_config_lmem(tile->primary_gt, vfid);

	for_each_tile(tile, xe, tid) {
		lmtt = &tile->sriov.pf.lmtt;

		xe_lmtt_drop_pages(lmtt, vfid);
		if (!total)
			continue;

		err  = xe_lmtt_prepare_pages(lmtt, vfid, total);
		if (err)
			goto fail;

		offset = 0;
		for_each_gt_with_type(gt, xe, gtid, BIT(XE_GT_TYPE_MAIN)) {
			config = pf_pick_vf_config(gt, vfid);
			bo = config->lmem_obj;
			if (!bo)
				continue;

			err = xe_lmtt_populate_pages(lmtt, vfid, bo, offset);
			if (err)
				goto fail;
			offset += xe_bo_size(bo);
		}
	}

	pf_force_lmtt_invalidate(xe);

Annotation

Implementation Notes