drm/i915/uc: Add init_fw/fini_fw to to intel_uc_ops
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Fri, 10 Jan 2020 22:27:21 +0000 (22:27 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Sat, 11 Jan 2020 08:34:28 +0000 (08:34 +0000)
Firmware fetching and cleanup steps are only meaningful if we are
running with uC enabled. Make these functions part of the uc_ops.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
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/20200110222723.14724-3-michal.wajdeczko@intel.com
drivers/gpu/drm/i915/gt/uc/intel_uc.c
drivers/gpu/drm/i915/gt/uc/intel_uc.h

index 9bcec6e..cd0742f 100644 (file)
@@ -253,12 +253,11 @@ static void guc_disable_communication(struct intel_guc *guc)
        DRM_INFO("GuC communication disabled\n");
 }
 
-void intel_uc_fetch_firmwares(struct intel_uc *uc)
+static void __uc_fetch_firmwares(struct intel_uc *uc)
 {
        int err;
 
-       if (!intel_uc_uses_guc(uc))
-               return;
+       GEM_BUG_ON(!intel_uc_uses_guc(uc));
 
        err = intel_uc_fw_fetch(&uc->guc.fw);
        if (err)
@@ -268,7 +267,7 @@ void intel_uc_fetch_firmwares(struct intel_uc *uc)
                intel_uc_fw_fetch(&uc->huc.fw);
 }
 
-void intel_uc_cleanup_firmwares(struct intel_uc *uc)
+static void __uc_cleanup_firmwares(struct intel_uc *uc)
 {
        intel_uc_fw_cleanup_fetch(&uc->huc.fw);
        intel_uc_fw_cleanup_fetch(&uc->guc.fw);
@@ -617,6 +616,9 @@ static const struct intel_uc_ops uc_ops_off = {
 };
 
 static const struct intel_uc_ops uc_ops_on = {
+       .init_fw = __uc_fetch_firmwares,
+       .fini_fw = __uc_cleanup_firmwares,
+
        .init_hw = __uc_init_hw,
        .fini_hw = __uc_fini_hw,
 };
index d5c2d4c..47c7c8a 100644 (file)
@@ -13,6 +13,8 @@
 struct intel_uc;
 
 struct intel_uc_ops {
+       void (*init_fw)(struct intel_uc *uc);
+       void (*fini_fw)(struct intel_uc *uc);
        int (*init_hw)(struct intel_uc *uc);
        void (*fini_hw)(struct intel_uc *uc);
 };
@@ -29,8 +31,6 @@ struct intel_uc {
 void intel_uc_init_early(struct intel_uc *uc);
 void intel_uc_driver_late_release(struct intel_uc *uc);
 void intel_uc_init_mmio(struct intel_uc *uc);
-void intel_uc_fetch_firmwares(struct intel_uc *uc);
-void intel_uc_cleanup_firmwares(struct intel_uc *uc);
 void intel_uc_sanitize(struct intel_uc *uc);
 void intel_uc_init(struct intel_uc *uc);
 void intel_uc_fini(struct intel_uc *uc);
@@ -77,6 +77,8 @@ static inline _TYPE intel_uc_##_NAME(struct intel_uc *uc) \
                return uc->ops->_OPS(uc); \
        return _RET; \
 }
+intel_uc_ops_function(fetch_firmwares, init_fw, void, );
+intel_uc_ops_function(cleanup_firmwares, fini_fw, void, );
 intel_uc_ops_function(init_hw, init_hw, int, 0);
 intel_uc_ops_function(fini_hw, fini_hw, void, );
 #undef intel_uc_ops_function