mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-21 18:14:48 +08:00
drm/i915: Add i915 to i915_inject_probe_failure
With i915 added to i915_inject_probe_failure we can use dedicated printk when injecting artificial load failure. Also make this function look like other i915 functions that return error code and make it more flexible to return any provided error code instead of previously assumed -ENODEV. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> 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/20190802184055.31988-2-michal.wajdeczko@intel.com
This commit is contained in:
parent
cd2a4eaf8c
commit
50d84418f5
@ -118,7 +118,7 @@ int intel_connector_register(struct drm_connector *connector)
|
|||||||
if (ret)
|
if (ret)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
if (i915_inject_probe_failure()) {
|
if (i915_inject_probe_failure(to_i915(connector->dev))) {
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
goto err_backlight;
|
goto err_backlight;
|
||||||
}
|
}
|
||||||
|
@ -426,7 +426,7 @@ int intel_engines_init_mmio(struct drm_i915_private *i915)
|
|||||||
WARN_ON(engine_mask &
|
WARN_ON(engine_mask &
|
||||||
GENMASK(BITS_PER_TYPE(mask) - 1, I915_NUM_ENGINES));
|
GENMASK(BITS_PER_TYPE(mask) - 1, I915_NUM_ENGINES));
|
||||||
|
|
||||||
if (i915_inject_probe_failure())
|
if (i915_inject_probe_failure(i915))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(intel_engines); i++) {
|
for (i = 0; i < ARRAY_SIZE(intel_engines); i++) {
|
||||||
|
@ -83,19 +83,20 @@ static struct drm_driver driver;
|
|||||||
#if IS_ENABLED(CONFIG_DRM_I915_DEBUG)
|
#if IS_ENABLED(CONFIG_DRM_I915_DEBUG)
|
||||||
static unsigned int i915_probe_fail_count;
|
static unsigned int i915_probe_fail_count;
|
||||||
|
|
||||||
bool __i915_inject_probe_failure(const char *func, int line)
|
int __i915_inject_load_error(struct drm_i915_private *i915, int err,
|
||||||
|
const char *func, int line)
|
||||||
{
|
{
|
||||||
if (i915_probe_fail_count >= i915_modparams.inject_load_failure)
|
if (i915_probe_fail_count >= i915_modparams.inject_load_failure)
|
||||||
return false;
|
return 0;
|
||||||
|
|
||||||
if (++i915_probe_fail_count == i915_modparams.inject_load_failure) {
|
if (++i915_probe_fail_count < i915_modparams.inject_load_failure)
|
||||||
DRM_INFO("Injecting failure at checkpoint %u [%s:%d]\n",
|
return 0;
|
||||||
i915_modparams.inject_load_failure, func, line);
|
|
||||||
|
__i915_printk(i915, KERN_INFO,
|
||||||
|
"Injecting failure %d at checkpoint %u [%s:%d]\n",
|
||||||
|
err, i915_modparams.inject_load_failure, func, line);
|
||||||
i915_modparams.inject_load_failure = 0;
|
i915_modparams.inject_load_failure = 0;
|
||||||
return true;
|
return err;
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool i915_error_injected(void)
|
bool i915_error_injected(void)
|
||||||
@ -687,7 +688,7 @@ static int i915_driver_modeset_probe(struct drm_device *dev)
|
|||||||
struct pci_dev *pdev = dev_priv->drm.pdev;
|
struct pci_dev *pdev = dev_priv->drm.pdev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (i915_inject_probe_failure())
|
if (i915_inject_probe_failure(dev_priv))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
if (HAS_DISPLAY(dev_priv)) {
|
if (HAS_DISPLAY(dev_priv)) {
|
||||||
@ -894,7 +895,7 @@ static int i915_driver_early_probe(struct drm_i915_private *dev_priv)
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (i915_inject_probe_failure())
|
if (i915_inject_probe_failure(dev_priv))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
intel_device_info_subplatform_init(dev_priv);
|
intel_device_info_subplatform_init(dev_priv);
|
||||||
@ -985,7 +986,7 @@ static int i915_driver_mmio_probe(struct drm_i915_private *dev_priv)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (i915_inject_probe_failure())
|
if (i915_inject_probe_failure(dev_priv))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
if (i915_get_bridge_dev(dev_priv))
|
if (i915_get_bridge_dev(dev_priv))
|
||||||
@ -1530,7 +1531,7 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
|
|||||||
struct pci_dev *pdev = dev_priv->drm.pdev;
|
struct pci_dev *pdev = dev_priv->drm.pdev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (i915_inject_probe_failure())
|
if (i915_inject_probe_failure(dev_priv))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
intel_device_info_runtime_init(dev_priv);
|
intel_device_info_runtime_init(dev_priv);
|
||||||
|
@ -122,19 +122,21 @@
|
|||||||
|
|
||||||
#if IS_ENABLED(CONFIG_DRM_I915_DEBUG)
|
#if IS_ENABLED(CONFIG_DRM_I915_DEBUG)
|
||||||
|
|
||||||
bool __i915_inject_probe_failure(const char *func, int line);
|
int __i915_inject_load_error(struct drm_i915_private *i915, int err,
|
||||||
#define i915_inject_probe_failure() \
|
const char *func, int line);
|
||||||
__i915_inject_probe_failure(__func__, __LINE__)
|
#define i915_inject_load_error(_i915, _err) \
|
||||||
|
__i915_inject_load_error((_i915), (_err), __func__, __LINE__)
|
||||||
bool i915_error_injected(void);
|
bool i915_error_injected(void);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define i915_inject_probe_failure() false
|
#define i915_inject_load_error(_i915, _err) 0
|
||||||
#define i915_error_injected() false
|
#define i915_error_injected() false
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define i915_inject_probe_failure(i915) i915_inject_load_error((i915), -ENODEV)
|
||||||
|
|
||||||
#define i915_probe_error(i915, fmt, ...) \
|
#define i915_probe_error(i915, fmt, ...) \
|
||||||
__i915_printk(i915, i915_error_injected() ? KERN_DEBUG : KERN_ERR, \
|
__i915_printk(i915, i915_error_injected() ? KERN_DEBUG : KERN_ERR, \
|
||||||
fmt, ##__VA_ARGS__)
|
fmt, ##__VA_ARGS__)
|
||||||
|
@ -1520,15 +1520,13 @@ int i915_gem_init(struct drm_i915_private *dev_priv)
|
|||||||
if (ret)
|
if (ret)
|
||||||
goto err_gt;
|
goto err_gt;
|
||||||
|
|
||||||
if (i915_inject_probe_failure()) {
|
ret = i915_inject_load_error(dev_priv, -ENODEV);
|
||||||
ret = -ENODEV;
|
if (ret)
|
||||||
goto err_gt;
|
goto err_gt;
|
||||||
}
|
|
||||||
|
|
||||||
if (i915_inject_probe_failure()) {
|
ret = i915_inject_load_error(dev_priv, -EIO);
|
||||||
ret = -EIO;
|
if (ret)
|
||||||
goto err_gt;
|
goto err_gt;
|
||||||
}
|
|
||||||
|
|
||||||
intel_uncore_forcewake_put(&dev_priv->uncore, FORCEWAKE_ALL);
|
intel_uncore_forcewake_put(&dev_priv->uncore, FORCEWAKE_ALL);
|
||||||
mutex_unlock(&dev_priv->drm.struct_mutex);
|
mutex_unlock(&dev_priv->drm.struct_mutex);
|
||||||
|
@ -959,7 +959,7 @@ static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (i915_inject_probe_failure()) {
|
if (i915_inject_probe_failure(to_i915(pci_get_drvdata(pdev)))) {
|
||||||
i915_pci_remove(pdev);
|
i915_pci_remove(pdev);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ int intel_gvt_init(struct drm_i915_private *dev_priv)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (i915_inject_probe_failure())
|
if (i915_inject_probe_failure(dev_priv))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
if (!i915_modparams.enable_gvt) {
|
if (!i915_modparams.enable_gvt) {
|
||||||
|
@ -1331,7 +1331,7 @@ static int __fw_domain_init(struct intel_uncore *uncore,
|
|||||||
GEM_BUG_ON(domain_id >= FW_DOMAIN_ID_COUNT);
|
GEM_BUG_ON(domain_id >= FW_DOMAIN_ID_COUNT);
|
||||||
GEM_BUG_ON(uncore->fw_domain[domain_id]);
|
GEM_BUG_ON(uncore->fw_domain[domain_id]);
|
||||||
|
|
||||||
if (i915_inject_probe_failure())
|
if (i915_inject_probe_failure(uncore->i915))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
d = kzalloc(sizeof(*d), GFP_KERNEL);
|
d = kzalloc(sizeof(*d), GFP_KERNEL);
|
||||||
|
@ -177,7 +177,7 @@ int intel_wopcm_init(struct intel_wopcm *wopcm)
|
|||||||
|
|
||||||
GEM_BUG_ON(!wopcm->size);
|
GEM_BUG_ON(!wopcm->size);
|
||||||
|
|
||||||
if (i915_inject_probe_failure())
|
if (i915_inject_probe_failure(i915))
|
||||||
return -E2BIG;
|
return -E2BIG;
|
||||||
|
|
||||||
if (guc_fw_size >= wopcm->size) {
|
if (guc_fw_size >= wopcm->size) {
|
||||||
|
Loading…
Reference in New Issue
Block a user