drivers/gpu/drm/i915/selftests/i915_selftest.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/selftests/i915_selftest.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/selftests/i915_selftest.c- Extension
.c- Size
- 14319 bytes
- Lines
- 591
- 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/random.hgt/intel_gt.hgt/intel_gt_pm.hgt/intel_gt_regs.hgt/uc/intel_gsc_fw.hi915_driver.hi915_drv.hi915_jiffies.hi915_selftest.hi915_wait_util.higt_flush_test.hi915_mock_selftests.hi915_live_selftests.hi915_perf_selftests.h
Detected Declarations
struct selftestfunction i915_mock_sanitycheckfunction i915_live_sanitycheckfunction set_default_test_allfunction __gsc_proxy_init_progressingfunction __wait_gsc_proxy_completedfunction __wait_gsc_huc_load_completedfunction __run_selftestsfunction i915_mock_selftestsfunction i915_live_selftestsfunction i915_perf_selftestsfunction apply_subtest_filterfunction __i915_nop_setupfunction __i915_nop_teardownfunction __i915_live_setupfunction __i915_live_teardownfunction __intel_gt_live_setupfunction __intel_gt_live_teardownfunction __i915_subtestsfunction __igt_timeoutfunction igt_hexdump
Annotated Snippet
struct selftest {
bool enabled;
const char *name;
union {
int (*mock)(void);
int (*live)(struct drm_i915_private *);
};
};
#define selftest(n, f) [mock_##n] = { .name = #n, { .mock = f } },
static struct selftest mock_selftests[] = {
#include "i915_mock_selftests.h"
};
#undef selftest
#define selftest(n, f) [live_##n] = { .name = #n, { .live = f } },
static struct selftest live_selftests[] = {
#include "i915_live_selftests.h"
};
#undef selftest
#define selftest(n, f) [perf_##n] = { .name = #n, { .live = f } },
static struct selftest perf_selftests[] = {
#include "i915_perf_selftests.h"
};
#undef selftest
/* Embed the line number into the parameter name so that we can order tests */
#define selftest(n, func) selftest_0(n, func, param(n))
#define param(n) __PASTE(igt__, __PASTE(__LINE__, __mock_##n))
#define selftest_0(n, func, id) \
module_param_named(id, mock_selftests[mock_##n].enabled, bool, 0400);
#include "i915_mock_selftests.h"
#undef selftest_0
#undef param
#define param(n) __PASTE(igt__, __PASTE(__LINE__, __live_##n))
#define selftest_0(n, func, id) \
module_param_named(id, live_selftests[live_##n].enabled, bool, 0400);
#include "i915_live_selftests.h"
#undef selftest_0
#undef param
#define param(n) __PASTE(igt__, __PASTE(__LINE__, __perf_##n))
#define selftest_0(n, func, id) \
module_param_named(id, perf_selftests[perf_##n].enabled, bool, 0400);
#include "i915_perf_selftests.h"
#undef selftest_0
#undef param
#undef selftest
static void set_default_test_all(struct selftest *st, unsigned int count)
{
unsigned int i;
for (i = 0; i < count; i++)
if (st[i].enabled)
return;
for (i = 0; i < count; i++)
st[i].enabled = true;
}
static bool
__gsc_proxy_init_progressing(struct intel_gsc_uc *gsc)
{
return intel_gsc_uc_fw_proxy_get_status(gsc) == -EAGAIN;
}
static void
__wait_gsc_proxy_completed(struct drm_i915_private *i915)
{
bool need_to_wait = (IS_ENABLED(CONFIG_INTEL_MEI_GSC_PROXY) &&
i915->media_gt &&
HAS_ENGINE(i915->media_gt, GSC0) &&
intel_uc_fw_is_loadable(&i915->media_gt->uc.gsc.fw));
/*
* The gsc proxy component depends on the kernel component driver load ordering
* and in corner cases (the first time after an IFWI flash), init-completion
* firmware flows take longer.
*/
unsigned long timeout_ms = 8000;
if (need_to_wait && wait_for(!__gsc_proxy_init_progressing(&i915->media_gt->uc.gsc),
timeout_ms))
pr_warn(DRIVER_NAME "Timed out waiting for gsc_proxy_completion!\n");
}
static void
__wait_gsc_huc_load_completed(struct drm_i915_private *i915)
Annotation
- Immediate include surface: `linux/random.h`, `gt/intel_gt.h`, `gt/intel_gt_pm.h`, `gt/intel_gt_regs.h`, `gt/uc/intel_gsc_fw.h`, `i915_driver.h`, `i915_drv.h`, `i915_jiffies.h`.
- Detected declarations: `struct selftest`, `function i915_mock_sanitycheck`, `function i915_live_sanitycheck`, `function set_default_test_all`, `function __gsc_proxy_init_progressing`, `function __wait_gsc_proxy_completed`, `function __wait_gsc_huc_load_completed`, `function __run_selftests`, `function i915_mock_selftests`, `function i915_live_selftests`.
- 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.