drm/i915/guc: Move notification code into virtual function
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Wed, 10 May 2017 12:59:26 +0000 (12:59 +0000)
committerJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Thu, 11 May 2017 09:49:26 +0000 (12:49 +0300)
Prepare for alternate GuC notification mechanism.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
[Joonas: Added newlines]
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
drivers/gpu/drm/i915/intel_uc.c
drivers/gpu/drm/i915/intel_uc.h

index 7fd75ca031c3d3d92647b79e2e41e7261d65a601..72f49e679707cad9c1b836f1d027b5fcaa080860 100644 (file)
@@ -94,12 +94,20 @@ void intel_uc_sanitize_options(struct drm_i915_private *dev_priv)
                i915.enable_guc_submission = HAS_GUC_SCHED(dev_priv);
 }
 
+static void guc_write_irq_trigger(struct intel_guc *guc)
+{
+       struct drm_i915_private *dev_priv = guc_to_i915(guc);
+
+       I915_WRITE(GUC_SEND_INTERRUPT, GUC_SEND_TRIGGER);
+}
+
 void intel_uc_init_early(struct drm_i915_private *dev_priv)
 {
        struct intel_guc *guc = &dev_priv->guc;
 
        mutex_init(&guc->send_mutex);
        guc->send = intel_guc_send_nop;
+       guc->notify = guc_write_irq_trigger;
 }
 
 static void fetch_uc_fw(struct drm_i915_private *dev_priv,
@@ -413,7 +421,7 @@ int intel_guc_send_mmio(struct intel_guc *guc, const u32 *action, u32 len)
 
        POSTING_READ(SOFT_SCRATCH(i - 1));
 
-       I915_WRITE(GUC_SEND_INTERRUPT, GUC_SEND_TRIGGER);
+       intel_guc_notify(guc);
 
        /*
         * No GuC command should ever take longer than 10ms.
index 1e0eecdcedc00b0c77b40c5b6d95018920262871..2af5633b8a0917533eb7ba969ba32e5b6346fc94 100644 (file)
@@ -210,6 +210,9 @@ struct intel_guc {
 
        /* GuC's FW specific send function */
        int (*send)(struct intel_guc *guc, const u32 *data, u32 len);
+
+       /* GuC's FW specific notify function */
+       void (*notify)(struct intel_guc *guc);
 };
 
 struct intel_huc {
@@ -229,11 +232,17 @@ void intel_uc_fini_hw(struct drm_i915_private *dev_priv);
 int intel_guc_sample_forcewake(struct intel_guc *guc);
 int intel_guc_send_nop(struct intel_guc *guc, const u32 *action, u32 len);
 int intel_guc_send_mmio(struct intel_guc *guc, const u32 *action, u32 len);
+
 static inline int intel_guc_send(struct intel_guc *guc, const u32 *action, u32 len)
 {
        return guc->send(guc, action, len);
 }
 
+static inline void intel_guc_notify(struct intel_guc *guc)
+{
+       guc->notify(guc);
+}
+
 /* intel_guc_loader.c */
 int intel_guc_select_fw(struct intel_guc *guc);
 int intel_guc_init_hw(struct intel_guc *guc);