ee33baa831
Previously, we assumed we could use mutex_trylock() within an atomic context, falling back to a worker if contended. However, such trickery is illegal inside interrupt context, and so we need to always use a worker under such circumstances. As we normally are in process context, we can typically use a plain mutex, and only defer to a work when we know we are being called from an interrupt path. Fixes:51fbd8de87
("drm/i915/pmu: Atomically acquire the gt_pm wakeref") References:a0855d24fc
("locking/mutex: Complain upon mutex API misuse in IRQ contexts") References: https://bugs.freedesktop.org/show_bug.cgi?id=111626 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20191120125433.3767149-1-chris@chris-wilson.co.uk (cherry picked from commit07779a76ee
) Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
69 lines
1.5 KiB
C
69 lines
1.5 KiB
C
/*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
* Copyright © 2019 Intel Corporation
|
|
*/
|
|
|
|
#ifndef INTEL_GT_PM_H
|
|
#define INTEL_GT_PM_H
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include "intel_gt_types.h"
|
|
#include "intel_wakeref.h"
|
|
|
|
static inline bool intel_gt_pm_is_awake(const struct intel_gt *gt)
|
|
{
|
|
return intel_wakeref_is_active(>->wakeref);
|
|
}
|
|
|
|
static inline void intel_gt_pm_get(struct intel_gt *gt)
|
|
{
|
|
intel_wakeref_get(>->wakeref);
|
|
}
|
|
|
|
static inline void __intel_gt_pm_get(struct intel_gt *gt)
|
|
{
|
|
__intel_wakeref_get(>->wakeref);
|
|
}
|
|
|
|
static inline bool intel_gt_pm_get_if_awake(struct intel_gt *gt)
|
|
{
|
|
return intel_wakeref_get_if_active(>->wakeref);
|
|
}
|
|
|
|
static inline void intel_gt_pm_put(struct intel_gt *gt)
|
|
{
|
|
intel_wakeref_put(>->wakeref);
|
|
}
|
|
|
|
static inline void intel_gt_pm_put_async(struct intel_gt *gt)
|
|
{
|
|
intel_wakeref_put_async(>->wakeref);
|
|
}
|
|
|
|
static inline int intel_gt_pm_wait_for_idle(struct intel_gt *gt)
|
|
{
|
|
return intel_wakeref_wait_for_idle(>->wakeref);
|
|
}
|
|
|
|
void intel_gt_pm_init_early(struct intel_gt *gt);
|
|
void intel_gt_pm_init(struct intel_gt *gt);
|
|
void intel_gt_pm_fini(struct intel_gt *gt);
|
|
|
|
void intel_gt_sanitize(struct intel_gt *gt, bool force);
|
|
|
|
void intel_gt_suspend_prepare(struct intel_gt *gt);
|
|
void intel_gt_suspend_late(struct intel_gt *gt);
|
|
int intel_gt_resume(struct intel_gt *gt);
|
|
|
|
void intel_gt_runtime_suspend(struct intel_gt *gt);
|
|
int intel_gt_runtime_resume(struct intel_gt *gt);
|
|
|
|
static inline bool is_mock_gt(const struct intel_gt *gt)
|
|
{
|
|
return I915_SELFTEST_ONLY(gt->awake == -ENODEV);
|
|
}
|
|
|
|
#endif /* INTEL_GT_PM_H */
|