drivers/gpu/drm/xe/xe_guc.c

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

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/xe/xe_guc.c
Extension
.c
Size
47675 bytes
Lines
1852
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 (err) {
				while (--t >= 0)
					guc_g2g_deregister(guc, far_tile, far_dev, t);
				goto err_deregister;
			}
		}
	}

	return 0;

err_deregister:
	for_each_gt(far_gt, xe, j) {
		u32 tile, dev;

		if (far_gt->info.id == gt->info.id)
			continue;

		if (j >= i)
			break;

		tile = gt_to_tile(far_gt)->id;
		dev = G2G_DEV(far_gt);

		for (t = 0; t < XE_G2G_TYPE_LIMIT; t++)
			guc_g2g_deregister(guc, tile, dev, t);
	}

	return err;
}

static int __guc_opt_in_features_enable(struct xe_guc *guc, u64 addr, u32 num_dwords)
{
	u32 action[] = {
		XE_GUC_ACTION_OPT_IN_FEATURE_KLV,
		lower_32_bits(addr),
		upper_32_bits(addr),
		num_dwords
	};

	return xe_guc_ct_send_block(&guc->ct, action, ARRAY_SIZE(action));
}

static bool supports_dynamic_ics(struct xe_guc *guc)
{
	struct xe_device *xe = guc_to_xe(guc);
	struct xe_gt *gt = guc_to_gt(guc);

	/* Dynamic ICS is available for PVC and Xe2 and newer platforms. */
	if (xe->info.platform != XE_PVC && GRAPHICS_VER(xe) < 20)
		return false;

	/*
	 * The feature is currently not compatible with multi-lrc, so the GuC
	 * does not support it at all on the media engines (which are the main
	 * users of mlrc). On the primary GT side, to avoid it being used in
	 * conjunction with mlrc, we only enable it if we are in single CCS
	 * mode.
	 */
	if (xe_gt_is_media_type(gt) || gt->ccs_mode > 1)
		return false;

	/*
	 * Dynamic ICS requires GuC v70.40.1, which maps to compatibility
	 * version v1.18.4.
	 */
	return GUC_SUBMIT_VER(guc) >= MAKE_GUC_VER(1, 18, 4);
}

#define OPT_IN_MAX_DWORDS 16
int xe_guc_opt_in_features_enable(struct xe_guc *guc)
{
	struct xe_device *xe = guc_to_xe(guc);
	CLASS(xe_guc_buf, buf)(&guc->buf, OPT_IN_MAX_DWORDS);
	u32 count = 0;
	u32 *klvs;
	int ret;

	if (!xe_guc_buf_is_valid(buf))
		return -ENOBUFS;

	klvs = xe_guc_buf_cpu_ptr(buf);

	/*
	 * The extra CAT error type opt-in was added in GuC v70.17.0, which maps
	 * to compatibility version v1.7.0.
	 * Note that the GuC allows enabling this KLV even on platforms that do
	 * not support the extra type; in such case the returned type variable
	 * will be set to a known invalid value which we can check against.
	 */
	if (GUC_SUBMIT_VER(guc) >= MAKE_GUC_VER(1, 7, 0))

Annotation

Implementation Notes