]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/guc: Apply new uC status tracking to GuC submission as well
authorDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Tue, 18 Feb 2020 22:33:24 +0000 (14:33 -0800)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 20 Feb 2020 17:48:06 +0000 (17:48 +0000)
To be able to differentiate the before and after of our commitment to
GuC submission, which will be used in follow-up patches to early set-up
the submission structures.

v2: move functions to guc_submission.h (Michal)

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: John Harrison <John.C.Harrison@Intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20200218223327.11058-7-daniele.ceraolospurio@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.c
drivers/gpu/drm/i915/gt/uc/intel_uc.h
drivers/gpu/drm/i915/gvt/scheduler.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_gvt.c

index c4c1523da7a641529be11f4000022a3b6b414fdb..f96d1bdf4bf29d2e55e756c23492279163963a84 100644 (file)
@@ -207,7 +207,7 @@ static u32 guc_ctl_feature_flags(struct intel_guc *guc)
 {
        u32 flags = 0;
 
-       if (!intel_guc_is_submission_supported(guc))
+       if (!intel_guc_submission_is_used(guc))
                flags |= GUC_CTL_DISABLE_SCHEDULER;
 
        return flags;
@@ -217,7 +217,7 @@ static u32 guc_ctl_ctxinfo_flags(struct intel_guc *guc)
 {
        u32 flags = 0;
 
-       if (intel_guc_is_submission_supported(guc)) {
+       if (intel_guc_submission_is_used(guc)) {
                u32 ctxnum, base;
 
                base = intel_guc_ggtt_offset(guc, guc->stage_desc_pool);
@@ -348,7 +348,7 @@ int intel_guc_init(struct intel_guc *guc)
        if (ret)
                goto err_ads;
 
-       if (intel_guc_is_submission_supported(guc)) {
+       if (intel_guc_submission_is_used(guc)) {
                /*
                 * This is stuff we need to have available at fw load time
                 * if we are planning to enable submission later
@@ -389,7 +389,7 @@ void intel_guc_fini(struct intel_guc *guc)
 
        i915_ggtt_disable_guc(gt->ggtt);
 
-       if (intel_guc_is_submission_supported(guc))
+       if (intel_guc_submission_is_used(guc))
                intel_guc_submission_fini(guc);
 
        intel_guc_ct_fini(&guc->ct);
@@ -544,7 +544,7 @@ int intel_guc_suspend(struct intel_guc *guc)
         * If GuC communication is enabled but submission is not supported,
         * we do not need to suspend the GuC.
         */
-       if (!intel_guc_submission_is_enabled(guc))
+       if (!intel_guc_submission_is_used(guc) || !intel_guc_is_ready(guc))
                return 0;
 
        /*
@@ -609,7 +609,7 @@ int intel_guc_resume(struct intel_guc *guc)
         * we do not need to resume the GuC but we do need to enable the
         * GuC communication on resume (above).
         */
-       if (!intel_guc_submission_is_enabled(guc))
+       if (!intel_guc_submission_is_used(guc) || !intel_guc_is_ready(guc))
                return 0;
 
        return intel_guc_send(guc, action, ARRAY_SIZE(action));
index b51adaac87520d5dafe235d9184c92835ce822d8..4594ccbeaa34216042854b221db8bfe2618496af 100644 (file)
@@ -39,7 +39,7 @@ struct intel_guc {
                void (*disable)(struct intel_guc *guc);
        } interrupts;
 
-       bool submission_supported;
+       bool submission_selected;
 
        struct i915_vma *ads_vma;
        struct __guc_ads_blob *ads_blob;
@@ -173,11 +173,6 @@ 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 9e42324fdecdd6e7ab64991db7770cbdc744ac79..1beaa77f9bb6928d066dd9c30b1e9217b9e9d8df 100644 (file)
@@ -660,12 +660,9 @@ void intel_guc_submission_disable(struct intel_guc *guc)
        guc_proc_desc_fini(guc);
 }
 
-static bool __guc_submission_support(struct intel_guc *guc)
+static bool __guc_submission_selected(struct intel_guc *guc)
 {
-       /* XXX: GuC submission is unavailable for now */
-       return false;
-
-       if (!intel_guc_is_supported(guc))
+       if (!intel_guc_submission_is_supported(guc))
                return false;
 
        return i915_modparams.enable_guc & ENABLE_GUC_SUBMISSION;
@@ -673,7 +670,7 @@ static bool __guc_submission_support(struct intel_guc *guc)
 
 void intel_guc_submission_init_early(struct intel_guc *guc)
 {
-       guc->submission_supported = __guc_submission_support(guc);
+       guc->submission_selected = __guc_submission_selected(guc);
 }
 
 bool intel_engine_in_guc_submission_mode(const struct intel_engine_cs *engine)
index e402a2932592ea7275f34bc34ddaf4672c3e66ee..4cf9d3e5026372c87eb62c745e09948a66678adc 100644 (file)
@@ -8,7 +8,8 @@
 
 #include <linux/types.h>
 
-struct intel_guc;
+#include "intel_guc.h"
+
 struct intel_engine_cs;
 
 void intel_guc_submission_init_early(struct intel_guc *guc);
@@ -20,4 +21,20 @@ int intel_guc_preempt_work_create(struct intel_guc *guc);
 void intel_guc_preempt_work_destroy(struct intel_guc *guc);
 bool intel_engine_in_guc_submission_mode(const struct intel_engine_cs *engine);
 
+static inline bool intel_guc_submission_is_supported(struct intel_guc *guc)
+{
+       /* XXX: GuC submission is unavailable for now */
+       return false;
+}
+
+static inline bool intel_guc_submission_is_wanted(struct intel_guc *guc)
+{
+       return guc->submission_selected;
+}
+
+static inline bool intel_guc_submission_is_used(struct intel_guc *guc)
+{
+       return intel_guc_is_used(guc) && intel_guc_submission_is_wanted(guc);
+}
+
 #endif
index 5825a6c3e0a0c7807cbb455482c75fca1f64c0e8..f81b4d40bc909b7b9b27c177437d108143b7cd1f 100644 (file)
@@ -49,7 +49,7 @@ static void __confirm_options(struct intel_uc *uc)
                             "enable_guc=%d (guc:%s submission:%s huc:%s)\n",
                             i915_modparams.enable_guc,
                             yesno(intel_uc_wants_guc(uc)),
-                            yesno(intel_uc_uses_guc_submission(uc)),
+                            yesno(intel_uc_wants_guc_submission(uc)),
                             yesno(intel_uc_wants_huc(uc)));
 
        if (i915_modparams.enable_guc == -1)
@@ -57,7 +57,7 @@ static void __confirm_options(struct intel_uc *uc)
 
        if (i915_modparams.enable_guc == 0) {
                GEM_BUG_ON(intel_uc_wants_guc(uc));
-               GEM_BUG_ON(intel_uc_uses_guc_submission(uc));
+               GEM_BUG_ON(intel_uc_wants_guc_submission(uc));
                GEM_BUG_ON(intel_uc_wants_huc(uc));
                return;
        }
@@ -285,7 +285,7 @@ static void __uc_init(struct intel_uc *uc)
                return;
 
        /* XXX: GuC submission is unavailable for now */
-       GEM_BUG_ON(intel_uc_supports_guc_submission(uc));
+       GEM_BUG_ON(intel_uc_uses_guc_submission(uc));
 
        ret = intel_guc_init(guc);
        if (ret) {
@@ -410,7 +410,7 @@ static int __uc_init_hw(struct intel_uc *uc)
        if (!intel_uc_fw_is_available(&guc->fw)) {
                ret = __uc_check_hw(uc) ||
                      intel_uc_fw_is_overridden(&guc->fw) ||
-                     intel_uc_supports_guc_submission(uc) ?
+                     intel_uc_wants_guc_submission(uc) ?
                      intel_uc_fw_status_to_error(guc->fw.status) : 0;
                goto err_out;
        }
@@ -462,14 +462,14 @@ static int __uc_init_hw(struct intel_uc *uc)
        if (ret)
                goto err_communication;
 
-       if (intel_uc_supports_guc_submission(uc))
+       if (intel_uc_uses_guc_submission(uc))
                intel_guc_submission_enable(guc);
 
        dev_info(i915->drm.dev, "%s firmware %s version %u.%u %s:%s\n",
                 intel_uc_fw_type_repr(INTEL_UC_FW_TYPE_GUC), guc->fw.path,
                 guc->fw.major_ver_found, guc->fw.minor_ver_found,
                 "submission",
-                enableddisabled(intel_uc_supports_guc_submission(uc)));
+                enableddisabled(intel_uc_uses_guc_submission(uc)));
 
        if (intel_uc_uses_huc(uc)) {
                dev_info(i915->drm.dev, "%s firmware %s version %u.%u %s:%s\n",
@@ -511,7 +511,7 @@ static void __uc_fini_hw(struct intel_uc *uc)
        if (!intel_guc_is_fw_running(guc))
                return;
 
-       if (intel_uc_supports_guc_submission(uc))
+       if (intel_uc_uses_guc_submission(uc))
                intel_guc_submission_disable(guc);
 
        if (guc_communication_enabled(guc))
index a41aaf353f880b52326a33e21f59ce2e31fcb2b0..c1f39bdc115a9a122519634a5440e0c6573c9803 100644 (file)
@@ -7,6 +7,7 @@
 #define _INTEL_UC_H_
 
 #include "intel_guc.h"
+#include "intel_guc_submission.h"
 #include "intel_huc.h"
 #include "i915_params.h"
 
@@ -61,33 +62,24 @@ int intel_uc_runtime_resume(struct intel_uc *uc);
  * - In use: wanted + firmware found on the system and successfully fetched.
  */
 
-#define __uc_state_checker(x, state, required) \
-static inline bool intel_uc_##state##_##x(struct intel_uc *uc) \
+#define __uc_state_checker(x, func, state, required) \
+static inline bool intel_uc_##state##_##func(struct intel_uc *uc) \
 { \
-       return intel_##x##_is_##required(&uc->x); \
+       return intel_##func##_is_##required(&uc->x); \
 }
 
-#define uc_state_checkers(x) \
-__uc_state_checker(x, supports, supported) \
-__uc_state_checker(x, wants, wanted) \
-__uc_state_checker(x, uses, used)
+#define uc_state_checkers(x, func) \
+__uc_state_checker(x, func, supports, supported) \
+__uc_state_checker(x, func, wants, wanted) \
+__uc_state_checker(x, func, uses, used)
 
-uc_state_checkers(guc);
-uc_state_checkers(huc);
+uc_state_checkers(guc, guc);
+uc_state_checkers(huc, huc);
+uc_state_checkers(guc, guc_submission);
 
 #undef uc_state_checkers
 #undef __uc_state_checker
 
-static inline bool intel_uc_supports_guc_submission(struct intel_uc *uc)
-{
-       return intel_guc_is_submission_supported(&uc->guc);
-}
-
-static inline bool intel_uc_uses_guc_submission(struct intel_uc *uc)
-{
-       return intel_guc_is_submission_supported(&uc->guc);
-}
-
 #define intel_uc_ops_function(_NAME, _OPS, _TYPE, _RET) \
 static inline _TYPE intel_uc_##_NAME(struct intel_uc *uc) \
 { \
index 5fe00ee6bd1b3e52cdec87b44fb5f6396c2874cd..e8c0885df978c2f236ecf275e1b83c105808a5a7 100644 (file)
@@ -1247,7 +1247,7 @@ int intel_vgpu_setup_submission(struct intel_vgpu *vgpu)
                intel_context_set_single_submission(ce);
 
                /* Max ring buffer size */
-               if (!intel_uc_uses_guc_submission(&engine->gt->uc)) {
+               if (!intel_uc_wants_guc_submission(&engine->gt->uc)) {
                        const unsigned int ring_size = 512 * SZ_4K;
 
                        ce->ring = __intel_context_ring_size(ring_size);
index be1a56acc732bf62d02ec781d92c1de536e9c5de..4305ccc4c683ae0d6424b9a864912a2487042262 100644 (file)
@@ -2000,10 +2000,4 @@ i915_coherent_map_type(struct drm_i915_private *i915)
        return HAS_LLC(i915) ? I915_MAP_WB : I915_MAP_WC;
 }
 
-static inline bool intel_guc_submission_is_enabled(struct intel_guc *guc)
-{
-       return intel_guc_is_submission_supported(guc) &&
-              intel_guc_is_ready(guc);
-}
-
 #endif
index 5c189bc31da51768ad29f972e54f48f212b89dbf..e73fd752adefbcd02cc5b413751a031be19d302a 100644 (file)
@@ -105,7 +105,7 @@ int intel_gvt_init(struct drm_i915_private *dev_priv)
                return 0;
        }
 
-       if (intel_uc_uses_guc_submission(&dev_priv->gt.uc)) {
+       if (intel_uc_wants_guc_submission(&dev_priv->gt.uc)) {
                drm_err(&dev_priv->drm,
                        "i915 GVT-g loading failed due to Graphics virtualization is not yet supported with GuC submission\n");
                return -EIO;