Commit cf1c97dc authored by Andi Shyti's avatar Andi Shyti Committed by Chris Wilson

drm/i915: Extract general GT interrupt handlers

i915_irq.c is large. It serves as the central dispatch and handler for
all of our device interrupts. Lets break it up by pulling out the GT
interrupt handlers.

Based on a patch by Chris Wilson.
Signed-off-by: default avatarAndi Shyti <andi.shyti@intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20190811210633.18417-1-chris@chris-wilson.co.uk
parent d762043f
...@@ -80,6 +80,7 @@ gt-y += \ ...@@ -80,6 +80,7 @@ gt-y += \
gt/intel_engine_pm.o \ gt/intel_engine_pm.o \
gt/intel_engine_user.o \ gt/intel_engine_user.o \
gt/intel_gt.o \ gt/intel_gt.o \
gt/intel_gt_irq.o \
gt/intel_gt_pm.o \ gt/intel_gt_pm.o \
gt/intel_gt_pm_irq.o \ gt/intel_gt_pm_irq.o \
gt/intel_hangcheck.o \ gt/intel_hangcheck.o \
......
...@@ -35,9 +35,9 @@ static void irq_enable(struct intel_engine_cs *engine) ...@@ -35,9 +35,9 @@ static void irq_enable(struct intel_engine_cs *engine)
return; return;
/* Caller disables interrupts */ /* Caller disables interrupts */
spin_lock(&engine->i915->irq_lock); spin_lock(&engine->gt->irq_lock);
engine->irq_enable(engine); engine->irq_enable(engine);
spin_unlock(&engine->i915->irq_lock); spin_unlock(&engine->gt->irq_lock);
} }
static void irq_disable(struct intel_engine_cs *engine) static void irq_disable(struct intel_engine_cs *engine)
...@@ -46,9 +46,9 @@ static void irq_disable(struct intel_engine_cs *engine) ...@@ -46,9 +46,9 @@ static void irq_disable(struct intel_engine_cs *engine)
return; return;
/* Caller disables interrupts */ /* Caller disables interrupts */
spin_lock(&engine->i915->irq_lock); spin_lock(&engine->gt->irq_lock);
engine->irq_disable(engine); engine->irq_disable(engine);
spin_unlock(&engine->i915->irq_lock); spin_unlock(&engine->gt->irq_lock);
} }
static void __intel_breadcrumbs_disarm_irq(struct intel_breadcrumbs *b) static void __intel_breadcrumbs_disarm_irq(struct intel_breadcrumbs *b)
......
This diff is collapsed.
/*
* SPDX-License-Identifier: MIT
*
* Copyright © 2019 Intel Corporation
*/
#ifndef INTEL_GT_IRQ_H
#define INTEL_GT_IRQ_H
#include <linux/types.h>
struct intel_gt;
#define GEN8_GT_IRQS (GEN8_GT_RCS_IRQ | \
GEN8_GT_BCS_IRQ | \
GEN8_GT_VCS0_IRQ | \
GEN8_GT_VCS1_IRQ | \
GEN8_GT_VECS_IRQ | \
GEN8_GT_PM_IRQ | \
GEN8_GT_GUC_IRQ)
void gen11_gt_irq_reset(struct intel_gt *gt);
void gen11_gt_irq_postinstall(struct intel_gt *gt);
void gen11_gt_irq_handler(struct intel_gt *gt, const u32 master_ctl);
bool gen11_gt_reset_one_iir(struct intel_gt *gt,
const unsigned int bank,
const unsigned int bit);
void gen5_gt_irq_handler(struct intel_gt *gt, u32 gt_iir);
void gen5_gt_irq_postinstall(struct intel_gt *gt);
void gen5_gt_irq_reset(struct intel_gt *gt);
void gen5_gt_disable_irq(struct intel_gt *gt, u32 mask);
void gen5_gt_enable_irq(struct intel_gt *gt, u32 mask);
void gen6_gt_irq_handler(struct intel_gt *gt, u32 gt_iir);
void gen8_gt_irq_ack(struct intel_gt *gt, u32 master_ctl, u32 gt_iir[4]);
void gen8_gt_irq_reset(struct intel_gt *gt);
void gen8_gt_irq_handler(struct intel_gt *gt, u32 master_ctl, u32 gt_iir[4]);
void gen8_gt_irq_postinstall(struct intel_gt *gt);
#endif /* INTEL_GT_IRQ_H */
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "i915_drv.h" #include "i915_drv.h"
#include "i915_reg.h" #include "i915_reg.h"
#include "intel_gt.h" #include "intel_gt.h"
#include "intel_gt_irq.h"
#include "intel_gt_pm_irq.h" #include "intel_gt_pm_irq.h"
static void write_pm_imr(struct intel_gt *gt) static void write_pm_imr(struct intel_gt *gt)
......
...@@ -74,6 +74,7 @@ struct intel_gt { ...@@ -74,6 +74,7 @@ struct intel_gt {
struct i915_vma *scratch; struct i915_vma *scratch;
spinlock_t irq_lock; spinlock_t irq_lock;
u32 gt_imr;
u32 pm_ier; u32 pm_ier;
u32 pm_imr; u32 pm_imr;
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "i915_trace.h" #include "i915_trace.h"
#include "intel_context.h" #include "intel_context.h"
#include "intel_gt.h" #include "intel_gt.h"
#include "intel_gt_irq.h"
#include "intel_gt_pm_irq.h" #include "intel_gt_pm_irq.h"
#include "intel_reset.h" #include "intel_reset.h"
#include "intel_workarounds.h" #include "intel_workarounds.h"
...@@ -983,13 +984,13 @@ static u32 *gen5_emit_breadcrumb(struct i915_request *rq, u32 *cs) ...@@ -983,13 +984,13 @@ static u32 *gen5_emit_breadcrumb(struct i915_request *rq, u32 *cs)
static void static void
gen5_irq_enable(struct intel_engine_cs *engine) gen5_irq_enable(struct intel_engine_cs *engine)
{ {
gen5_enable_gt_irq(engine->i915, engine->irq_enable_mask); gen5_gt_enable_irq(engine->gt, engine->irq_enable_mask);
} }
static void static void
gen5_irq_disable(struct intel_engine_cs *engine) gen5_irq_disable(struct intel_engine_cs *engine)
{ {
gen5_disable_gt_irq(engine->i915, engine->irq_enable_mask); gen5_gt_disable_irq(engine->gt, engine->irq_enable_mask);
} }
static void static void
...@@ -1050,14 +1051,14 @@ gen6_irq_enable(struct intel_engine_cs *engine) ...@@ -1050,14 +1051,14 @@ gen6_irq_enable(struct intel_engine_cs *engine)
/* Flush/delay to ensure the RING_IMR is active before the GT IMR */ /* Flush/delay to ensure the RING_IMR is active before the GT IMR */
ENGINE_POSTING_READ(engine, RING_IMR); ENGINE_POSTING_READ(engine, RING_IMR);
gen5_enable_gt_irq(engine->i915, engine->irq_enable_mask); gen5_gt_enable_irq(engine->gt, engine->irq_enable_mask);
} }
static void static void
gen6_irq_disable(struct intel_engine_cs *engine) gen6_irq_disable(struct intel_engine_cs *engine)
{ {
ENGINE_WRITE(engine, RING_IMR, ~engine->irq_keep_mask); ENGINE_WRITE(engine, RING_IMR, ~engine->irq_keep_mask);
gen5_disable_gt_irq(engine->i915, engine->irq_enable_mask); gen5_gt_disable_irq(engine->gt, engine->irq_enable_mask);
} }
static void static void
......
...@@ -1427,7 +1427,6 @@ struct drm_i915_private { ...@@ -1427,7 +1427,6 @@ struct drm_i915_private {
u32 irq_mask; u32 irq_mask;
u32 de_irq_mask[I915_MAX_PIPES]; u32 de_irq_mask[I915_MAX_PIPES];
}; };
u32 gt_irq_mask;
u32 pm_rps_events; u32 pm_rps_events;
u32 pipestat_irq_mask[I915_MAX_PIPES]; u32 pipestat_irq_mask[I915_MAX_PIPES];
......
This diff is collapsed.
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/types.h> #include <linux/types.h>
#include "display/intel_display.h" #include "display/intel_display.h"
#include "i915_reg.h"
struct drm_crtc; struct drm_crtc;
struct drm_device; struct drm_device;
...@@ -19,6 +20,10 @@ struct intel_crtc; ...@@ -19,6 +20,10 @@ struct intel_crtc;
struct intel_crtc; struct intel_crtc;
struct intel_gt; struct intel_gt;
struct intel_guc; struct intel_guc;
struct intel_uncore;
void gen11_rps_irq_handler(struct intel_gt *gt, u32 pm_iir);
void gen6_rps_irq_handler(struct drm_i915_private *dev_priv, u32 pm_iir);
void intel_irq_init(struct drm_i915_private *dev_priv); void intel_irq_init(struct drm_i915_private *dev_priv);
void intel_irq_fini(struct drm_i915_private *dev_priv); void intel_irq_fini(struct drm_i915_private *dev_priv);
...@@ -127,4 +132,46 @@ void i965_disable_vblank(struct drm_crtc *crtc); ...@@ -127,4 +132,46 @@ void i965_disable_vblank(struct drm_crtc *crtc);
void ilk_disable_vblank(struct drm_crtc *crtc); void ilk_disable_vblank(struct drm_crtc *crtc);
void bdw_disable_vblank(struct drm_crtc *crtc); void bdw_disable_vblank(struct drm_crtc *crtc);
void gen2_irq_reset(struct intel_uncore *uncore);
void gen3_irq_reset(struct intel_uncore *uncore, i915_reg_t imr,
i915_reg_t iir, i915_reg_t ier);
void gen2_irq_init(struct intel_uncore *uncore,
u32 imr_val, u32 ier_val);
void gen3_irq_init(struct intel_uncore *uncore,
i915_reg_t imr, u32 imr_val,
i915_reg_t ier, u32 ier_val,
i915_reg_t iir);
#define GEN8_IRQ_RESET_NDX(uncore, type, which) \
({ \
unsigned int which_ = which; \
gen3_irq_reset((uncore), GEN8_##type##_IMR(which_), \
GEN8_##type##_IIR(which_), GEN8_##type##_IER(which_)); \
})
#define GEN3_IRQ_RESET(uncore, type) \
gen3_irq_reset((uncore), type##IMR, type##IIR, type##IER)
#define GEN2_IRQ_RESET(uncore) \
gen2_irq_reset(uncore)
#define GEN8_IRQ_INIT_NDX(uncore, type, which, imr_val, ier_val) \
({ \
unsigned int which_ = which; \
gen3_irq_init((uncore), \
GEN8_##type##_IMR(which_), imr_val, \
GEN8_##type##_IER(which_), ier_val, \
GEN8_##type##_IIR(which_)); \
})
#define GEN3_IRQ_INIT(uncore, type, imr_val, ier_val) \
gen3_irq_init((uncore), \
type##IMR, imr_val, \
type##IER, ier_val, \
type##IIR)
#define GEN2_IRQ_INIT(uncore, imr_val, ier_val) \
gen2_irq_init((uncore), imr_val, ier_val)
#endif /* __I915_IRQ_H__ */ #endif /* __I915_IRQ_H__ */
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