Skip to contentSkip to conversation

introduce watchdog driver for Mellanox systems.

PATCH New [email protected] 1 participant 4 messages Feb 6, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover introduce watchdog driver for Mellanox systems.

From: Michael Shych <[email protected]>

This patchset introduces watchdog driver for a various range of Mellanox Ethernet and Infiniband switch systems.
Mellanox watchdog device is implemented in programmable logic device. There are 2 types of HW watchdog implementations with diferent capabilities. This mlx-wdt driver supports both HW watchdog implementations. Mellanox system can have 2 watchdogs: main and auxiliary.
Main and auxiliary watchdog devices can be enabled together on the same system. There are several actions that can be defined in the watchdog:
system reset, start fans on full speed and increase register counter.

Michael Shych (3):
platform_data/mlxreg: addittions for mellanox watchdog driver.
watchdog: mlx-wdt: introduce watchdog driver for Mellanox systems. Documentation/watchdog: Add documentation mlx-wdt driver

 Documentation/watchdog/mlx-wdt.txt   |  48 +++++
 drivers/watchdog/Kconfig             |  16 ++
 drivers/watchdog/Makefile            |   1 +
 drivers/watchdog/mlx_wdt.c           | 406 +++++++++++++++++++++++++++++++++++
 include/linux/platform_data/mlxreg.h |   6 +
 5 files changed, 477 insertions(+)
 create mode 100644 Documentation/watchdog/mlx-wdt.txt
 create mode 100644 drivers/watchdog/mlx_wdt.c
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/3 platform_data/mlxreg: addittions for mellanox watchdog driver.

From: Michael Shych <[email protected]>

There are two new fields added to mlxreg core structure:
features - supported features of device and identity - device identity name.
Add new defines for watchdog features.

---
 include/linux/platform_data/mlxreg.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/linux/platform_data/mlxreg.h +6 -0
index 19f5cb618c55..e6bb0e2d6efc 100644
@@ -35,6 +35,8 @@
 #define __LINUX_PLATFORM_DATA_MLXREG_H
 
 #define MLXREG_CORE_LABEL_MAX_SIZE	32
