ice: read internal temperature sensor
Subsystems (3)
PATCH v2 1/1 ice: read internal temperature sensor
Since 4.30 firmware exposes internal thermal sensor reading via admin queue commands. Expose those readouts via hwmon API when supported.
Driver provides current reading from HW as well as device specific thresholds for thermal alarm (Warning, Critical, Fatal) events.
$ sensors
Output
=========================================================
ice-pci-b100
Adapter: PCI adapter
temp1: +62.0°C (high = +95.0°C, crit = +105.0°C)
(emerg = +115.0°C)
---
v2: fix formmating issues, added hwmon maintainers to Cc
--- drivers/net/ethernet/intel/ice/Makefile | 1 + drivers/net/ethernet/intel/ice/ice.h | 1 + .../net/ethernet/intel/ice/ice_adminq_cmd.h | 28 ++++ drivers/net/ethernet/intel/ice/ice_common.c | 57 +++++++- drivers/net/ethernet/intel/ice/ice_common.h | 2 + drivers/net/ethernet/intel/ice/ice_hwmon.c | 127 ++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_hwmon.h | 7 + drivers/net/ethernet/intel/ice/ice_main.c | 5 + drivers/net/ethernet/intel/ice/ice_type.h | 4 + 9 files changed, 231 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_hwmon.c create mode 100644 drivers/net/ethernet/intel/ice/ice_hwmon.h
drivers/net/ethernet/intel/ice/Makefile +1 -0
@@ -36,6 +36,7 @@ ice-y := ice_main.o \ ice_repr.o \ ice_tc_lib.o \ ice_fwlog.o \ + ice_hwmon.o \ ice_debugfs.o ice-$(CONFIG_PCI_IOV) += \ ice_sriov.o \
drivers/net/ethernet/intel/ice/ice.h +1 -0
@@ -650,6 +650,7 @@ struct ice_pf {#define ICE_MAX_VF_AGG_NODES 32struct ice_agg_node vf_agg_node[ICE_MAX_VF_AGG_NODES ];struct ice_dplls dplls; +struct device *hwmon_dev; };extern struct workqueue_struct *ice_lag_wq;
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +28 -0
@@ -117,6 +117,7 @@ struct ice_aqc_list_caps_elem {#define ICE_AQC_CAPS_NET_VER 0x004C#define ICE_AQC_CAPS_PENDING_NET_VER 0x004D#define ICE_AQC_CAPS_RDMA 0x0051 +#define ICE_AQC_CAPS_SENSOR_READING 0x0067#define ICE_AQC_CAPS_PCIE_RESET_AVOIDANCE 0x0076#define ICE_AQC_CAPS_POST_UPDATE_RESET_RESTRICT 0x0077#define ICE_AQC_CAPS_NVM_MGMT 0x0080
@@ -1375,6 +1376,30 @@ struct ice_aqc_get_phy_rec_clk_out {__le16 node_handle; }; +/* Get sensor reading (direct 0x0632) */ +struct ice_aqc_get_sensor_reading { +u8 sensor; +u8 format; +u8 reserved[6 ]; +__le32 addr_high; +__le32 addr_low; +}; + +/* Get sensor reading response (direct 0x0632) */ +struct ice_aqc_get_sensor_reading_resp { +union { +u8 raw[8 ]; +/* Output data for sensor 0x00, format 0x00 */ +struct { +s8 temp; +u8 temp_warning_threshold; +u8 temp_critical_threshold; +u8 temp_fatal_threshold; +u8 reserved[4 ]; + } s0f0; + } data; +}; +struct ice_aqc_link_topo_params {u8 lport_num;u8 lport_num_valid;
@@ -2411,6 +2436,8 @@ struct ice_aq_desc {struct ice_aqc_restart_an restart_an;struct ice_aqc_set_phy_rec_clk_out set_phy_rec_clk_out;struct ice_aqc_get_phy_rec_clk_out get_phy_rec_clk_out; +struct ice_aqc_get_sensor_reading get_sensor_reading; +struct ice_aqc_get_sensor_reading_resp get_sensor_reading_resp;struct ice_aqc_gpio read_write_gpio;struct ice_aqc_sff_eeprom read_write_sff_param;struct ice_aqc_set_port_id_led set_port_id_led;
@@ -2585,6 +2612,7 @@ enum ice_adminq_opc { ice_aqc_opc_set_mac_lb =0x0620 , ice_aqc_opc_set_phy_rec_clk_out =0x0630 , ice_aqc_opc_get_phy_rec_clk_out =0x0631 , + ice_aqc_opc_get_sensor_reading =0x0632 , ice_aqc_opc_get_link_topo =0x06E0 , ice_aqc_opc_read_i2c =0x06E2 , ice_aqc_opc_write_i2c = 0x06E3,
drivers/net/ethernet/intel/ice/ice_common.c +56 -1
77 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_common.h +2 -0
@@ -240,6 +240,8 @@ ice_aq_set_phy_rec_clk_out(struct ice_hw *hw, u8 phy_output, bool enable,int ice_aq_get_phy_rec_clk_out (struct ice_hw *hw,u8 *phy_output,u8 *port_num,u8 *flags,u16 *node_handle); +int ice_aq_get_sensor_reading (struct ice_hw *hw,u8 sensor,u8 format, +struct ice_aqc_get_sensor_reading_resp *data);void ice_stat_update40 (struct ice_hw *hw,u32 reg,bool prev_stat_loaded,u64 *prev_stat,u64 *cur_stat);
drivers/net/ethernet/intel/ice/ice_hwmon.c new file +127 -0
127 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_hwmon.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef _ICE_HWMON_H_ +#define _ICE_HWMON_H_ + +void ice_hwmon_init (struct ice_pf *pf); +void ice_hwmon_exit (struct ice_pf *pf); + +#endif /* _ICE_HWMON_H_ */
drivers/net/ethernet/intel/ice/ice_main.c +5 -0
@@ -13,6 +13,7 @@#include "ice_dcb_lib.h" #include "ice_dcb_nl.h" #include "ice_devlink.h" +#include "ice_hwmon.h" /* Including ice_trace.h with CREATE_TRACE_POINTS defined will generate the * ice tracepoint functions. This must be done exactly once across the * ice driver.
@@ -4725,6 +4726,8 @@ static void ice_init_features(struct ice_pf *pf)if (ice_init_lag (pf))dev_warn (dev,"Failed to init link aggregation support\n" ); + +ice_hwmon_init (pf); }static void ice_deinit_features (struct ice_pf *pf)
@@ -5233,6 +5236,8 @@ static void ice_remove(struct pci_dev *pdev)ice_free_vfs (pf); } +ice_hwmon_exit (pf); +ice_service_task_stop (pf);ice_aq_cancel_waiting_tasks (pf);set_bit (ICE_DOWN , pf->state);
drivers/net/ethernet/intel/ice/ice_type.h +4 -0
@@ -377,6 +377,8 @@ struct ice_hw_func_caps {struct ice_ts_func_info ts_func_info; }; +#define ICE_SENSOR_SUPPORT_E810_INT_TEMP_BIT 0 +/* Device wide capabilities */ struct ice_hw_dev_caps {struct ice_hw_common_caps common_cap;
@@ -385,6 +387,8 @@ struct ice_hw_dev_caps {u32 num_flow_director_fltr;/* Number of FD filters available */ struct ice_ts_dev_info ts_dev_info;u32 num_funcs; +/* bitmap of supported sensors */ +u32 supported_sensors; };/* MAC info */
base-commit: b6aed813cbe277cd41af1c898e7b8f9b762a75c0
Signature · 6 lines
2.35.3 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Quoted 22 lines · Konrad Knitter
Since 4.30 firmware exposes internal thermal sensor reading via admin queue commands. Expose those readouts via hwmon API when supported.
Driver provides current reading from HW as well as device specific thresholds for thermal alarm (Warning, Critical, Fatal) events.
$ sensorsOutput
=========================================================
ice-pci-b100
Adapter: PCI adapter
temp1: +62.0°C (high = +95.0°C, crit = +105.0°C)(emerg = +115.0°C)Co-developed-by Marcin Domagala <[email protected]>Signed-off-by Marcin Domagala <[email protected]>Co-developed-by Eric Joyner <[email protected]>Signed-off-by Eric Joyner <[email protected]>Reviewed-by Marcin Szycik <[email protected]>Reviewed-by Przemek Kitszel <[email protected]>Signed-off-by Konrad Knitter <[email protected]>
Quoted 3 lines
---
v2: fix formmating issues, added hwmon maintainers to Cc
---
The new ice_hwmon.c and ice_hwmon.h files lack SPDX identification. Please fix.
Thanks,
Jake
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan