Skip to contentSkip to conversation

drm/i915/uc: Add explicit DISABLED state for firmware

PATCH Superseded Michal Wajdeczko 3 participants 5 messages Aug 15, 2019 – Aug 16, 2019

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915/uc: Add explicit DISABLED state for firmware

We really need to have separate NOT_SUPPORTED state (for lack of hardware support) and DISABLED state (to indicate user decision) as we will have to take special steps even if GuC firmware is now disabled but hardware exists and could have been previously used.

Cc Daniele Ceraolo Spurio <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/gt/uc/intel_guc.h    |  7 ++++-
 drivers/gpu/drm/i915/gt/uc/intel_huc.h    |  7 ++++-
 drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c |  2 +-
 drivers/gpu/drm/i915/gt/uc/intel_uc.c     | 33 ++++++++++++-----------
 drivers/gpu/drm/i915/gt/uc/intel_uc.h     | 17 +++++++++++-
 drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c  |  6 +++--
 drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h  | 22 ++++++++++-----
 drivers/gpu/drm/i915/i915_drv.h           |  2 +-
 8 files changed, 68 insertions(+), 28 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc.h +6 -1
index 4999db965685..2b2f046d3cc3 100644
@@ -154,7 +154,12 @@ struct i915_vma *intel_guc_allocate_vma(struct intel_guc *guc, u32 size);
 
 static inline bool intel_guc_is_supported(struct intel_guc *guc)
 {
-	return intel_uc_fw_supported(&guc->fw);
+	return intel_uc_fw_is_supported(&guc->fw);
+}
+
+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)
drivers/gpu/drm/i915/gt/uc/intel_huc.h +6 -1
index f8a4557c8d6d..644c059fe01d 100644
@@ -38,7 +38,12 @@ static inline int intel_huc_sanitize(struct intel_huc *huc)
 
 static inline bool intel_huc_is_supported(struct intel_huc *huc)
 {
-	return intel_uc_fw_supported(&huc->fw);
+	return intel_uc_fw_is_supported(&huc->fw);
+}
+
+static inline bool intel_huc_is_enabled(struct intel_huc *huc)
+{
+	return intel_uc_fw_is_enabled(&huc->fw);
 }
 
 static inline bool intel_huc_is_authenticated(struct intel_huc *huc)
drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c +1 -1
index 96feca99322a..74602487ed67 100644
@@ -35,7 +35,7 @@ void intel_huc_fw_init_early(struct intel_huc *huc)
 	struct drm_i915_private *i915 = gt->i915;
 
 	intel_uc_fw_init_early(&huc->fw, INTEL_UC_FW_TYPE_HUC,
-			       intel_uc_supports_guc(uc),
+			       intel_uc_uses_guc(uc),
 			       INTEL_INFO(i915)->platform, INTEL_REVID(i915));
 }
 
drivers/gpu/drm/i915/gt/uc/intel_uc.c +18 -15
index 0dc2b0cf4604..b375db468c9c 100644
@@ -45,17 +45,17 @@ static void __confirm_options(struct intel_uc *uc)
 	DRM_DEV_DEBUG_DRIVER(i915->drm.dev,
 			     "enable_guc=%d (guc:%s submission:%s huc:%s)\n",
 			     i915_modparams.enable_guc,
-			     yesno(intel_uc_supports_guc(uc)),
-			     yesno(intel_uc_supports_guc_submission(uc)),
-			     yesno(intel_uc_supports_huc(uc)));
+			     yesno(intel_uc_uses_guc(uc)),
+			     yesno(intel_uc_uses_guc_submission(uc)),
+			     yesno(intel_uc_uses_huc(uc)));
 
 	if (i915_modparams.enable_guc == -1)
 		return;
 
 	if (i915_modparams.enable_guc == 0) {
-		GEM_BUG_ON(intel_uc_supports_guc(uc));
-		GEM_BUG_ON(intel_uc_supports_guc_submission(uc));
-		GEM_BUG_ON(intel_uc_supports_huc(uc));
+		GEM_BUG_ON(intel_uc_uses_guc(uc));
+		GEM_BUG_ON(intel_uc_uses_guc_submission(uc));
+		GEM_BUG_ON(intel_uc_uses_huc(uc));
 		return;
 	}
 
@@ -266,23 +266,23 @@ void intel_uc_fetch_firmwares(struct intel_uc *uc)
 	struct drm_i915_private *i915 = uc_to_gt(uc)->i915;
 	int err;
 
-	if (!intel_uc_supports_guc(uc))
+	if (!intel_uc_uses_guc(uc))
 		return;
 
 	err = intel_uc_fw_fetch(&uc->guc.fw, i915);
 	if (err)
 		return;
 
