diff options
author | Michał Winiarski <michal.winiarski@intel.com> | 2018-03-08 16:46:54 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2018-03-09 22:21:41 +0000 |
commit | 950724ba88521195b4aefd092c8a0337487be352 (patch) | |
tree | 140c301c3b09fab76d266ae08821d869a86165e2 /drivers/gpu/drm/i915/intel_uc.c | |
parent | 86aa82476cffdfa2cb85c2dc8b198e1675773982 (diff) | |
download | lwn-950724ba88521195b4aefd092c8a0337487be352.tar.gz lwn-950724ba88521195b4aefd092c8a0337487be352.zip |
drm/i915/guc: Create common entry points for log register/unregister
We have many functions responsible for allocating different parts of
GuC log runtime called from multiple places. Let's stick with keeping
everything in guc_log_register instead.
v2: Use more generic intel_uc_register name, keep using "misc" suffix (Michał)
s/dev_priv/i915 (Sagar)
Make guc_log_relay_* static (sparse)
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com>
Reviewed-by: Sagar Arun Kamble <sagar.a.kamble@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20180308154707.21716-2-michal.winiarski@intel.com
Diffstat (limited to 'drivers/gpu/drm/i915/intel_uc.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_uc.c | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c index e5bf0d37bf43..1c1a00df010b 100644 --- a/drivers/gpu/drm/i915/intel_uc.c +++ b/drivers/gpu/drm/i915/intel_uc.c @@ -219,6 +219,28 @@ static void guc_free_load_err_log(struct intel_guc *guc) i915_gem_object_put(guc->load_err_log); } +int intel_uc_register(struct drm_i915_private *i915) +{ + int ret = 0; + + if (!USES_GUC(i915)) + return 0; + + if (i915_modparams.guc_log_level) + ret = intel_guc_log_register(&i915->guc); + + return ret; +} + +void intel_uc_unregister(struct drm_i915_private *i915) +{ + if (!USES_GUC(i915)) + return; + + if (i915_modparams.guc_log_level) + intel_guc_log_unregister(&i915->guc); +} + static int guc_enable_communication(struct intel_guc *guc) { struct drm_i915_private *dev_priv = guc_to_i915(guc); @@ -249,23 +271,10 @@ int intel_uc_init_misc(struct drm_i915_private *dev_priv) return 0; ret = intel_guc_init_wq(guc); - if (ret) { - DRM_ERROR("Couldn't allocate workqueues for GuC\n"); - goto err; - } - - ret = intel_guc_log_relay_create(guc); - if (ret) { - DRM_ERROR("Couldn't allocate relay for GuC log\n"); - goto err_relay; - } + if (ret) + return ret; return 0; - -err_relay: - intel_guc_fini_wq(guc); -err: - return ret; } void intel_uc_fini_misc(struct drm_i915_private *dev_priv) @@ -276,8 +285,6 @@ void intel_uc_fini_misc(struct drm_i915_private *dev_priv) return; intel_guc_fini_wq(guc); - - intel_guc_log_relay_destroy(guc); } int intel_uc_init(struct drm_i915_private *dev_priv) |