diff mbox

[7/8] drm/i915/guc: Don't touch WOPCM if we're not using GuC

Message ID 20180323123411.3214-7-michal.winiarski@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michał Winiarski March 23, 2018, 12:34 p.m. UTC
We probably shouldn't print out WOPCM size on platforms that don't have
GuC. We also want to make sure we don't hit any asserts if user explicitly
sets enable_guc != 0 on non-guc platforms.

Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jackie Li <yaodong.li@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
---
 drivers/gpu/drm/i915/intel_wopcm.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Jackie Li March 23, 2018, 10:08 p.m. UTC | #1
On 03/23/2018 05:34 AM, Michał Winiarski wrote:
> We probably shouldn't print out WOPCM size on platforms that don't have
> GuC. We also want to make sure we don't hit any asserts if user explicitly
> sets enable_guc != 0 on non-guc platforms.
>
> Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Jackie Li <yaodong.li@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_wopcm.c | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_wopcm.c b/drivers/gpu/drm/i915/intel_wopcm.c
> index be8fca80aeca..828800ca119c 100644
> --- a/drivers/gpu/drm/i915/intel_wopcm.c
> +++ b/drivers/gpu/drm/i915/intel_wopcm.c
> @@ -69,6 +69,9 @@
>    */
>   void intel_wopcm_init_early(struct intel_wopcm *wopcm)
>   {
> +	if (!HAS_GUC(wopcm_to_i915(wopcm)))
> +		return;
> +
>   	wopcm->size = GEN9_WOPCM_SIZE;
>   
>   	DRM_DEBUG_DRIVER("WOPCM size: %uKiB\n", wopcm->size / 1024);
> @@ -285,8 +288,12 @@ static int wopcm_guc_region_init(struct intel_wopcm *wopcm)
>    */
>   int intel_wopcm_init(struct intel_wopcm *wopcm)
>   {
> +	struct drm_i915_private *dev_priv = wopcm_to_i915(wopcm);
>   	int err;
>   
> +	if (!HAS_GUC(dev_priv) || !USES_GUC(dev_priv))
> +		return 0;
> +
I guess I have to bring up an old question here: if we want to
use this only for enable_guc > 0. Why not make it as a part of
uc layer?

Regards,
-Jackie
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_wopcm.c b/drivers/gpu/drm/i915/intel_wopcm.c
index be8fca80aeca..828800ca119c 100644
--- a/drivers/gpu/drm/i915/intel_wopcm.c
+++ b/drivers/gpu/drm/i915/intel_wopcm.c
@@ -69,6 +69,9 @@ 
  */
 void intel_wopcm_init_early(struct intel_wopcm *wopcm)
 {
+	if (!HAS_GUC(wopcm_to_i915(wopcm)))
+		return;
+
 	wopcm->size = GEN9_WOPCM_SIZE;
 
 	DRM_DEBUG_DRIVER("WOPCM size: %uKiB\n", wopcm->size / 1024);
@@ -285,8 +288,12 @@  static int wopcm_guc_region_init(struct intel_wopcm *wopcm)
  */
 int intel_wopcm_init(struct intel_wopcm *wopcm)
 {
+	struct drm_i915_private *dev_priv = wopcm_to_i915(wopcm);
 	int err;
 
+	if (!HAS_GUC(dev_priv) || !USES_GUC(dev_priv))
+		return 0;
+
 	GEM_BUG_ON(!wopcm->size);
 
 	err = wopcm_guc_region_init(wopcm);
@@ -319,10 +326,9 @@  void intel_wopcm_init_hw(struct intel_wopcm *wopcm)
 {
 	struct drm_i915_private *dev_priv = wopcm_to_i915(wopcm);
 
-	if (!USES_GUC(dev_priv))
+	if (!HAS_GUC(dev_priv) || !USES_GUC(dev_priv))
 		return;
 
-	GEM_BUG_ON(!HAS_GUC(dev_priv));
 	GEM_BUG_ON(!wopcm->guc.size);
 	GEM_BUG_ON(!wopcm->guc.base);