+#define MLXREG_CORE_WD_FEATURE_NOSTOP_AFTER_START	BIT(0)
+#define MLXREG_CORE_WD_FEATURE_START_AT_BOOT		BIT(1)
 
 /**
  * struct mlxreg_hotplug_device - I2C device data:
@@ -110,11 +112,15 @@ struct mlxreg_core_item {
  * @led_data: led private data;
  * @regmap: register map of parent device;
  * @counter: number of led instances;
+ * @features: supported features of device;
+ * @identity: device identity name;
  */
 struct mlxreg_core_platform_data {
 	struct mlxreg_core_data *data;
 	void *regmap;
 	int counter;
+	u32 features;
+	char identity[MLXREG_CORE_LABEL_MAX_SIZE];
 };
 
 /**
Signature · 1 line
2.11.0
#2 lore raw

PATCH 2/3 watchdog: mlx-wdt: introduce watchdog driver for Mellanox systems.

In reply to [email protected]

From: Michael Shych <[email protected]>

Introduce watchdog driver for variious rang of Mellanox Ethernet and Infiniband switch systems.

Watchdog driver for Mellanox watchdog devices, implemented in programmable logic device.

Main and auxiliary watchdog devices can exist on the same system. There are several actions that can be defined in the watchdog:
system reset, start fans on full speed and increase a counter. The last 2 actions are performed without a system reset. Actions without reset are provided for auxiliary watchdog devices, which is optional.
Access to HW registers is performed through generic regmap interface.

There are 2 types of HW watchdog implementations.
Type 1: actual HW timeout can be defined as power of 2 msec. e.g. timeout 20 sec will be rounded up to 32768 msec.; maximum timeout period is 32 sec (32768 msec.);
get time-left isn't supported
Type 2: actual HW timeout is defined in sec. and it's the same as user-defined timeout;
maximum timeout is 255 sec;
get time-left is supported;

Watchdog driver is probed from the common mlx_platform driver.

---
 drivers/watchdog/Kconfig   |  16 ++
 drivers/watchdog/Makefile  |   1 +
 drivers/watchdog/mlx_wdt.c | 406 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 423 insertions(+)
 create mode 100644 drivers/watchdog/mlx_wdt.c
drivers/watchdog/Kconfig +16 -0
index 57f017d74a97..f1766eb081bb 100644
@@ -241,6 +241,22 @@ config RAVE_SP_WATCHDOG
 	help
 	  Support for the watchdog on RAVE SP device.
 
+config MLX_WDT
+	tristate "Mellanox Watchdog"
+	depends on MELLANOX_PLATFORM
+	select WATCHDOG_CORE
+	select REGMAP
+	help
+	  This is the driver for the hardware watchdog on Mellanox systems.
+	  If you are going to use it, say Y here, otherwise N.
+	  This driver can be used together with the watchdog daemon.
+	  It can also watch your kernel to make sure it doesn't freeze,
+	  and if it does, it reboots your system after a certain amount of
+	  time.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called mlx-wdt.
+
 # ALPHA Architecture
 
 # ARM Architecture
drivers/watchdog/Makefile +1 -0
index a0917ef28e07..941b74185c9c 100644
@@ -142,6 +142,7 @@ obj-$(CONFIG_INTEL_MID_WATCHDOG) += intel-mid_wdt.o
 obj-$(CONFIG_INTEL_MEI_WDT) += mei_wdt.o
 obj-$(CONFIG_NI903X_WDT) += ni903x_wdt.o
 obj-$(CONFIG_NIC7018_WDT) += nic7018_wdt.o
+obj-$(CONFIG_MLX_WDT) += mlx_wdt.o
 
 # M68K Architecture
 obj-$(CONFIG_M54xx_WATCHDOG) += m54xx_wdt.o
drivers/watchdog/mlx_wdt.c new file +406 -0

406 lines not on this page · raw message

Signature · 1 line
2.11.0
#3 lore raw

PATCH 3/3 Documentation/watchdog: Add documentation mlx-wdt driver

In reply to [email protected]

From: Michael Shych <[email protected]>

Add documentation with details of mellanox watchdog driver.

---
 Documentation/watchdog/mlx-wdt.txt | 48 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 Documentation/watchdog/mlx-wdt.txt
Documentation/watchdog/mlx-wdt.txt new file +48 -0
new file mode 100644
index 000000000000..13123acc4195
@@ -0,0 +1,48 @@
+		Mellanox watchdog drivers
+		for x86 based system switches
+
+This driver provides watchdog functionality for various Mellanox
+Ethernet and Infiniband switch systems.
+
+Mellanox watchdog device is implemented in a programmable logic device.
+
+There are 2 types of HW watchdog implementations.
+
+Type 1:
+Actual HW timeout can be defined as a power of 2 msec.
+e.g. timeout 20 sec will be rounded up to 32768 msec.
+The maximum timeout period is 32 sec (32768 msec.),
+Get time-left isn't supported
+
+Type 2:
+Actual HW timeout is defined in sec. and it's the same as 
+a user-defined timeout.
+Maximum timeout is 255 sec.
+Get time-left is supported.
+
+Type 1 HW watchdog implementation exist in old systems and 
+all new systems have type 2 HW watchdog.
+Two types of HW implementation have also different register map.
+
+Mellanox system can have 2 watchdogs: main and auxiliary.
+Main and auxiliary watchdog devices can be enabled together 
+on the same system.
+There are several actions that can be defined in the watchdog:
+system reset, start fans on full speed and increase register counter.
+The last 2 actions are performed without a system reset.
+Actions without reset are provided for auxiliary watchdog device,
+which is optional.
+
+This mlx-wdt driver supports both HW watchdog implementations.
+
+Watchdog driver is probed from the common mlx_platform driver.
+Mlx_platform driver provides an appropriate set of registers for
+Mellanox watchdog device, identity name (mlx-wdt-main or mlx-wdt-aux),
+initial timeout, performed action in expiration and configuration flags.
+watchdog configuration flags: nostop_after_start i.e. nowayout and
+start_at_boot.
+The driver reports if watchdog set timeout is rounded in type1 HW watchdog.
+The driver checks during initialization if the previous system reset 
+was done by the watchdog. If yes, it makes a notification about this event.
+
+Access to HW registers is performed through a generic regmap interface.
Signature · 1 line
2.11.0