/* * This struct helps tracking the state needed for runtime PM, which puts the * device in PCI D3 state. Notice that when this happens, nothing on the * graphics device works, even register access, so we don't get interrupts nor * anything else. * * Every piece of our code that needs to actually touch the hardware needs to * either call intel_runtime_pm_get or call intel_display_power_get with the * appropriate power domain. * * Our driver uses the autosuspend delay feature, which means we'll only really * suspend if we stay with zero refcount for a certain amount of time. The * default value is currently very conservative (see intel_runtime_pm_enable), but * it can be changed with the standard runtime PM files from sysfs. * * The irqs_disabled variable becomes true exactly after we disable the IRQs and * goes back to false exactly before we re-enable the IRQs. We use this variable * to check if someone is trying to enable/disable IRQs while they're supposed * to be disabled. This shouldn't happen and we'll print some error messages in * case it happens. * * For more, read the Documentation/power/runtime_pm.rst.
*/ 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
};
staticinlinevoid
__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");
}
staticinlinevoid
__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");
}
/** * disable_rpm_wakeref_asserts - disable the RPM assert checks * @rpm: the intel_runtime_pm structure * * This function disable asserts that check if we hold an RPM wakelock * reference, while keeping the device-not-suspended checks still enabled. * It's meant to be used only in special circumstances where our rule about * the wakelock refcount wrt. the device power state doesn't hold. According * to this rule at any point where we access the HW or want to keep the HW in * an active state we must hold an RPM wakelock reference acquired via one of * the intel_runtime_pm_get() helpers. Currently there are a few special spots * where this rule doesn't hold: the IRQ and suspend/resume handlers, the * forcewake release timer, and the GPU RPS and hangcheck works. All other * users should avoid using this function. * * Any calls to this function must have a symmetric call to * enable_rpm_wakeref_asserts().
*/ staticinlinevoid
disable_rpm_wakeref_asserts(struct intel_runtime_pm *rpm)
{
atomic_add(INTEL_RPM_WAKELOCK_BIAS + 1,
&rpm->wakeref_count);
}
/** * enable_rpm_wakeref_asserts - re-enable the RPM assert checks * @rpm: the intel_runtime_pm structure * * This function re-enables the RPM assert checks after disabling them with * disable_rpm_wakeref_asserts. It's meant to be used only in special * circumstances otherwise its use should be avoided. * * Any calls to this function must have a symmetric call to * disable_rpm_wakeref_asserts().
*/ staticinlinevoid
enable_rpm_wakeref_asserts(struct intel_runtime_pm *rpm)
{
atomic_sub(INTEL_RPM_WAKELOCK_BIAS + 1,
&rpm->wakeref_count);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.