Commit 9cbd51c2 authored by Daniele Ceraolo Spurio's avatar Daniele Ceraolo Spurio Committed by Chris Wilson

drm/i915/guc: move guc irq functions to intel_guc parameter

No functional change, just moving the guc_to_i915 from the caller into
the irq function. This will help with the upcoming move of guc under
intel_gt.
Signed-off-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20190713100016.8026-4-chris@chris-wilson.co.ukSigned-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
parent bb2881f8
...@@ -599,8 +599,10 @@ void gen6_disable_rps_interrupts(struct drm_i915_private *dev_priv) ...@@ -599,8 +599,10 @@ void gen6_disable_rps_interrupts(struct drm_i915_private *dev_priv)
gen6_reset_rps_interrupts(dev_priv); gen6_reset_rps_interrupts(dev_priv);
} }
void gen9_reset_guc_interrupts(struct drm_i915_private *dev_priv) void gen9_reset_guc_interrupts(struct intel_guc *guc)
{ {
struct drm_i915_private *dev_priv = guc_to_i915(guc);
assert_rpm_wakelock_held(&dev_priv->runtime_pm); assert_rpm_wakelock_held(&dev_priv->runtime_pm);
spin_lock_irq(&dev_priv->irq_lock); spin_lock_irq(&dev_priv->irq_lock);
...@@ -608,61 +610,71 @@ void gen9_reset_guc_interrupts(struct drm_i915_private *dev_priv) ...@@ -608,61 +610,71 @@ void gen9_reset_guc_interrupts(struct drm_i915_private *dev_priv)
spin_unlock_irq(&dev_priv->irq_lock); spin_unlock_irq(&dev_priv->irq_lock);
} }
void gen9_enable_guc_interrupts(struct drm_i915_private *dev_priv) void gen9_enable_guc_interrupts(struct intel_guc *guc)
{ {
struct drm_i915_private *dev_priv = guc_to_i915(guc);
assert_rpm_wakelock_held(&dev_priv->runtime_pm); assert_rpm_wakelock_held(&dev_priv->runtime_pm);
spin_lock_irq(&dev_priv->irq_lock); spin_lock_irq(&dev_priv->irq_lock);
if (!dev_priv->guc.interrupts.enabled) { if (!guc->interrupts.enabled) {
WARN_ON_ONCE(I915_READ(gen6_pm_iir(dev_priv)) & WARN_ON_ONCE(I915_READ(gen6_pm_iir(dev_priv)) &
dev_priv->pm_guc_events); dev_priv->pm_guc_events);
dev_priv->guc.interrupts.enabled = true; guc->interrupts.enabled = true;
gen6_enable_pm_irq(&dev_priv->gt, dev_priv->pm_guc_events); gen6_enable_pm_irq(&dev_priv->gt, dev_priv->pm_guc_events);
} }
spin_unlock_irq(&dev_priv->irq_lock); spin_unlock_irq(&dev_priv->irq_lock);
} }
void gen9_disable_guc_interrupts(struct drm_i915_private *dev_priv) void gen9_disable_guc_interrupts(struct intel_guc *guc)
{ {
struct drm_i915_private *dev_priv = guc_to_i915(guc);
assert_rpm_wakelock_held(&dev_priv->runtime_pm); assert_rpm_wakelock_held(&dev_priv->runtime_pm);
spin_lock_irq(&dev_priv->irq_lock); spin_lock_irq(&dev_priv->irq_lock);
dev_priv->guc.interrupts.enabled = false; guc->interrupts.enabled = false;
gen6_disable_pm_irq(&dev_priv->gt, dev_priv->pm_guc_events); gen6_disable_pm_irq(&dev_priv->gt, dev_priv->pm_guc_events);
spin_unlock_irq(&dev_priv->irq_lock); spin_unlock_irq(&dev_priv->irq_lock);
intel_synchronize_irq(dev_priv); intel_synchronize_irq(dev_priv);
gen9_reset_guc_interrupts(dev_priv); gen9_reset_guc_interrupts(guc);
} }
void gen11_reset_guc_interrupts(struct drm_i915_private *i915) void gen11_reset_guc_interrupts(struct intel_guc *guc)
{ {
struct drm_i915_private *i915 = guc_to_i915(guc);
spin_lock_irq(&i915->irq_lock); spin_lock_irq(&i915->irq_lock);
gen11_reset_one_iir(&i915->gt, 0, GEN11_GUC); gen11_reset_one_iir(&i915->gt, 0, GEN11_GUC);
spin_unlock_irq(&i915->irq_lock); spin_unlock_irq(&i915->irq_lock);
} }
void gen11_enable_guc_interrupts(struct drm_i915_private *dev_priv) void gen11_enable_guc_interrupts(struct intel_guc *guc)
{ {
struct drm_i915_private *dev_priv = guc_to_i915(guc);
spin_lock_irq(&dev_priv->irq_lock); spin_lock_irq(&dev_priv->irq_lock);
if (!dev_priv->guc.interrupts.enabled) { if (!guc->interrupts.enabled) {
u32 events = REG_FIELD_PREP(ENGINE1_MASK, u32 events = REG_FIELD_PREP(ENGINE1_MASK,
GEN11_GUC_INTR_GUC2HOST); GEN11_GUC_INTR_GUC2HOST);
WARN_ON_ONCE(gen11_reset_one_iir(&dev_priv->gt, 0, GEN11_GUC)); WARN_ON_ONCE(gen11_reset_one_iir(&dev_priv->gt, 0, GEN11_GUC));
I915_WRITE(GEN11_GUC_SG_INTR_ENABLE, events); I915_WRITE(GEN11_GUC_SG_INTR_ENABLE, events);
I915_WRITE(GEN11_GUC_SG_INTR_MASK, ~events); I915_WRITE(GEN11_GUC_SG_INTR_MASK, ~events);
dev_priv->guc.interrupts.enabled = true; guc->interrupts.enabled = true;
} }
spin_unlock_irq(&dev_priv->irq_lock); spin_unlock_irq(&dev_priv->irq_lock);
} }
void gen11_disable_guc_interrupts(struct drm_i915_private *dev_priv) void gen11_disable_guc_interrupts(struct intel_guc *guc)
{ {
struct drm_i915_private *dev_priv = guc_to_i915(guc);
spin_lock_irq(&dev_priv->irq_lock); spin_lock_irq(&dev_priv->irq_lock);
dev_priv->guc.interrupts.enabled = false; guc->interrupts.enabled = false;
I915_WRITE(GEN11_GUC_SG_INTR_MASK, ~0); I915_WRITE(GEN11_GUC_SG_INTR_MASK, ~0);
I915_WRITE(GEN11_GUC_SG_INTR_ENABLE, 0); I915_WRITE(GEN11_GUC_SG_INTR_ENABLE, 0);
...@@ -670,7 +682,7 @@ void gen11_disable_guc_interrupts(struct drm_i915_private *dev_priv) ...@@ -670,7 +682,7 @@ void gen11_disable_guc_interrupts(struct drm_i915_private *dev_priv)
spin_unlock_irq(&dev_priv->irq_lock); spin_unlock_irq(&dev_priv->irq_lock);
intel_synchronize_irq(dev_priv); intel_synchronize_irq(dev_priv);
gen11_reset_guc_interrupts(dev_priv); gen11_reset_guc_interrupts(guc);
} }
/** /**
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
struct drm_i915_private; struct drm_i915_private;
struct intel_crtc; struct intel_crtc;
struct intel_guc;
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);
...@@ -112,12 +113,12 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv, ...@@ -112,12 +113,12 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
u8 pipe_mask); u8 pipe_mask);
void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv, void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
u8 pipe_mask); u8 pipe_mask);
void gen9_reset_guc_interrupts(struct drm_i915_private *dev_priv); void gen9_reset_guc_interrupts(struct intel_guc *guc);
void gen9_enable_guc_interrupts(struct drm_i915_private *dev_priv); void gen9_enable_guc_interrupts(struct intel_guc *guc);
void gen9_disable_guc_interrupts(struct drm_i915_private *dev_priv); void gen9_disable_guc_interrupts(struct intel_guc *guc);
void gen11_reset_guc_interrupts(struct drm_i915_private *i915); void gen11_reset_guc_interrupts(struct intel_guc *guc);
void gen11_enable_guc_interrupts(struct drm_i915_private *i915); void gen11_enable_guc_interrupts(struct intel_guc *guc);
void gen11_disable_guc_interrupts(struct drm_i915_private *i915); void gen11_disable_guc_interrupts(struct intel_guc *guc);
bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe, bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
bool in_vblank_irq, int *vpos, int *hpos, bool in_vblank_irq, int *vpos, int *hpos,
......
...@@ -56,9 +56,9 @@ struct intel_guc { ...@@ -56,9 +56,9 @@ struct intel_guc {
struct { struct {
bool enabled; bool enabled;
void (*reset)(struct drm_i915_private *i915); void (*reset)(struct intel_guc *guc);
void (*enable)(struct drm_i915_private *i915); void (*enable)(struct intel_guc *guc);
void (*disable)(struct drm_i915_private *i915); void (*disable)(struct intel_guc *guc);
} interrupts; } interrupts;
struct i915_vma *ads_vma; struct i915_vma *ads_vma;
......
...@@ -272,17 +272,17 @@ static void guc_handle_mmio_msg(struct intel_guc *guc) ...@@ -272,17 +272,17 @@ static void guc_handle_mmio_msg(struct intel_guc *guc)
static void guc_reset_interrupts(struct intel_guc *guc) static void guc_reset_interrupts(struct intel_guc *guc)
{ {
guc->interrupts.reset(guc_to_i915(guc)); guc->interrupts.reset(guc);
} }
static void guc_enable_interrupts(struct intel_guc *guc) static void guc_enable_interrupts(struct intel_guc *guc)
{ {
guc->interrupts.enable(guc_to_i915(guc)); guc->interrupts.enable(guc);
} }
static void guc_disable_interrupts(struct intel_guc *guc) static void guc_disable_interrupts(struct intel_guc *guc)
{ {
guc->interrupts.disable(guc_to_i915(guc)); guc->interrupts.disable(guc);
} }
static int guc_enable_communication(struct intel_guc *guc) static int guc_enable_communication(struct intel_guc *guc)
......
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