drm/xe: clean up fault injection usage

With the proper stubs in place in linux/fault-inject.h, we can remove a
bunch of conditional compilation for CONFIG_FAULT_INJECTION=n.

Link: https://lkml.kernel.org/r/20240813121237.2382534-3-jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Cc: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
Jani Nikula 2024-08-13 15:12:37 +03:00 committed by Andrew Morton
parent f161cdd91b
commit ccbfd2df30
2 changed files with 3 additions and 14 deletions

View File

@ -6,6 +6,7 @@
#include "xe_debugfs.h" #include "xe_debugfs.h"
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/fault-inject.h>
#include <linux/string_helpers.h> #include <linux/string_helpers.h>
#include <drm/drm_debugfs.h> #include <drm/drm_debugfs.h>
@ -26,10 +27,7 @@
#include "xe_vm.h" #include "xe_vm.h"
#endif #endif
#ifdef CONFIG_FAULT_INJECTION
#include <linux/fault-inject.h> /* XXX: fault-inject.h is broken */
DECLARE_FAULT_ATTR(gt_reset_failure); DECLARE_FAULT_ATTR(gt_reset_failure);
#endif
static struct xe_device *node_to_xe(struct drm_info_node *node) static struct xe_device *node_to_xe(struct drm_info_node *node)
{ {
@ -214,8 +212,5 @@ void xe_debugfs_register(struct xe_device *xe)
for_each_gt(gt, xe, id) for_each_gt(gt, xe, id)
xe_gt_debugfs_register(gt); xe_gt_debugfs_register(gt);
#ifdef CONFIG_FAULT_INJECTION
fault_create_debugfs_attr("fail_gt_reset", root, &gt_reset_failure); fault_create_debugfs_attr("fail_gt_reset", root, &gt_reset_failure);
#endif
} }

View File

@ -6,6 +6,8 @@
#ifndef _XE_GT_H_ #ifndef _XE_GT_H_
#define _XE_GT_H_ #define _XE_GT_H_
#include <linux/fault-inject.h>
#include <drm/drm_util.h> #include <drm/drm_util.h>
#include "xe_device.h" #include "xe_device.h"
@ -19,19 +21,11 @@
#define CCS_MASK(gt) (((gt)->info.engine_mask & XE_HW_ENGINE_CCS_MASK) >> XE_HW_ENGINE_CCS0) #define CCS_MASK(gt) (((gt)->info.engine_mask & XE_HW_ENGINE_CCS_MASK) >> XE_HW_ENGINE_CCS0)
#ifdef CONFIG_FAULT_INJECTION
#include <linux/fault-inject.h> /* XXX: fault-inject.h is broken */
extern struct fault_attr gt_reset_failure; extern struct fault_attr gt_reset_failure;
static inline bool xe_fault_inject_gt_reset(void) static inline bool xe_fault_inject_gt_reset(void)
{ {
return should_fail(&gt_reset_failure, 1); return should_fail(&gt_reset_failure, 1);
} }
#else
static inline bool xe_fault_inject_gt_reset(void)
{
return false;
}
#endif
struct xe_gt *xe_gt_alloc(struct xe_tile *tile); struct xe_gt *xe_gt_alloc(struct xe_tile *tile);
int xe_gt_init_hwconfig(struct xe_gt *gt); int xe_gt_init_hwconfig(struct xe_gt *gt);