linux/drivers/ufs/core/ufs-fault-injection.h
Akinobu Mita 045da3077b scsi: ufs: core: Make fault injection dynamically configurable per HBA
The UFS driver has two driver-specific fault injection mechanisms
(trigger_eh and timeout). Each fault injection configuration can only be
specified by a module parameter and cannot be reconfigured without
reloading the driver. Also, each configuration is common to all HBAs.

This change adds the following subdirectories for each UFS HBA when
debugfs is enabled:

  /sys/kernel/debug/ufshcd/<HBA>/timeout_inject
  /sys/kernel/debug/ufshcd/<HBA>/trigger_eh_inject

Each fault injection attribute can be dynamically set per HBA by a
corresponding file in these directories.

This is tested with QEMU UFS devices.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Link: https://lore.kernel.org/r/20231118124443.1007116-1-akinobu.mita@gmail.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-11-24 19:23:35 -05:00

30 lines
612 B
C

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _UFS_FAULT_INJECTION_H
#define _UFS_FAULT_INJECTION_H
#include <linux/kconfig.h>
#include <linux/types.h>
#ifdef CONFIG_SCSI_UFS_FAULT_INJECTION
void ufs_fault_inject_hba_init(struct ufs_hba *hba);
bool ufs_trigger_eh(struct ufs_hba *hba);
bool ufs_fail_completion(struct ufs_hba *hba);
#else
static inline void ufs_fault_inject_hba_init(struct ufs_hba *hba)
{
}
static inline bool ufs_trigger_eh(struct ufs_hba *hba)
{
return false;
}
static inline bool ufs_fail_completion(struct ufs_hba *hba)
{
return false;
}
#endif
#endif /* _UFS_FAULT_INJECTION_H */