drivers/gpu/drm/i915/gt/sysfs_engines.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gt/sysfs_engines.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/gt/sysfs_engines.c- Extension
.c- Size
- 14438 bytes
- Lines
- 539
- 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.
- 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/kobject.hlinux/sysfs.hi915_drv.hi915_timer_util.hintel_engine.hintel_engine_heartbeat.hsysfs_engines.h
Detected Declarations
struct kobj_enginefunction name_showfunction class_showfunction inst_showfunction mmio_showfunction repr_trimfunction __caps_showfunction caps_showfunction all_caps_showfunction max_spin_storefunction max_spin_showfunction max_spin_defaultfunction timeslice_storefunction timeslice_showfunction timeslice_defaultfunction stop_storefunction stop_showfunction stop_defaultfunction preempt_timeout_storefunction preempt_timeout_showfunction preempt_timeout_defaultfunction heartbeat_storefunction heartbeat_showfunction heartbeat_defaultfunction kobj_engine_releasefunction kobj_enginefunction add_defaultsfunction intel_engines_add_sysfsfunction for_each_uabi_engine
Annotated Snippet
struct kobj_engine {
struct kobject base;
struct intel_engine_cs *engine;
};
static struct intel_engine_cs *kobj_to_engine(struct kobject *kobj)
{
return container_of(kobj, struct kobj_engine, base)->engine;
}
static ssize_t
name_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
{
return sysfs_emit(buf, "%s\n", kobj_to_engine(kobj)->name);
}
static const struct kobj_attribute name_attr =
__ATTR(name, 0444, name_show, NULL);
static ssize_t
class_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
{
return sysfs_emit(buf, "%d\n", kobj_to_engine(kobj)->uabi_class);
}
static const struct kobj_attribute class_attr =
__ATTR(class, 0444, class_show, NULL);
static ssize_t
inst_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
{
return sysfs_emit(buf, "%d\n", kobj_to_engine(kobj)->uabi_instance);
}
static const struct kobj_attribute inst_attr =
__ATTR(instance, 0444, inst_show, NULL);
static ssize_t
mmio_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
{
return sysfs_emit(buf, "0x%x\n", kobj_to_engine(kobj)->mmio_base);
}
static const struct kobj_attribute mmio_attr =
__ATTR(mmio_base, 0444, mmio_show, NULL);
static const char * const vcs_caps[] = {
[ilog2(I915_VIDEO_CLASS_CAPABILITY_HEVC)] = "hevc",
[ilog2(I915_VIDEO_AND_ENHANCE_CLASS_CAPABILITY_SFC)] = "sfc",
};
static const char * const vecs_caps[] = {
[ilog2(I915_VIDEO_AND_ENHANCE_CLASS_CAPABILITY_SFC)] = "sfc",
};
static ssize_t repr_trim(char *buf, ssize_t len)
{
/* Trim off the trailing space and replace with a newline */
if (len > PAGE_SIZE)
len = PAGE_SIZE;
if (len > 0)
buf[len - 1] = '\n';
return len;
}
static ssize_t
__caps_show(struct intel_engine_cs *engine,
unsigned long caps, char *buf, bool show_unknown)
{
const char * const *repr;
int count, n;
ssize_t len;
switch (engine->class) {
case VIDEO_DECODE_CLASS:
repr = vcs_caps;
count = ARRAY_SIZE(vcs_caps);
break;
case VIDEO_ENHANCEMENT_CLASS:
repr = vecs_caps;
count = ARRAY_SIZE(vecs_caps);
break;
default:
repr = NULL;
count = 0;
break;
}
Annotation
- Immediate include surface: `linux/kobject.h`, `linux/sysfs.h`, `i915_drv.h`, `i915_timer_util.h`, `intel_engine.h`, `intel_engine_heartbeat.h`, `sysfs_engines.h`.
- Detected declarations: `struct kobj_engine`, `function name_show`, `function class_show`, `function inst_show`, `function mmio_show`, `function repr_trim`, `function __caps_show`, `function caps_show`, `function all_caps_show`, `function max_spin_store`.
- 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.