drivers/gpu/drm/xe/tests/xe_rtp_test.c

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

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/xe/tests/xe_rtp_test.c
Extension
.c
Size
17671 bytes
Lines
702
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

struct rtp_rules_test_case {
	const char *name;
	bool expected_match;
	int expected_err;
	const struct xe_rtp_rule *rules;
	u8 n_rules;
};

struct rtp_to_sr_test_case {
	const char *name;
	struct xe_reg expected_reg;
	u32 expected_set_bits;
	u32 expected_clr_bits;
	unsigned long expected_count_sr_entries;
	unsigned int expected_sr_errors;
	unsigned long expected_active;
	const struct xe_rtp_entry_sr *entries;
};

struct rtp_test_case {
	const char *name;
	unsigned long expected_active;
	const struct xe_rtp_entry *entries;
};

static bool fake_xe_gt_mcr_check_reg(struct xe_gt *gt, struct xe_reg reg)
{
	/*
	 * All supported platforms in this imaginary setup will always have REG4
	 * as a non-MCR register and REG5 as MCR, meaning that BAD_MCR_REG4 and
	 * BAD_REGULAR_REG5 represent programming errors to be captured by our
	 * tests.
	 */
	if (reg.raw == BAD_REGULAR_REG5.raw)
		return true;

	if (reg.raw == BAD_MCR_REG4.raw)
		return false;

	return reg.mcr;
}

static bool match_yes(const struct xe_device *xe, const struct xe_gt *gt,
		      const struct xe_hw_engine *hwe)
{
	return true;
}

static bool match_no(const struct xe_device *xe, const struct xe_gt *gt,
		     const struct xe_hw_engine *hwe)
{
	return false;
}

static const struct rtp_rules_test_case rtp_rules_cases[] = {
	/*
	 * Single rules.
	 *
	 * TODO: Include other types of rules as well: GRAPHICS_VERSION(),
	 * MEDIA_VERSION(), etc.
	 */
	{
		.name = "no",
		.expected_match = false,
		XE_RTP_RULES(FUNC(match_no)),
	},
	{
		.name = "yes",
		.expected_match = true,
		XE_RTP_RULES(FUNC(match_yes)),
	},

	/* Conjunctions with 2 operands. */
	{
		.name = "no-and-no",
		.expected_match = false,
		XE_RTP_RULES(FUNC(match_no), FUNC(match_no)),
	},
	{
		.name = "no-and-yes",
		.expected_match = false,
		XE_RTP_RULES(FUNC(match_no), FUNC(match_yes)),
	},
	{
		.name = "yes-and-no",
		.expected_match = false,
		XE_RTP_RULES(FUNC(match_yes), FUNC(match_no)),
	},
	{
		.name = "yes-and-yes",

Annotation

Implementation Notes