]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/guc: Introduce guc_is_ready
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Fri, 31 Jan 2020 15:37:06 +0000 (15:37 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 31 Jan 2020 23:42:59 +0000 (23:42 +0000)
We already have guc_is_running function, but it only reflects
firmware status, while to fully use GuC we need to know if we've
already established communication with it.

v2: also s/intel_guc_is_running/intel_guc_is_fw_running (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/20200131153706.109528-1-michal.wajdeczko@intel.com
drivers/gpu/drm/i915/gt/uc/intel_guc.h
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
drivers/gpu/drm/i915/gt/uc/intel_uc.c
drivers/gpu/drm/i915/i915_debugfs.c
drivers/gpu/drm/i915/i915_drv.h

index 910d49590068674869d0c74406bd66a935cf3032..7ca9e5159f05b7d1b3ddde221dd99bc4c8131965 100644 (file)
@@ -148,11 +148,16 @@ static inline bool intel_guc_is_enabled(struct intel_guc *guc)
        return intel_uc_fw_is_enabled(&guc->fw);
 }
 
-static inline bool intel_guc_is_running(struct intel_guc *guc)
+static inline bool intel_guc_is_fw_running(struct intel_guc *guc)
 {
        return intel_uc_fw_is_running(&guc->fw);
 }
 
+static inline bool intel_guc_is_ready(struct intel_guc *guc)
+{
+       return intel_guc_is_fw_running(guc) && intel_guc_ct_enabled(&guc->ct);
+}
+
 static inline int intel_guc_sanitize(struct intel_guc *guc)
 {
        intel_uc_fw_sanitize(&guc->fw);
index d8481268336406b889db9b8fe065046cec46a255..11742fca0e9eb5cda12cf79d268ce8103dca4403 100644 (file)
@@ -279,7 +279,7 @@ void intel_guc_ct_disable(struct intel_guc_ct *ct)
 
        ct->enabled = false;
 
-       if (intel_guc_is_running(guc)) {
+       if (intel_guc_is_fw_running(guc)) {
                ct_deregister_buffer(ct, INTEL_GUC_CT_BUFFER_TYPE_SEND);
                ct_deregister_buffer(ct, INTEL_GUC_CT_BUFFER_TYPE_RECV);
        }
index 64934a876a501f4dc2df1a452dfe379b5998cb12..affc4d6f9ead09fb9ee334f39f365c3c0fb6a62f 100644 (file)
@@ -505,7 +505,7 @@ static void __uc_fini_hw(struct intel_uc *uc)
 {
        struct intel_guc *guc = &uc->guc;
 
-       if (!intel_guc_is_running(guc))
+       if (!intel_guc_is_fw_running(guc))
                return;
 
        if (intel_uc_supports_guc_submission(uc))
@@ -527,7 +527,7 @@ void intel_uc_reset_prepare(struct intel_uc *uc)
 {
        struct intel_guc *guc = &uc->guc;
 
-       if (!intel_guc_is_running(guc))
+       if (!intel_guc_is_ready(guc))
                return;
 
        guc_disable_communication(guc);
@@ -539,7 +539,7 @@ void intel_uc_runtime_suspend(struct intel_uc *uc)
        struct intel_guc *guc = &uc->guc;
        int err;
 
-       if (!intel_guc_is_running(guc))
+       if (!intel_guc_is_ready(guc))
                return;
 
        err = intel_guc_suspend(guc);
@@ -554,7 +554,7 @@ void intel_uc_suspend(struct intel_uc *uc)
        struct intel_guc *guc = &uc->guc;
        intel_wakeref_t wakeref;
 
-       if (!intel_guc_is_running(guc))
+       if (!intel_guc_is_ready(guc))
                return;
 
        with_intel_runtime_pm(uc_to_gt(uc)->uncore->rpm, wakeref)
@@ -566,7 +566,7 @@ static int __uc_resume(struct intel_uc *uc, bool enable_communication)
        struct intel_guc *guc = &uc->guc;
        int err;
 
-       if (!intel_guc_is_running(guc))
+       if (!intel_guc_is_fw_running(guc))
                return 0;
 
        /* Make sure we enable communication if and only if it's disabled */
index 2d76138c349f981264b1ce69556f24ae6cd6167a..e329503b68c2b20b2bcda002788ff77eb1348e84 100644 (file)
@@ -1914,7 +1914,7 @@ static int i915_guc_log_relay_open(struct inode *inode, struct file *file)
        struct intel_guc *guc = &i915->gt.uc.guc;
        struct intel_guc_log *log = &guc->log;
 
-       if (!intel_guc_is_running(guc))
+       if (!intel_guc_is_ready(guc))
                return -ENODEV;
 
        file->private_data = log;
index e56f289d2975a69b427ddbfaea69088b56b8bf4b..a71ff233cc55c5ff616ea8c1022409c45fbd5119 100644 (file)
@@ -2017,7 +2017,7 @@ i915_coherent_map_type(struct drm_i915_private *i915)
 static inline bool intel_guc_submission_is_enabled(struct intel_guc *guc)
 {
        return intel_guc_is_submission_supported(guc) &&
-               intel_guc_is_running(guc);
+              intel_guc_is_ready(guc);
 }
 
 #endif