scsi: ufs: core: Make fault injection dynamically configurable per HBA
authorAkinobu Mita <akinobu.mita@gmail.com>
Sat, 18 Nov 2023 12:44:43 +0000 (21:44 +0900)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sat, 25 Nov 2023 00:23:35 +0000 (19:23 -0500)
commit045da3077bc57e587d0ab4cfc8945b76af03d72d
tree46d9e9dbedf2bc031e5fce18706f18f4fc803706
parentedbc78a1b74c3d31dabaf3280bcee0356e744ca9
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>
drivers/ufs/core/ufs-fault-injection.c
drivers/ufs/core/ufs-fault-injection.h
drivers/ufs/core/ufshcd.c
include/ufs/ufshcd.h