Skip to contentSkip to conversation

drm/i915/uc: Start preparing GuC/HuC for reset

PATCH In review Michal Wajdeczko 4 participants 6 messages Mar 5, 2018 – Mar 8, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 drm/i915/uc: Start preparing GuC/HuC for reset

Right after GPU reset there will be a small window of time during which some of GuC/HuC fields will still show state before reset. Let's start to fix that by sanitizing firmware status as we will use it shortly.

v2: s/reset_prepare/prepare_to_reset (Michel)
don't forget about gem_sanitize path (Daniele)
v3: rebased

---
 drivers/gpu/drm/i915/i915_gem.c    |  5 ++++-
 drivers/gpu/drm/i915/intel_guc.h   |  5 +++++
 drivers/gpu/drm/i915/intel_huc.h   |  5 +++++
 drivers/gpu/drm/i915/intel_uc.c    | 14 ++++++++++++++
 drivers/gpu/drm/i915/intel_uc.h    |  1 +
 drivers/gpu/drm/i915/intel_uc_fw.h |  6 ++++++
 6 files changed, 35 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +4 -1
index a5bd073..aedb17d 100644
@@ -2981,6 +2981,7 @@ int i915_gem_reset_prepare(struct drm_i915_private *dev_priv)
 	}
 
 	i915_gem_revoke_fences(dev_priv);
+	intel_uc_prepare_to_reset(dev_priv);
 
 	return err;
 }
@@ -4882,8 +4883,10 @@ void i915_gem_sanitize(struct drm_i915_private *i915)
 	 * it may impact the display and we are uncertain about the stability
 	 * of the reset, so this could be applied to even earlier gen.
 	 */
-	if (INTEL_GEN(i915) >= 5 && intel_has_gpu_reset(i915))
+	if (INTEL_GEN(i915) >= 5 && intel_has_gpu_reset(i915)) {
+		intel_uc_prepare_to_reset(i915);
 		WARN_ON(intel_gpu_reset(i915, ALL_ENGINES));
+	}
 }
 
 int i915_gem_suspend(struct drm_i915_private *dev_priv)
drivers/gpu/drm/i915/intel_guc.h +5 -0
index b9424ac..bdb0777 100644
@@ -132,4 +132,9 @@ static inline u32 guc_ggtt_offset(struct i915_vma *vma)
 struct i915_vma *intel_guc_allocate_vma(struct intel_guc *guc, u32 size);
 u32 intel_guc_wopcm_size(struct drm_i915_private *dev_priv);
 
+static inline void intel_guc_prepare_to_reset(struct intel_guc *guc)
+{
+	intel_uc_fw_prepare_to_reset(&guc->fw);
+}
+
 #endif
drivers/gpu/drm/i915/intel_huc.h +5 -0
index 5d6e804..6f21424 100644
@@ -38,4 +38,9 @@ struct intel_huc {
 void intel_huc_init_early(struct intel_huc *huc);
 int intel_huc_auth(struct intel_huc *huc);
 
+static inline void intel_huc_prepare_to_reset(struct intel_huc *huc)
+{
+	intel_uc_fw_prepare_to_reset(&huc->fw);
+}
+
 #endif
drivers/gpu/drm/i915/intel_uc.c +14 -0
index e5bf0d3..8a64ff5 100644
@@ -490,3 +490,17 @@ int intel_uc_resume(struct drm_i915_private *i915)
 
 	return 0;
 }
+
+void intel_uc_prepare_to_reset(struct drm_i915_private *i915)
+{
+	struct intel_huc *huc = &i915->huc;
+	struct intel_guc *guc = &i915->guc;
+
+	if (!USES_GUC(i915))
+		return;
+
+	GEM_BUG_ON(!HAS_GUC(i915));
+
+	intel_huc_prepare_to_reset(huc);
+	intel_guc_prepare_to_reset(guc);
+}
drivers/gpu/drm/i915/intel_uc.h +1 -0
index f76d51d..182a2de 100644
@@ -41,6 +41,7 @@
 void intel_uc_fini(struct drm_i915_private *dev_priv);
 int intel_uc_suspend(struct drm_i915_private *dev_priv);
 int intel_uc_resume(struct drm_i915_private *dev_priv);