-	if (intel_uc_supports_huc(uc))
+	if (intel_uc_uses_huc(uc))
 		intel_uc_fw_fetch(&uc->huc.fw, i915);
 }
 
 void intel_uc_cleanup_firmwares(struct intel_uc *uc)
 {
-	if (!intel_uc_supports_guc(uc))
+	if (!intel_uc_uses_guc(uc))
 		return;
 
-	if (intel_uc_supports_huc(uc))
+	if (intel_uc_uses_huc(uc))
 		intel_uc_fw_cleanup_fetch(&uc->huc.fw);
 
 	intel_uc_fw_cleanup_fetch(&uc->guc.fw);
@@ -304,7 +304,7 @@ int intel_uc_init(struct intel_uc *uc)
 	if (ret)
 		return ret;
 
-	if (intel_uc_supports_huc(uc)) {
+	if (intel_uc_uses_huc(uc)) {
 		ret = intel_huc_init(huc);
 		if (ret)
 			goto out_huc;
@@ -324,7 +324,7 @@ void intel_uc_fini(struct intel_uc *uc)
 	if (!intel_uc_supports_guc(uc))
 		return;
 
-	if (intel_uc_supports_huc(uc))
+	if (intel_uc_uses_huc(uc))
 		intel_huc_fini(&uc->huc);
 
 	intel_guc_fini(guc);
@@ -360,7 +360,7 @@ static int uc_init_wopcm(struct intel_uc *uc)
 	struct intel_uncore *uncore = gt->uncore;
 	u32 base = intel_wopcm_guc_base(&gt->i915->wopcm);
 	u32 size = intel_wopcm_guc_size(&gt->i915->wopcm);
-	u32 huc_agent = intel_uc_supports_huc(uc) ? HUC_LOADING_AGENT_GUC : 0;
+	u32 huc_agent = intel_uc_uses_huc(uc) ? HUC_LOADING_AGENT_GUC : 0;
 	u32 mask;
 	int err;
 
@@ -417,6 +417,9 @@ int intel_uc_init_hw(struct intel_uc *uc)
 	if (!intel_uc_supports_guc(uc))
 		return 0;
 
+	if (!intel_uc_uses_guc(uc))
+		return 0;
+
 	if (!intel_uc_fw_is_available(&guc->fw)) {
 		ret = intel_uc_fw_status_to_error(guc->fw.status);
 		goto err_out;
@@ -444,7 +447,7 @@ int intel_uc_init_hw(struct intel_uc *uc)
 		if (ret)
 			goto err_out;
 
-		if (intel_uc_supports_huc(uc)) {
+		if (intel_uc_uses_huc(uc)) {
 			ret = intel_huc_fw_upload(huc);
 			if (ret && intel_uc_fw_is_overridden(&huc->fw))
 				goto err_out;
@@ -490,7 +493,7 @@ int intel_uc_init_hw(struct intel_uc *uc)
 		 "submission",
 		 enableddisabled(intel_uc_supports_guc_submission(uc)));
 
-	if (intel_uc_supports_huc(uc)) {
+	if (intel_uc_uses_huc(uc)) {
 		dev_info(i915->drm.dev, "%s firmware %s version %u.%u %s:%s\n",
 			 intel_uc_fw_type_repr(INTEL_UC_FW_TYPE_HUC),
 			 huc->fw.path,
drivers/gpu/drm/i915/gt/uc/intel_uc.h +16 -1
index bfb6f97578a5..1b9404a75ac0 100644
@@ -39,14 +39,29 @@ static inline bool intel_uc_supports_guc(struct intel_uc *uc)
 	return intel_guc_is_supported(&uc->guc);
 }
 
+static inline bool intel_uc_uses_guc(struct intel_uc *uc)
+{
+	return intel_guc_is_enabled(&uc->guc);
+}
+
 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);
+}
+
 static inline bool intel_uc_supports_huc(struct intel_uc *uc)
 {
-	return intel_huc_is_supported(&uc->huc);
+	return intel_uc_supports_guc(uc);
+}
+
+static inline bool intel_uc_uses_huc(struct intel_uc *uc)
+{
+	return intel_huc_is_enabled(&uc->huc);
 }
 
 #endif
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +4 -2
index d056e1f4bd6d..ce828ae3ea03 100644
@@ -206,8 +206,10 @@ void intel_uc_fw_init_early(struct intel_uc_fw *uc_fw,
 		__uc_fw_user_override(uc_fw);
 	}
 
-	intel_uc_fw_change_status(uc_fw, uc_fw->path && *uc_fw->path ?
+	intel_uc_fw_change_status(uc_fw, uc_fw->path ?
+				  uc_fw->path ?
 				  INTEL_UC_FIRMWARE_SELECTED :
+				  INTEL_UC_FIRMWARE_DISABLED :
 				  INTEL_UC_FIRMWARE_NOT_SUPPORTED);
 }
 
@@ -265,7 +267,7 @@ int intel_uc_fw_fetch(struct intel_uc_fw *uc_fw, struct drm_i915_private *i915)
 	size_t size;
 	int err;
 
-	GEM_BUG_ON(!intel_uc_fw_supported(uc_fw));
+	GEM_BUG_ON(!intel_uc_fw_is_enabled(uc_fw));
 
 	err = i915_inject_load_error(i915, -ENXIO);
 	if (err)
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h +16 -6
index ce8e83128a95..40927d17efe2 100644
@@ -19,8 +19,9 @@ struct intel_gt;
 #define INTEL_UC_FIRMWARE_URL "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915"
 
 enum intel_uc_fw_status {
-	INTEL_UC_FIRMWARE_NOT_SUPPORTED = -1, /* no uc HW or disabled */
+	INTEL_UC_FIRMWARE_NOT_SUPPORTED = -1, /* no uc HW */
 	INTEL_UC_FIRMWARE_UNINITIALIZED = 0, /* used to catch checks done too early */
+	INTEL_UC_FIRMWARE_DISABLED, /* disabled */
 	INTEL_UC_FIRMWARE_SELECTED, /* selected the blob we want to load */
 	INTEL_UC_FIRMWARE_MISSING, /* blob not found on the system */
 	INTEL_UC_FIRMWARE_ERROR, /* invalid format or version */
@@ -84,6 +85,8 @@ const char *intel_uc_fw_status_repr(enum intel_uc_fw_status status)
 		return "N/A";
 	case INTEL_UC_FIRMWARE_UNINITIALIZED:
 		return "UNINITIALIZED";
+	case INTEL_UC_FIRMWARE_DISABLED:
+		return "DISABLED";
 	case INTEL_UC_FIRMWARE_SELECTED:
 		return "SELECTED";
 	case INTEL_UC_FIRMWARE_MISSING:
@@ -106,7 +109,9 @@ static inline int intel_uc_fw_status_to_error(enum intel_uc_fw_status status)
 {
 	switch (status) {
 	case INTEL_UC_FIRMWARE_NOT_SUPPORTED:
+		return -ENODEV;
 	case INTEL_UC_FIRMWARE_UNINITIALIZED:
+	case INTEL_UC_FIRMWARE_DISABLED:
 		return -EPERM;
 	case INTEL_UC_FIRMWARE_MISSING:
 		return -ENOENT;
@@ -142,6 +147,16 @@ __intel_uc_fw_status(struct intel_uc_fw *uc_fw)
 	return uc_fw->status;
 }
 
+static inline bool intel_uc_fw_is_supported(struct intel_uc_fw *uc_fw)
+{
+	return __intel_uc_fw_status(uc_fw) != INTEL_UC_FIRMWARE_NOT_SUPPORTED;
+}
+
+static inline bool intel_uc_fw_is_enabled(struct intel_uc_fw *uc_fw)
+{
+	return __intel_uc_fw_status(uc_fw) > INTEL_UC_FIRMWARE_DISABLED;
+}
+
 static inline bool intel_uc_fw_is_available(struct intel_uc_fw *uc_fw)
 {
 	return __intel_uc_fw_status(uc_fw) >= INTEL_UC_FIRMWARE_AVAILABLE;
@@ -157,11 +172,6 @@ static inline bool intel_uc_fw_is_running(struct intel_uc_fw *uc_fw)
 	return __intel_uc_fw_status(uc_fw) == INTEL_UC_FIRMWARE_RUNNING;
 }
 
-static inline bool intel_uc_fw_supported(struct intel_uc_fw *uc_fw)
-{
-	return __intel_uc_fw_status(uc_fw) != INTEL_UC_FIRMWARE_NOT_SUPPORTED;
-}
-
 static inline bool intel_uc_fw_is_overridden(const struct intel_uc_fw *uc_fw)
 {
 	return uc_fw->user_overridden;
drivers/gpu/drm/i915/i915_drv.h +1 -1
index c4406a60f3e4..7cb70f614ec2 100644
@@ -2214,7 +2214,7 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
 #define HAS_GT_UC(dev_priv)	(INTEL_INFO(dev_priv)->has_gt_uc)
 
 /* Having GuC is not the same as using GuC */
-#define USES_GUC(dev_priv)		intel_uc_supports_guc(&(dev_priv)->gt.uc)
+#define USES_GUC(dev_priv)		intel_uc_uses_guc(&(dev_priv)->gt.uc)
 #define USES_GUC_SUBMISSION(dev_priv)	intel_uc_supports_guc_submission(&(dev_priv)->gt.uc)
 
 #define HAS_POOLED_EU(dev_priv)	(INTEL_INFO(dev_priv)->has_pooled_eu)
Signature · 6 lines
2.19.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✗ Fi.CI.BAT: failure for drm/i915/uc: Add explicit DISABLED state for firmware

== Series Details ==

== Series Details ==

Series: drm/i915/uc: Add explicit DISABLED state for firmware
URL : https://patchwork.freedesktop.org/series/65278/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_6714 -> Patchwork_14042
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_14042 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_14042, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14042/

Known issues
------------

Here are the changes found in Patchwork_14042 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_suspend@basic-s3:
- fi-blb-e6850: [PASS][1] -> [INCOMPLETE][2] ([fdo#107718])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6714/fi-blb-e6850/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14042/fi-blb-e6850/igt@[email protected]

* igt@prime_vgem@basic-fence-flip:
- fi-ilk-650: [PASS][3] -> [DMESG-WARN][4] ([fdo#106387])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6714/fi-ilk-650/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14042/fi-ilk-650/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#106387]: https://bugs.freedesktop.org/show_bug.cgi?id=106387
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718

Participating hosts (52 -> 23)
------------------------------

ERROR: It appears as if the changes made in Patchwork_14042 prevented too many machines from booting.

Missing (29): fi-kbl-soraka fi-skl-6770hq fi-icl-u2 fi-skl-6260u fi-bxt-j4205 fi-icl-u3 fi-icl-y fi-skl-lmem fi-icl-dsi fi-skl-6600u fi-cml-u fi-cml-u2 fi-icl-u4 fi-bxt-dsi fi-glk-dsi fi-skl-6700k2 fi-kbl-r fi-kbl-7567u fi-skl-gvtdvm fi-cfl-8700k fi-byt-squawks fi-bsw-cyan fi-whl-u fi-kbl-x1275 fi-cfl-8109u fi-skl-iommu fi-kbl-8809g fi-byt-clapper fi-bdw-samus

Build changes
-------------

* CI: CI-20190529 -> None
* Linux: CI_DRM_6714 -> Patchwork_14042

CI-20190529: 20190529
CI_DRM_6714: 9198974f9fa309c4c74197365844971e0940b227 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5138: b9abe0bf6c478c4f6cac56bff286d6926ad8c0ab @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_14042: 2129de239b7fd2c44691a754e78c289fbca39af8 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

2129de239b7f drm/i915/uc: Add explicit DISABLED state for firmware

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14042/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
In reply to Michal Wajdeczko

Quoting Michal Wajdeczko (2019-08-16 00:48:32)

drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c void intel_uc_fw_init_early(struct intel_uc_fw *uc_fw, · line 210

Quoted 11 lines
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +2 -1
index d056e1f4bd6d..ce828ae3ea03 100644
@@ -206,8 +206,10 @@ void intel_uc_fw_init_early(struct intel_uc_fw *uc_fw,
                __uc_fw_user_override(uc_fw);
        }
 
-       intel_uc_fw_change_status(uc_fw, uc_fw->path && *uc_fw->path ?
+       intel_uc_fw_change_status(uc_fw, uc_fw->path ?
+                                 uc_fw->path ?

uc_fw->path ? *uc_fw->path ?

Quoted 30 lines
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +1 -0
                                  INTEL_UC_FIRMWARE_SELECTED :
+                                 INTEL_UC_FIRMWARE_DISABLED :
                                  INTEL_UC_FIRMWARE_NOT_SUPPORTED);
 }
 
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h +4 -1
index ce8e83128a95..40927d17efe2 100644
@@ -19,8 +19,9 @@ struct intel_gt;
 #define INTEL_UC_FIRMWARE_URL "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915"
 
 enum intel_uc_fw_status {
-       INTEL_UC_FIRMWARE_NOT_SUPPORTED = -1, /* no uc HW or disabled */
+       INTEL_UC_FIRMWARE_NOT_SUPPORTED = -1, /* no uc HW */
        INTEL_UC_FIRMWARE_UNINITIALIZED = 0, /* used to catch checks done too early */
+       INTEL_UC_FIRMWARE_DISABLED, /* disabled */
        INTEL_UC_FIRMWARE_SELECTED, /* selected the blob we want to load */
        INTEL_UC_FIRMWARE_MISSING, /* blob not found on the system */
        INTEL_UC_FIRMWARE_ERROR, /* invalid format or version */
@@ -84,6 +85,8 @@ const char *intel_uc_fw_status_repr(enum intel_uc_fw_status status)
                return "N/A";
        case INTEL_UC_FIRMWARE_UNINITIALIZED:
                return "UNINITIALIZED";
+       case INTEL_UC_FIRMWARE_DISABLED:
+               return "DISABLED";
        case INTEL_UC_FIRMWARE_SELECTED:
                return "SELECTED";
        case INTEL_UC_FIRMWARE_MISSING:

drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h static inline int intel_uc_fw_status_to_error(enum intel_uc_fw_status status) · line 113

Quoted 5 lines
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h +1 -0
@@ -106,7 +109,9 @@ static inline int intel_uc_fw_status_to_error(enum intel_uc_fw_status status)
 {
        switch (status) {
        case INTEL_UC_FIRMWARE_NOT_SUPPORTED:
+               return -ENODEV;
        case INTEL_UC_FIRMWARE_UNINITIALIZED:

return -EACCES; ?

Quoted 8 lines
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h +1 -0
+       case INTEL_UC_FIRMWARE_DISABLED:
                return -EPERM;
 
        case INTEL_UC_FIRMWARE_MISSING:
                return -ENOENT;
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h +0 -0
@@ -142,6 +147,16 @@ __intel_uc_fw_status(struct intel_uc_fw *uc_fw)
        return uc_fw->status;
 }

drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h __intel_uc_fw_status(struct intel_uc_fw *uc_fw) · line 158

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h +9 -0
 
+static inline bool intel_uc_fw_is_supported(struct intel_uc_fw *uc_fw)
+{
+       return __intel_uc_fw_status(uc_fw) != INTEL_UC_FIRMWARE_NOT_SUPPORTED;
+}
+
+static inline bool intel_uc_fw_is_enabled(struct intel_uc_fw *uc_fw)
+{
+       return __intel_uc_fw_status(uc_fw) > INTEL_UC_FIRMWARE_DISABLED;
+}

Ok.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

PATCH v2 1/1 drm/i915/uc: Add explicit DISABLED state for firmware

In reply to Michal Wajdeczko

We really need to have separate NOT_SUPPORTED state (for lack of hardware support) and DISABLED state (to indicate user decision) as we will have to take special steps even if GuC firmware is now disabled but hardware exists and could have been previously used.

v2: fix logic (Chris/CI)

Cc Daniele Ceraolo Spurio <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/gt/uc/intel_guc.h    |  7 ++++-
 drivers/gpu/drm/i915/gt/uc/intel_huc.h    |  7 ++++-
 drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c |  2 +-
 drivers/gpu/drm/i915/gt/uc/intel_uc.c     | 33 ++++++++++++-----------
 drivers/gpu/drm/i915/gt/uc/intel_uc.h     | 17 +++++++++++-
 drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c  |  5 ++--
 drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h  | 23 +++++++++++-----
 drivers/gpu/drm/i915/i915_drv.h           |  2 +-
 8 files changed, 68 insertions(+), 28 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc.h +6 -1
index 4999db965685..2b2f046d3cc3 100644
@@ -154,7 +154,12 @@ struct i915_vma *intel_guc_allocate_vma(struct intel_guc *guc, u32 size);
 
 static inline bool intel_guc_is_supported(struct intel_guc *guc)
 {
-	return intel_uc_fw_supported(&guc->fw);
+	return intel_uc_fw_is_supported(&guc->fw);
+}
+
+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)
drivers/gpu/drm/i915/gt/uc/intel_huc.h +6 -1
index f8a4557c8d6d..644c059fe01d 100644
@@ -38,7 +38,12 @@ static inline int intel_huc_sanitize(struct intel_huc *huc)
 
 static inline bool intel_huc_is_supported(struct intel_huc *huc)
 {
-	return intel_uc_fw_supported(&huc->fw);
+	return intel_uc_fw_is_supported(&huc->fw);
+}
+
+static inline bool intel_huc_is_enabled(struct intel_huc *huc)
+{
+	return intel_uc_fw_is_enabled(&huc->fw);
 }
 
 static inline bool intel_huc_is_authenticated(struct intel_huc *huc)
drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c +1 -1
index 96feca99322a..74602487ed67 100644
@@ -35,7 +35,7 @@ void intel_huc_fw_init_early(struct intel_huc *huc)
 	struct drm_i915_private *i915 = gt->i915;
 
 	intel_uc_fw_init_early(&huc->fw, INTEL_UC_FW_TYPE_HUC,
-			       intel_uc_supports_guc(uc),
+			       intel_uc_uses_guc(uc),
 			       INTEL_INFO(i915)->platform, INTEL_REVID(i915));
 }
 
drivers/gpu/drm/i915/gt/uc/intel_uc.c +18 -15
index 0dc2b0cf4604..b375db468c9c 100644
@@ -45,17 +45,17 @@ static void __confirm_options(struct intel_uc *uc)
 	DRM_DEV_DEBUG_DRIVER(i915->drm.dev,
 			     "enable_guc=%d (guc:%s submission:%s huc:%s)\n",
 			     i915_modparams.enable_guc,
-			     yesno(intel_uc_supports_guc(uc)),
-			     yesno(intel_uc_supports_guc_submission(uc)),
-			     yesno(intel_uc_supports_huc(uc)));
+			     yesno(intel_uc_uses_guc(uc)),
+			     yesno(intel_uc_uses_guc_submission(uc)),
+			     yesno(intel_uc_uses_huc(uc)));
 
 	if (i915_modparams.enable_guc == -1)
 		return;
 
 	if (i915_modparams.enable_guc == 0) {
-		GEM_BUG_ON(intel_uc_supports_guc(uc));
-		GEM_BUG_ON(intel_uc_supports_guc_submission(uc));
-		GEM_BUG_ON(intel_uc_supports_huc(uc));
+		GEM_BUG_ON(intel_uc_uses_guc(uc));
+		GEM_BUG_ON(intel_uc_uses_guc_submission(uc));
+		GEM_BUG_ON(intel_uc_uses_huc(uc));
 		return;
 	}
 
@@ -266,23 +266,23 @@ void intel_uc_fetch_firmwares(struct intel_uc *uc)
 	struct drm_i915_private *i915 = uc_to_gt(uc)->i915;
 	int err;
 
-	if (!intel_uc_supports_guc(uc))
+	if (!intel_uc_uses_guc(uc))
 		return;
 
 	err = intel_uc_fw_fetch(&uc->guc.fw, i915);
 	if (err)
 		return;
 
-	if (intel_uc_supports_huc(uc))
+	if (intel_uc_uses_huc(uc))
 		intel_uc_fw_fetch(&uc->huc.fw, i915);
 }
 
 void intel_uc_cleanup_firmwares(struct intel_uc *uc)
 {
-	if (!intel_uc_supports_guc(uc))
+	if (!intel_uc_uses_guc(uc))
 		return;
 
-	if (intel_uc_supports_huc(uc))
+	if (intel_uc_uses_huc(uc))
 		intel_uc_fw_cleanup_fetch(&uc->huc.fw);
 
 	intel_uc_fw_cleanup_fetch(&uc->guc.fw);
@@ -304,7 +304,7 @@ int intel_uc_init(struct intel_uc *uc)
 	if (ret)
 		return ret;
 
-	if (intel_uc_supports_huc(uc)) {
+	if (intel_uc_uses_huc(uc)) {
 		ret = intel_huc_init(huc);
 		if (ret)
 			goto out_huc;
@@ -324,7 +324,7 @@ void intel_uc_fini(struct intel_uc *uc)
 	if (!intel_uc_supports_guc(uc))
 		return;
 
-	if (intel_uc_supports_huc(uc))
+	if (intel_uc_uses_huc(uc))
 		intel_huc_fini(&uc->huc);
 
 	intel_guc_fini(guc);
@@ -360,7 +360,7 @@ static int uc_init_wopcm(struct intel_uc *uc)
 	struct intel_uncore *uncore = gt->uncore;
 	u32 base = intel_wopcm_guc_base(&gt->i915->wopcm);
 	u32 size = intel_wopcm_guc_size(&gt->i915->wopcm);
-	u32 huc_agent = intel_uc_supports_huc(uc) ? HUC_LOADING_AGENT_GUC : 0;
+	u32 huc_agent = intel_uc_uses_huc(uc) ? HUC_LOADING_AGENT_GUC : 0;
 	u32 mask;
 	int err;
 
@@ -417,6 +417,9 @@ int intel_uc_init_hw(struct intel_uc *uc)
 	if (!intel_uc_supports_guc(uc))
 		return 0;
 
+	if (!intel_uc_uses_guc(uc))
+		return 0;
+
 	if (!intel_uc_fw_is_available(&guc->fw)) {
 		ret = intel_uc_fw_status_to_error(guc->fw.status);
 		goto err_out;
@@ -444,7 +447,7 @@ int intel_uc_init_hw(struct intel_uc *uc)
 		if (ret)
 			goto err_out;
 
-		if (intel_uc_supports_huc(uc)) {
+		if (intel_uc_uses_huc(uc)) {
 			ret = intel_huc_fw_upload(huc);
 			if (ret && intel_uc_fw_is_overridden(&huc->fw))
 				goto err_out;
@@ -490,7 +493,7 @@ int intel_uc_init_hw(struct intel_uc *uc)
 		 "submission",
 		 enableddisabled(intel_uc_supports_guc_submission(uc)));
 
-	if (intel_uc_supports_huc(uc)) {
+	if (intel_uc_uses_huc(uc)) {
 		dev_info(i915->drm.dev, "%s firmware %s version %u.%u %s:%s\n",
 			 intel_uc_fw_type_repr(INTEL_UC_FW_TYPE_HUC),
 			 huc->fw.path,
drivers/gpu/drm/i915/gt/uc/intel_uc.h +16 -1
index bfb6f97578a5..1b9404a75ac0 100644
@@ -39,14 +39,29 @@ static inline bool intel_uc_supports_guc(struct intel_uc *uc)
 	return intel_guc_is_supported(&uc->guc);
 }
 
+static inline bool intel_uc_uses_guc(struct intel_uc *uc)
+{
+	return intel_guc_is_enabled(&uc->guc);
+}
+
 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);
+}
+
 static inline bool intel_uc_supports_huc(struct intel_uc *uc)
 {
-	return intel_huc_is_supported(&uc->huc);
+	return intel_uc_supports_guc(uc);
+}
+
+static inline bool intel_uc_uses_huc(struct intel_uc *uc)
+{
+	return intel_huc_is_enabled(&uc->huc);
 }
 
 #endif
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +3 -2
index d056e1f4bd6d..bd6635ff9e2d 100644
@@ -206,8 +206,9 @@ void intel_uc_fw_init_early(struct intel_uc_fw *uc_fw,
 		__uc_fw_user_override(uc_fw);
 	}
 
-	intel_uc_fw_change_status(uc_fw, uc_fw->path && *uc_fw->path ?
+	intel_uc_fw_change_status(uc_fw, uc_fw->path ? *uc_fw->path ?
 				  INTEL_UC_FIRMWARE_SELECTED :
+				  INTEL_UC_FIRMWARE_DISABLED :
 				  INTEL_UC_FIRMWARE_NOT_SUPPORTED);
 }
 
@@ -265,7 +266,7 @@ int intel_uc_fw_fetch(struct intel_uc_fw *uc_fw, struct drm_i915_private *i915)
 	size_t size;
 	int err;
 
-	GEM_BUG_ON(!intel_uc_fw_supported(uc_fw));
+	GEM_BUG_ON(!intel_uc_fw_is_enabled(uc_fw));
 
 	err = i915_inject_load_error(i915, -ENXIO);
 	if (err)
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h +17 -6
index ce8e83128a95..fdda17f0a953 100644
@@ -19,8 +19,9 @@ struct intel_gt;
 #define INTEL_UC_FIRMWARE_URL "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915"
 
 enum intel_uc_fw_status {
-	INTEL_UC_FIRMWARE_NOT_SUPPORTED = -1, /* no uc HW or disabled */
+	INTEL_UC_FIRMWARE_NOT_SUPPORTED = -1, /* no uc HW */
 	INTEL_UC_FIRMWARE_UNINITIALIZED = 0, /* used to catch checks done too early */
+	INTEL_UC_FIRMWARE_DISABLED, /* disabled */
 	INTEL_UC_FIRMWARE_SELECTED, /* selected the blob we want to load */
 	INTEL_UC_FIRMWARE_MISSING, /* blob not found on the system */
 	INTEL_UC_FIRMWARE_ERROR, /* invalid format or version */
@@ -84,6 +85,8 @@ const char *intel_uc_fw_status_repr(enum intel_uc_fw_status status)
 		return "N/A";
 	case INTEL_UC_FIRMWARE_UNINITIALIZED:
 		return "UNINITIALIZED";
+	case INTEL_UC_FIRMWARE_DISABLED:
+		return "DISABLED";
 	case INTEL_UC_FIRMWARE_SELECTED:
 		return "SELECTED";
 	case INTEL_UC_FIRMWARE_MISSING:
@@ -106,7 +109,10 @@ static inline int intel_uc_fw_status_to_error(enum intel_uc_fw_status status)
 {
 	switch (status) {
 	case INTEL_UC_FIRMWARE_NOT_SUPPORTED:
+		return -ENODEV;
 	case INTEL_UC_FIRMWARE_UNINITIALIZED:
+		return -EACCES;
+	case INTEL_UC_FIRMWARE_DISABLED:
 		return -EPERM;
 	case INTEL_UC_FIRMWARE_MISSING:
 		return -ENOENT;
@@ -142,6 +148,16 @@ __intel_uc_fw_status(struct intel_uc_fw *uc_fw)
 	return uc_fw->status;
 }
 
+static inline bool intel_uc_fw_is_supported(struct intel_uc_fw *uc_fw)
+{
+	return __intel_uc_fw_status(uc_fw) != INTEL_UC_FIRMWARE_NOT_SUPPORTED;
+}
+
+static inline bool intel_uc_fw_is_enabled(struct intel_uc_fw *uc_fw)
+{
+	return __intel_uc_fw_status(uc_fw) > INTEL_UC_FIRMWARE_DISABLED;
+}
+
 static inline bool intel_uc_fw_is_available(struct intel_uc_fw *uc_fw)
 {
 	return __intel_uc_fw_status(uc_fw) >= INTEL_UC_FIRMWARE_AVAILABLE;
@@ -157,11 +173,6 @@ static inline bool intel_uc_fw_is_running(struct intel_uc_fw *uc_fw)
 	return __intel_uc_fw_status(uc_fw) == INTEL_UC_FIRMWARE_RUNNING;
 }
 
-static inline bool intel_uc_fw_supported(struct intel_uc_fw *uc_fw)
-{
-	return __intel_uc_fw_status(uc_fw) != INTEL_UC_FIRMWARE_NOT_SUPPORTED;
-}
-
 static inline bool intel_uc_fw_is_overridden(const struct intel_uc_fw *uc_fw)
 {
 	return uc_fw->user_overridden;
drivers/gpu/drm/i915/i915_drv.h +1 -1
index c4406a60f3e4..7cb70f614ec2 100644
@@ -2214,7 +2214,7 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
 #define HAS_GT_UC(dev_priv)	(INTEL_INFO(dev_priv)->has_gt_uc)
 
 /* Having GuC is not the same as using GuC */
-#define USES_GUC(dev_priv)		intel_uc_supports_guc(&(dev_priv)->gt.uc)
+#define USES_GUC(dev_priv)		intel_uc_uses_guc(&(dev_priv)->gt.uc)
 #define USES_GUC_SUBMISSION(dev_priv)	intel_uc_supports_guc_submission(&(dev_priv)->gt.uc)
 
 #define HAS_POOLED_EU(dev_priv)	(INTEL_INFO(dev_priv)->has_pooled_eu)
Signature · 6 lines
2.19.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

✗ Fi.CI.BAT: failure for drm/i915/uc: Add explicit DISABLED state for firmware (rev2)

In reply to Michal Wajdeczko
== Series Details ==

== Series Details ==

Series: drm/i915/uc: Add explicit DISABLED state for firmware (rev2)
URL : https://patchwork.freedesktop.org/series/65278/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_6715 -> Patchwork_14044
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_14044 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_14044, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14044/

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_14044:

### IGT changes ###

#### Possible regressions ####

* igt@gem_wait@basic-busy-all:
- fi-skl-gvtdvm: [PASS][1] -> [TIMEOUT][2] +8 similar issues
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6715/fi-skl-gvtdvm/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14044/fi-skl-gvtdvm/igt@[email protected]

Known issues
------------

Here are the changes found in Patchwork_14044 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_mmap@basic-small-bo:
- fi-skl-gvtdvm: [PASS][3] -> [SKIP][4] ([fdo#109271]) +88 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6715/fi-skl-gvtdvm/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14044/fi-skl-gvtdvm/igt@[email protected]

#### Possible fixes ####

* igt@i915_selftest@live_active:
- fi-bsw-n3050: [DMESG-WARN][5] ([fdo#111373]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6715/fi-bsw-n3050/igt@i915_selftest@live_active.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14044/fi-bsw-n3050/igt@i915_selftest@live_active.html

#### Warnings ####

* igt@i915_pm_rpm@basic-pci-d3-state:
- fi-kbl-guc: [SKIP][7] ([fdo#109271]) -> [FAIL][8] ([fdo#110829])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6715/fi-kbl-guc/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14044/fi-kbl-guc/igt@[email protected]

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#110829]: https://bugs.freedesktop.org/show_bug.cgi?id=110829
[fdo#111373]: https://bugs.freedesktop.org/show_bug.cgi?id=111373

Participating hosts (51 -> 25)
------------------------------

ERROR: It appears as if the changes made in Patchwork_14044 prevented too many machines from booting.

Missing (26): fi-skl-6770hq fi-icl-u2 fi-skl-6260u fi-bxt-j4205 fi-icl-u3 fi-icl-y fi-skl-lmem fi-icl-dsi fi-skl-6600u fi-cml-u fi-cml-u2 fi-icl-u4 fi-bxt-dsi fi-glk-dsi fi-skl-6700k2 fi-kbl-r fi-kbl-7567u fi-cfl-8700k fi-byt-squawks fi-bsw-cyan fi-whl-u fi-cfl-8109u fi-skl-iommu fi-kbl-8809g fi-byt-clapper fi-bdw-samus

Build changes
-------------

* CI: CI-20190529 -> None
* Linux: CI_DRM_6715 -> Patchwork_14044

CI-20190529: 20190529
CI_DRM_6715: 566f8f36249da60874943886a753a2e2a00ae992 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5138: b9abe0bf6c478c4f6cac56bff286d6926ad8c0ab @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_14044: 15736fdd8604f534bb7c9d2297a6346b28d5f28c @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

15736fdd8604 drm/i915/uc: Add explicit DISABLED state for firmware

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14044/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx