diff mbox

[4/5] drm/i915/guc: Init send_mutex in intel_uc_init()

Message ID 1480004003-27377-5-git-send-email-arkadiusz.hiler@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Arkadiusz Hiler Nov. 24, 2016, 4:13 p.m. UTC
send_mutex is used to serialise communication with GuC via
intel_guc_send().

Since functions that utilize it are no longer limited to submission,
initialization should be handled as a part of general setup.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michal Winiarski <michal.winiarski@intel.com>
Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.c            | 1 +
 drivers/gpu/drm/i915/i915_guc_submission.c | 1 -
 drivers/gpu/drm/i915/intel_uc.c            | 5 +++++
 drivers/gpu/drm/i915/intel_uc.h            | 1 +
 4 files changed, 7 insertions(+), 1 deletion(-)

Comments

Chris Wilson Nov. 24, 2016, 5:12 p.m. UTC | #1
On Thu, Nov 24, 2016 at 05:13:22PM +0100, Arkadiusz Hiler wrote:
> send_mutex is used to serialise communication with GuC via
> intel_guc_send().
> 
> Since functions that utilize it are no longer limited to submission,
> initialization should be handled as a part of general setup.
> 
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Michal Winiarski <michal.winiarski@intel.com>
> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.c            | 1 +
>  drivers/gpu/drm/i915/i915_guc_submission.c | 1 -
>  drivers/gpu/drm/i915/intel_uc.c            | 5 +++++
>  drivers/gpu/drm/i915/intel_uc.h            | 1 +
>  4 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index b893e67..21d61dc 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -603,6 +603,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
>  	if (ret)
>  		goto cleanup_irq;
>  
> +	intel_uc_init(dev_priv);
>  	intel_guc_init(dev);

Probably wants to be in i915_driver_init_early() or i915_driver_init_mmio().
My preferences would be i915_driver_init_early(). (So call it
intel_uc_init_early()).

With that minor change,
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index b893e67..21d61dc 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -603,6 +603,7 @@  static int i915_load_modeset_init(struct drm_device *dev)
 	if (ret)
 		goto cleanup_irq;
 
+	intel_uc_init(dev_priv);
 	intel_guc_init(dev);
 
 	ret = i915_gem_init(dev);
diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
index d1f0d6d..0f09d5c 100644
--- a/drivers/gpu/drm/i915/i915_guc_submission.c
+++ b/drivers/gpu/drm/i915/i915_guc_submission.c
@@ -1388,7 +1388,6 @@  int i915_guc_submission_init(struct drm_i915_private *dev_priv)
 
 	guc->ctx_pool_vma = vma;
 	ida_init(&guc->ctx_ids);
-	mutex_init(&guc->send_mutex);
 	guc_log_create(guc);
 	guc_addon_create(guc);
 
diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c
index 497c9c3..4f4070a 100644
--- a/drivers/gpu/drm/i915/intel_uc.c
+++ b/drivers/gpu/drm/i915/intel_uc.c
@@ -26,6 +26,11 @@ 
 #include "i915_drv.h"
 #include "intel_uc.h"
 
+void intel_uc_init(struct drm_i915_private *dev_priv)
+{
+	mutex_init(&dev_priv->guc.send_mutex);
+}
+
 /*
  * Read GuC command/status register (SOFT_SCRATCH_0)
  * Return true if it contains a response rather than a command
diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
index 0a55e5a..be72709 100644
--- a/drivers/gpu/drm/i915/intel_uc.h
+++ b/drivers/gpu/drm/i915/intel_uc.h
@@ -169,6 +169,7 @@  struct intel_guc {
 };
 
 /* intel_uc.c */
+void intel_uc_init(struct drm_i915_private *dev_priv);
 bool intel_guc_recv(struct drm_i915_private *dev_priv, u32 *status);
 int intel_guc_send(struct intel_guc *guc, u32 *data, u32 len);
 int intel_guc_sample_forcewake(struct intel_guc *guc,