[Intel-gfx] [PATCH 3/4] drm/i915/uc: Inject load errors into intel_uc_init_hw
Michal Wajdeczko
michal.wajdeczko at intel.com
Mon Jul 29 15:23:00 UTC 2019
Inject load errors into intel_uc_init_hw to make sure we
correctly handle uC initialization failures.
To avoid complains from CI about inserted errors or warnings,
use helper macro that checks if there was an error injection.
Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
---
drivers/gpu/drm/i915/gt/uc/intel_uc.c | 8 ++++++++
drivers/gpu/drm/i915/i915_drv.h | 7 ++++++-
drivers/gpu/drm/i915/i915_gem.c | 2 +-
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc.c b/drivers/gpu/drm/i915/gt/uc/intel_uc.c
index fafa9be1e12a..9e1156c29cb1 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_uc.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_uc.c
@@ -400,6 +400,14 @@ int intel_uc_init_hw(struct intel_uc *uc)
if (!intel_uc_is_using_guc(uc))
return 0;
+ ret = i915_inject_load_error(i915, -EIO);
+ if (ret)
+ return ret;
+
+ ret = i915_inject_load_error(i915, -ENXIO);
+ if (ret)
+ return ret;
+
GEM_BUG_ON(!intel_uc_fw_supported(&guc->fw));
guc_reset_interrupts(guc);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 6b059d51aaff..36f7a146f06a 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -137,9 +137,14 @@ bool i915_error_injected(void);
#define i915_inject_probe_failure(i915) i915_inject_load_error((i915), -ENODEV)
-#define i915_probe_error(i915, fmt, ...) \
+#define I915_ERROR(i915, fmt, ...) \
__i915_printk(i915, i915_error_injected() ? KERN_DEBUG : KERN_ERR, \
fmt, ##__VA_ARGS__)
+#define I915_WARN(i915, fmt, ...) \
+ __i915_printk(i915, i915_error_injected() ? KERN_DEBUG : KERN_WARNING, \
+ fmt, ##__VA_ARGS__)
+
+#define i915_probe_error(i915, fmt, ...) I915_ERROR(i915, fmt, ##__VA_ARGS__)
struct drm_i915_gem_object;
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 32b4fa5c579c..c437ab5554ec 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1248,7 +1248,7 @@ int i915_gem_init_hw(struct drm_i915_private *i915)
/* We can't enable contexts until all firmware is loaded */
ret = intel_uc_init_hw(&i915->gt.uc);
if (ret) {
- DRM_ERROR("Enabling uc failed (%d)\n", ret);
+ I915_ERROR(i915, "Enabling uc failed (%d)\n", ret);
goto out;
}
--
2.19.2
More information about the Intel-gfx
mailing list