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.
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/string.hlinux/xarray.hdrm/drm_drv.hdrm/drm_kunit_helpers.hkunit/static_stub.hkunit/test.hregs/xe_gt_regs.hregs/xe_reg_defs.hxe_device.hxe_device_types.hxe_gt_mcr.hxe_kunit_helpers.hxe_pci_test.hxe_reg_sr.hxe_rtp.hxe_rtp_test.h
Detected Declarations
struct rtp_rules_test_casestruct rtp_to_sr_test_casestruct rtp_test_casefunction fake_xe_gt_mcr_check_regfunction match_yesfunction match_nofunction xe_rtp_rules_testsfunction XE_RTP_RULESfunction xe_rtp_process_to_sr_testsfunction xa_for_eachfunction XE_RTP_RULESfunction xe_rtp_process_testsfunction rtp_rules_descfunction rtp_to_sr_descfunction rtp_descfunction xe_rtp_test_initfunction xe_rtp_test_exit
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
- Immediate include surface: `linux/string.h`, `linux/xarray.h`, `drm/drm_drv.h`, `drm/drm_kunit_helpers.h`, `kunit/static_stub.h`, `kunit/test.h`, `regs/xe_gt_regs.h`, `regs/xe_reg_defs.h`.
- Detected declarations: `struct rtp_rules_test_case`, `struct rtp_to_sr_test_case`, `struct rtp_test_case`, `function fake_xe_gt_mcr_check_reg`, `function match_yes`, `function match_no`, `function xe_rtp_rules_tests`, `function XE_RTP_RULES`, `function xe_rtp_process_to_sr_tests`, `function xa_for_each`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.