Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 May 2019 17:13:22 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r347800 - in stable/11/sys/dev/mlx5: . mlx5_core
Message-ID:  <201905161713.x4GHDMld098546@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Thu May 16 17:13:21 2019
New Revision: 347800
URL: https://svnweb.freebsd.org/changeset/base/347800

Log:
  MFC r347250:
  Add temperature warning event to log in mlx5core.
  
  Temperature warning event is sent by FW to indicate high temperature
  as detected by one of the sensors on the board.
  Add handling of this event by writing the numbers of the alert sensors
  to the kernel log.
  
  Linux commit:
  1865ea9adbfaf341c5cd5d8f7d384f19948b2fe9
  
  Submitted by:	slavash@
  Sponsored by:	Mellanox Technologies

Modified:
  stable/11/sys/dev/mlx5/device.h
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c
  stable/11/sys/dev/mlx5/mlx5_ifc.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mlx5/device.h
==============================================================================
--- stable/11/sys/dev/mlx5/device.h	Thu May 16 17:12:38 2019	(r347799)
+++ stable/11/sys/dev/mlx5/device.h	Thu May 16 17:13:21 2019	(r347800)
@@ -566,6 +566,11 @@ struct mlx5_eqe_general_notification_event {
 	u32       rsvd0[6];
 };
 
+struct mlx5_eqe_temp_warning {
+	__be64 sensor_warning_msb;
+	__be64 sensor_warning_lsb;
+} __packed;
+
 union ev_data {
 	__be32				raw[7];
 	struct mlx5_eqe_cmd		cmd;
@@ -580,6 +585,7 @@ union ev_data {
 	struct mlx5_eqe_port_module_event port_module_event;
 	struct mlx5_eqe_vport_change	vport_change;
 	struct mlx5_eqe_general_notification_event general_notifications;
+	struct mlx5_eqe_temp_warning	temp_warning;
 } __packed;
 
 struct mlx5_eqe {

Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c	Thu May 16 17:12:38 2019	(r347799)
+++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c	Thu May 16 17:13:21 2019	(r347800)
@@ -142,6 +142,8 @@ static const char *eqe_type_str(u8 type)
 		return "MLX5_EVENT_TYPE_GPIO_EVENT";
 	case MLX5_EVENT_TYPE_CODING_PORT_MODULE_EVENT:
 		return "MLX5_EVENT_TYPE_PORT_MODULE_EVENT";
+	case MLX5_EVENT_TYPE_TEMP_WARN_EVENT:
+		return "MLX5_EVENT_TYPE_TEMP_WARN_EVENT";
 	case MLX5_EVENT_TYPE_REMOTE_CONFIG:
 		return "MLX5_EVENT_TYPE_REMOTE_CONFIG";
 	case MLX5_EVENT_TYPE_DB_BF_CONGESTION:
@@ -212,6 +214,16 @@ static void eq_update_ci(struct mlx5_eq *eq, int arm)
 	mb();
 }
 
+static void
+mlx5_temp_warning_event(struct mlx5_core_dev *dev, struct mlx5_eqe *eqe)
+{
+
+	mlx5_core_warn(dev,
+	    "High temperature on sensors with bit set %#jx %#jx",
+	    (uintmax_t)be64_to_cpu(eqe->data.temp_warning.sensor_warning_msb),
+	    (uintmax_t)be64_to_cpu(eqe->data.temp_warning.sensor_warning_lsb));
+}
+
 static int mlx5_eq_int(struct mlx5_core_dev *dev, struct mlx5_eq *eq)
 {
 	struct mlx5_eqe *eqe;
@@ -347,6 +359,9 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, stru
 		case MLX5_EVENT_TYPE_FPGA_QP_ERROR:
 			mlx5_fpga_event(dev, eqe->type, &eqe->data.raw);
 			break;
+		case MLX5_EVENT_TYPE_TEMP_WARN_EVENT:
+			mlx5_temp_warning_event(dev, eqe);
+			break;
 
 		default:
 			mlx5_core_warn(dev, "Unhandled event 0x%x on EQ 0x%x\n",
@@ -540,6 +555,9 @@ int mlx5_start_eqs(struct mlx5_core_dev *dev)
 	if (MLX5_CAP_GEN(dev, fpga))
 		async_event_mask |= (1ull << MLX5_EVENT_TYPE_FPGA_ERROR) |
 				    (1ull << MLX5_EVENT_TYPE_FPGA_QP_ERROR);
+
+	if (MLX5_CAP_GEN(dev, temp_warn_event))
+		async_event_mask |= (1ull << MLX5_EVENT_TYPE_TEMP_WARN_EVENT);
 
 	err = mlx5_create_map_eq(dev, &table->cmd_eq, MLX5_EQ_VEC_CMD,
 				 MLX5_NUM_CMD_EQE, 1ull << MLX5_EVENT_TYPE_CMD,

Modified: stable/11/sys/dev/mlx5/mlx5_ifc.h
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_ifc.h	Thu May 16 17:12:38 2019	(r347799)
+++ stable/11/sys/dev/mlx5/mlx5_ifc.h	Thu May 16 17:13:21 2019	(r347800)
@@ -50,7 +50,7 @@ enum {
 	MLX5_EVENT_TYPE_PORT_CHANGE                                = 0x9,
 	MLX5_EVENT_TYPE_GPIO_EVENT                                 = 0x15,
 	MLX5_EVENT_TYPE_CODING_PORT_MODULE_EVENT                   = 0x16,
-	MLX5_EVENT_TYPE_CODING_TEMP_WARNING_EVENT                  = 0x17,
+	MLX5_EVENT_TYPE_TEMP_WARN_EVENT                            = 0x17,
 	MLX5_EVENT_TYPE_REMOTE_CONFIG                              = 0x19,
 	MLX5_EVENT_TYPE_CODING_DCBX_CHANGE_EVENT                   = 0x1e,
 	MLX5_EVENT_TYPE_CODING_PPS_EVENT                           = 0x25,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905161713.x4GHDMld098546>