drivers/gpu/drm/i915/gt/selftest_hangcheck.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gt/selftest_hangcheck.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/gt/selftest_hangcheck.c- Extension
.c- Size
- 46605 bytes
- Lines
- 2037
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kthread.hgem/i915_gem_context.hgem/i915_gem_internal.hi915_gem_evict.hintel_gt.hintel_engine_heartbeat.hintel_engine_pm.hselftest_engine_heartbeat.hi915_selftest.hselftests/i915_random.hselftests/igt_flush_test.hselftests/igt_reset.hselftests/igt_atomic.hselftests/igt_spinner.hselftests/intel_scheduler_helpers.hselftests/mock_drm.hgem/selftests/mock_context.hgem/selftests/igt_gem_utils.h
Detected Declarations
struct hangstruct active_enginestruct evict_vmafunction hang_initfunction hws_addressfunction hang_create_requestfunction hws_seqnofunction hang_finifunction wait_until_runningfunction igt_hang_sanitycheckfunction for_each_enginefunction wait_for_idlefunction igt_reset_nopfunction for_each_enginefunction igt_reset_nop_enginefunction for_each_enginefunction force_reset_timeoutfunction cancel_reset_timeoutfunction igt_reset_fail_enginefunction for_each_enginefunction __igt_reset_enginefunction for_each_enginefunction igt_reset_idle_enginefunction igt_reset_active_enginefunction active_request_putfunction active_enginefunction __igt_reset_enginesfunction for_each_enginefunction for_each_enginefunction for_each_enginefunction igt_reset_enginesfunction fake_hangcheckfunction igt_reset_waitfunction evict_vmafunction evict_fencefunction __igt_reset_evict_vmafunction igt_reset_evict_ggttfunction igt_reset_evict_ppgttfunction igt_reset_evict_fencefunction wait_for_othersfunction for_each_enginefunction igt_reset_queuefunction for_each_enginefunction igt_handle_errorfunction __igt_atomic_reset_enginefunction igt_atomic_reset_enginefunction igt_reset_engines_atomicfunction for_each_engine
Annotated Snippet
struct hang {
struct intel_gt *gt;
struct drm_i915_gem_object *hws;
struct drm_i915_gem_object *obj;
struct i915_gem_context *ctx;
u32 *seqno;
u32 *batch;
};
static int hang_init(struct hang *h, struct intel_gt *gt)
{
void *vaddr;
int err;
memset(h, 0, sizeof(*h));
h->gt = gt;
h->ctx = kernel_context(gt->i915, NULL);
if (IS_ERR(h->ctx))
return PTR_ERR(h->ctx);
GEM_BUG_ON(i915_gem_context_is_bannable(h->ctx));
h->hws = i915_gem_object_create_internal(gt->i915, PAGE_SIZE);
if (IS_ERR(h->hws)) {
err = PTR_ERR(h->hws);
goto err_ctx;
}
h->obj = i915_gem_object_create_internal(gt->i915, PAGE_SIZE);
if (IS_ERR(h->obj)) {
err = PTR_ERR(h->obj);
goto err_hws;
}
i915_gem_object_set_cache_coherency(h->hws, I915_CACHE_LLC);
vaddr = i915_gem_object_pin_map_unlocked(h->hws, I915_MAP_WB);
if (IS_ERR(vaddr)) {
err = PTR_ERR(vaddr);
goto err_obj;
}
h->seqno = memset(vaddr, 0xff, PAGE_SIZE);
vaddr = i915_gem_object_pin_map_unlocked(h->obj,
intel_gt_coherent_map_type(gt, h->obj, false));
if (IS_ERR(vaddr)) {
err = PTR_ERR(vaddr);
goto err_unpin_hws;
}
h->batch = vaddr;
return 0;
err_unpin_hws:
i915_gem_object_unpin_map(h->hws);
err_obj:
i915_gem_object_put(h->obj);
err_hws:
i915_gem_object_put(h->hws);
err_ctx:
kernel_context_close(h->ctx);
return err;
}
static u64 hws_address(const struct i915_vma *hws,
const struct i915_request *rq)
{
return i915_vma_offset(hws) +
offset_in_page(sizeof(u32) * rq->fence.context);
}
static struct i915_request *
hang_create_request(struct hang *h, struct intel_engine_cs *engine)
{
struct intel_gt *gt = h->gt;
struct i915_address_space *vm = i915_gem_context_get_eb_vm(h->ctx);
struct drm_i915_gem_object *obj;
struct i915_request *rq = NULL;
struct i915_vma *hws, *vma;
unsigned int flags;
void *vaddr;
u32 *batch;
int err;
obj = i915_gem_object_create_internal(gt->i915, PAGE_SIZE);
if (IS_ERR(obj)) {
i915_vm_put(vm);
return ERR_CAST(obj);
}
Annotation
- Immediate include surface: `linux/kthread.h`, `gem/i915_gem_context.h`, `gem/i915_gem_internal.h`, `i915_gem_evict.h`, `intel_gt.h`, `intel_engine_heartbeat.h`, `intel_engine_pm.h`, `selftest_engine_heartbeat.h`.
- Detected declarations: `struct hang`, `struct active_engine`, `struct evict_vma`, `function hang_init`, `function hws_address`, `function hang_create_request`, `function hws_seqno`, `function hang_fini`, `function wait_until_running`, `function igt_hang_sanitycheck`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.