+void intel_uc_prepare_to_reset(struct drm_i915_private *dev_priv);
 
 static inline bool intel_uc_is_using_guc(void)
 {
drivers/gpu/drm/i915/intel_uc_fw.h +6 -0
index d5fd460..f1ee653 100644
@@ -115,6 +115,12 @@ static inline bool intel_uc_fw_is_selected(struct intel_uc_fw *uc_fw)
 	return uc_fw->path != NULL;
 }
 
+static inline void intel_uc_fw_prepare_to_reset(struct intel_uc_fw *uc_fw)
+{
+	if (uc_fw->load_status == INTEL_UC_FIRMWARE_SUCCESS)
+		uc_fw->load_status = INTEL_UC_FIRMWARE_PENDING;
+}
+
 void intel_uc_fw_fetch(struct drm_i915_private *dev_priv,
 		       struct intel_uc_fw *uc_fw);
 int intel_uc_fw_upload(struct intel_uc_fw *uc_fw,
Signature · 6 lines
1.9.1

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

PATCH v3 2/2 HAX: Enable GuC for CI

v2: except running with HYPERVISOR

---
 drivers/gpu/drm/i915/i915_params.h | 2 +-
 drivers/gpu/drm/i915/intel_uc.c    | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_params.h +1 -1
index 430f5f9..3deae1e 100644
@@ -47,7 +47,7 @@
 	param(int, disable_power_well, -1) \
 	param(int, enable_ips, 1) \
 	param(int, invert_brightness, 0) \
-	param(int, enable_guc, 0) \
+	param(int, enable_guc, -1) \
 	param(int, guc_log_level, 0) \
 	param(char *, guc_firmware_path, NULL) \
 	param(char *, huc_firmware_path, NULL) \
drivers/gpu/drm/i915/intel_uc.c +2 -0
index 8a64ff5..aaaeb61 100644
@@ -63,6 +63,8 @@ static int __get_platform_enable_guc(struct drm_i915_private *dev_priv)
 		enable_guc |= ENABLE_GUC_LOAD_HUC;
 
 	/* Any platform specific fine-tuning can be done here */
+	if (boot_cpu_has(X86_FEATURE_HYPERVISOR))
+		enable_guc = 0;
 
 	return enable_guc;
 }
Signature · 6 lines
1.9.1

_______________________________________________
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 (2018-03-05 14:29:16)

Quoted 37 lines

Right after GPU reset there will be a small window of time during which some of GuC/HuC fields will still show state before reset. Let's start to fix that by sanitizing firmware status as we will use it shortly.

v2: s/reset_prepare/prepare_to_reset (Michel)
don't forget about gem_sanitize path (Daniele)
v3: rebased

---
 drivers/gpu/drm/i915/i915_gem.c    |  5 ++++-
 drivers/gpu/drm/i915/intel_guc.h   |  5 +++++
 drivers/gpu/drm/i915/intel_huc.h   |  5 +++++
 drivers/gpu/drm/i915/intel_uc.c    | 14 ++++++++++++++
 drivers/gpu/drm/i915/intel_uc.h    |  1 +
 drivers/gpu/drm/i915/intel_uc_fw.h |  6 ++++++
 6 files changed, 35 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +1 -0
index a5bd073..aedb17d 100644
@@ -2981,6 +2981,7 @@ int i915_gem_reset_prepare(struct drm_i915_private *dev_priv)
        }
 
        i915_gem_revoke_fences(dev_priv);
+       intel_uc_prepare_to_reset(dev_priv);
 
        return err;
 }

drivers/gpu/drm/i915/i915_gem.c void i915_gem_sanitize(struct drm_i915_private *i915) · line 4888

Quoted 7 lines
drivers/gpu/drm/i915/i915_gem.c +2 -1
@@ -4882,8 +4883,10 @@ void i915_gem_sanitize(struct drm_i915_private *i915)
         * it may impact the display and we are uncertain about the stability
         * of the reset, so this could be applied to even earlier gen.
         */
