Re: [PATCH v4 2/4] drivers: misc: Add Support for TMR Manager

From: Rao, Appana Durga Kedareswara
Date: Fri Sep 09 2022 - 04:58:01 EST


Hi Greg,

Thanks for the review.

On 09/09/22 2:10 pm, Greg KH wrote:
On Fri, Sep 09, 2022 at 11:49:14AM +0530, Appana Durga Kedareswara rao wrote:
Triple Modular Redundancy(TMR) subsystem contains three microblaze cores,
subsystem is fault-tolerant and continues to operate nominally after
encountering an error. Together with the capability to detect and recover
from errors, the implementation ensures the reliability of the entire
subsystem. TMR Manager is responsible for performing recovery of the
subsystem detects the fault via a break signal it invokes microblaze
software break handler which calls the tmr manager driver api to
update the error count and status, added support for fault detection
feature via sysfs interface.

Usage:
To know the break handler count(Error count):
cat /sys/devices/platform/amba_pl/44a10000.tmr_manager/errcnt

Signed-off-by: Appana Durga Kedareswara rao <appana.durga.kedareswara.rao@xxxxxxx>
---
Changes for v4:
--> None.
Changes for v3:
--> Corrected month in the sysfs-driver-xilinx-tmr-manager file
--> Updated the Kconfig to compile the driver as a module
--> Removed unneeded status sysfs attribute
Changes for v2:
--> Fixed Month in the sysfs description.
--> Fixed line over 80 char in driver.
--> Replaced kstrtol with kstrtoul as suggested by Michal.
--> Added error check for xlnx,magic1 value.

.../testing/sysfs-driver-xilinx-tmr-manager | 16 ++
MAINTAINERS | 7 +
drivers/misc/Kconfig | 10 +
drivers/misc/Makefile | 3 +-
drivers/misc/xilinx_tmr_manager.c | 222 ++++++++++++++++++
5 files changed, 257 insertions(+), 1 deletion(-)
create mode 100644 Documentation/ABI/testing/sysfs-driver-xilinx-tmr-manager
create mode 100644 drivers/misc/xilinx_tmr_manager.c

diff --git a/Documentation/ABI/testing/sysfs-driver-xilinx-tmr-manager b/Documentation/ABI/testing/sysfs-driver-xilinx-tmr-manager
new file mode 100644
index 000000000000..2a97be6ae849
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-driver-xilinx-tmr-manager
@@ -0,0 +1,16 @@
+What: /sys/devices/platform/amba_pl/<dev>/errcnt
+Date: Sep 2022
+Contact: appana.durga.kedareswara.rao@xxxxxxx
+Description: This control file provides the fault detection count.
+ This file cannot be written.
+ Example:
+ # cat /sys/devices/platform/amba_pl/44a10000.tmr_manager/errcnt
+ 1
+
+What: /sys/devices/platform/amba_pl/<dev>/dis_block_break
+Date: Sep 2022
+Contact: appana.durga.kedareswara.rao@xxxxxxx
+Description: Write any value to it, This control file enables the break signal.
+ This file is write only.
+ Example:
+ # echo <any value> > /sys/devices/platform/amba_pl/44a10000.tmr_manager/dis_block_break
diff --git a/MAINTAINERS b/MAINTAINERS
index f1390b8270b2..5fc5ec13985e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -13277,6 +13277,13 @@ W: http://www.monstr.eu/fdt/
T: git git://git.monstr.eu/linux-2.6-microblaze.git
F: arch/microblaze/
+MICROBLAZE TMR MANAGER
+M: Appana Durga Kedareswara rao <appana.durga.kedareswara.rao@xxxxxxx>
+S: Supported
+F: Documentation/ABI/testing/sysfs-driver-xilinx-tmr-manager
+F: Documentation/devicetree/bindings/misc/xlnx,tmr-manager.yaml
+F: drivers/misc/xilinx_tmr_manager.c
+
MICROCHIP AT91 DMA DRIVERS
M: Ludovic Desroches <ludovic.desroches@xxxxxxxxxxxxx>
M: Tudor Ambarus <tudor.ambarus@xxxxxxxxxxxxx>
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 94e9fb4cdd76..1508cc29b05a 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -496,6 +496,16 @@ config VCPU_STALL_DETECTOR
If you do not intend to run this kernel as a guest, say N.
+config TMR_MANAGER
+ tristate "Select TMR Manager"
+ depends on MICROBLAZE && MB_MANAGER
+ help
+ This option enables the driver developed for TMR Manager. The Triple
+ Modular Redundancy(TMR) manager provides support for fault detection
+ via sysfs interface.

What is the module name?

And the fault detection api is in debugfs, not sysfs, right?

Fault injection happens via debugfs in the tmr-inject driver (4/4 patch - xilinx_tmr_inject.c) patch, Fault detection is tracked using tmr manager errcnt sysfs entry (/sys/devices/platform/amba_pl/<dev>/errcnt).
TMR Manager is responsible for performing recovery of the subsystem detects the fault via a break signal it invokes microblaze
software break handler which calls the tmr manager driver api to
update the error count.


Regards,
Kedar.

thanks,

greg k-h