drm/i915/guc: Use dedicated flag to track submission mode
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Wed, 31 Jul 2019 22:33:20 +0000 (22:33 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 1 Aug 2019 20:13:29 +0000 (21:13 +0100)
Instead of relying on enable_guc modparam to represent actual
GuC submission mode, use dedicated flag and look at modparam
only to check if submission was explicitly disabled by the user.

v2: rebased, simplified condition (Chris)

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20190731223321.36436-4-michal.wajdeczko@intel.com
drivers/gpu/drm/i915/gt/uc/intel_guc.c
drivers/gpu/drm/i915/gt/uc/intel_guc.h
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h
drivers/gpu/drm/i915/gt/uc/intel_uc.h

index f8fc34816e2ca9c3dbb9e00adb1a87e5c0d416ec..da14f8067497b995e3f9592499baf8cc7b06b71d 100644 (file)
@@ -82,6 +82,7 @@ void intel_guc_init_early(struct intel_guc *guc)
        intel_guc_fw_init_early(guc);
        intel_guc_ct_init_early(&guc->ct);
        intel_guc_log_init_early(&guc->log);
+       intel_guc_submission_init_early(guc);
 
        mutex_init(&guc->send_mutex);
        spin_lock_init(&guc->irq_lock);
index 5901506672cd9f504cb96f08352ae32ec6bf2096..6edb29b9ceaadc8995f017d4981327f5aab4c94a 100644 (file)
@@ -61,6 +61,8 @@ struct intel_guc {
                void (*disable)(struct intel_guc *guc);
        } interrupts;
 
+       bool submission_supported;
+
        struct i915_vma *ads_vma;
        struct __guc_ads_blob *ads_blob;
 
@@ -190,6 +192,11 @@ static inline int intel_guc_sanitize(struct intel_guc *guc)
        return 0;
 }
 
+static inline bool intel_guc_is_submission_supported(struct intel_guc *guc)
+{
+       return guc->submission_supported;
+}
+
 static inline void intel_guc_enable_msg(struct intel_guc *guc, u32 mask)
 {
        spin_lock_irq(&guc->irq_lock);
index b4238fe16a036a1a33ec3ff9bed3955aeb8fc1e5..b4b508f19a1c27bca2674ec7e848ffcc73d618d5 100644 (file)
@@ -1163,6 +1163,22 @@ void intel_guc_submission_disable(struct intel_guc *guc)
        guc_clients_disable(guc);
 }
 
+static bool __guc_submission_support(struct intel_guc *guc)
+{
+       /* XXX: GuC submission is unavailable for now */
+       return false;
+
+       if (!intel_guc_is_supported(guc))
+               return false;
+
+       return i915_modparams.enable_guc & ENABLE_GUC_SUBMISSION;
+}
+
+void intel_guc_submission_init_early(struct intel_guc *guc)
+{
+       guc->submission_supported = __guc_submission_support(guc);
+}
+
 #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
 #include "selftest_guc.c"
 #endif
index 87a38cb6faf3432be9fa72b7ee78830178195ecb..c4ad2702ec8d9f36d1070fbd597b02ac885830bd 100644 (file)
@@ -77,6 +77,7 @@ struct intel_guc_client {
        I915_SELFTEST_DECLARE(bool use_nop_wqi);
 };
 
+void intel_guc_submission_init_early(struct intel_guc *guc);
 int intel_guc_submission_init(struct intel_guc *guc);
 int intel_guc_submission_enable(struct intel_guc *guc);
 void intel_guc_submission_disable(struct intel_guc *guc);
index a81c016ff078a9a217ee5528460ad7fcc0d5a747..0cca839422e22d9ca178cc36aa3db5ce97789e7b 100644 (file)
@@ -56,8 +56,7 @@ static inline bool intel_uc_supports_guc(struct intel_uc *uc)
 
 static inline bool intel_uc_supports_guc_submission(struct intel_uc *uc)
 {
-       GEM_BUG_ON(i915_modparams.enable_guc < 0);
-       return i915_modparams.enable_guc & ENABLE_GUC_SUBMISSION;
+       return intel_guc_is_submission_supported(&uc->guc);
 }
 
 static inline bool intel_uc_supports_huc(struct intel_uc *uc)