-       if (INTEL_GEN(i915) >= 5 && intel_has_gpu_reset(i915))
+       if (INTEL_GEN(i915) >= 5 && intel_has_gpu_reset(i915)) {
+               intel_uc_prepare_to_reset(i915);
                WARN_ON(intel_gpu_reset(i915, ALL_ENGINES));

This still feels wrong. If we accept that we will have to reload the fw on resume, why are we not just sanitzing the uc state and forcing the reload?
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
Quoted 35 lines · Chris Wilson

Quoting Michal Wajdeczko (2018-03-05 14:29:16)

Quoted 34 lines

Right after GPU reset there will be a small window of time during which some of GuC/HuC fields will still show state before reset. Let's start to fix that by sanitizing firmware status as we will use it shortly.

v2: s/reset_prepare/prepare_to_reset (Michel)
don't forget about gem_sanitize path (Daniele)
v3: rebased

---
  drivers/gpu/drm/i915/i915_gem.c    |  5 ++++-
  drivers/gpu/drm/i915/intel_guc.h   |  5 +++++
  drivers/gpu/drm/i915/intel_huc.h   |  5 +++++
  drivers/gpu/drm/i915/intel_uc.c    | 14 ++++++++++++++
  drivers/gpu/drm/i915/intel_uc.h    |  1 +
  drivers/gpu/drm/i915/intel_uc_fw.h |  6 ++++++
  6 files changed, 35 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +1 -0
index a5bd073..aedb17d 100644
@@ -2981,6 +2981,7 @@ int i915_gem_reset_prepare(struct drm_i915_private *dev_priv)
         }
 
         i915_gem_revoke_fences(dev_priv);
+       intel_uc_prepare_to_reset(dev_priv);
 
Quoted 13 lines

drivers/gpu/drm/i915/i915_gem.c void i915_gem_sanitize(struct drm_i915_private *i915) · line 4888

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem.c +2 -1
         return err;
  }
@@ -4882,8 +4883,10 @@ void i915_gem_sanitize(struct drm_i915_private *i915)
          * it may impact the display and we are uncertain about the stability
          * of the reset, so this could be applied to even earlier gen.
          */
-       if (INTEL_GEN(i915) >= 5 && intel_has_gpu_reset(i915))
+       if (INTEL_GEN(i915) >= 5 && intel_has_gpu_reset(i915)) {
+               intel_uc_prepare_to_reset(i915);
                 WARN_ON(intel_gpu_reset(i915, ALL_ENGINES));

This still feels wrong. If we accept that we will have to reload the fw on resume, why are we not just sanitzing the uc state and forcing the reload?

Hi Chris,

intel_uc_prepare_to_reset() is sanitizing uc state and reload is happening through gem_init_hw in resume path. what are we missing?

Thanks,
Sagar

Quoted 1 line

-Chris

Signature · 7 lines
Thanks,
Sagar

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
Quoted 52 lines · Sagar Arun Kamble
Quoted 41 lines · Chris Wilson

Quoting Michal Wajdeczko (2018-03-05 14:29:16)

Quoted 40 lines

Right after GPU reset there will be a small window of time during which some of GuC/HuC fields will still show state before reset. Let's start to fix that by sanitizing firmware status as we will use it shortly.

v2: s/reset_prepare/prepare_to_reset (Michel)
don't forget about gem_sanitize path (Daniele)
v3: rebased

---
  drivers/gpu/drm/i915/i915_gem.c    |  5 ++++-
  drivers/gpu/drm/i915/intel_guc.h   |  5 +++++
  drivers/gpu/drm/i915/intel_huc.h   |  5 +++++
  drivers/gpu/drm/i915/intel_uc.c    | 14 ++++++++++++++
  drivers/gpu/drm/i915/intel_uc.h    |  1 +
  drivers/gpu/drm/i915/intel_uc_fw.h |  6 ++++++
  6 files changed, 35 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +1 -0
index a5bd073..aedb17d 100644
@@ -2981,6 +2981,7 @@ int i915_gem_reset_prepare(struct  
 drm_i915_private *dev_priv)
         }
           i915_gem_revoke_fences(dev_priv);
+       intel_uc_prepare_to_reset(dev_priv);
           return err;
  }
@@ -4882,8 +4883,10 @@ void i915_gem_sanitize(struct drm_i915_private  
 *i915)
          * it may impact the display and we are uncertain about the  

stability
* of the reset, so this could be applied to even earlier gen.

Quoted 8 lines

drivers/gpu/drm/i915/i915_gem.c void i915_gem_sanitize(struct drm_i915_private *i915) · line 4888

Quoted 5 lines
          */
