Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 May 2019 15:43:34 +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-12@freebsd.org
Subject:   svn commit: r347714 - in stable/12/sys/dev/mlx5: . mlx5_core
Message-ID:  <201905161543.x4GFhYUb045992@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Thu May 16 15:43:34 2019
New Revision: 347714
URL: https://svnweb.freebsd.org/changeset/base/347714

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/12/sys/dev/mlx5/device.h
  stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c
  stable/12/sys/dev/mlx5/mlx5_ifc.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/mlx5/device.h
==============================================================================
--- stable/12/sys/dev/mlx5/device.h	Thu May 16 15:42:47 2019	(r347713)
+++ stable/12/sys/dev/mlx5/device.h	Thu May 16 15:43:34 2019	(r347714)
@@ -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/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c
==============================================================================
--- stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c	Thu May 16 15:42:47 2019	(r347713)
+++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c	Thu May 16 15:43:34 2019	(r347714)
@@ -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/12/sys/dev/mlx5/mlx5_ifc.h
==============================================================================
--- stable/12/sys/dev/mlx5/mlx5_ifc.h	Thu May 16 15:42:47 2019	(r347713)
+++ stable/12/sys/dev/mlx5/mlx5_ifc.h	Thu May 16 15:43:34 2019	(r347714)
@@ -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?201905161543.x4GFhYUb045992>