[Intel-gfx] [PATCH] drm/i915: Add fault injection support
Imre Deak
imre.deak at intel.com
Fri Mar 11 23:15:06 UTC 2016
Add support for forcing an error at selected places in the driver. As an
example add 3 options to fail during driver loading.
Requested by Chris.
CC: Chris Wilson <chris at chris-wilson.co.uk>
Signed-off-by: Imre Deak <imre.deak at intel.com>
---
[This depends on
https://lists.freedesktop.org/archives/intel-gfx/2016-March/089597.html]
drivers/gpu/drm/i915/i915_dma.c | 9 +++++++++
drivers/gpu/drm/i915/i915_drv.h | 4 ++++
drivers/gpu/drm/i915/i915_params.c | 6 ++++++
drivers/gpu/drm/i915/i915_params.h | 1 +
4 files changed, 20 insertions(+)
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index b1dbf1b..d12ae0b 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -950,6 +950,9 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,
struct intel_device_info *device_info;
int ret = 0;
+ if (i915.inject_fault & I915_FAULT_INIT_EARLY)
+ return -ENODEV;
+
dev_priv->dev = dev;
/* Setup the write-once "constant" device info */
@@ -1064,6 +1067,9 @@ static int i915_driver_init_mmio(struct drm_i915_private *dev_priv)
struct drm_device *dev = dev_priv->dev;
int ret;
+ if (i915.inject_fault & I915_FAULT_INIT_MMIO)
+ return -ENODEV;
+
if (i915_get_bridge_dev(dev))
return -EIO;
@@ -1107,6 +1113,9 @@ static int i915_driver_init_hw(struct drm_i915_private *dev_priv)
uint32_t aperture_size;
int ret;
+ if (i915.inject_fault & I915_FAULT_INIT_HW)
+ return -ENODEV;
+
intel_device_info_runtime_init(dev);
ret = i915_gem_gtt_init(dev);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index f62b6d1..5122ed9 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -98,6 +98,10 @@
#define I915_STATE_WARN_ON(x) \
I915_STATE_WARN((x), "%s", "WARN_ON(" __stringify(x) ")")
+#define I915_FAULT_INIT_EARLY 0x0001
+#define I915_FAULT_INIT_MMIO 0x0002
+#define I915_FAULT_INIT_HW 0x0004
+
static inline const char *yesno(bool v)
{
return v ? "yes" : "no";
diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
index 278c9c4..21f8dd3 100644
--- a/drivers/gpu/drm/i915/i915_params.c
+++ b/drivers/gpu/drm/i915/i915_params.c
@@ -56,6 +56,7 @@ struct i915_params i915 __read_mostly = {
.edp_vswing = 0,
.enable_guc_submission = false,
.guc_log_level = -1,
+ .inject_fault = 0,
};
module_param_named(modeset, i915.modeset, int, 0400);
@@ -201,3 +202,8 @@ MODULE_PARM_DESC(enable_guc_submission, "Enable GuC submission (default:false)")
module_param_named(guc_log_level, i915.guc_log_level, int, 0400);
MODULE_PARM_DESC(guc_log_level,
"GuC firmware logging level (-1:disabled (default), 0-3:enabled)");
+
+module_param_named(inject_fault, i915.inject_fault, uint, 0600);
+MODULE_PARM_DESC(inject_fault,
+ "Force an error at selected points "
+ "(0:disabled, 0x1:INIT_EARLY, 0x2:INIT_MMIO, 0x4:INIT_HW)");
diff --git a/drivers/gpu/drm/i915/i915_params.h b/drivers/gpu/drm/i915/i915_params.h
index bd5026b..2989a48 100644
--- a/drivers/gpu/drm/i915/i915_params.h
+++ b/drivers/gpu/drm/i915/i915_params.h
@@ -59,6 +59,7 @@ struct i915_params {
bool enable_guc_submission;
bool verbose_state_checks;
bool nuclear_pageflip;
+ unsigned int inject_fault;
};
extern struct i915_params i915 __read_mostly;
--
2.5.0
More information about the Intel-gfx
mailing list