drivers/gpu/drm/i915/i915_gem.c +2 -1
-       if (INTEL_GEN(i915) >= 5 && intel_has_gpu_reset(i915))
+       if (INTEL_GEN(i915) >= 5 && intel_has_gpu_reset(i915)) {
+               intel_uc_prepare_to_reset(i915);
                 WARN_ON(intel_gpu_reset(i915, ALL_ENGINES));

This still feels wrong. If we accept that we will have to reload the fw on resume, why are we not just sanitzing the uc state and forcing the reload?

Quoted 4 lines

Hi Chris,

intel_uc_prepare_to_reset() is sanitizing uc state and reload is happening through gem_init_hw in resume path. what are we missing?

Maybe to make everyone happy, I'll introduce intel_uc_sanitize() leaving to doubt how we will handle reset/suspend/resume scenarios. And then uc_resume will likely be nop as we will do full reload on gem_init_hw.

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

#5 lore raw

✗ Fi.CI.BAT: failure for series starting with [v3,1/2] drm/i915/uc: Start preparing GuC/HuC for reset

In reply to Michal Wajdeczko
== Series Details ==

== Series Details ==

Series: series starting with [v3,1/2] drm/i915/uc: Start preparing GuC/HuC for reset
URL : https://patchwork.freedesktop.org/series/39381/
State : failure

== Summary ==

Series 39381v1 series starting with [v3,1/2] drm/i915/uc: Start preparing GuC/HuC for reset
https://patchwork.freedesktop.org/api/1.0/series/39381/revisions/1/mbox/

---- Possible new issues:

Test core_auth:

        Subgroup basic-auth:
                pass       -> INCOMPLETE (fi-bdw-5557u)
                pass       -> INCOMPLETE (fi-bdw-gvtdvm)
                pass       -> INCOMPLETE (fi-bsw-n3050)
                pass       -> INCOMPLETE (fi-bxt-dsi)
                pass       -> INCOMPLETE (fi-byt-j1900)
                pass       -> INCOMPLETE (fi-byt-n2820)
                pass       -> INCOMPLETE (fi-cfl-8700k)
                pass       -> INCOMPLETE (fi-cfl-s2)
                pass       -> INCOMPLETE (fi-cnl-y3)
                pass       -> INCOMPLETE (fi-glk-1)
                pass       -> INCOMPLETE (fi-hsw-4770)
                pass       -> INCOMPLETE (fi-ilk-650)
                pass       -> INCOMPLETE (fi-ivb-3520m)
                pass       -> INCOMPLETE (fi-ivb-3770)
                pass       -> INCOMPLETE (fi-kbl-7500u)
                pass       -> INCOMPLETE (fi-kbl-7560u)
                pass       -> INCOMPLETE (fi-kbl-7567u)
                pass       -> INCOMPLETE (fi-kbl-r)
                pass       -> INCOMPLETE (fi-skl-6260u)
                pass       -> INCOMPLETE (fi-skl-6600u)
                pass       -> INCOMPLETE (fi-skl-6700hq)
                pass       -> INCOMPLETE (fi-skl-6700k2)
                pass       -> INCOMPLETE (fi-skl-6770hq)
                pass       -> INCOMPLETE (fi-skl-gvtdvm)
                pass       -> INCOMPLETE (fi-snb-2520m)
                pass       -> INCOMPLETE (fi-snb-2600)
fi-bdw-5557u     total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  
fi-bdw-gvtdvm    total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:376s
fi-bsw-n3050     total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:280s
fi-bxt-dsi       total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  
fi-byt-j1900     total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  
fi-byt-n2820     total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  
fi-cfl-8700k     total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  
fi-cfl-s2        total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  
fi-cnl-y3        total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  
fi-elk-e7500     total:288  pass:229  dwarn:0   dfail:0   fail:0   skip:59  time:414s
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:294s
fi-glk-1         total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  
fi-hsw-4770      total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  
fi-ilk-650       total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  
fi-ivb-3520m     total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  
fi-ivb-3770      total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  
fi-kbl-7500u     total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  
fi-kbl-7560u     total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  
fi-kbl-7567u     total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  
fi-kbl-r         total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:582s
fi-skl-6260u     total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  
fi-skl-6600u     total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  
fi-skl-6700hq    total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  
fi-skl-6700k2    total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  
fi-skl-6770hq    total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  
fi-skl-guc       total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:412s
fi-skl-gvtdvm    total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  
fi-snb-2520m     total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  
fi-snb-2600      total:1    pass:0    dwarn:0   dfail:0   fail:0   skip:0  

276a88800a08604e3f617f084f59aeef75d5a01a drm-tip: 2018y-03m-05d-12h-15m-50s UTC integration manifest dd0e68d34742 HAX: Enable GuC for CI
b963c685ed40 drm/i915/uc: Start preparing GuC/HuC for reset

== Logs ==

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