drivers/gpu/drm/xe/xe_rtp.c

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

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/xe/xe_rtp.c
Extension
.c
Size
12809 bytes
Lines
472
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: exported/initcall integration point
Status
integration 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

struct rule_match_ctx {
	const struct xe_device *xe;
	struct xe_gt *gt;
	struct xe_hw_engine *hwe;
	const struct xe_rtp_rule *rules;
	const unsigned int n_rules;
	unsigned int head;
	int err;
};

static bool rule_is_item(const struct xe_rtp_rule *r)
{
	return r->match_type != XE_RTP_MATCH_OR;
}

static bool rule_match_item(struct rule_match_ctx *match_ctx)
{
	const struct xe_device *xe = match_ctx->xe;
	struct xe_gt *gt = match_ctx->gt;
	struct xe_hw_engine *hwe = match_ctx->hwe;
	const struct xe_rtp_rule *r = &match_ctx->rules[match_ctx->head];

	switch (r->match_type) {
	case XE_RTP_MATCH_PLATFORM:
		return xe->info.platform == r->platform;
	case XE_RTP_MATCH_SUBPLATFORM:
		return xe->info.platform == r->platform &&
			xe->info.subplatform == r->subplatform;
	case XE_RTP_MATCH_PLATFORM_STEP:
		if (drm_WARN_ON(&xe->drm, xe->info.step.platform == STEP_NONE))
			return false;

		return xe->info.step.platform >= r->step_start &&
			xe->info.step.platform < r->step_end;
	case XE_RTP_MATCH_GRAPHICS_VERSION:
		if (drm_WARN_ON(&xe->drm, !gt))
			return false;

		return xe->info.graphics_verx100 == r->ver_start &&
			(!has_samedia(xe) || !xe_gt_is_media_type(gt));
	case XE_RTP_MATCH_GRAPHICS_VERSION_RANGE:
		if (drm_WARN_ON(&xe->drm, !gt))
			return false;

		return xe->info.graphics_verx100 >= r->ver_start &&
			xe->info.graphics_verx100 <= r->ver_end &&
			(!has_samedia(xe) || !xe_gt_is_media_type(gt));
	case XE_RTP_MATCH_GRAPHICS_VERSION_ANY_GT:
		if (drm_WARN_ON(&xe->drm, !gt))
			return false;

		return xe->info.graphics_verx100 == r->ver_start;
	case XE_RTP_MATCH_GRAPHICS_STEP:
		if (drm_WARN_ON(&xe->drm, !gt))
			return false;

		return xe->info.step.graphics >= r->step_start &&
			xe->info.step.graphics < r->step_end &&
			(!has_samedia(xe) || !xe_gt_is_media_type(gt));
	case XE_RTP_MATCH_MEDIA_VERSION:
		if (drm_WARN_ON(&xe->drm, !gt))
			return false;

		return xe->info.media_verx100 == r->ver_start &&
			(!has_samedia(xe) || xe_gt_is_media_type(gt));
	case XE_RTP_MATCH_MEDIA_VERSION_RANGE:
		if (drm_WARN_ON(&xe->drm, !gt))
			return false;

		return xe->info.media_verx100 >= r->ver_start &&
			xe->info.media_verx100 <= r->ver_end &&
			(!has_samedia(xe) || xe_gt_is_media_type(gt));
	case XE_RTP_MATCH_MEDIA_STEP:
		if (drm_WARN_ON(&xe->drm, !gt))
			return false;

		return xe->info.step.media >= r->step_start &&
			xe->info.step.media < r->step_end &&
			(!has_samedia(xe) || xe_gt_is_media_type(gt));
	case XE_RTP_MATCH_MEDIA_VERSION_ANY_GT:
		if (drm_WARN_ON(&xe->drm, !gt))
			return false;

		return xe->info.media_verx100 == r->ver_start;
	case XE_RTP_MATCH_INTEGRATED:
		return !xe->info.is_dgfx;
	case XE_RTP_MATCH_DISCRETE:
		return xe->info.is_dgfx;
	case XE_RTP_MATCH_ENGINE_CLASS:
		if (drm_WARN_ON(&xe->drm, !hwe))

Annotation

Implementation Notes