Commit 8e99299a authored by Chris Wilson's avatar Chris Wilson

drm/i915/gt: Track use of RPS interrupts in flags

Use the new intel_rps.flags field to store whether or not interrupts are
being used with RPS.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarAndi Shyti <andi@etezian.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200429205446.3259-3-chris@chris-wilson.co.uk
parent 9bad2adb
...@@ -742,7 +742,7 @@ void intel_rps_unpark(struct intel_rps *rps) ...@@ -742,7 +742,7 @@ void intel_rps_unpark(struct intel_rps *rps)
mutex_unlock(&rps->lock); mutex_unlock(&rps->lock);
if (INTEL_GEN(rps_to_i915(rps)) >= 6) if (intel_rps_has_interrupts(rps))
rps_enable_interrupts(rps); rps_enable_interrupts(rps);
if (IS_GEN(rps_to_i915(rps), 5)) if (IS_GEN(rps_to_i915(rps), 5))
...@@ -751,12 +751,10 @@ void intel_rps_unpark(struct intel_rps *rps) ...@@ -751,12 +751,10 @@ void intel_rps_unpark(struct intel_rps *rps)
void intel_rps_park(struct intel_rps *rps) void intel_rps_park(struct intel_rps *rps)
{ {
struct drm_i915_private *i915 = rps_to_i915(rps);
if (!intel_rps_clear_active(rps)) if (!intel_rps_clear_active(rps))
return; return;
if (INTEL_GEN(i915) >= 6) if (intel_rps_has_interrupts(rps))
rps_disable_interrupts(rps); rps_disable_interrupts(rps);
if (rps->last_freq <= rps->idle_freq) if (rps->last_freq <= rps->idle_freq)
...@@ -838,7 +836,7 @@ int intel_rps_set(struct intel_rps *rps, u8 val) ...@@ -838,7 +836,7 @@ int intel_rps_set(struct intel_rps *rps, u8 val)
* Make sure we continue to get interrupts * Make sure we continue to get interrupts
* until we hit the minimum or maximum frequencies. * until we hit the minimum or maximum frequencies.
*/ */
if (INTEL_GEN(rps_to_i915(rps)) >= 6) { if (intel_rps_has_interrupts(rps)) {
struct intel_uncore *uncore = rps_to_uncore(rps); struct intel_uncore *uncore = rps_to_uncore(rps);
set(uncore, set(uncore,
...@@ -1257,6 +1255,11 @@ void intel_rps_enable(struct intel_rps *rps) ...@@ -1257,6 +1255,11 @@ void intel_rps_enable(struct intel_rps *rps)
GEM_BUG_ON(rps->efficient_freq < rps->min_freq); GEM_BUG_ON(rps->efficient_freq < rps->min_freq);
GEM_BUG_ON(rps->efficient_freq > rps->max_freq); GEM_BUG_ON(rps->efficient_freq > rps->max_freq);
if (INTEL_GEN(i915) >= 6)
intel_rps_set_interrupts(rps);
else
/* Ironlake currently uses intel_ips.ko */ {}
intel_rps_set_enabled(rps); intel_rps_set_enabled(rps);
} }
...@@ -1270,6 +1273,7 @@ void intel_rps_disable(struct intel_rps *rps) ...@@ -1270,6 +1273,7 @@ void intel_rps_disable(struct intel_rps *rps)
struct drm_i915_private *i915 = rps_to_i915(rps); struct drm_i915_private *i915 = rps_to_i915(rps);
intel_rps_clear_enabled(rps); intel_rps_clear_enabled(rps);
intel_rps_clear_interrupts(rps);
if (INTEL_GEN(i915) >= 6) if (INTEL_GEN(i915) >= 6)
gen6_rps_disable(rps); gen6_rps_disable(rps);
...@@ -1741,6 +1745,9 @@ void intel_rps_init(struct intel_rps *rps) ...@@ -1741,6 +1745,9 @@ void intel_rps_init(struct intel_rps *rps)
if (INTEL_GEN(i915) >= 8 && INTEL_GEN(i915) < 11) if (INTEL_GEN(i915) >= 8 && INTEL_GEN(i915) < 11)
rps->pm_intrmsk_mbz |= GEN8_PMINTR_DISABLE_REDIRECT_TO_GUC; rps->pm_intrmsk_mbz |= GEN8_PMINTR_DISABLE_REDIRECT_TO_GUC;
if (INTEL_GEN(i915) >= 6)
rps_disable_interrupts(rps);
} }
u32 intel_rps_get_cagf(struct intel_rps *rps, u32 rpstat) u32 intel_rps_get_cagf(struct intel_rps *rps, u32 rpstat)
......
...@@ -66,4 +66,19 @@ static inline bool intel_rps_clear_active(struct intel_rps *rps) ...@@ -66,4 +66,19 @@ static inline bool intel_rps_clear_active(struct intel_rps *rps)
return test_and_clear_bit(INTEL_RPS_ACTIVE, &rps->flags); return test_and_clear_bit(INTEL_RPS_ACTIVE, &rps->flags);
} }
static inline bool intel_rps_has_interrupts(const struct intel_rps *rps)
{
return test_bit(INTEL_RPS_INTERRUPTS, &rps->flags);
}
static inline void intel_rps_set_interrupts(struct intel_rps *rps)
{
set_bit(INTEL_RPS_INTERRUPTS, &rps->flags);
}
static inline void intel_rps_clear_interrupts(struct intel_rps *rps)
{
clear_bit(INTEL_RPS_INTERRUPTS, &rps->flags);
}
#endif /* INTEL_RPS_H */ #endif /* INTEL_RPS_H */
...@@ -34,6 +34,7 @@ struct intel_rps_ei { ...@@ -34,6 +34,7 @@ struct intel_rps_ei {
enum { enum {
INTEL_RPS_ENABLED = 0, INTEL_RPS_ENABLED = 0,
INTEL_RPS_ACTIVE, INTEL_RPS_ACTIVE,
INTEL_RPS_INTERRUPTS,
}; };
struct intel_rps { struct intel_rps {
......
...@@ -1017,7 +1017,7 @@ int live_rps_interrupt(void *arg) ...@@ -1017,7 +1017,7 @@ int live_rps_interrupt(void *arg)
* First, let's check whether or not we are receiving interrupts. * First, let's check whether or not we are receiving interrupts.
*/ */
if (!intel_rps_is_enabled(rps)) if (!intel_rps_has_interrupts(rps))
return 0; return 0;
intel_gt_pm_get(gt); intel_gt_pm_get(gt);
......
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