Commit 05273c95 authored by Chris Wilson's avatar Chris Wilson

drm/i915/pmu: Fix building without CONFIG_PM

As we peek inside struct device to query members guarded by CONFIG_PM,
so must be the code.
Reported-by: default avatarkbuild test robot <fengguang.wu@intel.com>
Fixes: 1fe699e3 ("drm/i915/pmu: Fix sleep under atomic in RC6 readout")
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180207160428.17015-1-chris@chris-wilson.co.uk
parent 1fe699e3
...@@ -415,22 +415,32 @@ static int i915_pmu_event_init(struct perf_event *event) ...@@ -415,22 +415,32 @@ static int i915_pmu_event_init(struct perf_event *event)
return 0; return 0;
} }
static u64 get_rc6(struct drm_i915_private *i915, bool locked) static u64 __get_rc6(struct drm_i915_private *i915)
{ {
unsigned long flags;
u64 val; u64 val;
if (intel_runtime_pm_get_if_in_use(i915)) { val = intel_rc6_residency_ns(i915,
val = intel_rc6_residency_ns(i915, IS_VALLEYVIEW(i915) ? IS_VALLEYVIEW(i915) ?
VLV_GT_RENDER_RC6 : VLV_GT_RENDER_RC6 :
GEN6_GT_GFX_RC6); GEN6_GT_GFX_RC6);
if (HAS_RC6p(i915)) if (HAS_RC6p(i915))
val += intel_rc6_residency_ns(i915, GEN6_GT_GFX_RC6p); val += intel_rc6_residency_ns(i915, GEN6_GT_GFX_RC6p);
if (HAS_RC6pp(i915))
val += intel_rc6_residency_ns(i915, GEN6_GT_GFX_RC6pp);
return val;
}
if (HAS_RC6pp(i915)) static u64 get_rc6(struct drm_i915_private *i915, bool locked)
val += intel_rc6_residency_ns(i915, GEN6_GT_GFX_RC6pp); {
#if IS_ENABLED(CONFIG_PM)
unsigned long flags;
u64 val;
if (intel_runtime_pm_get_if_in_use(i915)) {
val = __get_rc6(i915);
intel_runtime_pm_put(i915); intel_runtime_pm_put(i915);
/* /*
...@@ -487,6 +497,9 @@ static u64 get_rc6(struct drm_i915_private *i915, bool locked) ...@@ -487,6 +497,9 @@ static u64 get_rc6(struct drm_i915_private *i915, bool locked)
} }
return val; return val;
#else
return __get_rc6(i915);
#endif
} }
static u64 __i915_pmu_event_read(struct perf_event *event, bool locked) static u64 __i915_pmu_event_read(struct perf_event *event, bool locked)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment