drivers/gpu/drm/i915/intel_runtime_pm.h
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/intel_runtime_pm.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/intel_runtime_pm.h- Extension
.h- Size
- 8160 bytes
- Lines
- 233
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/pm_runtime.hlinux/types.hintel_wakeref.h
Detected Declarations
struct devicestruct drm_i915_privatestruct drm_printerstruct intel_display_rpm_interfacestruct intel_runtime_pmfunction intel_rpm_raw_wakeref_countfunction intel_rpm_wakelock_countfunction intel_runtime_pm_suspendedfunction assert_rpm_device_not_suspendedfunction __assert_rpm_raw_wakeref_heldfunction __assert_rpm_wakelock_heldfunction assert_rpm_raw_wakeref_heldfunction assert_rpm_wakelock_heldfunction intel_runtime_pm_getfunction disable_rpm_wakeref_assertsfunction intel_runtime_pm_putfunction print_intel_runtime_pm_wakeref
Annotated Snippet
struct intel_runtime_pm {
atomic_t wakeref_count;
struct device *kdev; /* points to i915->drm.dev */
bool available;
bool no_wakeref_tracking;
/*
* Protects access to lmem usefault list.
* It is required, if we are outside of the runtime suspend path,
* access to @lmem_userfault_list requires always first grabbing the
* runtime pm, to ensure we can't race against runtime suspend.
* Once we have that we also need to grab @lmem_userfault_lock,
* at which point we have exclusive access.
* The runtime suspend path is special since it doesn't really hold any locks,
* but instead has exclusive access by virtue of all other accesses requiring
* holding the runtime pm wakeref.
*/
spinlock_t lmem_userfault_lock;
/*
* Keep list of userfaulted gem obj, which require to release their
* mmap mappings at runtime suspend path.
*/
struct list_head lmem_userfault_list;
/* Manual runtime pm autosuspend delay for user GGTT/lmem mmaps */
struct intel_wakeref_auto userfault_wakeref;
#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_RUNTIME_PM)
/*
* To aide detection of wakeref leaks and general misuse, we
* track all wakeref holders. With manual markup (i.e. returning
* a cookie to each rpm_get caller which they then supply to their
* paired rpm_put) we can remove corresponding pairs of and keep
* the array trimmed to active wakerefs.
*/
struct ref_tracker_dir debug;
#endif
};
#define BITS_PER_WAKEREF \
BITS_PER_TYPE(typeof_member(struct intel_runtime_pm, wakeref_count))
#define INTEL_RPM_WAKELOCK_SHIFT (BITS_PER_WAKEREF / 2)
#define INTEL_RPM_WAKELOCK_BIAS (1 << INTEL_RPM_WAKELOCK_SHIFT)
#define INTEL_RPM_RAW_WAKEREF_MASK (INTEL_RPM_WAKELOCK_BIAS - 1)
static inline int
intel_rpm_raw_wakeref_count(int wakeref_count)
{
return wakeref_count & INTEL_RPM_RAW_WAKEREF_MASK;
}
static inline int
intel_rpm_wakelock_count(int wakeref_count)
{
return wakeref_count >> INTEL_RPM_WAKELOCK_SHIFT;
}
static inline bool
intel_runtime_pm_suspended(struct intel_runtime_pm *rpm)
{
return pm_runtime_suspended(rpm->kdev);
}
static inline void
assert_rpm_device_not_suspended(struct intel_runtime_pm *rpm)
{
WARN_ONCE(intel_runtime_pm_suspended(rpm),
"Device suspended during HW access\n");
}
static inline void
__assert_rpm_raw_wakeref_held(struct intel_runtime_pm *rpm, int wakeref_count)
{
assert_rpm_device_not_suspended(rpm);
WARN_ONCE(!intel_rpm_raw_wakeref_count(wakeref_count),
"RPM raw-wakeref not held\n");
}
static inline void
__assert_rpm_wakelock_held(struct intel_runtime_pm *rpm, int wakeref_count)
{
__assert_rpm_raw_wakeref_held(rpm, wakeref_count);
WARN_ONCE(!intel_rpm_wakelock_count(wakeref_count),
"RPM wakelock ref not held during HW access\n");
}
static inline void
assert_rpm_raw_wakeref_held(struct intel_runtime_pm *rpm)
{
Annotation
- Immediate include surface: `linux/pm_runtime.h`, `linux/types.h`, `intel_wakeref.h`.
- Detected declarations: `struct device`, `struct drm_i915_private`, `struct drm_printer`, `struct intel_display_rpm_interface`, `struct intel_runtime_pm`, `function intel_rpm_raw_wakeref_count`, `function intel_rpm_wakelock_count`, `function intel_runtime_pm_suspended`, `function assert_rpm_device_not_suspended`, `function __assert_rpm_raw_wakeref_held`.
- 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.