diff mbox

drm/i915/guc: Protect against HAS_GUC_* returning true values other than one

Message ID C182EC90AE29B54BB712270726FAFA75145B3391@IRSMSX102.ger.corp.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Peter Antoine July 5, 2016, 10:58 a.m. UTC
This is not quite right.
If no guc loading then there should be no guc_submission can't have submission without loading.

But, I guess that should be handled later.

Peter.

-----Original Message-----
From: Intel-gfx [mailto:intel-gfx-bounces@lists.freedesktop.org] On Behalf Of Tvrtko Ursulin
Sent: Monday, July 4, 2016 3:31 PM
To: Intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH] drm/i915/guc: Protect against HAS_GUC_* returning true values other than one

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

At the moment HAS_GUC_UCODE == HAS_GUC == IS_GEN9 == (INTEL_INFO(dev)->gen_mask & BIT(8)), which is true but not one. And module parameters are integers and not booleans so compiler will not normalize the value for us.

Quick and easy fix for the GuC loading code and the whole area can be evaluated afterwards.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reported-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Dave Gordon <david.s.gordon@intel.com>
---
 drivers/gpu/drm/i915/intel_guc_loader.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c b/drivers/gpu/drm/i915/intel_guc_loader.c
index d925e2daeb24..72ea5b97e242 100644
--- a/drivers/gpu/drm/i915/intel_guc_loader.c
+++ b/drivers/gpu/drm/i915/intel_guc_loader.c
@@ -687,9 +687,9 @@  void intel_guc_init(struct drm_device *dev)
 
 	/* A negative value means "use platform default" */
 	if (i915.enable_guc_loading < 0)
-		i915.enable_guc_loading = HAS_GUC_UCODE(dev);
+		i915.enable_guc_loading = !!HAS_GUC_UCODE(dev);
 	if (i915.enable_guc_submission < 0)
-		i915.enable_guc_submission = HAS_GUC_SCHED(dev);
+		i915.enable_guc_submission = !!HAS_GUC_SCHED(dev);
 
 	if (!HAS_GUC_UCODE(dev)) {
 		fw_path = NULL;