diff --git a/packages/kernel/linux/package.mk b/packages/kernel/linux/package.mk index a224ac3d1..8507ddaca 100644 --- a/packages/kernel/linux/package.mk +++ b/packages/kernel/linux/package.mk @@ -4,7 +4,7 @@ PKG_NAME="linux" PKG_LICENSE="GPL" -PKG_VERSION="6.1" +PKG_VERSION="6.1.2" PKG_URL="https://www.kernel.org/pub/linux/kernel/v6.x/${PKG_NAME}-${PKG_VERSION}.tar.xz" PKG_SITE="http://www.kernel.org" PKG_DEPENDS_HOST="ccache:host rsync:host openssl:host" diff --git a/packages/kernel/linux/patches/X86_64/001-hwsensors.patch b/packages/kernel/linux/patches/X86_64/001-hwsensors.patch index 46ec6da73..c361271f4 100644 --- a/packages/kernel/linux/patches/X86_64/001-hwsensors.patch +++ b/packages/kernel/linux/patches/X86_64/001-hwsensors.patch @@ -1,24 +1,1092 @@ -From 415519ad6966ce35f2535fc3ff95549414beb032 Mon Sep 17 00:00:00 2001 -From: Colin Ian King -Date: Wed, 5 Oct 2022 16:27:52 +0100 -Subject: hwmon: (fschmd) Make const arrays static const - -Don't populate the read-only const arrays names and watchdog_minors -on the stack but instead make them static const. Also makes the -object code a little smaller. - -Signed-off-by: Colin Ian King -Link: https://lore.kernel.org/r/20221005152752.318493-1-colin.i.king@gmail.com -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/fschmd.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c -index 0a77d61619288..e1f426e86f36c 100644 ---- a/drivers/hwmon/fschmd.c -+++ b/drivers/hwmon/fschmd.c -@@ -1083,9 +1083,9 @@ static int fschmd_detect(struct i2c_client *client, +diff -rupN linux-6.1.2.orig/Documentation/hwmon/aquacomputer_d5next.rst linux-6.1.2/Documentation/hwmon/aquacomputer_d5next.rst +--- linux-6.1.2.orig/Documentation/hwmon/aquacomputer_d5next.rst 2022-12-31 16:12:05.774603120 -0500 ++++ linux-6.1.2/Documentation/hwmon/aquacomputer_d5next.rst 2022-12-31 16:19:55.381168081 -0500 +@@ -39,7 +39,7 @@ current. + + The Quadro exposes four physical and sixteen virtual temperature sensors, a flow + sensor and four PWM controllable fans, along with their speed (in RPM), power, +-voltage and current. ++voltage and current. Flow sensor pulses are also available. + + The Farbwerk and Farbwerk 360 expose four temperature sensors. Additionally, + sixteen virtual temperature sensors of the Farbwerk 360 are exposed. +@@ -62,7 +62,9 @@ Sysfs entries + + ================ ============================================================== + temp[1-20]_input Physical/virtual temperature sensors (in millidegrees Celsius) ++temp[1-4]_offset Temperature sensor correction offset (in millidegrees Celsius) + fan[1-8]_input Pump/fan speed (in RPM) / Flow speed (in dL/h) ++fan5_pulses Quadro flow sensor pulses + power[1-8]_input Pump/fan power (in micro Watts) + in[0-7]_input Pump/fan voltage (in milli Volts) + curr[1-8]_input Pump/fan current (in milli Amperes) +diff -rupN linux-6.1.2.orig/Documentation/hwmon/index.rst linux-6.1.2/Documentation/hwmon/index.rst +--- linux-6.1.2.orig/Documentation/hwmon/index.rst 2022-12-31 16:12:05.774603120 -0500 ++++ linux-6.1.2/Documentation/hwmon/index.rst 2022-12-31 16:19:53.949181008 -0500 +@@ -160,6 +160,7 @@ Hardware Monitoring Kernel Drivers + nzxt-kraken2 + nzxt-smart2 + occ ++ oxp-sensors + pc87360 + pc87427 + pcf8591 +@@ -187,6 +188,7 @@ Hardware Monitoring Kernel Drivers + sis5595 + sl28cpld + smm665 ++ smpro-hwmon + smsc47b397 + smsc47m192 + smsc47m1 +diff -rupN linux-6.1.2.orig/Documentation/hwmon/oxp-sensors.rst linux-6.1.2/Documentation/hwmon/oxp-sensors.rst +--- linux-6.1.2.orig/Documentation/hwmon/oxp-sensors.rst 1969-12-31 19:00:00.000000000 -0500 ++++ linux-6.1.2/Documentation/hwmon/oxp-sensors.rst 2022-12-31 16:19:55.381168081 -0500 +@@ -0,0 +1,44 @@ ++.. SPDX-License-Identifier: GPL-2.0-or-later ++ ++Kernel driver oxp-sensors ++========================= ++ ++Author: ++ - Joaquín Ignacio Aramendía ++ ++Description: ++------------ ++ ++One X Player devices from One Netbook provide fan readings and fan control ++through its Embedded Controller. ++ ++Currently only supports AMD boards from the One X Player and AOK ZOE lineup. ++Intel boards could be supported if we could figure out the EC registers and ++values to write to since the EC layout and model is different. ++ ++Supported devices ++----------------- ++ ++Currently the driver supports the following handhelds: ++ ++ - AOK ZOE A1 ++ - OneXPlayer AMD ++ - OneXPlayer mini AMD ++ - OneXPlayer mini AMD PRO ++ ++Sysfs entries ++------------- ++ ++The following attributes are supported: ++ ++fan1_input ++ Read Only. Reads current fan RMP. ++ ++pwm1_enable ++ Read Write. Enable manual fan control. Write "1" to set to manual, write "0" ++ to let the EC control de fan speed. Read this attribute to see current status. ++ ++pwm1 ++ Read Write. Read this attribute to see current duty cycle in the range [0-255]. ++ When pwm1_enable is set to "1" (manual) write any value in the range [0-255] ++ to set fan speed. +diff -rupN linux-6.1.2.orig/Documentation/hwmon/smpro-hwmon.rst linux-6.1.2/Documentation/hwmon/smpro-hwmon.rst +--- linux-6.1.2.orig/Documentation/hwmon/smpro-hwmon.rst 1969-12-31 19:00:00.000000000 -0500 ++++ linux-6.1.2/Documentation/hwmon/smpro-hwmon.rst 2022-12-31 16:19:53.945181044 -0500 +@@ -0,0 +1,102 @@ ++.. SPDX-License-Identifier: GPL-2.0-only ++ ++Kernel driver Ampere(R)'s Altra(R) SMpro hwmon ++============================================== ++ ++Supported chips: ++ ++ * Ampere(R) Altra(R) ++ ++ Prefix: ``smpro`` ++ ++ Reference: `Altra SoC BMC Interface Specification` ++ ++Author: Thu Nguyen ++ ++Description ++----------- ++The smpro-hwmon driver supports hardware monitoring for Ampere(R) Altra(R) ++SoCs based on the SMpro co-processor (SMpro). The following sensor metrics ++are supported by the driver: ++ ++ * temperature ++ * voltage ++ * current ++ * power ++ ++The interface provides the registers to query the various sensors and ++their values which are then exported to userspace by this driver. ++ ++Usage Notes ++----------- ++ ++The driver creates at least two sysfs files for each sensor. ++ ++* ``_label`` reports the sensor label. ++* ``_input`` returns the sensor value. ++ ++The sysfs files are allocated in the SMpro rootfs folder, with one root ++directory for each instance. ++ ++When the SoC is turned off, the driver will fail to read registers and ++return ``-ENXIO``. ++ ++Sysfs entries ++------------- ++ ++The following sysfs files are supported: ++ ++* Ampere(R) Altra(R): ++ ++ ============ ============= ====== =============================================== ++ Name Unit Perm Description ++ ============ ============= ====== =============================================== ++ temp1_input millicelsius RO SoC temperature ++ temp2_input millicelsius RO Max temperature reported among SoC VRDs ++ temp2_crit millicelsius RO SoC VRD HOT Threshold temperature ++ temp3_input millicelsius RO Max temperature reported among DIMM VRDs ++ temp4_input millicelsius RO Max temperature reported among Core VRDs ++ temp5_input millicelsius RO Temperature of DIMM0 on CH0 ++ temp5_crit millicelsius RO MEM HOT Threshold for all DIMMs ++ temp6_input millicelsius RO Temperature of DIMM0 on CH1 ++ temp6_crit millicelsius RO MEM HOT Threshold for all DIMMs ++ temp7_input millicelsius RO Temperature of DIMM0 on CH2 ++ temp7_crit millicelsius RO MEM HOT Threshold for all DIMMs ++ temp8_input millicelsius RO Temperature of DIMM0 on CH3 ++ temp8_crit millicelsius RO MEM HOT Threshold for all DIMMs ++ temp9_input millicelsius RO Temperature of DIMM0 on CH4 ++ temp9_crit millicelsius RO MEM HOT Threshold for all DIMMs ++ temp10_input millicelsius RO Temperature of DIMM0 on CH5 ++ temp10_crit millicelsius RO MEM HOT Threshold for all DIMMs ++ temp11_input millicelsius RO Temperature of DIMM0 on CH6 ++ temp11_crit millicelsius RO MEM HOT Threshold for all DIMMs ++ temp12_input millicelsius RO Temperature of DIMM0 on CH7 ++ temp12_crit millicelsius RO MEM HOT Threshold for all DIMMs ++ temp13_input millicelsius RO Max temperature reported among RCA VRDs ++ in0_input millivolts RO Core voltage ++ in1_input millivolts RO SoC voltage ++ in2_input millivolts RO DIMM VRD1 voltage ++ in3_input millivolts RO DIMM VRD2 voltage ++ in4_input millivolts RO RCA VRD voltage ++ cur1_input milliamperes RO Core VRD current ++ cur2_input milliamperes RO SoC VRD current ++ cur3_input milliamperes RO DIMM VRD1 current ++ cur4_input milliamperes RO DIMM VRD2 current ++ cur5_input milliamperes RO RCA VRD current ++ power1_input microwatts RO Core VRD power ++ power2_input microwatts RO SoC VRD power ++ power3_input microwatts RO DIMM VRD1 power ++ power4_input microwatts RO DIMM VRD2 power ++ power5_input microwatts RO RCA VRD power ++ ============ ============= ====== =============================================== ++ ++ Example:: ++ ++ # cat in0_input ++ 830 ++ # cat temp1_input ++ 37000 ++ # cat curr1_input ++ 9000 ++ # cat power5_input ++ 19500000 +diff -rupN linux-6.1.2.orig/drivers/hwmon/adm1177.c linux-6.1.2/drivers/hwmon/adm1177.c +--- linux-6.1.2.orig/drivers/hwmon/adm1177.c 2022-12-31 16:12:06.934585693 -0500 ++++ linux-6.1.2/drivers/hwmon/adm1177.c 2022-12-31 16:19:46.457248898 -0500 +@@ -26,14 +26,12 @@ + /** + * struct adm1177_state - driver instance specific data + * @client: pointer to i2c client +- * @reg: regulator info for the power supply of the device + * @r_sense_uohm: current sense resistor value + * @alert_threshold_ua: current limit for shutdown + * @vrange_high: internal voltage divider + */ + struct adm1177_state { + struct i2c_client *client; +- struct regulator *reg; + u32 r_sense_uohm; + u32 alert_threshold_ua; + bool vrange_high; +@@ -189,13 +187,6 @@ static const struct hwmon_chip_info adm1 + .info = adm1177_info, + }; + +-static void adm1177_remove(void *data) +-{ +- struct adm1177_state *st = data; +- +- regulator_disable(st->reg); +-} +- + static int adm1177_probe(struct i2c_client *client) + { + struct device *dev = &client->dev; +@@ -210,21 +201,9 @@ static int adm1177_probe(struct i2c_clie + + st->client = client; + +- st->reg = devm_regulator_get_optional(&client->dev, "vref"); +- if (IS_ERR(st->reg)) { +- if (PTR_ERR(st->reg) == -EPROBE_DEFER) +- return -EPROBE_DEFER; +- +- st->reg = NULL; +- } else { +- ret = regulator_enable(st->reg); +- if (ret) +- return ret; +- ret = devm_add_action_or_reset(&client->dev, adm1177_remove, +- st); +- if (ret) +- return ret; +- } ++ ret = devm_regulator_get_enable_optional(&client->dev, "vref"); ++ if (ret == -EPROBE_DEFER) ++ return -EPROBE_DEFER; + + if (device_property_read_u32(dev, "shunt-resistor-micro-ohms", + &st->r_sense_uohm)) +diff -rupN linux-6.1.2.orig/drivers/hwmon/aht10.c linux-6.1.2/drivers/hwmon/aht10.c +--- linux-6.1.2.orig/drivers/hwmon/aht10.c 2022-12-31 16:12:06.934585693 -0500 ++++ linux-6.1.2/drivers/hwmon/aht10.c 2022-12-31 16:19:46.453248935 -0500 +@@ -289,8 +289,7 @@ static const struct hwmon_chip_info aht1 + .info = aht10_info, + }; + +-static int aht10_probe(struct i2c_client *client, +- const struct i2c_device_id *aht10_id) ++static int aht10_probe(struct i2c_client *client) + { + struct device *device = &client->dev; + struct device *hwmon_dev; +@@ -336,7 +335,7 @@ static struct i2c_driver aht10_driver = + .driver = { + .name = "aht10", + }, +- .probe = aht10_probe, ++ .probe_new = aht10_probe, + .id_table = aht10_id, + }; + +diff -rupN linux-6.1.2.orig/drivers/hwmon/aquacomputer_d5next.c linux-6.1.2/drivers/hwmon/aquacomputer_d5next.c +--- linux-6.1.2.orig/drivers/hwmon/aquacomputer_d5next.c 2022-12-31 16:12:06.934585693 -0500 ++++ linux-6.1.2/drivers/hwmon/aquacomputer_d5next.c 2022-12-31 16:19:55.385168045 -0500 +@@ -59,7 +59,7 @@ static u8 secondary_ctrl_report[] = { + 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x34, 0xC6 + }; + +-/* Register offsets for all Aquacomputer devices */ ++/* Sensor sizes and offsets for all Aquacomputer devices */ + #define AQC_TEMP_SENSOR_SIZE 0x02 + #define AQC_TEMP_SENSOR_DISCONNECTED 0x7FFF + #define AQC_FAN_PERCENT_OFFSET 0x00 +@@ -68,62 +68,81 @@ static u8 secondary_ctrl_report[] = { + #define AQC_FAN_POWER_OFFSET 0x06 + #define AQC_FAN_SPEED_OFFSET 0x08 + +-/* Register offsets for the D5 Next pump */ +-#define D5NEXT_POWER_CYCLES 0x18 +-#define D5NEXT_COOLANT_TEMP 0x57 ++/* Specs of the D5 Next pump */ + #define D5NEXT_NUM_FANS 2 + #define D5NEXT_NUM_SENSORS 1 + #define D5NEXT_NUM_VIRTUAL_SENSORS 8 +-#define D5NEXT_VIRTUAL_SENSORS_START 0x3f ++#define D5NEXT_CTRL_REPORT_SIZE 0x329 ++ ++/* Sensor report offsets for the D5 Next pump */ ++#define D5NEXT_POWER_CYCLES 0x18 ++#define D5NEXT_COOLANT_TEMP 0x57 + #define D5NEXT_PUMP_OFFSET 0x6c + #define D5NEXT_FAN_OFFSET 0x5f + #define D5NEXT_5V_VOLTAGE 0x39 + #define D5NEXT_12V_VOLTAGE 0x37 +-#define D5NEXT_CTRL_REPORT_SIZE 0x329 ++#define D5NEXT_VIRTUAL_SENSORS_START 0x3f + static u8 d5next_sensor_fan_offsets[] = { D5NEXT_PUMP_OFFSET, D5NEXT_FAN_OFFSET }; + +-/* Pump and fan speed registers in D5 Next control report (from 0-100%) */ +-static u16 d5next_ctrl_fan_offsets[] = { 0x97, 0x42 }; ++/* Control report offsets for the D5 Next pump */ ++#define D5NEXT_TEMP_CTRL_OFFSET 0x2D /* Temperature sensor offsets location */ ++static u16 d5next_ctrl_fan_offsets[] = { 0x97, 0x42 }; /* Pump and fan speed (from 0-100%) */ + +-/* Register offsets for the Farbwerk RGB controller */ ++/* Spec and sensor report offset for the Farbwerk RGB controller */ + #define FARBWERK_NUM_SENSORS 4 + #define FARBWERK_SENSOR_START 0x2f + +-/* Register offsets for the Farbwerk 360 RGB controller */ ++/* Specs of the Farbwerk 360 RGB controller */ + #define FARBWERK360_NUM_SENSORS 4 +-#define FARBWERK360_SENSOR_START 0x32 + #define FARBWERK360_NUM_VIRTUAL_SENSORS 16 ++#define FARBWERK360_CTRL_REPORT_SIZE 0x682 ++ ++/* Sensor report offsets for the Farbwerk 360 */ ++#define FARBWERK360_SENSOR_START 0x32 + #define FARBWERK360_VIRTUAL_SENSORS_START 0x3a + +-/* Register offsets for the Octo fan controller */ +-#define OCTO_POWER_CYCLES 0x18 ++/* Control report offsets for the Farbwerk 360 */ ++#define FARBWERK360_TEMP_CTRL_OFFSET 0x8 ++ ++/* Specs of the Octo fan controller */ + #define OCTO_NUM_FANS 8 + #define OCTO_NUM_SENSORS 4 +-#define OCTO_SENSOR_START 0x3D + #define OCTO_NUM_VIRTUAL_SENSORS 16 +-#define OCTO_VIRTUAL_SENSORS_START 0x45 + #define OCTO_CTRL_REPORT_SIZE 0x65F ++ ++/* Sensor report offsets for the Octo */ ++#define OCTO_POWER_CYCLES 0x18 ++#define OCTO_SENSOR_START 0x3D ++#define OCTO_VIRTUAL_SENSORS_START 0x45 + static u8 octo_sensor_fan_offsets[] = { 0x7D, 0x8A, 0x97, 0xA4, 0xB1, 0xBE, 0xCB, 0xD8 }; + +-/* Fan speed registers in Octo control report (from 0-100%) */ ++/* Control report offsets for the Octo */ ++#define OCTO_TEMP_CTRL_OFFSET 0xA ++/* Fan speed offsets (0-100%) */ + static u16 octo_ctrl_fan_offsets[] = { 0x5B, 0xB0, 0x105, 0x15A, 0x1AF, 0x204, 0x259, 0x2AE }; + +-/* Register offsets for the Quadro fan controller */ +-#define QUADRO_POWER_CYCLES 0x18 ++/* Specs of Quadro fan controller */ + #define QUADRO_NUM_FANS 4 + #define QUADRO_NUM_SENSORS 4 +-#define QUADRO_SENSOR_START 0x34 + #define QUADRO_NUM_VIRTUAL_SENSORS 16 +-#define QUADRO_VIRTUAL_SENSORS_START 0x3c + #define QUADRO_CTRL_REPORT_SIZE 0x3c1 ++ ++/* Sensor report offsets for the Quadro */ ++#define QUADRO_POWER_CYCLES 0x18 ++#define QUADRO_SENSOR_START 0x34 ++#define QUADRO_VIRTUAL_SENSORS_START 0x3c + #define QUADRO_FLOW_SENSOR_OFFSET 0x6e + static u8 quadro_sensor_fan_offsets[] = { 0x70, 0x7D, 0x8A, 0x97 }; + +-/* Fan speed registers in Quadro control report (from 0-100%) */ +-static u16 quadro_ctrl_fan_offsets[] = { 0x37, 0x8c, 0xe1, 0x136 }; ++/* Control report offsets for the Quadro */ ++#define QUADRO_TEMP_CTRL_OFFSET 0xA ++#define QUADRO_FLOW_PULSES_CTRL_OFFSET 0x6 ++static u16 quadro_ctrl_fan_offsets[] = { 0x37, 0x8c, 0xe1, 0x136 }; /* Fan speed offsets (0-100%) */ + +-/* Register offsets for the High Flow Next */ ++/* Specs of High Flow Next flow sensor */ + #define HIGHFLOWNEXT_NUM_SENSORS 2 ++ ++/* Sensor report offsets for the High Flow Next */ + #define HIGHFLOWNEXT_SENSOR_START 85 + #define HIGHFLOWNEXT_FLOW 81 + #define HIGHFLOWNEXT_WATER_QUALITY 89 +@@ -282,8 +301,10 @@ struct aqc_data { + int temp_sensor_start_offset; + int num_virtual_temp_sensors; + int virtual_temp_sensor_start_offset; ++ u16 temp_ctrl_offset; + u16 power_cycle_count_offset; + u8 flow_sensor_offset; ++ u8 flow_pulses_ctrl_offset; + + /* General info, same across all devices */ + u32 serial_number[2]; +@@ -365,8 +386,8 @@ static int aqc_send_ctrl_data(struct aqc + return ret; + } + +-/* Refreshes the control buffer and returns value at offset */ +-static int aqc_get_ctrl_val(struct aqc_data *priv, int offset) ++/* Refreshes the control buffer and stores value at offset in val */ ++static int aqc_get_ctrl_val(struct aqc_data *priv, int offset, long *val) + { + int ret; + +@@ -376,7 +397,7 @@ static int aqc_get_ctrl_val(struct aqc_d + if (ret < 0) + goto unlock_and_return; + +- ret = get_unaligned_be16(priv->buffer + offset); ++ *val = (s16)get_unaligned_be16(priv->buffer + offset); + + unlock_and_return: + mutex_unlock(&priv->mutex); +@@ -393,7 +414,7 @@ static int aqc_set_ctrl_val(struct aqc_d + if (ret < 0) + goto unlock_and_return; + +- put_unaligned_be16((u16)val, priv->buffer + offset); ++ put_unaligned_be16((s16)val, priv->buffer + offset); + + ret = aqc_send_ctrl_data(priv); + +@@ -408,8 +429,28 @@ static umode_t aqc_is_visible(const void + + switch (type) { + case hwmon_temp: ++ if (channel < priv->num_temp_sensors) { ++ switch (attr) { ++ case hwmon_temp_label: ++ case hwmon_temp_input: ++ return 0444; ++ case hwmon_temp_offset: ++ if (priv->temp_ctrl_offset != 0) ++ return 0644; ++ break; ++ default: ++ break; ++ } ++ } ++ + if (channel < priv->num_temp_sensors + priv->num_virtual_temp_sensors) +- return 0444; ++ switch (attr) { ++ case hwmon_temp_label: ++ case hwmon_temp_input: ++ return 0444; ++ default: ++ break; ++ } + break; + case hwmon_pwm: + if (priv->fan_ctrl_offsets && channel < priv->num_fans) { +@@ -422,20 +463,34 @@ static umode_t aqc_is_visible(const void + } + break; + case hwmon_fan: +- switch (priv->kind) { +- case highflownext: +- /* Special case to support flow sensor, water quality and conductivity */ +- if (channel < 3) +- return 0444; ++ switch (attr) { ++ case hwmon_fan_input: ++ case hwmon_fan_label: ++ switch (priv->kind) { ++ case highflownext: ++ /* Special case to support flow sensor, water quality ++ * and conductivity ++ */ ++ if (channel < 3) ++ return 0444; ++ break; ++ case quadro: ++ /* Special case to support flow sensor */ ++ if (channel < priv->num_fans + 1) ++ return 0444; ++ break; ++ default: ++ if (channel < priv->num_fans) ++ return 0444; ++ break; ++ } + break; +- case quadro: +- /* Special case to support flow sensor */ +- if (channel < priv->num_fans + 1) +- return 0444; ++ case hwmon_fan_pulses: ++ /* Special case for Quadro flow sensor */ ++ if (priv->kind == quadro && channel == priv->num_fans) ++ return 0644; + break; + default: +- if (channel < priv->num_fans) +- return 0444; + break; + } + break; +@@ -492,20 +547,46 @@ static int aqc_read(struct device *dev, + + switch (type) { + case hwmon_temp: +- if (priv->temp_input[channel] == -ENODATA) +- return -ENODATA; ++ switch (attr) { ++ case hwmon_temp_input: ++ if (priv->temp_input[channel] == -ENODATA) ++ return -ENODATA; + +- *val = priv->temp_input[channel]; ++ *val = priv->temp_input[channel]; ++ break; ++ case hwmon_temp_offset: ++ ret = ++ aqc_get_ctrl_val(priv, priv->temp_ctrl_offset + ++ channel * AQC_TEMP_SENSOR_SIZE, val); ++ if (ret < 0) ++ return ret; ++ ++ *val *= 10; ++ break; ++ default: ++ break; ++ } + break; + case hwmon_fan: +- *val = priv->speed_input[channel]; ++ switch (attr) { ++ case hwmon_fan_input: ++ *val = priv->speed_input[channel]; ++ break; ++ case hwmon_fan_pulses: ++ ret = aqc_get_ctrl_val(priv, priv->flow_pulses_ctrl_offset, val); ++ if (ret < 0) ++ return ret; ++ break; ++ default: ++ break; ++ } + break; + case hwmon_power: + *val = priv->power_input[channel]; + break; + case hwmon_pwm: + if (priv->fan_ctrl_offsets) { +- ret = aqc_get_ctrl_val(priv, priv->fan_ctrl_offsets[channel]); ++ ret = aqc_get_ctrl_val(priv, priv->fan_ctrl_offsets[channel], val); + if (ret < 0) + return ret; + +@@ -563,6 +644,33 @@ static int aqc_write(struct device *dev, + struct aqc_data *priv = dev_get_drvdata(dev); + + switch (type) { ++ case hwmon_temp: ++ switch (attr) { ++ case hwmon_temp_offset: ++ /* Limit temp offset to +/- 15K as in the official software */ ++ val = clamp_val(val, -15000, 15000) / 10; ++ ret = ++ aqc_set_ctrl_val(priv, priv->temp_ctrl_offset + ++ channel * AQC_TEMP_SENSOR_SIZE, val); ++ if (ret < 0) ++ return ret; ++ break; ++ default: ++ return -EOPNOTSUPP; ++ } ++ break; ++ case hwmon_fan: ++ switch (attr) { ++ case hwmon_fan_pulses: ++ val = clamp_val(val, 10, 1000); ++ ret = aqc_set_ctrl_val(priv, priv->flow_pulses_ctrl_offset, val); ++ if (ret < 0) ++ return ret; ++ break; ++ default: ++ break; ++ } ++ break; + case hwmon_pwm: + switch (attr) { + case hwmon_pwm_input: +@@ -597,10 +705,10 @@ static const struct hwmon_ops aqc_hwmon_ + + static const struct hwmon_channel_info *aqc_info[] = { + HWMON_CHANNEL_INFO(temp, +- HWMON_T_INPUT | HWMON_T_LABEL, +- HWMON_T_INPUT | HWMON_T_LABEL, +- HWMON_T_INPUT | HWMON_T_LABEL, +- HWMON_T_INPUT | HWMON_T_LABEL, ++ HWMON_T_INPUT | HWMON_T_LABEL | HWMON_T_OFFSET, ++ HWMON_T_INPUT | HWMON_T_LABEL | HWMON_T_OFFSET, ++ HWMON_T_INPUT | HWMON_T_LABEL | HWMON_T_OFFSET, ++ HWMON_T_INPUT | HWMON_T_LABEL | HWMON_T_OFFSET, + HWMON_T_INPUT | HWMON_T_LABEL, + HWMON_T_INPUT | HWMON_T_LABEL, + HWMON_T_INPUT | HWMON_T_LABEL, +@@ -622,7 +730,7 @@ static const struct hwmon_channel_info * + HWMON_F_INPUT | HWMON_F_LABEL, + HWMON_F_INPUT | HWMON_F_LABEL, + HWMON_F_INPUT | HWMON_F_LABEL, +- HWMON_F_INPUT | HWMON_F_LABEL, ++ HWMON_F_INPUT | HWMON_F_LABEL | HWMON_F_PULSES, + HWMON_F_INPUT | HWMON_F_LABEL, + HWMON_F_INPUT | HWMON_F_LABEL, + HWMON_F_INPUT | HWMON_F_LABEL), +@@ -847,13 +955,17 @@ static int aqc_probe(struct hid_device * + priv->num_fans = D5NEXT_NUM_FANS; + priv->fan_sensor_offsets = d5next_sensor_fan_offsets; + priv->fan_ctrl_offsets = d5next_ctrl_fan_offsets; ++ + priv->num_temp_sensors = D5NEXT_NUM_SENSORS; + priv->temp_sensor_start_offset = D5NEXT_COOLANT_TEMP; + priv->num_virtual_temp_sensors = D5NEXT_NUM_VIRTUAL_SENSORS; + priv->virtual_temp_sensor_start_offset = D5NEXT_VIRTUAL_SENSORS_START; +- priv->power_cycle_count_offset = D5NEXT_POWER_CYCLES; ++ priv->temp_ctrl_offset = D5NEXT_TEMP_CTRL_OFFSET; ++ + priv->buffer_size = D5NEXT_CTRL_REPORT_SIZE; + ++ priv->power_cycle_count_offset = D5NEXT_POWER_CYCLES; ++ + priv->temp_label = label_d5next_temp; + priv->virtual_temp_label = label_virtual_temp_sensors; + priv->speed_label = label_d5next_speeds; +@@ -865,18 +977,24 @@ static int aqc_probe(struct hid_device * + priv->kind = farbwerk; + + priv->num_fans = 0; ++ + priv->num_temp_sensors = FARBWERK_NUM_SENSORS; + priv->temp_sensor_start_offset = FARBWERK_SENSOR_START; ++ + priv->temp_label = label_temp_sensors; + break; + case USB_PRODUCT_ID_FARBWERK360: + priv->kind = farbwerk360; + + priv->num_fans = 0; ++ + priv->num_temp_sensors = FARBWERK360_NUM_SENSORS; + priv->temp_sensor_start_offset = FARBWERK360_SENSOR_START; + priv->num_virtual_temp_sensors = FARBWERK360_NUM_VIRTUAL_SENSORS; + priv->virtual_temp_sensor_start_offset = FARBWERK360_VIRTUAL_SENSORS_START; ++ priv->temp_ctrl_offset = FARBWERK360_TEMP_CTRL_OFFSET; ++ ++ priv->buffer_size = FARBWERK360_CTRL_REPORT_SIZE; + + priv->temp_label = label_temp_sensors; + priv->virtual_temp_label = label_virtual_temp_sensors; +@@ -887,13 +1005,17 @@ static int aqc_probe(struct hid_device * + priv->num_fans = OCTO_NUM_FANS; + priv->fan_sensor_offsets = octo_sensor_fan_offsets; + priv->fan_ctrl_offsets = octo_ctrl_fan_offsets; ++ + priv->num_temp_sensors = OCTO_NUM_SENSORS; + priv->temp_sensor_start_offset = OCTO_SENSOR_START; + priv->num_virtual_temp_sensors = OCTO_NUM_VIRTUAL_SENSORS; + priv->virtual_temp_sensor_start_offset = OCTO_VIRTUAL_SENSORS_START; +- priv->power_cycle_count_offset = OCTO_POWER_CYCLES; ++ priv->temp_ctrl_offset = OCTO_TEMP_CTRL_OFFSET; ++ + priv->buffer_size = OCTO_CTRL_REPORT_SIZE; + ++ priv->power_cycle_count_offset = OCTO_POWER_CYCLES; ++ + priv->temp_label = label_temp_sensors; + priv->virtual_temp_label = label_virtual_temp_sensors; + priv->speed_label = label_fan_speed; +@@ -907,13 +1029,18 @@ static int aqc_probe(struct hid_device * + priv->num_fans = QUADRO_NUM_FANS; + priv->fan_sensor_offsets = quadro_sensor_fan_offsets; + priv->fan_ctrl_offsets = quadro_ctrl_fan_offsets; ++ + priv->num_temp_sensors = QUADRO_NUM_SENSORS; + priv->temp_sensor_start_offset = QUADRO_SENSOR_START; + priv->num_virtual_temp_sensors = QUADRO_NUM_VIRTUAL_SENSORS; + priv->virtual_temp_sensor_start_offset = QUADRO_VIRTUAL_SENSORS_START; +- priv->power_cycle_count_offset = QUADRO_POWER_CYCLES; ++ priv->temp_ctrl_offset = QUADRO_TEMP_CTRL_OFFSET; ++ + priv->buffer_size = QUADRO_CTRL_REPORT_SIZE; ++ + priv->flow_sensor_offset = QUADRO_FLOW_SENSOR_OFFSET; ++ priv->flow_pulses_ctrl_offset = QUADRO_FLOW_PULSES_CTRL_OFFSET; ++ priv->power_cycle_count_offset = QUADRO_POWER_CYCLES; + + priv->temp_label = label_temp_sensors; + priv->virtual_temp_label = label_virtual_temp_sensors; +@@ -926,8 +1053,10 @@ static int aqc_probe(struct hid_device * + priv->kind = highflownext; + + priv->num_fans = 0; ++ + priv->num_temp_sensors = HIGHFLOWNEXT_NUM_SENSORS; + priv->temp_sensor_start_offset = HIGHFLOWNEXT_SENSOR_START; ++ + priv->power_cycle_count_offset = QUADRO_POWER_CYCLES; + + priv->temp_label = label_highflownext_temp_sensors; +diff -rupN linux-6.1.2.orig/drivers/hwmon/atxp1.c linux-6.1.2/drivers/hwmon/atxp1.c +--- linux-6.1.2.orig/drivers/hwmon/atxp1.c 2022-12-31 16:12:06.934585693 -0500 ++++ linux-6.1.2/drivers/hwmon/atxp1.c 2022-12-31 16:19:53.945181044 -0500 +@@ -16,6 +16,7 @@ + #include + #include + #include ++#include + #include + #include + #include +diff -rupN linux-6.1.2.orig/drivers/hwmon/coretemp.c linux-6.1.2/drivers/hwmon/coretemp.c +--- linux-6.1.2.orig/drivers/hwmon/coretemp.c 2022-12-31 16:12:06.934585693 -0500 ++++ linux-6.1.2/drivers/hwmon/coretemp.c 2022-12-31 16:19:53.953180971 -0500 +@@ -55,6 +55,8 @@ MODULE_PARM_DESC(tjmax, "TjMax value in + + /* + * Per-Core Temperature Data ++ * @tjmax: The static tjmax value when tjmax cannot be retrieved from ++ * IA32_TEMPERATURE_TARGET MSR. + * @last_updated: The time when the current temperature value was updated + * earlier (in jiffies). + * @cpu_core_id: The CPU Core from which temperature values should be read +@@ -64,11 +66,9 @@ MODULE_PARM_DESC(tjmax, "TjMax value in + * @attr_size: Total number of pre-core attrs displayed in the sysfs. + * @is_pkg_data: If this is 1, the temp_data holds pkgtemp data. + * Otherwise, temp_data holds coretemp data. +- * @valid: If this is 1, the current temperature is valid. + */ + struct temp_data { + int temp; +- int ttarget; + int tjmax; + unsigned long last_updated; + unsigned int cpu; +@@ -76,7 +76,6 @@ struct temp_data { + u32 status_reg; + int attr_size; + bool is_pkg_data; +- bool valid; + struct sensor_device_attribute sd_attrs[TOTAL_ATTRS]; + char attr_name[TOTAL_ATTRS][CORETEMP_NAME_LENGTH]; + struct attribute *attrs[TOTAL_ATTRS + 1]; +@@ -95,85 +94,6 @@ struct platform_data { + struct device_attribute name_attr; + }; + +-/* Keep track of how many zone pointers we allocated in init() */ +-static int max_zones __read_mostly; +-/* Array of zone pointers. Serialized by cpu hotplug lock */ +-static struct platform_device **zone_devices; +- +-static ssize_t show_label(struct device *dev, +- struct device_attribute *devattr, char *buf) +-{ +- struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); +- struct platform_data *pdata = dev_get_drvdata(dev); +- struct temp_data *tdata = pdata->core_data[attr->index]; +- +- if (tdata->is_pkg_data) +- return sprintf(buf, "Package id %u\n", pdata->pkg_id); +- +- return sprintf(buf, "Core %u\n", tdata->cpu_core_id); +-} +- +-static ssize_t show_crit_alarm(struct device *dev, +- struct device_attribute *devattr, char *buf) +-{ +- u32 eax, edx; +- struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); +- struct platform_data *pdata = dev_get_drvdata(dev); +- struct temp_data *tdata = pdata->core_data[attr->index]; +- +- mutex_lock(&tdata->update_lock); +- rdmsr_on_cpu(tdata->cpu, tdata->status_reg, &eax, &edx); +- mutex_unlock(&tdata->update_lock); +- +- return sprintf(buf, "%d\n", (eax >> 5) & 1); +-} +- +-static ssize_t show_tjmax(struct device *dev, +- struct device_attribute *devattr, char *buf) +-{ +- struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); +- struct platform_data *pdata = dev_get_drvdata(dev); +- +- return sprintf(buf, "%d\n", pdata->core_data[attr->index]->tjmax); +-} +- +-static ssize_t show_ttarget(struct device *dev, +- struct device_attribute *devattr, char *buf) +-{ +- struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); +- struct platform_data *pdata = dev_get_drvdata(dev); +- +- return sprintf(buf, "%d\n", pdata->core_data[attr->index]->ttarget); +-} +- +-static ssize_t show_temp(struct device *dev, +- struct device_attribute *devattr, char *buf) +-{ +- u32 eax, edx; +- struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); +- struct platform_data *pdata = dev_get_drvdata(dev); +- struct temp_data *tdata = pdata->core_data[attr->index]; +- +- mutex_lock(&tdata->update_lock); +- +- /* Check whether the time interval has elapsed */ +- if (!tdata->valid || time_after(jiffies, tdata->last_updated + HZ)) { +- rdmsr_on_cpu(tdata->cpu, tdata->status_reg, &eax, &edx); +- /* +- * Ignore the valid bit. In all observed cases the register +- * value is either low or zero if the valid bit is 0. +- * Return it instead of reporting an error which doesn't +- * really help at all. +- */ +- tdata->temp = tdata->tjmax - ((eax >> 16) & 0x7f) * 1000; +- tdata->valid = true; +- tdata->last_updated = jiffies; +- } +- +- mutex_unlock(&tdata->update_lock); +- return sprintf(buf, "%d\n", tdata->temp); +-} +- + struct tjmax_pci { + unsigned int device; + int tjmax; +@@ -340,20 +260,25 @@ static bool cpu_has_tjmax(struct cpuinfo + model != 0x36; + } + +-static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev) ++static int get_tjmax(struct temp_data *tdata, struct device *dev) + { ++ struct cpuinfo_x86 *c = &cpu_data(tdata->cpu); + int err; + u32 eax, edx; + u32 val; + ++ /* use static tjmax once it is set */ ++ if (tdata->tjmax) ++ return tdata->tjmax; ++ + /* + * A new feature of current Intel(R) processors, the + * IA32_TEMPERATURE_TARGET contains the TjMax value + */ +- err = rdmsr_safe_on_cpu(id, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx); ++ err = rdmsr_safe_on_cpu(tdata->cpu, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx); + if (err) { + if (cpu_has_tjmax(c)) +- dev_warn(dev, "Unable to read TjMax from CPU %u\n", id); ++ dev_warn(dev, "Unable to read TjMax from CPU %u\n", tdata->cpu); + } else { + val = (eax >> 16) & 0xff; + /* +@@ -369,14 +294,133 @@ static int get_tjmax(struct cpuinfo_x86 + if (force_tjmax) { + dev_notice(dev, "TjMax forced to %d degrees C by user\n", + force_tjmax); +- return force_tjmax * 1000; ++ tdata->tjmax = force_tjmax * 1000; ++ } else { ++ /* ++ * An assumption is made for early CPUs and unreadable MSR. ++ * NOTE: the calculated value may not be correct. ++ */ ++ tdata->tjmax = adjust_tjmax(c, tdata->cpu, dev); + } ++ return tdata->tjmax; ++} ++ ++static int get_ttarget(struct temp_data *tdata, struct device *dev) ++{ ++ u32 eax, edx; ++ int tjmax, ttarget_offset, ret; + + /* +- * An assumption is made for early CPUs and unreadable MSR. +- * NOTE: the calculated value may not be correct. ++ * ttarget is valid only if tjmax can be retrieved from ++ * MSR_IA32_TEMPERATURE_TARGET + */ +- return adjust_tjmax(c, id, dev); ++ if (tdata->tjmax) ++ return -ENODEV; ++ ++ ret = rdmsr_safe_on_cpu(tdata->cpu, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx); ++ if (ret) ++ return ret; ++ ++ tjmax = (eax >> 16) & 0xff; ++ ++ /* Read the still undocumented bits 8:15 of IA32_TEMPERATURE_TARGET. */ ++ ttarget_offset = (eax >> 8) & 0xff; ++ ++ return (tjmax - ttarget_offset) * 1000; ++} ++ ++/* Keep track of how many zone pointers we allocated in init() */ ++static int max_zones __read_mostly; ++/* Array of zone pointers. Serialized by cpu hotplug lock */ ++static struct platform_device **zone_devices; ++ ++static ssize_t show_label(struct device *dev, ++ struct device_attribute *devattr, char *buf) ++{ ++ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); ++ struct platform_data *pdata = dev_get_drvdata(dev); ++ struct temp_data *tdata = pdata->core_data[attr->index]; ++ ++ if (tdata->is_pkg_data) ++ return sprintf(buf, "Package id %u\n", pdata->pkg_id); ++ ++ return sprintf(buf, "Core %u\n", tdata->cpu_core_id); ++} ++ ++static ssize_t show_crit_alarm(struct device *dev, ++ struct device_attribute *devattr, char *buf) ++{ ++ u32 eax, edx; ++ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); ++ struct platform_data *pdata = dev_get_drvdata(dev); ++ struct temp_data *tdata = pdata->core_data[attr->index]; ++ ++ mutex_lock(&tdata->update_lock); ++ rdmsr_on_cpu(tdata->cpu, tdata->status_reg, &eax, &edx); ++ mutex_unlock(&tdata->update_lock); ++ ++ return sprintf(buf, "%d\n", (eax >> 5) & 1); ++} ++ ++static ssize_t show_tjmax(struct device *dev, ++ struct device_attribute *devattr, char *buf) ++{ ++ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); ++ struct platform_data *pdata = dev_get_drvdata(dev); ++ struct temp_data *tdata = pdata->core_data[attr->index]; ++ int tjmax; ++ ++ mutex_lock(&tdata->update_lock); ++ tjmax = get_tjmax(tdata, dev); ++ mutex_unlock(&tdata->update_lock); ++ ++ return sprintf(buf, "%d\n", tjmax); ++} ++ ++static ssize_t show_ttarget(struct device *dev, ++ struct device_attribute *devattr, char *buf) ++{ ++ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); ++ struct platform_data *pdata = dev_get_drvdata(dev); ++ struct temp_data *tdata = pdata->core_data[attr->index]; ++ int ttarget; ++ ++ mutex_lock(&tdata->update_lock); ++ ttarget = get_ttarget(tdata, dev); ++ mutex_unlock(&tdata->update_lock); ++ ++ if (ttarget < 0) ++ return ttarget; ++ return sprintf(buf, "%d\n", ttarget); ++} ++ ++static ssize_t show_temp(struct device *dev, ++ struct device_attribute *devattr, char *buf) ++{ ++ u32 eax, edx; ++ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); ++ struct platform_data *pdata = dev_get_drvdata(dev); ++ struct temp_data *tdata = pdata->core_data[attr->index]; ++ int tjmax; ++ ++ mutex_lock(&tdata->update_lock); ++ ++ tjmax = get_tjmax(tdata, dev); ++ /* Check whether the time interval has elapsed */ ++ if (time_after(jiffies, tdata->last_updated + HZ)) { ++ rdmsr_on_cpu(tdata->cpu, tdata->status_reg, &eax, &edx); ++ /* ++ * Ignore the valid bit. In all observed cases the register ++ * value is either low or zero if the valid bit is 0. ++ * Return it instead of reporting an error which doesn't ++ * really help at all. ++ */ ++ tdata->temp = tjmax - ((eax >> 16) & 0x7f) * 1000; ++ tdata->last_updated = jiffies; ++ } ++ ++ mutex_unlock(&tdata->update_lock); ++ return sprintf(buf, "%d\n", tdata->temp); + } + + static int create_core_attrs(struct temp_data *tdata, struct device *dev, +@@ -490,23 +534,17 @@ static int create_core_data(struct platf + if (err) + goto exit_free; + +- /* We can access status register. Get Critical Temperature */ +- tdata->tjmax = get_tjmax(c, cpu, &pdev->dev); ++ /* Make sure tdata->tjmax is a valid indicator for dynamic/static tjmax */ ++ get_tjmax(tdata, &pdev->dev); + + /* +- * Read the still undocumented bits 8:15 of IA32_TEMPERATURE_TARGET. +- * The target temperature is available on older CPUs but not in this +- * register. Atoms don't have the register at all. ++ * The target temperature is available on older CPUs but not in the ++ * MSR_IA32_TEMPERATURE_TARGET register. Atoms don't have the register ++ * at all. + */ +- if (c->x86_model > 0xe && c->x86_model != 0x1c) { +- err = rdmsr_safe_on_cpu(cpu, MSR_IA32_TEMPERATURE_TARGET, +- &eax, &edx); +- if (!err) { +- tdata->ttarget +- = tdata->tjmax - ((eax >> 8) & 0xff) * 1000; ++ if (c->x86_model > 0xe && c->x86_model != 0x1c) ++ if (get_ttarget(tdata, &pdev->dev) >= 0) + tdata->attr_size++; +- } +- } + + pdata->core_data[attr_no] = tdata; + +diff -rupN linux-6.1.2.orig/drivers/hwmon/dell-smm-hwmon.c linux-6.1.2/drivers/hwmon/dell-smm-hwmon.c +--- linux-6.1.2.orig/drivers/hwmon/dell-smm-hwmon.c 2022-12-31 16:12:06.934585693 -0500 ++++ linux-6.1.2/drivers/hwmon/dell-smm-hwmon.c 2022-12-31 16:19:55.385168045 -0500 +@@ -1447,9 +1447,10 @@ static int __init i8k_init(void) + */ + if (i8k_get_dell_signature(I8K_SMM_GET_DELL_SIG1) && + i8k_get_dell_signature(I8K_SMM_GET_DELL_SIG2)) { +- pr_err("unable to get SMM Dell signature\n"); + if (!force) + return -ENODEV; ++ ++ pr_err("Unable to get Dell SMM signature\n"); + } + + dell_smm_device = platform_create_bundle(&dell_smm_driver, dell_smm_probe, NULL, 0, NULL, +diff -rupN linux-6.1.2.orig/drivers/hwmon/ds1621.c linux-6.1.2/drivers/hwmon/ds1621.c +--- linux-6.1.2.orig/drivers/hwmon/ds1621.c 2022-12-31 16:12:06.934585693 -0500 ++++ linux-6.1.2/drivers/hwmon/ds1621.c 2022-12-31 16:19:55.385168045 -0500 +@@ -269,7 +269,7 @@ static ssize_t update_interval_show(stru + struct device_attribute *da, char *buf) + { + struct ds1621_data *data = dev_get_drvdata(dev); +- return scnprintf(buf, PAGE_SIZE, "%hu\n", data->update_interval); ++ return sysfs_emit(buf, "%hu\n", data->update_interval); + } + + static ssize_t update_interval_store(struct device *dev, +diff -rupN linux-6.1.2.orig/drivers/hwmon/emc2305.c linux-6.1.2/drivers/hwmon/emc2305.c +--- linux-6.1.2.orig/drivers/hwmon/emc2305.c 2022-12-31 16:12:06.934585693 -0500 ++++ linux-6.1.2/drivers/hwmon/emc2305.c 2022-12-31 16:19:46.453248935 -0500 +@@ -528,7 +528,7 @@ static int emc2305_identify(struct devic + return 0; + } + +-static int emc2305_probe(struct i2c_client *client, const struct i2c_device_id *id) ++static int emc2305_probe(struct i2c_client *client) + { + struct i2c_adapter *adapter = client->adapter; + struct device *dev = &client->dev; +@@ -613,7 +613,7 @@ static struct i2c_driver emc2305_driver + .driver = { + .name = "emc2305", + }, +- .probe = emc2305_probe, ++ .probe_new = emc2305_probe, + .remove = emc2305_remove, + .id_table = emc2305_ids, + .address_list = emc2305_normal_i2c, +diff -rupN linux-6.1.2.orig/drivers/hwmon/fschmd.c linux-6.1.2/drivers/hwmon/fschmd.c +--- linux-6.1.2.orig/drivers/hwmon/fschmd.c 2022-12-31 16:12:06.938585633 -0500 ++++ linux-6.1.2/drivers/hwmon/fschmd.c 2022-12-31 16:19:46.453248935 -0500 +@@ -1083,9 +1083,9 @@ static int fschmd_detect(struct i2c_clie static int fschmd_probe(struct i2c_client *client) { struct fschmd_data *data; @@ -30,32 +1098,57 @@ index 0a77d61619288..e1f426e86f36c 100644 int i, err; enum chips kind = i2c_match_id(fschmd_id, client)->driver_data; --- -cgit - - -From 12c44ab8b401c29d8d3569aaea34da662b8ece1d Mon Sep 17 00:00:00 2001 -From: Ahmad Khalifa -Date: Tue, 4 Oct 2022 22:01:01 +0100 -Subject: hwmon: (it87) Add param to ignore ACPI resource conflicts - -Add parameter to ignore ACPI resource conflicts as an alternate to using -'acpi_enforce_resources=lax'. - -Some BIOSes reserve resources and don't use them and the system wide -parameter may result in failures to certain drivers. - -Signed-off-by: Ahmad Khalifa -Link: https://lore.kernel.org/r/20221004210100.540120-2-ahmad@khalifa.ws -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/it87.c | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c -index 7bd154ba351b9..e920dd26225ff 100644 ---- a/drivers/hwmon/it87.c -+++ b/drivers/hwmon/it87.c +diff -rupN linux-6.1.2.orig/drivers/hwmon/gpio-fan.c linux-6.1.2/drivers/hwmon/gpio-fan.c +--- linux-6.1.2.orig/drivers/hwmon/gpio-fan.c 2022-12-31 16:12:06.938585633 -0500 ++++ linux-6.1.2/drivers/hwmon/gpio-fan.c 2022-12-31 16:19:53.945181044 -0500 +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + #include + #include + #include +diff -rupN linux-6.1.2.orig/drivers/hwmon/gsc-hwmon.c linux-6.1.2/drivers/hwmon/gsc-hwmon.c +--- linux-6.1.2.orig/drivers/hwmon/gsc-hwmon.c 2022-12-31 16:12:06.938585633 -0500 ++++ linux-6.1.2/drivers/hwmon/gsc-hwmon.c 2022-12-31 16:19:55.381168081 -0500 +@@ -257,13 +257,10 @@ gsc_hwmon_get_devtree_pdata(struct devic + if (nchannels == 0) + return ERR_PTR(-ENODEV); + +- pdata = devm_kzalloc(dev, +- sizeof(*pdata) + nchannels * sizeof(*ch), ++ pdata = devm_kzalloc(dev, struct_size(pdata, channels, nchannels), + GFP_KERNEL); + if (!pdata) + return ERR_PTR(-ENOMEM); +- ch = (struct gsc_hwmon_channel *)(pdata + 1); +- pdata->channels = ch; + pdata->nchannels = nchannels; + + /* fan controller base address */ +@@ -277,6 +274,7 @@ gsc_hwmon_get_devtree_pdata(struct devic + + of_node_put(fan); + ++ ch = pdata->channels; + /* allocate structures for channels and count instances of each type */ + device_for_each_child_node(dev, child) { + if (fwnode_property_read_string(child, "label", &ch->name)) { +diff -rupN linux-6.1.2.orig/drivers/hwmon/hwmon.c linux-6.1.2/drivers/hwmon/hwmon.c +--- linux-6.1.2.orig/drivers/hwmon/hwmon.c 2022-12-31 16:12:06.938585633 -0500 ++++ linux-6.1.2/drivers/hwmon/hwmon.c 2022-12-31 16:19:53.945181044 -0500 +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + #include + #include + #include +diff -rupN linux-6.1.2.orig/drivers/hwmon/it87.c linux-6.1.2/drivers/hwmon/it87.c +--- linux-6.1.2.orig/drivers/hwmon/it87.c 2022-12-31 16:12:06.938585633 -0500 ++++ linux-6.1.2/drivers/hwmon/it87.c 2022-12-31 16:19:53.949181008 -0500 @@ -69,6 +69,10 @@ static unsigned short force_id; module_param(force_id, ushort, 0); MODULE_PARM_DESC(force_id, "Override the detected device ID"); @@ -67,43 +1160,30 @@ index 7bd154ba351b9..e920dd26225ff 100644 static struct platform_device *it87_pdev[2]; #define REG_2E 0x2e /* The register to read/write */ -@@ -3261,8 +3265,10 @@ static int __init it87_device_add(int index, unsigned short address, +@@ -563,6 +567,14 @@ struct it87_data { + s8 auto_temp[NUM_AUTO_PWM][5]; /* [nr][0] is point1_temp_hyst */ + }; + ++/* Board specific settings from DMI matching */ ++struct it87_dmi_data { ++ u8 skip_pwm; /* pwm channels to skip for this board */ ++}; ++ ++/* Global for results from DMI matching, if needed */ ++static struct it87_dmi_data *dmi_data; ++ + static int adc_lsb(const struct it87_data *data, int nr) + { + int lsb; +@@ -2389,7 +2401,6 @@ static int __init it87_find(int sioaddr, + { int err; + u16 chip_type; +- const char *board_vendor, *board_name; + const struct it87_devices *config; - err = acpi_check_resource_conflict(&res); -- if (err) -- return err; -+ if (err) { -+ if (!ignore_resource_conflict) -+ return err; -+ } - - pdev = platform_device_alloc(DRVNAME, address); - if (!pdev) --- -cgit - - -From b3b19931a5c22f5a09f846e037b23f8a74455d0a Mon Sep 17 00:00:00 2001 -From: Ahmad Khalifa -Date: Tue, 4 Oct 2022 22:01:03 +0100 -Subject: hwmon: (it87) Check for a valid chip before using force_id - -Check there is a chip before using force_id parameter as there -is no value in registering a non-existent chip - -Signed-off-by: Ahmad Khalifa -Link: https://lore.kernel.org/r/20221004210100.540120-3-ahmad@khalifa.ws -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/it87.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c -index e920dd26225ff..73ed21ab325ba 100644 ---- a/drivers/hwmon/it87.c -+++ b/drivers/hwmon/it87.c -@@ -2401,7 +2401,13 @@ static int __init it87_find(int sioaddr, unsigned short *address, + err = superio_enter(sioaddr); +@@ -2397,7 +2408,13 @@ static int __init it87_find(int sioaddr, return err; err = -ENODEV; @@ -118,269 +1198,278 @@ index e920dd26225ff..73ed21ab325ba 100644 switch (chip_type) { case IT8705F_DEVID: --- -cgit - - -From deeab9ea40dbaabdf0e2828b5c3da3418ae7dd39 Mon Sep 17 00:00:00 2001 -From: Stephen Kitt -Date: Tue, 11 Oct 2022 16:33:08 +0200 -Subject: hwmon: use simple i2c probe - -All these drivers have an i2c probe function which doesn't use the -"struct i2c_device_id *id" parameter, so they can trivially be -converted to the "probe_new" style of probe with a single argument. - -This is part of an ongoing transition to single-argument i2c probe -functions. Old-style probe functions involve a call to i2c_match_id: -in drivers/i2c/i2c-core-base.c, - - /* - * When there are no more users of probe(), - * rename probe_new to probe. - */ - if (driver->probe_new) - status = driver->probe_new(client); - else if (driver->probe) - status = driver->probe(client, - i2c_match_id(driver->id_table, client)); - else - status = -EINVAL; - -Drivers which don't need the second parameter can be declared using -probe_new instead, avoiding the call to i2c_match_id. Drivers which do -can still be converted to probe_new-style, calling i2c_match_id -themselves (as is done currently for of_match_id). - -This change was done using the following Coccinelle script, and fixed -up for whitespace changes: - -@ rule1 @ -identifier fn; -identifier client, id; -@@ - -- static int fn(struct i2c_client *client, const struct i2c_device_id *id) -+ static int fn(struct i2c_client *client) -{ -...when != id -} - -@ rule2 depends on rule1 @ -identifier rule1.fn; -identifier driver; -@@ - -struct i2c_driver driver = { -- .probe -+ .probe_new - = -( - fn -| -- &fn -+ fn -) - , -}; - -Signed-off-by: Stephen Kitt -Link: https://lore.kernel.org/r/20221011143309.3141267-1-steve@sk2.org -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/aht10.c | 5 ++--- - drivers/hwmon/emc2305.c | 4 ++-- - drivers/hwmon/ltc2992.c | 4 ++-- - drivers/hwmon/max127.c | 5 ++--- - drivers/hwmon/sbrmi.c | 5 ++--- - drivers/hwmon/sbtsi_temp.c | 5 ++--- - drivers/hwmon/sht4x.c | 5 ++--- - 7 files changed, 14 insertions(+), 19 deletions(-) - -diff --git a/drivers/hwmon/aht10.c b/drivers/hwmon/aht10.c -index 2d9770cb4401b..d76f3441ecf1a 100644 ---- a/drivers/hwmon/aht10.c -+++ b/drivers/hwmon/aht10.c -@@ -289,8 +289,7 @@ static const struct hwmon_chip_info aht10_chip_info = { - .info = aht10_info, - }; +@@ -2802,24 +2819,9 @@ static int __init it87_find(int sioaddr, + if (sio_data->beep_pin) + pr_info("Beeping is supported\n"); --static int aht10_probe(struct i2c_client *client, -- const struct i2c_device_id *aht10_id) -+static int aht10_probe(struct i2c_client *client) - { - struct device *device = &client->dev; - struct device *hwmon_dev; -@@ -336,7 +335,7 @@ static struct i2c_driver aht10_driver = { - .driver = { - .name = "aht10", - }, -- .probe = aht10_probe, -+ .probe_new = aht10_probe, - .id_table = aht10_id, - }; +- /* Disable specific features based on DMI strings */ +- board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); +- board_name = dmi_get_system_info(DMI_BOARD_NAME); +- if (board_vendor && board_name) { +- if (strcmp(board_vendor, "nVIDIA") == 0 && +- strcmp(board_name, "FN68PT") == 0) { +- /* +- * On the Shuttle SN68PT, FAN_CTL2 is apparently not +- * connected to a fan, but to something else. One user +- * has reported instant system power-off when changing +- * the PWM2 duty cycle, so we disable it. +- * I use the board name string as the trigger in case +- * the same board is ever used in other systems. +- */ +- pr_info("Disabling pwm2 due to hardware constraints\n"); +- sio_data->skip_pwm = BIT(1); +- } +- } ++ /* Set values based on DMI matches */ ++ if (dmi_data) ++ sio_data->skip_pwm |= dmi_data->skip_pwm; -diff --git a/drivers/hwmon/emc2305.c b/drivers/hwmon/emc2305.c -index aa1f25add0b6b..f222fcf3b6aa1 100644 ---- a/drivers/hwmon/emc2305.c -+++ b/drivers/hwmon/emc2305.c -@@ -518,7 +518,7 @@ static int emc2305_identify(struct device *dev) - return 0; + exit: + superio_exit(sioaddr); +@@ -3261,8 +3263,10 @@ static int __init it87_device_add(int in + int err; + + err = acpi_check_resource_conflict(&res); +- if (err) +- return err; ++ if (err) { ++ if (!ignore_resource_conflict) ++ return err; ++ } + + pdev = platform_device_alloc(DRVNAME, address); + if (!pdev) +@@ -3295,6 +3299,46 @@ exit_device_put: + return err; } --static int emc2305_probe(struct i2c_client *client, const struct i2c_device_id *id) -+static int emc2305_probe(struct i2c_client *client) ++/* callback function for DMI */ ++static int it87_dmi_cb(const struct dmi_system_id *dmi_entry) ++{ ++ dmi_data = dmi_entry->driver_data; ++ ++ if (dmi_data && dmi_data->skip_pwm) ++ pr_info("Disabling pwm2 due to hardware constraints\n"); ++ ++ return 1; ++} ++ ++/* ++ * On the Shuttle SN68PT, FAN_CTL2 is apparently not ++ * connected to a fan, but to something else. One user ++ * has reported instant system power-off when changing ++ * the PWM2 duty cycle, so we disable it. ++ * I use the board name string as the trigger in case ++ * the same board is ever used in other systems. ++ */ ++static struct it87_dmi_data nvidia_fn68pt = { ++ .skip_pwm = BIT(1), ++}; ++ ++#define IT87_DMI_MATCH_VND(vendor, name, cb, data) \ ++ { \ ++ .callback = cb, \ ++ .matches = { \ ++ DMI_EXACT_MATCH(DMI_BOARD_VENDOR, vendor), \ ++ DMI_EXACT_MATCH(DMI_BOARD_NAME, name), \ ++ }, \ ++ .driver_data = data, \ ++ } ++ ++static const struct dmi_system_id it87_dmi_table[] __initconst = { ++ IT87_DMI_MATCH_VND("nVIDIA", "FN68PT", it87_dmi_cb, &nvidia_fn68pt), ++ { } ++ ++}; ++MODULE_DEVICE_TABLE(dmi, it87_dmi_table); ++ + static int __init sm_it87_init(void) { - struct i2c_adapter *adapter = client->adapter; - struct device *dev = &client->dev; -@@ -607,7 +607,7 @@ static struct i2c_driver emc2305_driver = { - .driver = { - .name = "emc2305", - }, -- .probe = emc2305_probe, -+ .probe_new = emc2305_probe, - .remove = emc2305_remove, - .id_table = emc2305_ids, - .address_list = emc2305_normal_i2c, -diff --git a/drivers/hwmon/ltc2992.c b/drivers/hwmon/ltc2992.c -index 72489d5d7eaf9..88514152d9306 100644 ---- a/drivers/hwmon/ltc2992.c -+++ b/drivers/hwmon/ltc2992.c -@@ -881,7 +881,7 @@ static int ltc2992_parse_dt(struct ltc2992_state *st) - return 0; + int sioaddr[2] = { REG_2E, REG_4E }; +@@ -3307,6 +3351,8 @@ static int __init sm_it87_init(void) + if (err) + return err; + ++ dmi_check_system(it87_dmi_table); ++ + for (i = 0; i < ARRAY_SIZE(sioaddr); i++) { + memset(&sio_data, 0, sizeof(struct it87_sio_data)); + isa_address[i] = 0; +diff -rupN linux-6.1.2.orig/drivers/hwmon/jc42.c linux-6.1.2/drivers/hwmon/jc42.c +--- linux-6.1.2.orig/drivers/hwmon/jc42.c 2022-12-31 16:12:06.938585633 -0500 ++++ linux-6.1.2/drivers/hwmon/jc42.c 2022-12-31 16:19:53.945181044 -0500 +@@ -10,6 +10,7 @@ + */ + + #include ++#include + #include + #include + #include +@@ -37,20 +38,19 @@ static const unsigned short normal_i2c[] + #define JC42_REG_SMBUS 0x22 /* NXP and Atmel, possibly others? */ + + /* Status bits in temperature register */ +-#define JC42_ALARM_CRIT_BIT 15 +-#define JC42_ALARM_MAX_BIT 14 +-#define JC42_ALARM_MIN_BIT 13 ++#define JC42_ALARM_CRIT BIT(15) ++#define JC42_ALARM_MAX BIT(14) ++#define JC42_ALARM_MIN BIT(13) + + /* Configuration register defines */ +-#define JC42_CFG_CRIT_ONLY (1 << 2) +-#define JC42_CFG_TCRIT_LOCK (1 << 6) +-#define JC42_CFG_EVENT_LOCK (1 << 7) +-#define JC42_CFG_SHUTDOWN (1 << 8) +-#define JC42_CFG_HYST_SHIFT 9 +-#define JC42_CFG_HYST_MASK (0x03 << 9) ++#define JC42_CFG_CRIT_ONLY BIT(2) ++#define JC42_CFG_TCRIT_LOCK BIT(6) ++#define JC42_CFG_EVENT_LOCK BIT(7) ++#define JC42_CFG_SHUTDOWN BIT(8) ++#define JC42_CFG_HYST_MASK GENMASK(10, 9) + + /* Capabilities */ +-#define JC42_CAP_RANGE (1 << 2) ++#define JC42_CAP_RANGE BIT(2) + + /* Manufacturer IDs */ + #define ADT_MANID 0x11d4 /* Analog Devices */ +@@ -277,8 +277,8 @@ static int jc42_read(struct device *dev, + break; + + temp = jc42_temp_from_reg(regval); +- hyst = jc42_hysteresis[(data->config & JC42_CFG_HYST_MASK) +- >> JC42_CFG_HYST_SHIFT]; ++ hyst = jc42_hysteresis[FIELD_GET(JC42_CFG_HYST_MASK, ++ data->config)]; + *val = temp - hyst; + break; + case hwmon_temp_crit_hyst: +@@ -288,8 +288,8 @@ static int jc42_read(struct device *dev, + break; + + temp = jc42_temp_from_reg(regval); +- hyst = jc42_hysteresis[(data->config & JC42_CFG_HYST_MASK) +- >> JC42_CFG_HYST_SHIFT]; ++ hyst = jc42_hysteresis[FIELD_GET(JC42_CFG_HYST_MASK, ++ data->config)]; + *val = temp - hyst; + break; + case hwmon_temp_min_alarm: +@@ -297,21 +297,21 @@ static int jc42_read(struct device *dev, + if (ret) + break; + +- *val = (regval >> JC42_ALARM_MIN_BIT) & 1; ++ *val = FIELD_GET(JC42_ALARM_MIN, regval); + break; + case hwmon_temp_max_alarm: + ret = regmap_read(data->regmap, JC42_REG_TEMP, ®val); + if (ret) + break; + +- *val = (regval >> JC42_ALARM_MAX_BIT) & 1; ++ *val = FIELD_GET(JC42_ALARM_MAX, regval); + break; + case hwmon_temp_crit_alarm: + ret = regmap_read(data->regmap, JC42_REG_TEMP, ®val); + if (ret) + break; + +- *val = (regval >> JC42_ALARM_CRIT_BIT) & 1; ++ *val = FIELD_GET(JC42_ALARM_CRIT, regval); + break; + default: + ret = -EOPNOTSUPP; +@@ -370,7 +370,7 @@ static int jc42_write(struct device *dev + hyst = 3; /* 6.0 degrees C */ + } + data->config = (data->config & ~JC42_CFG_HYST_MASK) | +- (hyst << JC42_CFG_HYST_SHIFT); ++ FIELD_PREP(JC42_CFG_HYST_MASK, hyst); + ret = regmap_write(data->regmap, JC42_REG_CONFIG, + data->config); + break; +diff -rupN linux-6.1.2.orig/drivers/hwmon/Kconfig linux-6.1.2/drivers/hwmon/Kconfig +--- linux-6.1.2.orig/drivers/hwmon/Kconfig 2022-12-31 16:12:06.934585693 -0500 ++++ linux-6.1.2/drivers/hwmon/Kconfig 2022-12-31 16:19:53.953180971 -0500 +@@ -67,6 +67,14 @@ config SENSORS_ABITUGURU3 + This driver can also be built as a module. If so, the module + will be called abituguru3. + ++config SENSORS_SMPRO ++ tristate "Ampere's Altra SMpro hardware monitoring driver" ++ depends on MFD_SMPRO ++ help ++ If you say yes here you get support for the thermal, voltage, ++ current and power sensors of Ampere's Altra processor family SoC ++ with SMpro co-processor. ++ + config SENSORS_AD7314 + tristate "Analog Devices AD7314 and compatibles" + depends on SPI +@@ -1608,6 +1616,17 @@ config SENSORS_NZXT_SMART2 + + source "drivers/hwmon/occ/Kconfig" + ++config SENSORS_OXP ++ tristate "OneXPlayer EC fan control" ++ depends on ACPI ++ depends on X86 ++ help ++ If you say yes here you get support for fan readings and control over ++ OneXPlayer handheld devices. Only OneXPlayer mini AMD handheld variant ++ boards are supported. ++ ++ Can also be built as a module. In that case it will be called oxp-sensors. ++ + config SENSORS_PCF8591 + tristate "Philips PCF8591 ADC/DAC" + depends on I2C +diff -rupN linux-6.1.2.orig/drivers/hwmon/lm73.c linux-6.1.2/drivers/hwmon/lm73.c +--- linux-6.1.2.orig/drivers/hwmon/lm73.c 2022-12-31 16:12:06.938585633 -0500 ++++ linux-6.1.2/drivers/hwmon/lm73.c 2022-12-31 16:19:55.385168045 -0500 +@@ -92,7 +92,7 @@ static ssize_t temp_show(struct device * + /* use integer division instead of equivalent right shift to + guarantee arithmetic shift and preserve the sign */ + temp = (((s16) err) * 250) / 32; +- return scnprintf(buf, PAGE_SIZE, "%d\n", temp); ++ return sysfs_emit(buf, "%d\n", temp); } --static int ltc2992_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) -+static int ltc2992_i2c_probe(struct i2c_client *client) - { - struct device *hwmon_dev; - struct ltc2992_state *st; -@@ -927,7 +927,7 @@ static struct i2c_driver ltc2992_i2c_driver = { - .name = "ltc2992", - .of_match_table = ltc2992_of_match, - }, -- .probe = ltc2992_i2c_probe, -+ .probe_new = ltc2992_i2c_probe, - .id_table = ltc2992_i2c_id, - }; + static ssize_t convrate_store(struct device *dev, struct device_attribute *da, +@@ -137,7 +137,7 @@ static ssize_t convrate_show(struct devi + int res; -diff --git a/drivers/hwmon/max127.c b/drivers/hwmon/max127.c -index 402ffdc2f425b..0e21e7e6bbd2e 100644 ---- a/drivers/hwmon/max127.c -+++ b/drivers/hwmon/max127.c -@@ -303,8 +303,7 @@ static const struct hwmon_chip_info max127_chip_info = { - .info = max127_info, - }; - --static int max127_probe(struct i2c_client *client, -- const struct i2c_device_id *id) -+static int max127_probe(struct i2c_client *client) - { - int i; - struct device *hwmon_dev; -@@ -340,7 +339,7 @@ static struct i2c_driver max127_driver = { - .driver = { - .name = "max127", - }, -- .probe = max127_probe, -+ .probe_new = max127_probe, - .id_table = max127_id, - }; - -diff --git a/drivers/hwmon/sbrmi.c b/drivers/hwmon/sbrmi.c -index 7bf0c3fba75fe..8ea5a4d3219ff 100644 ---- a/drivers/hwmon/sbrmi.c -+++ b/drivers/hwmon/sbrmi.c -@@ -297,8 +297,7 @@ static int sbrmi_get_max_pwr_limit(struct sbrmi_data *data) - return ret; + res = (data->ctrl & LM73_CTRL_RES_MASK) >> LM73_CTRL_RES_SHIFT; +- return scnprintf(buf, PAGE_SIZE, "%hu\n", lm73_convrates[res]); ++ return sysfs_emit(buf, "%hu\n", lm73_convrates[res]); } --static int sbrmi_probe(struct i2c_client *client, -- const struct i2c_device_id *id) -+static int sbrmi_probe(struct i2c_client *client) - { - struct device *dev = &client->dev; - struct device *hwmon_dev; -@@ -348,7 +347,7 @@ static struct i2c_driver sbrmi_driver = { - .name = "sbrmi", - .of_match_table = of_match_ptr(sbrmi_of_match), - }, -- .probe = sbrmi_probe, -+ .probe_new = sbrmi_probe, - .id_table = sbrmi_id, - }; + static ssize_t maxmin_alarm_show(struct device *dev, +@@ -154,7 +154,7 @@ static ssize_t maxmin_alarm_show(struct + data->ctrl = ctrl; + mutex_unlock(&data->lock); -diff --git a/drivers/hwmon/sbtsi_temp.c b/drivers/hwmon/sbtsi_temp.c -index e35357c48b8e6..4c37de846f93b 100644 ---- a/drivers/hwmon/sbtsi_temp.c -+++ b/drivers/hwmon/sbtsi_temp.c -@@ -199,8 +199,7 @@ static const struct hwmon_chip_info sbtsi_chip_info = { - .info = sbtsi_info, - }; +- return scnprintf(buf, PAGE_SIZE, "%d\n", (ctrl >> attr->index) & 1); ++ return sysfs_emit(buf, "%d\n", (ctrl >> attr->index) & 1); --static int sbtsi_probe(struct i2c_client *client, -- const struct i2c_device_id *id) -+static int sbtsi_probe(struct i2c_client *client) - { - struct device *dev = &client->dev; - struct device *hwmon_dev; -@@ -239,7 +238,7 @@ static struct i2c_driver sbtsi_driver = { - .name = "sbtsi", - .of_match_table = of_match_ptr(sbtsi_of_match), - }, -- .probe = sbtsi_probe, -+ .probe_new = sbtsi_probe, - .id_table = sbtsi_id, - }; - -diff --git a/drivers/hwmon/sht4x.c b/drivers/hwmon/sht4x.c -index 13ac2d8f22c79..13e042927bf89 100644 ---- a/drivers/hwmon/sht4x.c -+++ b/drivers/hwmon/sht4x.c -@@ -232,8 +232,7 @@ static const struct hwmon_chip_info sht4x_chip_info = { - .info = sht4x_info, - }; - --static int sht4x_probe(struct i2c_client *client, -- const struct i2c_device_id *sht4x_id) -+static int sht4x_probe(struct i2c_client *client) - { - struct device *device = &client->dev; - struct device *hwmon_dev; -@@ -292,7 +291,7 @@ static struct i2c_driver sht4x_driver = { - .name = "sht4x", - .of_match_table = sht4x_of_match, - }, -- .probe = sht4x_probe, -+ .probe_new = sht4x_probe, - .id_table = sht4x_id, - }; - --- -cgit - - -From ad804a4d82fc7ececb457c06c8ba8b3a9d0e3bfd Mon Sep 17 00:00:00 2001 -From: Matti Vaittinen -Date: Fri, 21 Oct 2022 16:18:43 +0300 -Subject: hwmon: (lm90) simplify using devm_regulator_get_enable() - -Drop open-coded pattern: 'devm_regulator_get(), regulator_enable(), -add_action_or_reset(regulator_disable)' and use the -devm_regulator_get_enable(). - -Signed-off-by: Matti Vaittinen -Link: https://lore.kernel.org/r/a1fa4364cbb775de25478117dd22dda0742089e3.1666357434.git.mazziesaccount@gmail.com -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/lm90.c | 20 ++------------------ - 1 file changed, 2 insertions(+), 18 deletions(-) - -diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c -index db595f7d01f8a..a3f95ba00dbff 100644 ---- a/drivers/hwmon/lm90.c -+++ b/drivers/hwmon/lm90.c -@@ -2663,11 +2663,6 @@ static void lm90_remove_pec(void *dev) + abort: + mutex_unlock(&data->lock); +diff -rupN linux-6.1.2.orig/drivers/hwmon/lm90.c linux-6.1.2/drivers/hwmon/lm90.c +--- linux-6.1.2.orig/drivers/hwmon/lm90.c 2022-12-31 16:12:06.938585633 -0500 ++++ linux-6.1.2/drivers/hwmon/lm90.c 2022-12-31 16:19:53.945181044 -0500 +@@ -103,6 +103,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -2663,11 +2664,6 @@ static void lm90_remove_pec(void *dev) device_remove_file(dev, &dev_attr_pec); } @@ -392,7 +1481,7 @@ index db595f7d01f8a..a3f95ba00dbff 100644 static int lm90_probe_channel_from_dt(struct i2c_client *client, struct device_node *child, struct lm90_data *data) -@@ -2749,24 +2744,13 @@ static int lm90_probe(struct i2c_client *client) +@@ -2749,24 +2745,13 @@ static int lm90_probe(struct i2c_client struct device *dev = &client->dev; struct i2c_adapter *adapter = client->adapter; struct hwmon_channel_info *info; @@ -419,133 +1508,39 @@ index db595f7d01f8a..a3f95ba00dbff 100644 data = devm_kzalloc(dev, sizeof(struct lm90_data), GFP_KERNEL); if (!data) --- -cgit - - -From bba63de0c7a7e69584266872cb278cf12fe9ae83 Mon Sep 17 00:00:00 2001 -From: Matti Vaittinen -Date: Fri, 21 Oct 2022 16:19:04 +0300 -Subject: hwmon: (adm1177) simplify using devm_regulator_get_enable() - -Drop open-coded pattern: 'devm_regulator_get(), regulator_enable(), -add_action_or_reset(regulator_disable)' and use the -devm_regulator_get_enable() and drop the pointer to the regulator. -This simplifies code and makes it less tempting to add manual control -for the regulator which is also controlled by devm. - -Signed-off-by: Matti Vaittinen -Link: https://lore.kernel.org/r/7773541795f280db31dd981ffc21df8a630b794a.1666357434.git.mazziesaccount@gmail.com -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/adm1177.c | 27 +++------------------------ - 1 file changed, 3 insertions(+), 24 deletions(-) - -diff --git a/drivers/hwmon/adm1177.c b/drivers/hwmon/adm1177.c -index 0c5dbc5e33b46..be17a26a84f19 100644 ---- a/drivers/hwmon/adm1177.c -+++ b/drivers/hwmon/adm1177.c -@@ -26,14 +26,12 @@ - /** - * struct adm1177_state - driver instance specific data - * @client: pointer to i2c client -- * @reg: regulator info for the power supply of the device - * @r_sense_uohm: current sense resistor value - * @alert_threshold_ua: current limit for shutdown - * @vrange_high: internal voltage divider - */ - struct adm1177_state { - struct i2c_client *client; -- struct regulator *reg; - u32 r_sense_uohm; - u32 alert_threshold_ua; - bool vrange_high; -@@ -189,13 +187,6 @@ static const struct hwmon_chip_info adm1177_chip_info = { - .info = adm1177_info, +diff -rupN linux-6.1.2.orig/drivers/hwmon/ltc2992.c linux-6.1.2/drivers/hwmon/ltc2992.c +--- linux-6.1.2.orig/drivers/hwmon/ltc2992.c 2022-12-31 16:12:06.938585633 -0500 ++++ linux-6.1.2/drivers/hwmon/ltc2992.c 2022-12-31 16:19:46.453248935 -0500 +@@ -881,7 +881,7 @@ static int ltc2992_parse_dt(struct ltc29 + return 0; + } + +-static int ltc2992_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) ++static int ltc2992_i2c_probe(struct i2c_client *client) + { + struct device *hwmon_dev; + struct ltc2992_state *st; +@@ -927,7 +927,7 @@ static struct i2c_driver ltc2992_i2c_dri + .name = "ltc2992", + .of_match_table = ltc2992_of_match, + }, +- .probe = ltc2992_i2c_probe, ++ .probe_new = ltc2992_i2c_probe, + .id_table = ltc2992_i2c_id, }; --static void adm1177_remove(void *data) --{ -- struct adm1177_state *st = data; -- -- regulator_disable(st->reg); --} -- - static int adm1177_probe(struct i2c_client *client) - { - struct device *dev = &client->dev; -@@ -210,21 +201,9 @@ static int adm1177_probe(struct i2c_client *client) - - st->client = client; - -- st->reg = devm_regulator_get_optional(&client->dev, "vref"); -- if (IS_ERR(st->reg)) { -- if (PTR_ERR(st->reg) == -EPROBE_DEFER) -- return -EPROBE_DEFER; -- -- st->reg = NULL; -- } else { -- ret = regulator_enable(st->reg); -- if (ret) -- return ret; -- ret = devm_add_action_or_reset(&client->dev, adm1177_remove, -- st); -- if (ret) -- return ret; -- } -+ ret = devm_regulator_get_enable_optional(&client->dev, "vref"); -+ if (ret == -EPROBE_DEFER) -+ return -EPROBE_DEFER; - - if (device_property_read_u32(dev, "shunt-resistor-micro-ohms", - &st->r_sense_uohm)) --- -cgit - - -From 7bce898147000718084c842e150519319dc202c6 Mon Sep 17 00:00:00 2001 -From: Quan Nguyen -Date: Thu, 29 Sep 2022 16:43:13 +0700 -Subject: hwmon: Add Ampere's Altra smpro-hwmon driver - -This commit adds support for Ampere SMpro hwmon driver. This driver -supports accessing various CPU sensors provided by the SMpro co-processor -including temperature, power, voltages, and current. - -Signed-off-by: Quan Nguyen -Link: https://lore.kernel.org/r/20220929094321.770125-2-quan@os.amperecomputing.com -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/Kconfig | 8 + - drivers/hwmon/Makefile | 1 + - drivers/hwmon/smpro-hwmon.c | 463 ++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 472 insertions(+) - create mode 100644 drivers/hwmon/smpro-hwmon.c - -diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig -index 7ac3daaf59ce0..e7ec6af309c79 100644 ---- a/drivers/hwmon/Kconfig -+++ b/drivers/hwmon/Kconfig -@@ -67,6 +67,14 @@ config SENSORS_ABITUGURU3 - This driver can also be built as a module. If so, the module - will be called abituguru3. - -+config SENSORS_SMPRO -+ tristate "Ampere's Altra SMpro hardware monitoring driver" -+ depends on MFD_SMPRO -+ help -+ If you say yes here you get support for the thermal, voltage, -+ current and power sensors of Ampere's Altra processor family SoC -+ with SMpro co-processor. -+ - config SENSORS_AD7314 - tristate "Analog Devices AD7314 and compatibles" - depends on SPI -diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile -index 11d076cad8a2d..c5cd7e3a67ffd 100644 ---- a/drivers/hwmon/Makefile -+++ b/drivers/hwmon/Makefile -@@ -187,6 +187,7 @@ obj-$(CONFIG_SENSORS_SHT4x) += sht4x.o +diff -rupN linux-6.1.2.orig/drivers/hwmon/Makefile linux-6.1.2/drivers/hwmon/Makefile +--- linux-6.1.2.orig/drivers/hwmon/Makefile 2022-12-31 16:12:06.934585693 -0500 ++++ linux-6.1.2/drivers/hwmon/Makefile 2022-12-31 16:19:53.953180971 -0500 +@@ -167,6 +167,7 @@ obj-$(CONFIG_SENSORS_NSA320) += nsa320-h + obj-$(CONFIG_SENSORS_NTC_THERMISTOR) += ntc_thermistor.o + obj-$(CONFIG_SENSORS_NZXT_KRAKEN2) += nzxt-kraken2.o + obj-$(CONFIG_SENSORS_NZXT_SMART2) += nzxt-smart2.o ++obj-$(CONFIG_SENSORS_OXP) += oxp-sensors.o + obj-$(CONFIG_SENSORS_PC87360) += pc87360.o + obj-$(CONFIG_SENSORS_PC87427) += pc87427.o + obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o +@@ -187,6 +188,7 @@ obj-$(CONFIG_SENSORS_SHT4x) += sht4x.o obj-$(CONFIG_SENSORS_SHTC1) += shtc1.o obj-$(CONFIG_SENSORS_SIS5595) += sis5595.o obj-$(CONFIG_SENSORS_SMM665) += smm665.o @@ -553,12 +1548,649 @@ index 11d076cad8a2d..c5cd7e3a67ffd 100644 obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o -diff --git a/drivers/hwmon/smpro-hwmon.c b/drivers/hwmon/smpro-hwmon.c -new file mode 100644 -index 0000000000000..ee54e21c2c123 ---- /dev/null -+++ b/drivers/hwmon/smpro-hwmon.c -@@ -0,0 +1,463 @@ +diff -rupN linux-6.1.2.orig/drivers/hwmon/max127.c linux-6.1.2/drivers/hwmon/max127.c +--- linux-6.1.2.orig/drivers/hwmon/max127.c 2022-12-31 16:12:06.938585633 -0500 ++++ linux-6.1.2/drivers/hwmon/max127.c 2022-12-31 16:19:46.453248935 -0500 +@@ -303,8 +303,7 @@ static const struct hwmon_chip_info max1 + .info = max127_info, + }; + +-static int max127_probe(struct i2c_client *client, +- const struct i2c_device_id *id) ++static int max127_probe(struct i2c_client *client) + { + int i; + struct device *hwmon_dev; +@@ -340,7 +339,7 @@ static struct i2c_driver max127_driver = + .driver = { + .name = "max127", + }, +- .probe = max127_probe, ++ .probe_new = max127_probe, + .id_table = max127_id, + }; + +diff -rupN linux-6.1.2.orig/drivers/hwmon/mr75203.c linux-6.1.2/drivers/hwmon/mr75203.c +--- linux-6.1.2.orig/drivers/hwmon/mr75203.c 2022-12-31 16:12:06.938585633 -0500 ++++ linux-6.1.2/drivers/hwmon/mr75203.c 2022-12-31 16:19:53.945181044 -0500 +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + #include + #include + #include +diff -rupN linux-6.1.2.orig/drivers/hwmon/occ/Kconfig linux-6.1.2/drivers/hwmon/occ/Kconfig +--- linux-6.1.2.orig/drivers/hwmon/occ/Kconfig 2022-12-31 16:12:06.938585633 -0500 ++++ linux-6.1.2/drivers/hwmon/occ/Kconfig 2022-12-31 16:19:46.457248898 -0500 +@@ -6,7 +6,6 @@ + config SENSORS_OCC_P8_I2C + tristate "POWER8 OCC through I2C" + depends on I2C +- depends on ARM || ARM64 || COMPILE_TEST + select SENSORS_OCC + help + This option enables support for monitoring sensors provided by the +@@ -21,7 +20,6 @@ config SENSORS_OCC_P8_I2C + config SENSORS_OCC_P9_SBE + tristate "POWER9 OCC through SBE" + depends on FSI_OCC +- depends on ARM || ARM64 || COMPILE_TEST + select SENSORS_OCC + help + This option enables support for monitoring sensors provided by the +diff -rupN linux-6.1.2.orig/drivers/hwmon/oxp-sensors.c linux-6.1.2/drivers/hwmon/oxp-sensors.c +--- linux-6.1.2.orig/drivers/hwmon/oxp-sensors.c 1969-12-31 19:00:00.000000000 -0500 ++++ linux-6.1.2/drivers/hwmon/oxp-sensors.c 2022-12-31 16:19:55.385168045 -0500 +@@ -0,0 +1,284 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Platform driver for OXP Handhelds that expose fan reading and control ++ * via hwmon sysfs. ++ * ++ * Old boards have the same DMI strings and they are told appart by the ++ * boot cpu vendor (Intel/AMD). Currently only AMD boards are supported ++ * but the code is made to be simple to add other handheld boards in the ++ * future. ++ * Fan control is provided via pwm interface in the range [0-255]. ++ * Old AMD boards use [0-100] as range in the EC, the written value is ++ * scaled to accommodate for that. Newer boards like the mini PRO and ++ * AOK ZOE are not scaled but have the same EC layout. ++ * ++ * Copyright (C) 2022 Joaquín I. Aramendía ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* Handle ACPI lock mechanism */ ++static u32 oxp_mutex; ++ ++#define ACPI_LOCK_DELAY_MS 500 ++ ++static bool lock_global_acpi_lock(void) ++{ ++ return ACPI_SUCCESS(acpi_acquire_global_lock(ACPI_LOCK_DELAY_MS, &oxp_mutex)); ++} ++ ++static bool unlock_global_acpi_lock(void) ++{ ++ return ACPI_SUCCESS(acpi_release_global_lock(oxp_mutex)); ++} ++ ++enum oxp_board { ++ aok_zoe_a1 = 1, ++ oxp_mini_amd, ++ oxp_mini_amd_pro, ++}; ++ ++static enum oxp_board board; ++ ++#define OXP_SENSOR_FAN_REG 0x76 /* Fan reading is 2 registers long */ ++#define OXP_SENSOR_PWM_ENABLE_REG 0x4A /* PWM enable is 1 register long */ ++#define OXP_SENSOR_PWM_REG 0x4B /* PWM reading is 1 register long */ ++ ++static const struct dmi_system_id dmi_table[] = { ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "AOKZOE"), ++ DMI_EXACT_MATCH(DMI_BOARD_NAME, "AOKZOE A1 AR07"), ++ }, ++ .driver_data = (void *) &(enum oxp_board) {aok_zoe_a1}, ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"), ++ DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONE XPLAYER"), ++ }, ++ .driver_data = (void *) &(enum oxp_board) {oxp_mini_amd}, ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"), ++ DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONEXPLAYER Mini Pro"), ++ }, ++ .driver_data = (void *) &(enum oxp_board) {oxp_mini_amd_pro}, ++ }, ++ {}, ++}; ++ ++/* Helper functions to handle EC read/write */ ++static int read_from_ec(u8 reg, int size, long *val) ++{ ++ int i; ++ int ret; ++ u8 buffer; ++ ++ if (!lock_global_acpi_lock()) ++ return -EBUSY; ++ ++ *val = 0; ++ for (i = 0; i < size; i++) { ++ ret = ec_read(reg + i, &buffer); ++ if (ret) ++ return ret; ++ *val <<= i * 8; ++ *val += buffer; ++ } ++ ++ if (!unlock_global_acpi_lock()) ++ return -EBUSY; ++ ++ return 0; ++} ++ ++static int write_to_ec(const struct device *dev, u8 reg, u8 value) ++{ ++ int ret; ++ ++ if (!lock_global_acpi_lock()) ++ return -EBUSY; ++ ++ ret = ec_write(reg, value); ++ ++ if (!unlock_global_acpi_lock()) ++ return -EBUSY; ++ ++ return ret; ++} ++ ++static int oxp_pwm_enable(const struct device *dev) ++{ ++ return write_to_ec(dev, OXP_SENSOR_PWM_ENABLE_REG, 0x01); ++} ++ ++static int oxp_pwm_disable(const struct device *dev) ++{ ++ return write_to_ec(dev, OXP_SENSOR_PWM_ENABLE_REG, 0x00); ++} ++ ++/* Callbacks for hwmon interface */ ++static umode_t oxp_ec_hwmon_is_visible(const void *drvdata, ++ enum hwmon_sensor_types type, u32 attr, int channel) ++{ ++ switch (type) { ++ case hwmon_fan: ++ return 0444; ++ case hwmon_pwm: ++ return 0644; ++ default: ++ return 0; ++ } ++} ++ ++static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type, ++ u32 attr, int channel, long *val) ++{ ++ int ret; ++ ++ switch (type) { ++ case hwmon_fan: ++ switch (attr) { ++ case hwmon_fan_input: ++ return read_from_ec(OXP_SENSOR_FAN_REG, 2, val); ++ default: ++ break; ++ } ++ break; ++ case hwmon_pwm: ++ switch (attr) { ++ case hwmon_pwm_input: ++ ret = read_from_ec(OXP_SENSOR_PWM_REG, 1, val); ++ if (ret) ++ return ret; ++ if (board == oxp_mini_amd) ++ *val = (*val * 255) / 100; ++ return 0; ++ case hwmon_pwm_enable: ++ return read_from_ec(OXP_SENSOR_PWM_ENABLE_REG, 1, val); ++ default: ++ break; ++ } ++ break; ++ default: ++ break; ++ } ++ return -EOPNOTSUPP; ++} ++ ++static int oxp_platform_write(struct device *dev, enum hwmon_sensor_types type, ++ u32 attr, int channel, long val) ++{ ++ switch (type) { ++ case hwmon_pwm: ++ switch (attr) { ++ case hwmon_pwm_enable: ++ if (val == 1) ++ return oxp_pwm_enable(dev); ++ else if (val == 0) ++ return oxp_pwm_disable(dev); ++ return -EINVAL; ++ case hwmon_pwm_input: ++ if (val < 0 || val > 255) ++ return -EINVAL; ++ if (board == oxp_mini_amd) ++ val = (val * 100) / 255; ++ return write_to_ec(dev, OXP_SENSOR_PWM_REG, val); ++ default: ++ break; ++ } ++ break; ++ default: ++ break; ++ } ++ return -EOPNOTSUPP; ++} ++ ++/* Known sensors in the OXP EC controllers */ ++static const struct hwmon_channel_info *oxp_platform_sensors[] = { ++ HWMON_CHANNEL_INFO(fan, ++ HWMON_F_INPUT), ++ HWMON_CHANNEL_INFO(pwm, ++ HWMON_PWM_INPUT | HWMON_PWM_ENABLE), ++ NULL, ++}; ++ ++static const struct hwmon_ops oxp_ec_hwmon_ops = { ++ .is_visible = oxp_ec_hwmon_is_visible, ++ .read = oxp_platform_read, ++ .write = oxp_platform_write, ++}; ++ ++static const struct hwmon_chip_info oxp_ec_chip_info = { ++ .ops = &oxp_ec_hwmon_ops, ++ .info = oxp_platform_sensors, ++}; ++ ++/* Initialization logic */ ++static int oxp_platform_probe(struct platform_device *pdev) ++{ ++ const struct dmi_system_id *dmi_entry; ++ struct device *dev = &pdev->dev; ++ struct device *hwdev; ++ ++ /* ++ * Have to check for AMD processor here because DMI strings are the ++ * same between Intel and AMD boards, the only way to tell them appart ++ * is the CPU. ++ * Intel boards seem to have different EC registers and values to ++ * read/write. ++ */ ++ dmi_entry = dmi_first_match(dmi_table); ++ if (!dmi_entry || boot_cpu_data.x86_vendor != X86_VENDOR_AMD) ++ return -ENODEV; ++ ++ board = *((enum oxp_board *) dmi_entry->driver_data); ++ ++ hwdev = devm_hwmon_device_register_with_info(dev, "oxpec", NULL, ++ &oxp_ec_chip_info, NULL); ++ ++ return PTR_ERR_OR_ZERO(hwdev); ++} ++ ++static struct platform_driver oxp_platform_driver = { ++ .driver = { ++ .name = "oxp-platform", ++ }, ++ .probe = oxp_platform_probe, ++}; ++ ++static struct platform_device *oxp_platform_device; ++ ++static int __init oxp_platform_init(void) ++{ ++ oxp_platform_device = ++ platform_create_bundle(&oxp_platform_driver, ++ oxp_platform_probe, NULL, 0, NULL, 0); ++ ++ return PTR_ERR_OR_ZERO(oxp_platform_device); ++} ++ ++static void __exit oxp_platform_exit(void) ++{ ++ platform_device_unregister(oxp_platform_device); ++ platform_driver_unregister(&oxp_platform_driver); ++} ++ ++MODULE_DEVICE_TABLE(dmi, dmi_table); ++ ++module_init(oxp_platform_init); ++module_exit(oxp_platform_exit); ++ ++MODULE_AUTHOR("Joaquín Ignacio Aramendía "); ++MODULE_DESCRIPTION("Platform driver that handles EC sensors of OneXPlayer devices"); ++MODULE_LICENSE("GPL"); +diff -rupN linux-6.1.2.orig/drivers/hwmon/pcf8591.c linux-6.1.2/drivers/hwmon/pcf8591.c +--- linux-6.1.2.orig/drivers/hwmon/pcf8591.c 2022-12-31 16:12:06.938585633 -0500 ++++ linux-6.1.2/drivers/hwmon/pcf8591.c 2022-12-31 16:19:53.949181008 -0500 +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + + /* Insmod parameters */ + +diff -rupN linux-6.1.2.orig/drivers/hwmon/pmbus/ltc2978.c linux-6.1.2/drivers/hwmon/pmbus/ltc2978.c +--- linux-6.1.2.orig/drivers/hwmon/pmbus/ltc2978.c 2022-12-31 16:12:06.942585573 -0500 ++++ linux-6.1.2/drivers/hwmon/pmbus/ltc2978.c 2022-12-31 16:19:53.945181044 -0500 +@@ -23,7 +23,7 @@ enum chips { + /* Managers */ + ltc2972, ltc2974, ltc2975, ltc2977, ltc2978, ltc2979, ltc2980, + /* Controllers */ +- ltc3880, ltc3882, ltc3883, ltc3884, ltc3886, ltc3887, ltc3889, ltc7880, ++ ltc3880, ltc3882, ltc3883, ltc3884, ltc3886, ltc3887, ltc3889, ltc7132, ltc7880, + /* Modules */ + ltm2987, ltm4664, ltm4675, ltm4676, ltm4677, ltm4678, ltm4680, ltm4686, + ltm4700, +@@ -45,15 +45,14 @@ enum chips { + #define LTC2974_MFR_IOUT_PEAK 0xd7 + #define LTC2974_MFR_IOUT_MIN 0xd8 + +-/* LTC3880, LTC3882, LTC3883, LTC3887, LTM4675, and LTM4676 */ ++/* LTC3880, LTC3882, LTC3883, LTC3887, LTM4675, LTM4676, LTC7132 */ + #define LTC3880_MFR_IOUT_PEAK 0xd7 + #define LTC3880_MFR_CLEAR_PEAKS 0xe3 + #define LTC3880_MFR_TEMPERATURE2_PEAK 0xf4 + +-/* LTC3883, LTC3884, LTC3886, LTC3889 and LTC7880 only */ ++/* LTC3883, LTC3884, LTC3886, LTC3889, LTC7132, LTC7880 */ + #define LTC3883_MFR_IIN_PEAK 0xe1 + +- + /* LTC2975 only */ + #define LTC2975_MFR_IIN_PEAK 0xc4 + #define LTC2975_MFR_IIN_MIN 0xc5 +@@ -79,10 +78,11 @@ enum chips { + #define LTC3884_ID 0x4C00 + #define LTC3886_ID 0x4600 + #define LTC3887_ID 0x4700 +-#define LTM2987_ID_A 0x8010 /* A/B for two die IDs */ +-#define LTM2987_ID_B 0x8020 + #define LTC3889_ID 0x4900 ++#define LTC7132_ID 0x4CE0 + #define LTC7880_ID 0x49E0 ++#define LTM2987_ID_A 0x8010 /* A/B for two die IDs */ ++#define LTM2987_ID_B 0x8020 + #define LTM4664_ID 0x4120 + #define LTM4675_ID 0x47a0 + #define LTM4676_ID_REV1 0x4400 +@@ -547,6 +547,7 @@ static const struct i2c_device_id ltc297 + {"ltc3886", ltc3886}, + {"ltc3887", ltc3887}, + {"ltc3889", ltc3889}, ++ {"ltc7132", ltc7132}, + {"ltc7880", ltc7880}, + {"ltm2987", ltm2987}, + {"ltm4664", ltm4664}, +@@ -651,6 +652,8 @@ static int ltc2978_get_id(struct i2c_cli + return ltc3887; + else if (chip_id == LTC3889_ID) + return ltc3889; ++ else if (chip_id == LTC7132_ID) ++ return ltc7132; + else if (chip_id == LTC7880_ID) + return ltc7880; + else if (chip_id == LTM2987_ID_A || chip_id == LTM2987_ID_B) +@@ -831,6 +834,7 @@ static int ltc2978_probe(struct i2c_clie + case ltc3884: + case ltc3886: + case ltc3889: ++ case ltc7132: + case ltc7880: + case ltm4664: + case ltm4678: +@@ -902,6 +906,7 @@ static const struct of_device_id ltc2978 + { .compatible = "lltc,ltc3886" }, + { .compatible = "lltc,ltc3887" }, + { .compatible = "lltc,ltc3889" }, ++ { .compatible = "lltc,ltc7132" }, + { .compatible = "lltc,ltc7880" }, + { .compatible = "lltc,ltm2987" }, + { .compatible = "lltc,ltm4664" }, +diff -rupN linux-6.1.2.orig/drivers/hwmon/pmbus/pmbus_core.c linux-6.1.2/drivers/hwmon/pmbus/pmbus_core.c +--- linux-6.1.2.orig/drivers/hwmon/pmbus/pmbus_core.c 2022-12-31 16:12:06.942585573 -0500 ++++ linux-6.1.2/drivers/hwmon/pmbus/pmbus_core.c 2022-12-31 16:19:55.381168081 -0500 +@@ -2827,9 +2827,13 @@ static int pmbus_regulator_get_error_fla + if (status < 0) + return status; + +- if (pmbus_regulator_is_enabled(rdev) && (status & PB_STATUS_OFF)) +- *flags |= REGULATOR_ERROR_FAIL; ++ if (pmbus_regulator_is_enabled(rdev)) { ++ if (status & PB_STATUS_OFF) ++ *flags |= REGULATOR_ERROR_FAIL; + ++ if (status & PB_STATUS_POWER_GOOD_N) ++ *flags |= REGULATOR_ERROR_REGULATION_OUT; ++ } + /* + * Unlike most other status bits, PB_STATUS_{IOUT_OC,VOUT_OV} are + * defined strictly as fault indicators (not warnings). +@@ -2851,6 +2855,49 @@ static int pmbus_regulator_get_error_fla + return 0; + } + ++static int pmbus_regulator_get_status(struct regulator_dev *rdev) ++{ ++ struct device *dev = rdev_get_dev(rdev); ++ struct i2c_client *client = to_i2c_client(dev->parent); ++ struct pmbus_data *data = i2c_get_clientdata(client); ++ u8 page = rdev_get_id(rdev); ++ int status, ret; ++ ++ mutex_lock(&data->update_lock); ++ status = pmbus_get_status(client, page, PMBUS_STATUS_WORD); ++ if (status < 0) { ++ ret = status; ++ goto unlock; ++ } ++ ++ if (status & PB_STATUS_OFF) { ++ ret = REGULATOR_STATUS_OFF; ++ goto unlock; ++ } ++ ++ /* If regulator is ON & reports power good then return ON */ ++ if (!(status & PB_STATUS_POWER_GOOD_N)) { ++ ret = REGULATOR_STATUS_ON; ++ goto unlock; ++ } ++ ++ ret = pmbus_regulator_get_error_flags(rdev, &status); ++ if (ret) ++ goto unlock; ++ ++ if (status & (REGULATOR_ERROR_UNDER_VOLTAGE | REGULATOR_ERROR_OVER_CURRENT | ++ REGULATOR_ERROR_REGULATION_OUT | REGULATOR_ERROR_FAIL | REGULATOR_ERROR_OVER_TEMP)) { ++ ret = REGULATOR_STATUS_ERROR; ++ goto unlock; ++ } ++ ++ ret = REGULATOR_STATUS_UNDEFINED; ++ ++unlock: ++ mutex_unlock(&data->update_lock); ++ return ret; ++} ++ + static int pmbus_regulator_get_low_margin(struct i2c_client *client, int page) + { + struct pmbus_data *data = i2c_get_clientdata(client); +@@ -2991,6 +3038,7 @@ const struct regulator_ops pmbus_regulat + .disable = pmbus_regulator_disable, + .is_enabled = pmbus_regulator_is_enabled, + .get_error_flags = pmbus_regulator_get_error_flags, ++ .get_status = pmbus_regulator_get_status, + .get_voltage = pmbus_regulator_get_voltage, + .set_voltage = pmbus_regulator_set_voltage, + .list_voltage = pmbus_regulator_list_voltage, +diff -rupN linux-6.1.2.orig/drivers/hwmon/pmbus/q54sj108a2.c linux-6.1.2/drivers/hwmon/pmbus/q54sj108a2.c +--- linux-6.1.2.orig/drivers/hwmon/pmbus/q54sj108a2.c 2022-12-31 16:12:06.942585573 -0500 ++++ linux-6.1.2/drivers/hwmon/pmbus/q54sj108a2.c 2022-12-31 16:19:53.949181008 -0500 +@@ -8,6 +8,7 @@ + + #include + #include ++#include + #include + #include + #include "pmbus.h" +diff -rupN linux-6.1.2.orig/drivers/hwmon/sbrmi.c linux-6.1.2/drivers/hwmon/sbrmi.c +--- linux-6.1.2.orig/drivers/hwmon/sbrmi.c 2022-12-31 16:12:06.942585573 -0500 ++++ linux-6.1.2/drivers/hwmon/sbrmi.c 2022-12-31 16:19:46.453248935 -0500 +@@ -297,8 +297,7 @@ static int sbrmi_get_max_pwr_limit(struc + return ret; + } + +-static int sbrmi_probe(struct i2c_client *client, +- const struct i2c_device_id *id) ++static int sbrmi_probe(struct i2c_client *client) + { + struct device *dev = &client->dev; + struct device *hwmon_dev; +@@ -348,7 +347,7 @@ static struct i2c_driver sbrmi_driver = + .name = "sbrmi", + .of_match_table = of_match_ptr(sbrmi_of_match), + }, +- .probe = sbrmi_probe, ++ .probe_new = sbrmi_probe, + .id_table = sbrmi_id, + }; + +diff -rupN linux-6.1.2.orig/drivers/hwmon/sbtsi_temp.c linux-6.1.2/drivers/hwmon/sbtsi_temp.c +--- linux-6.1.2.orig/drivers/hwmon/sbtsi_temp.c 2022-12-31 16:12:06.942585573 -0500 ++++ linux-6.1.2/drivers/hwmon/sbtsi_temp.c 2022-12-31 16:19:46.453248935 -0500 +@@ -199,8 +199,7 @@ static const struct hwmon_chip_info sbts + .info = sbtsi_info, + }; + +-static int sbtsi_probe(struct i2c_client *client, +- const struct i2c_device_id *id) ++static int sbtsi_probe(struct i2c_client *client) + { + struct device *dev = &client->dev; + struct device *hwmon_dev; +@@ -239,7 +238,7 @@ static struct i2c_driver sbtsi_driver = + .name = "sbtsi", + .of_match_table = of_match_ptr(sbtsi_of_match), + }, +- .probe = sbtsi_probe, ++ .probe_new = sbtsi_probe, + .id_table = sbtsi_id, + }; + +diff -rupN linux-6.1.2.orig/drivers/hwmon/sht3x.c linux-6.1.2/drivers/hwmon/sht3x.c +--- linux-6.1.2.orig/drivers/hwmon/sht3x.c 2022-12-31 16:12:06.942585573 -0500 ++++ linux-6.1.2/drivers/hwmon/sht3x.c 2022-12-31 16:19:55.385168045 -0500 +@@ -320,7 +320,7 @@ static ssize_t temp1_limit_show(struct d + u8 index = to_sensor_dev_attr(attr)->index; + int temperature_limit = data->temperature_limits[index]; + +- return scnprintf(buf, PAGE_SIZE, "%d\n", temperature_limit); ++ return sysfs_emit(buf, "%d\n", temperature_limit); + } + + static ssize_t humidity1_limit_show(struct device *dev, +@@ -331,7 +331,7 @@ static ssize_t humidity1_limit_show(stru + u8 index = to_sensor_dev_attr(attr)->index; + u32 humidity_limit = data->humidity_limits[index]; + +- return scnprintf(buf, PAGE_SIZE, "%u\n", humidity_limit); ++ return sysfs_emit(buf, "%u\n", humidity_limit); + } + + /* +@@ -483,7 +483,7 @@ static ssize_t temp1_alarm_show(struct d + if (ret) + return ret; + +- return scnprintf(buf, PAGE_SIZE, "%d\n", !!(buffer[0] & 0x04)); ++ return sysfs_emit(buf, "%d\n", !!(buffer[0] & 0x04)); + } + + static ssize_t humidity1_alarm_show(struct device *dev, +@@ -498,7 +498,7 @@ static ssize_t humidity1_alarm_show(stru + if (ret) + return ret; + +- return scnprintf(buf, PAGE_SIZE, "%d\n", !!(buffer[0] & 0x08)); ++ return sysfs_emit(buf, "%d\n", !!(buffer[0] & 0x08)); + } + + static ssize_t heater_enable_show(struct device *dev, +@@ -513,7 +513,7 @@ static ssize_t heater_enable_show(struct + if (ret) + return ret; + +- return scnprintf(buf, PAGE_SIZE, "%d\n", !!(buffer[0] & 0x20)); ++ return sysfs_emit(buf, "%d\n", !!(buffer[0] & 0x20)); + } + + static ssize_t heater_enable_store(struct device *dev, +@@ -550,7 +550,7 @@ static ssize_t update_interval_show(stru + { + struct sht3x_data *data = dev_get_drvdata(dev); + +- return scnprintf(buf, PAGE_SIZE, "%u\n", ++ return sysfs_emit(buf, "%u\n", + mode_to_update_interval[data->mode]); + } + +diff -rupN linux-6.1.2.orig/drivers/hwmon/sht4x.c linux-6.1.2/drivers/hwmon/sht4x.c +--- linux-6.1.2.orig/drivers/hwmon/sht4x.c 2022-12-31 16:12:06.942585573 -0500 ++++ linux-6.1.2/drivers/hwmon/sht4x.c 2022-12-31 16:19:46.457248898 -0500 +@@ -232,8 +232,7 @@ static const struct hwmon_chip_info sht4 + .info = sht4x_info, + }; + +-static int sht4x_probe(struct i2c_client *client, +- const struct i2c_device_id *sht4x_id) ++static int sht4x_probe(struct i2c_client *client) + { + struct device *device = &client->dev; + struct device *hwmon_dev; +@@ -292,7 +291,7 @@ static struct i2c_driver sht4x_driver = + .name = "sht4x", + .of_match_table = sht4x_of_match, + }, +- .probe = sht4x_probe, ++ .probe_new = sht4x_probe, + .id_table = sht4x_id, + }; + +diff -rupN linux-6.1.2.orig/drivers/hwmon/smpro-hwmon.c linux-6.1.2/drivers/hwmon/smpro-hwmon.c +--- linux-6.1.2.orig/drivers/hwmon/smpro-hwmon.c 1969-12-31 19:00:00.000000000 -0500 ++++ linux-6.1.2/drivers/hwmon/smpro-hwmon.c 2022-12-31 16:19:53.945181044 -0500 +@@ -0,0 +1,466 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Ampere Computing SoC's SMPro Hardware Monitoring Driver @@ -934,8 +2566,11 @@ index 0000000000000..ee54e21c2c123 + ret = regmap_read(hwmon->regmap, temperature[channel].reg, &value); + if (ret || value == 0xFFFF) + return 0; -+ break; ++ break; ++ default: ++ break; + } ++ break; + default: + break; + } @@ -1022,2408 +2657,9 @@ index 0000000000000..ee54e21c2c123 +MODULE_AUTHOR("Quan Nguyen "); +MODULE_DESCRIPTION("Ampere Altra SMPro hwmon driver"); +MODULE_LICENSE("GPL"); --- -cgit - - -From 694144b215fc077087d68dfc3d1ef7dae9fec387 Mon Sep 17 00:00:00 2001 -From: Quan Nguyen -Date: Thu, 29 Sep 2022 16:43:14 +0700 -Subject: docs: hwmon: (smpro-hwmon) Add documentation - -Add documentation for the Ampere(R)'s Altra(R) SMpro hwmon driver. - -Signed-off-by: Thu Nguyen -Signed-off-by: Quan Nguyen -Link: https://lore.kernel.org/r/20220929094321.770125-3-quan@os.amperecomputing.com -Signed-off-by: Guenter Roeck ---- - Documentation/hwmon/index.rst | 1 + - Documentation/hwmon/smpro-hwmon.rst | 101 ++++++++++++++++++++++++++++++++++++ - 2 files changed, 102 insertions(+) - create mode 100644 Documentation/hwmon/smpro-hwmon.rst - -diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst -index c1d11cf13eef1..ddff3c5713d74 100644 ---- a/Documentation/hwmon/index.rst -+++ b/Documentation/hwmon/index.rst -@@ -187,6 +187,7 @@ Hardware Monitoring Kernel Drivers - sis5595 - sl28cpld - smm665 -+ smpro-hwmon - smsc47b397 - smsc47m192 - smsc47m1 -diff --git a/Documentation/hwmon/smpro-hwmon.rst b/Documentation/hwmon/smpro-hwmon.rst -new file mode 100644 -index 0000000000000..3a9b14dacf897 ---- /dev/null -+++ b/Documentation/hwmon/smpro-hwmon.rst -@@ -0,0 +1,101 @@ -+.. SPDX-License-Identifier: GPL-2.0-only -+ -+Kernel driver Ampere(R)'s Altra(R) SMpro hwmon -+============================================== -+ -+Supported chips: -+ -+ * Ampere(R) Altra(R) -+ -+ Prefix: 'smpro' -+ -+ Reference: Altra SoC BMC Interface Specification -+ -+Author: Thu Nguyen -+ -+Description -+----------- -+This driver supports hardware monitoring for Ampere(R) Altra(R) SoC's based on the -+SMpro co-processor (SMpro). -+The following sensor types are supported by the driver: -+ -+ * temperature -+ * voltage -+ * current -+ * power -+ -+The SMpro interface provides the registers to query the various sensors and -+their values which are then exported to userspace by this driver. -+ -+Usage Notes -+----------- -+ -+SMpro hwmon driver creates at least two sysfs files for each sensor. -+ -+* File ``_label`` reports the sensor label. -+* File ``_input`` returns the sensor value. -+ -+The sysfs files are allocated in the SMpro root fs folder. -+There is one root folder for each SMpro instance. -+ -+When the SoC is turned off, the driver will fail to read registers -+and return -ENXIO. -+ -+Sysfs entries -+------------- -+ -+The following sysfs files are supported: -+ -+* Ampere(R) Altra(R): -+ -+============ ============= ====== =============================================== -+Name Unit Perm Description -+temp1_input milli Celsius RO SoC temperature -+temp2_input milli Celsius RO Max temperature reported among SoC VRDs -+temp2_crit milli Celsius RO SoC VRD HOT Threshold temperature -+temp3_input milli Celsius RO Max temperature reported among DIMM VRDs -+temp4_input milli Celsius RO Max temperature reported among Core VRDs -+temp5_input milli Celsius RO Temperature of DIMM0 on CH0 -+temp5_crit milli Celsius RO MEM HOT Threshold for all DIMMs -+temp6_input milli Celsius RO Temperature of DIMM0 on CH1 -+temp6_crit milli Celsius RO MEM HOT Threshold for all DIMMs -+temp7_input milli Celsius RO Temperature of DIMM0 on CH2 -+temp7_crit milli Celsius RO MEM HOT Threshold for all DIMMs -+temp8_input milli Celsius RO Temperature of DIMM0 on CH3 -+temp8_crit milli Celsius RO MEM HOT Threshold for all DIMMs -+temp9_input milli Celsius RO Temperature of DIMM0 on CH4 -+temp9_crit milli Celsius RO MEM HOT Threshold for all DIMMs -+temp10_input milli Celsius RO Temperature of DIMM0 on CH5 -+temp10_crit milli Celsius RO MEM HOT Threshold for all DIMMs -+temp11_input milli Celsius RO Temperature of DIMM0 on CH6 -+temp11_crit milli Celsius RO MEM HOT Threshold for all DIMMs -+temp12_input milli Celsius RO Temperature of DIMM0 on CH7 -+temp12_crit milli Celsius RO MEM HOT Threshold for all DIMMs -+temp13_input milli Celsius RO Max temperature reported among RCA VRDs -+in0_input milli Volts RO Core voltage -+in1_input milli Volts RO SoC voltage -+in2_input milli Volts RO DIMM VRD1 voltage -+in3_input milli Volts RO DIMM VRD2 voltage -+in4_input milli Volts RO RCA VRD voltage -+cur1_input milli Amperes RO Core VRD current -+cur2_input milli Amperes RO SoC VRD current -+cur3_input milli Amperes RO DIMM VRD1 current -+cur4_input milli Amperes RO DIMM VRD2 current -+cur5_input milli Amperes RO RCA VRD current -+power1_input micro Watts RO Core VRD power -+power2_input micro Watts RO SoC VRD power -+power3_input micro Watts RO DIMM VRD1 power -+power4_input micro Watts RO DIMM VRD2 power -+power5_input micro Watts RO RCA VRD power -+============ ============= ====== =============================================== -+ -+Example:: -+ -+ # cat in0_input -+ 830 -+ # cat temp1_input -+ 37000 -+ # cat curr1_input -+ 9000 -+ # cat power5_input -+ 19500000 --- -cgit - - -From 6d270868cd529c39ac746e9ae3522c43f2764aca Mon Sep 17 00:00:00 2001 -From: Jeremy Kerr -Date: Mon, 24 Oct 2022 16:15:27 +0800 -Subject: hwmon: (occ) OCC sensors aren't arch-specific - -Commit c112d75840fb ("hwmon: OCC drivers are ARM-only") made the OCC -sensor drivers not selectable on powerpc64: - - These drivers are for a BMC inside PowerPC servers. The BMC runs on - ARM hardware, so only propose the drivers on this architecture, unless - build-testing. - -... but we now have a powerpc64 BMC (still for a powerpc64 host), so -drop the `depends on` that excludes building for this platform. - -Signed-off-by: Jeremy Kerr -Acked-by: Joel Stanley -Link: https://lore.kernel.org/r/20221024081527.3842565-1-jk@codeconstruct.com.au -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/occ/Kconfig | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/drivers/hwmon/occ/Kconfig b/drivers/hwmon/occ/Kconfig -index 35a7070db8277..348c21100a372 100644 ---- a/drivers/hwmon/occ/Kconfig -+++ b/drivers/hwmon/occ/Kconfig -@@ -6,7 +6,6 @@ - config SENSORS_OCC_P8_I2C - tristate "POWER8 OCC through I2C" - depends on I2C -- depends on ARM || ARM64 || COMPILE_TEST - select SENSORS_OCC - help - This option enables support for monitoring sensors provided by the -@@ -21,7 +20,6 @@ config SENSORS_OCC_P8_I2C - config SENSORS_OCC_P9_SBE - tristate "POWER9 OCC through SBE" - depends on FSI_OCC -- depends on ARM || ARM64 || COMPILE_TEST - select SENSORS_OCC - help - This option enables support for monitoring sensors provided by the --- -cgit - - -From 662d20b3a5afee888e805c5326ccdb7ebbd23012 Mon Sep 17 00:00:00 2001 -From: Aleksa Savic -Date: Mon, 24 Oct 2022 17:10:39 +0200 -Subject: hwmon: (aquacomputer_d5next) Add support for temperature sensor - offsets - -Add support for reading and writing temperature sensor offsets -on the Aquacomputer D5 Next, Farbwerk 360, Octo and Quadro, -for which the needed offsets are known. Implemented by -Leonard Anderweit [1]. - -[1] https://github.com/aleksamagicka/aquacomputer_d5next-hwmon/pull/22 - -Originally-from: Leonard Anderweit -Signed-off-by: Aleksa Savic -Link: https://lore.kernel.org/r/20221024151039.7222-1-savicaleksa83@gmail.com -Signed-off-by: Guenter Roeck ---- - Documentation/hwmon/aquacomputer_d5next.rst | 1 + - drivers/hwmon/aquacomputer_d5next.c | 88 ++++++++++++++++++++++++----- - 2 files changed, 75 insertions(+), 14 deletions(-) - -diff --git a/Documentation/hwmon/aquacomputer_d5next.rst b/Documentation/hwmon/aquacomputer_d5next.rst -index e238533b5fe01..15226346434dd 100644 ---- a/Documentation/hwmon/aquacomputer_d5next.rst -+++ b/Documentation/hwmon/aquacomputer_d5next.rst -@@ -62,6 +62,7 @@ Sysfs entries - - ================ ============================================================== - temp[1-20]_input Physical/virtual temperature sensors (in millidegrees Celsius) -+temp[1-4]_offset Temperature sensor correction offset (in millidegrees Celsius) - fan[1-8]_input Pump/fan speed (in RPM) / Flow speed (in dL/h) - power[1-8]_input Pump/fan power (in micro Watts) - in[0-7]_input Pump/fan voltage (in milli Volts) -diff --git a/drivers/hwmon/aquacomputer_d5next.c b/drivers/hwmon/aquacomputer_d5next.c -index c51a2678f0eb5..608f57f59cf94 100644 ---- a/drivers/hwmon/aquacomputer_d5next.c -+++ b/drivers/hwmon/aquacomputer_d5next.c -@@ -80,6 +80,7 @@ static u8 secondary_ctrl_report[] = { - #define D5NEXT_5V_VOLTAGE 0x39 - #define D5NEXT_12V_VOLTAGE 0x37 - #define D5NEXT_CTRL_REPORT_SIZE 0x329 -+#define D5NEXT_TEMP_CTRL_OFFSET 0x2D - static u8 d5next_sensor_fan_offsets[] = { D5NEXT_PUMP_OFFSET, D5NEXT_FAN_OFFSET }; - - /* Pump and fan speed registers in D5 Next control report (from 0-100%) */ -@@ -94,6 +95,8 @@ static u16 d5next_ctrl_fan_offsets[] = { 0x97, 0x42 }; - #define FARBWERK360_SENSOR_START 0x32 - #define FARBWERK360_NUM_VIRTUAL_SENSORS 16 - #define FARBWERK360_VIRTUAL_SENSORS_START 0x3a -+#define FARBWERK360_CTRL_REPORT_SIZE 0x682 -+#define FARBWERK360_TEMP_CTRL_OFFSET 0x8 - - /* Register offsets for the Octo fan controller */ - #define OCTO_POWER_CYCLES 0x18 -@@ -103,6 +106,7 @@ static u16 d5next_ctrl_fan_offsets[] = { 0x97, 0x42 }; - #define OCTO_NUM_VIRTUAL_SENSORS 16 - #define OCTO_VIRTUAL_SENSORS_START 0x45 - #define OCTO_CTRL_REPORT_SIZE 0x65F -+#define OCTO_TEMP_CTRL_OFFSET 0xA - static u8 octo_sensor_fan_offsets[] = { 0x7D, 0x8A, 0x97, 0xA4, 0xB1, 0xBE, 0xCB, 0xD8 }; - - /* Fan speed registers in Octo control report (from 0-100%) */ -@@ -117,6 +121,7 @@ static u16 octo_ctrl_fan_offsets[] = { 0x5B, 0xB0, 0x105, 0x15A, 0x1AF, 0x204, 0 - #define QUADRO_VIRTUAL_SENSORS_START 0x3c - #define QUADRO_CTRL_REPORT_SIZE 0x3c1 - #define QUADRO_FLOW_SENSOR_OFFSET 0x6e -+#define QUADRO_TEMP_CTRL_OFFSET 0xA - static u8 quadro_sensor_fan_offsets[] = { 0x70, 0x7D, 0x8A, 0x97 }; - - /* Fan speed registers in Quadro control report (from 0-100%) */ -@@ -282,6 +287,7 @@ struct aqc_data { - int temp_sensor_start_offset; - int num_virtual_temp_sensors; - int virtual_temp_sensor_start_offset; -+ u16 temp_ctrl_offset; - u16 power_cycle_count_offset; - u8 flow_sensor_offset; - -@@ -365,8 +371,8 @@ static int aqc_send_ctrl_data(struct aqc_data *priv) - return ret; - } - --/* Refreshes the control buffer and returns value at offset */ --static int aqc_get_ctrl_val(struct aqc_data *priv, int offset) -+/* Refreshes the control buffer and stores value at offset in val */ -+static int aqc_get_ctrl_val(struct aqc_data *priv, int offset, long *val) - { - int ret; - -@@ -376,7 +382,7 @@ static int aqc_get_ctrl_val(struct aqc_data *priv, int offset) - if (ret < 0) - goto unlock_and_return; - -- ret = get_unaligned_be16(priv->buffer + offset); -+ *val = (s16)get_unaligned_be16(priv->buffer + offset); - - unlock_and_return: - mutex_unlock(&priv->mutex); -@@ -393,7 +399,7 @@ static int aqc_set_ctrl_val(struct aqc_data *priv, int offset, long val) - if (ret < 0) - goto unlock_and_return; - -- put_unaligned_be16((u16)val, priv->buffer + offset); -+ put_unaligned_be16((s16)val, priv->buffer + offset); - - ret = aqc_send_ctrl_data(priv); - -@@ -408,8 +414,28 @@ static umode_t aqc_is_visible(const void *data, enum hwmon_sensor_types type, u3 - - switch (type) { - case hwmon_temp: -+ if (channel < priv->num_temp_sensors) { -+ switch (attr) { -+ case hwmon_temp_label: -+ case hwmon_temp_input: -+ return 0444; -+ case hwmon_temp_offset: -+ if (priv->temp_ctrl_offset != 0) -+ return 0644; -+ break; -+ default: -+ break; -+ } -+ } -+ - if (channel < priv->num_temp_sensors + priv->num_virtual_temp_sensors) -- return 0444; -+ switch (attr) { -+ case hwmon_temp_label: -+ case hwmon_temp_input: -+ return 0444; -+ default: -+ break; -+ } - break; - case hwmon_pwm: - if (priv->fan_ctrl_offsets && channel < priv->num_fans) { -@@ -492,10 +518,25 @@ static int aqc_read(struct device *dev, enum hwmon_sensor_types type, u32 attr, - - switch (type) { - case hwmon_temp: -- if (priv->temp_input[channel] == -ENODATA) -- return -ENODATA; -+ switch (attr) { -+ case hwmon_temp_input: -+ if (priv->temp_input[channel] == -ENODATA) -+ return -ENODATA; -+ -+ *val = priv->temp_input[channel]; -+ break; -+ case hwmon_temp_offset: -+ ret = -+ aqc_get_ctrl_val(priv, priv->temp_ctrl_offset + -+ channel * AQC_TEMP_SENSOR_SIZE, val); -+ if (ret < 0) -+ return ret; - -- *val = priv->temp_input[channel]; -+ *val *= 10; -+ break; -+ default: -+ break; -+ } - break; - case hwmon_fan: - *val = priv->speed_input[channel]; -@@ -505,7 +546,7 @@ static int aqc_read(struct device *dev, enum hwmon_sensor_types type, u32 attr, - break; - case hwmon_pwm: - if (priv->fan_ctrl_offsets) { -- ret = aqc_get_ctrl_val(priv, priv->fan_ctrl_offsets[channel]); -+ ret = aqc_get_ctrl_val(priv, priv->fan_ctrl_offsets[channel], val); - if (ret < 0) - return ret; - -@@ -563,6 +604,21 @@ static int aqc_write(struct device *dev, enum hwmon_sensor_types type, u32 attr, - struct aqc_data *priv = dev_get_drvdata(dev); - - switch (type) { -+ case hwmon_temp: -+ switch (attr) { -+ case hwmon_temp_offset: -+ /* Limit temp offset to +/- 15K as in the official software */ -+ val = clamp_val(val, -15000, 15000) / 10; -+ ret = -+ aqc_set_ctrl_val(priv, priv->temp_ctrl_offset + -+ channel * AQC_TEMP_SENSOR_SIZE, val); -+ if (ret < 0) -+ return ret; -+ break; -+ default: -+ return -EOPNOTSUPP; -+ } -+ break; - case hwmon_pwm: - switch (attr) { - case hwmon_pwm_input: -@@ -597,10 +653,10 @@ static const struct hwmon_ops aqc_hwmon_ops = { - - static const struct hwmon_channel_info *aqc_info[] = { - HWMON_CHANNEL_INFO(temp, -- HWMON_T_INPUT | HWMON_T_LABEL, -- HWMON_T_INPUT | HWMON_T_LABEL, -- HWMON_T_INPUT | HWMON_T_LABEL, -- HWMON_T_INPUT | HWMON_T_LABEL, -+ HWMON_T_INPUT | HWMON_T_LABEL | HWMON_T_OFFSET, -+ HWMON_T_INPUT | HWMON_T_LABEL | HWMON_T_OFFSET, -+ HWMON_T_INPUT | HWMON_T_LABEL | HWMON_T_OFFSET, -+ HWMON_T_INPUT | HWMON_T_LABEL | HWMON_T_OFFSET, - HWMON_T_INPUT | HWMON_T_LABEL, - HWMON_T_INPUT | HWMON_T_LABEL, - HWMON_T_INPUT | HWMON_T_LABEL, -@@ -853,6 +909,7 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id) - priv->virtual_temp_sensor_start_offset = D5NEXT_VIRTUAL_SENSORS_START; - priv->power_cycle_count_offset = D5NEXT_POWER_CYCLES; - priv->buffer_size = D5NEXT_CTRL_REPORT_SIZE; -+ priv->temp_ctrl_offset = D5NEXT_TEMP_CTRL_OFFSET; - - priv->temp_label = label_d5next_temp; - priv->virtual_temp_label = label_virtual_temp_sensors; -@@ -877,7 +934,8 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id) - priv->temp_sensor_start_offset = FARBWERK360_SENSOR_START; - priv->num_virtual_temp_sensors = FARBWERK360_NUM_VIRTUAL_SENSORS; - priv->virtual_temp_sensor_start_offset = FARBWERK360_VIRTUAL_SENSORS_START; -- -+ priv->buffer_size = FARBWERK360_CTRL_REPORT_SIZE; -+ priv->temp_ctrl_offset = FARBWERK360_TEMP_CTRL_OFFSET; - priv->temp_label = label_temp_sensors; - priv->virtual_temp_label = label_virtual_temp_sensors; - break; -@@ -893,6 +951,7 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id) - priv->virtual_temp_sensor_start_offset = OCTO_VIRTUAL_SENSORS_START; - priv->power_cycle_count_offset = OCTO_POWER_CYCLES; - priv->buffer_size = OCTO_CTRL_REPORT_SIZE; -+ priv->temp_ctrl_offset = OCTO_TEMP_CTRL_OFFSET; - - priv->temp_label = label_temp_sensors; - priv->virtual_temp_label = label_virtual_temp_sensors; -@@ -914,6 +973,7 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id) - priv->power_cycle_count_offset = QUADRO_POWER_CYCLES; - priv->buffer_size = QUADRO_CTRL_REPORT_SIZE; - priv->flow_sensor_offset = QUADRO_FLOW_SENSOR_OFFSET; -+ priv->temp_ctrl_offset = QUADRO_TEMP_CTRL_OFFSET; - - priv->temp_label = label_temp_sensors; - priv->virtual_temp_label = label_virtual_temp_sensors; --- -cgit - - -From 8f2fa4726faf01094d7a5be7bd0c120c565f54d9 Mon Sep 17 00:00:00 2001 -From: Martin Blumenstingl -Date: Sun, 23 Oct 2022 23:31:56 +0200 -Subject: hwmon: (jc42) Convert register access and caching to regmap/regcache - -Switch the jc42 driver to use an I2C regmap to access the registers. -Also move over to regmap's built-in caching instead of adding a -custom caching implementation. This works for JC42_REG_TEMP_UPPER, -JC42_REG_TEMP_LOWER and JC42_REG_TEMP_CRITICAL as these values never -change except when explicitly written. The cache For JC42_REG_TEMP is -dropped (regmap can't cache it because it's volatile, meaning it can -change at any time) as well for simplicity and consistency with other -drivers. - -Signed-off-by: Martin Blumenstingl -Link: https://lore.kernel.org/r/20221023213157.11078-2-martin.blumenstingl@googlemail.com -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/Kconfig | 1 + - drivers/hwmon/jc42.c | 233 ++++++++++++++++++++++++++++---------------------- - 2 files changed, 132 insertions(+), 102 deletions(-) - -diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig -index e7ec6af309c79..a5253abb7ea72 100644 ---- a/drivers/hwmon/Kconfig -+++ b/drivers/hwmon/Kconfig -@@ -807,6 +807,7 @@ config SENSORS_IT87 - config SENSORS_JC42 - tristate "JEDEC JC42.4 compliant memory module temperature sensors" - depends on I2C -+ select REGMAP_I2C - help - If you say yes here, you get support for JEDEC JC42.4 compliant - temperature sensors, which are used on many DDR3 memory modules for -diff --git a/drivers/hwmon/jc42.c b/drivers/hwmon/jc42.c -index 30888feaf589b..355639d208d04 100644 ---- a/drivers/hwmon/jc42.c -+++ b/drivers/hwmon/jc42.c -@@ -19,6 +19,7 @@ - #include - #include - #include -+#include - - /* Addresses to scan */ - static const unsigned short normal_i2c[] = { -@@ -199,31 +200,14 @@ static struct jc42_chips jc42_chips[] = { - { STM_MANID, STTS3000_DEVID, STTS3000_DEVID_MASK }, - }; - --enum temp_index { -- t_input = 0, -- t_crit, -- t_min, -- t_max, -- t_num_temp --}; -- --static const u8 temp_regs[t_num_temp] = { -- [t_input] = JC42_REG_TEMP, -- [t_crit] = JC42_REG_TEMP_CRITICAL, -- [t_min] = JC42_REG_TEMP_LOWER, -- [t_max] = JC42_REG_TEMP_UPPER, --}; -- - /* Each client has this additional data */ - struct jc42_data { -- struct i2c_client *client; - struct mutex update_lock; /* protect register access */ -+ struct regmap *regmap; - bool extended; /* true if extended range supported */ - bool valid; -- unsigned long last_updated; /* In jiffies */ - u16 orig_config; /* original configuration */ - u16 config; /* current configuration */ -- u16 temp[t_num_temp];/* Temperatures */ - }; - - #define JC42_TEMP_MIN_EXTENDED (-40000) -@@ -248,85 +232,102 @@ static int jc42_temp_from_reg(s16 reg) - return reg * 125 / 2; - } - --static struct jc42_data *jc42_update_device(struct device *dev) --{ -- struct jc42_data *data = dev_get_drvdata(dev); -- struct i2c_client *client = data->client; -- struct jc42_data *ret = data; -- int i, val; -- -- mutex_lock(&data->update_lock); -- -- if (time_after(jiffies, data->last_updated + HZ) || !data->valid) { -- for (i = 0; i < t_num_temp; i++) { -- val = i2c_smbus_read_word_swapped(client, temp_regs[i]); -- if (val < 0) { -- ret = ERR_PTR(val); -- goto abort; -- } -- data->temp[i] = val; -- } -- data->last_updated = jiffies; -- data->valid = true; -- } --abort: -- mutex_unlock(&data->update_lock); -- return ret; --} -- - static int jc42_read(struct device *dev, enum hwmon_sensor_types type, - u32 attr, int channel, long *val) - { -- struct jc42_data *data = jc42_update_device(dev); -- int temp, hyst; -+ struct jc42_data *data = dev_get_drvdata(dev); -+ unsigned int regval; -+ int ret, temp, hyst; - -- if (IS_ERR(data)) -- return PTR_ERR(data); -+ mutex_lock(&data->update_lock); - - switch (attr) { - case hwmon_temp_input: -- *val = jc42_temp_from_reg(data->temp[t_input]); -- return 0; -+ ret = regmap_read(data->regmap, JC42_REG_TEMP, ®val); -+ if (ret) -+ break; -+ -+ *val = jc42_temp_from_reg(regval); -+ break; - case hwmon_temp_min: -- *val = jc42_temp_from_reg(data->temp[t_min]); -- return 0; -+ ret = regmap_read(data->regmap, JC42_REG_TEMP_LOWER, ®val); -+ if (ret) -+ break; -+ -+ *val = jc42_temp_from_reg(regval); -+ break; - case hwmon_temp_max: -- *val = jc42_temp_from_reg(data->temp[t_max]); -- return 0; -+ ret = regmap_read(data->regmap, JC42_REG_TEMP_UPPER, ®val); -+ if (ret) -+ break; -+ -+ *val = jc42_temp_from_reg(regval); -+ break; - case hwmon_temp_crit: -- *val = jc42_temp_from_reg(data->temp[t_crit]); -- return 0; -+ ret = regmap_read(data->regmap, JC42_REG_TEMP_CRITICAL, -+ ®val); -+ if (ret) -+ break; -+ -+ *val = jc42_temp_from_reg(regval); -+ break; - case hwmon_temp_max_hyst: -- temp = jc42_temp_from_reg(data->temp[t_max]); -+ ret = regmap_read(data->regmap, JC42_REG_TEMP_UPPER, ®val); -+ if (ret) -+ break; -+ -+ temp = jc42_temp_from_reg(regval); - hyst = jc42_hysteresis[(data->config & JC42_CFG_HYST_MASK) - >> JC42_CFG_HYST_SHIFT]; - *val = temp - hyst; -- return 0; -+ break; - case hwmon_temp_crit_hyst: -- temp = jc42_temp_from_reg(data->temp[t_crit]); -+ ret = regmap_read(data->regmap, JC42_REG_TEMP_CRITICAL, -+ ®val); -+ if (ret) -+ break; -+ -+ temp = jc42_temp_from_reg(regval); - hyst = jc42_hysteresis[(data->config & JC42_CFG_HYST_MASK) - >> JC42_CFG_HYST_SHIFT]; - *val = temp - hyst; -- return 0; -+ break; - case hwmon_temp_min_alarm: -- *val = (data->temp[t_input] >> JC42_ALARM_MIN_BIT) & 1; -- return 0; -+ ret = regmap_read(data->regmap, JC42_REG_TEMP, ®val); -+ if (ret) -+ break; -+ -+ *val = (regval >> JC42_ALARM_MIN_BIT) & 1; -+ break; - case hwmon_temp_max_alarm: -- *val = (data->temp[t_input] >> JC42_ALARM_MAX_BIT) & 1; -- return 0; -+ ret = regmap_read(data->regmap, JC42_REG_TEMP, ®val); -+ if (ret) -+ break; -+ -+ *val = (regval >> JC42_ALARM_MAX_BIT) & 1; -+ break; - case hwmon_temp_crit_alarm: -- *val = (data->temp[t_input] >> JC42_ALARM_CRIT_BIT) & 1; -- return 0; -+ ret = regmap_read(data->regmap, JC42_REG_TEMP, ®val); -+ if (ret) -+ break; -+ -+ *val = (regval >> JC42_ALARM_CRIT_BIT) & 1; -+ break; - default: -- return -EOPNOTSUPP; -+ ret = -EOPNOTSUPP; -+ break; - } -+ -+ mutex_unlock(&data->update_lock); -+ -+ return ret; - } - - static int jc42_write(struct device *dev, enum hwmon_sensor_types type, - u32 attr, int channel, long val) - { - struct jc42_data *data = dev_get_drvdata(dev); -- struct i2c_client *client = data->client; -+ unsigned int regval; - int diff, hyst; - int ret; - -@@ -334,21 +335,23 @@ static int jc42_write(struct device *dev, enum hwmon_sensor_types type, - - switch (attr) { - case hwmon_temp_min: -- data->temp[t_min] = jc42_temp_to_reg(val, data->extended); -- ret = i2c_smbus_write_word_swapped(client, temp_regs[t_min], -- data->temp[t_min]); -+ ret = regmap_write(data->regmap, JC42_REG_TEMP_LOWER, -+ jc42_temp_to_reg(val, data->extended)); - break; - case hwmon_temp_max: -- data->temp[t_max] = jc42_temp_to_reg(val, data->extended); -- ret = i2c_smbus_write_word_swapped(client, temp_regs[t_max], -- data->temp[t_max]); -+ ret = regmap_write(data->regmap, JC42_REG_TEMP_UPPER, -+ jc42_temp_to_reg(val, data->extended)); - break; - case hwmon_temp_crit: -- data->temp[t_crit] = jc42_temp_to_reg(val, data->extended); -- ret = i2c_smbus_write_word_swapped(client, temp_regs[t_crit], -- data->temp[t_crit]); -+ ret = regmap_write(data->regmap, JC42_REG_TEMP_CRITICAL, -+ jc42_temp_to_reg(val, data->extended)); - break; - case hwmon_temp_crit_hyst: -+ ret = regmap_read(data->regmap, JC42_REG_TEMP_CRITICAL, -+ ®val); -+ if (ret) -+ return ret; -+ - /* - * JC42.4 compliant chips only support four hysteresis values. - * Pick best choice and go from there. -@@ -356,7 +359,7 @@ static int jc42_write(struct device *dev, enum hwmon_sensor_types type, - val = clamp_val(val, (data->extended ? JC42_TEMP_MIN_EXTENDED - : JC42_TEMP_MIN) - 6000, - JC42_TEMP_MAX); -- diff = jc42_temp_from_reg(data->temp[t_crit]) - val; -+ diff = jc42_temp_from_reg(regval) - val; - hyst = 0; - if (diff > 0) { - if (diff < 2250) -@@ -368,9 +371,8 @@ static int jc42_write(struct device *dev, enum hwmon_sensor_types type, - } - data->config = (data->config & ~JC42_CFG_HYST_MASK) | - (hyst << JC42_CFG_HYST_SHIFT); -- ret = i2c_smbus_write_word_swapped(data->client, -- JC42_REG_CONFIG, -- data->config); -+ ret = regmap_write(data->regmap, JC42_REG_CONFIG, -+ data->config); - break; - default: - ret = -EOPNOTSUPP; -@@ -470,51 +472,80 @@ static const struct hwmon_chip_info jc42_chip_info = { - .info = jc42_info, - }; - -+static bool jc42_readable_reg(struct device *dev, unsigned int reg) -+{ -+ return (reg >= JC42_REG_CAP && reg <= JC42_REG_DEVICEID) || -+ reg == JC42_REG_SMBUS; -+} -+ -+static bool jc42_writable_reg(struct device *dev, unsigned int reg) -+{ -+ return (reg >= JC42_REG_CONFIG && reg <= JC42_REG_TEMP_CRITICAL) || -+ reg == JC42_REG_SMBUS; -+} -+ -+static bool jc42_volatile_reg(struct device *dev, unsigned int reg) -+{ -+ return reg == JC42_REG_CONFIG || reg == JC42_REG_TEMP; -+} -+ -+static const struct regmap_config jc42_regmap_config = { -+ .reg_bits = 8, -+ .val_bits = 16, -+ .val_format_endian = REGMAP_ENDIAN_BIG, -+ .max_register = JC42_REG_SMBUS, -+ .writeable_reg = jc42_writable_reg, -+ .readable_reg = jc42_readable_reg, -+ .volatile_reg = jc42_volatile_reg, -+ .cache_type = REGCACHE_RBTREE, -+}; -+ - static int jc42_probe(struct i2c_client *client) - { - struct device *dev = &client->dev; - struct device *hwmon_dev; -+ unsigned int config, cap; - struct jc42_data *data; -- int config, cap; -+ int ret; - - data = devm_kzalloc(dev, sizeof(struct jc42_data), GFP_KERNEL); - if (!data) - return -ENOMEM; - -- data->client = client; -+ data->regmap = devm_regmap_init_i2c(client, &jc42_regmap_config); -+ if (IS_ERR(data->regmap)) -+ return PTR_ERR(data->regmap); -+ - i2c_set_clientdata(client, data); - mutex_init(&data->update_lock); - -- cap = i2c_smbus_read_word_swapped(client, JC42_REG_CAP); -- if (cap < 0) -- return cap; -+ ret = regmap_read(data->regmap, JC42_REG_CAP, &cap); -+ if (ret) -+ return ret; - - data->extended = !!(cap & JC42_CAP_RANGE); - - if (device_property_read_bool(dev, "smbus-timeout-disable")) { -- int smbus; -- - /* - * Not all chips support this register, but from a - * quick read of various datasheets no chip appears - * incompatible with the below attempt to disable - * the timeout. And the whole thing is opt-in... - */ -- smbus = i2c_smbus_read_word_swapped(client, JC42_REG_SMBUS); -- if (smbus < 0) -- return smbus; -- i2c_smbus_write_word_swapped(client, JC42_REG_SMBUS, -- smbus | SMBUS_STMOUT); -+ ret = regmap_set_bits(data->regmap, JC42_REG_SMBUS, -+ SMBUS_STMOUT); -+ if (ret) -+ return ret; - } - -- config = i2c_smbus_read_word_swapped(client, JC42_REG_CONFIG); -- if (config < 0) -- return config; -+ ret = regmap_read(data->regmap, JC42_REG_CONFIG, &config); -+ if (ret) -+ return ret; - - data->orig_config = config; - if (config & JC42_CFG_SHUTDOWN) { - config &= ~JC42_CFG_SHUTDOWN; -- i2c_smbus_write_word_swapped(client, JC42_REG_CONFIG, config); -+ regmap_write(data->regmap, JC42_REG_CONFIG, config); - } - data->config = config; - -@@ -535,7 +566,7 @@ static void jc42_remove(struct i2c_client *client) - - config = (data->orig_config & ~JC42_CFG_HYST_MASK) - | (data->config & JC42_CFG_HYST_MASK); -- i2c_smbus_write_word_swapped(client, JC42_REG_CONFIG, config); -+ regmap_write(data->regmap, JC42_REG_CONFIG, config); - } - } - -@@ -546,8 +577,7 @@ static int jc42_suspend(struct device *dev) - struct jc42_data *data = dev_get_drvdata(dev); - - data->config |= JC42_CFG_SHUTDOWN; -- i2c_smbus_write_word_swapped(data->client, JC42_REG_CONFIG, -- data->config); -+ regmap_write(data->regmap, JC42_REG_CONFIG, data->config); - return 0; - } - -@@ -556,8 +586,7 @@ static int jc42_resume(struct device *dev) - struct jc42_data *data = dev_get_drvdata(dev); - - data->config &= ~JC42_CFG_SHUTDOWN; -- i2c_smbus_write_word_swapped(data->client, JC42_REG_CONFIG, -- data->config); -+ regmap_write(data->regmap, JC42_REG_CONFIG, data->config); - return 0; - } - --- -cgit - - -From 084ed144c448fd5bc8ed5a58247153fbbfd115c3 Mon Sep 17 00:00:00 2001 -From: Martin Blumenstingl -Date: Sun, 23 Oct 2022 23:31:57 +0200 -Subject: hwmon: (jc42) Restore the min/max/critical temperatures on resume -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The JC42 compatible thermal sensor on Kingston KSM32ES8/16ME DIMMs -(using Micron E-Die) is an ST Microelectronics STTS2004 (manufacturer -0x104a, device 0x2201). It does not keep the previously programmed -minimum, maximum and critical temperatures after system suspend and -resume (which is a shutdown / startup cycle for the JC42 temperature -sensor). This results in an alarm on system resume because the hardware -default for these values is 0°C (so any environment temperature greater -than 0°C will trigger the alarm). - -Example before system suspend: - jc42-i2c-0-1a - Adapter: SMBus PIIX4 adapter port 0 at 0b00 - temp1: +34.8°C (low = +0.0°C) - (high = +85.0°C, hyst = +85.0°C) - (crit = +95.0°C, hyst = +95.0°C) - -Example after system resume (without this change): - jc42-i2c-0-1a - Adapter: SMBus PIIX4 adapter port 0 at 0b00 - temp1: +34.8°C (low = +0.0°C) ALARM (HIGH, CRIT) - (high = +0.0°C, hyst = +0.0°C) - (crit = +0.0°C, hyst = +0.0°C) - -Apply the cached values from the JC42_REG_TEMP_UPPER, -JC42_REG_TEMP_LOWER, JC42_REG_TEMP_CRITICAL and JC42_REG_SMBUS (where -the SMBUS register is not related to this issue but a side-effect of -using regcache_sync() during system resume with the previously -cached/programmed values. This fixes the alarm due to the hardware -defaults of 0°C because the previously applied limits (set by userspace) -are re-applied on system resume. - -Fixes: 175c490c9e7f ("hwmon: (jc42) Add support for STTS2004 and AT30TSE004") -Reviewed-by: Guenter Roeck -Signed-off-by: Martin Blumenstingl -Link: https://lore.kernel.org/r/20221023213157.11078-3-martin.blumenstingl@googlemail.com -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/jc42.c | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - -diff --git a/drivers/hwmon/jc42.c b/drivers/hwmon/jc42.c -index 355639d208d04..0554b41c32bc7 100644 ---- a/drivers/hwmon/jc42.c -+++ b/drivers/hwmon/jc42.c -@@ -578,6 +578,10 @@ static int jc42_suspend(struct device *dev) - - data->config |= JC42_CFG_SHUTDOWN; - regmap_write(data->regmap, JC42_REG_CONFIG, data->config); -+ -+ regcache_cache_only(data->regmap, true); -+ regcache_mark_dirty(data->regmap); -+ - return 0; - } - -@@ -585,9 +589,13 @@ static int jc42_resume(struct device *dev) - { - struct jc42_data *data = dev_get_drvdata(dev); - -+ regcache_cache_only(data->regmap, false); -+ - data->config &= ~JC42_CFG_SHUTDOWN; - regmap_write(data->regmap, JC42_REG_CONFIG, data->config); -- return 0; -+ -+ /* Restore cached register values to hardware */ -+ return regcache_sync(data->regmap); - } - - static const struct dev_pm_ops jc42_dev_pm_ops = { --- -cgit - - -From b744db17abf6a2efc2bfa80870cc88e9799a8ccc Mon Sep 17 00:00:00 2001 -From: Yang Yingliang -Date: Thu, 27 Oct 2022 14:29:31 +0800 -Subject: hwmon: (jc42) Fix missing unlock on error in jc42_write() - -Add the missing unlock before return from function jc42_write() -in the error handling case. - -Fixes: 37dedaee8bc6 ("hwmon: (jc42) Convert register access and caching to regmap/regcache") -Signed-off-by: Yang Yingliang -Reviewed-by: Martin Blumenstingl -Link: https://lore.kernel.org/r/20221027062931.598247-1-yangyingliang@huawei.com -Reported-by: kernel test robot -Reported-by: Dan Carpenter -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/jc42.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/hwmon/jc42.c b/drivers/hwmon/jc42.c -index 0554b41c32bc7..6593d81cb901b 100644 ---- a/drivers/hwmon/jc42.c -+++ b/drivers/hwmon/jc42.c -@@ -350,7 +350,7 @@ static int jc42_write(struct device *dev, enum hwmon_sensor_types type, - ret = regmap_read(data->regmap, JC42_REG_TEMP_CRITICAL, - ®val); - if (ret) -- return ret; -+ break; - - /* - * JC42.4 compliant chips only support four hysteresis values. --- -cgit - - -From 9e913888647be447c3d114042428f02d24676390 Mon Sep 17 00:00:00 2001 -From: Nathan Chancellor -Date: Thu, 27 Oct 2022 16:16:12 -0700 -Subject: hwmon: (smpro-hwmon) Improve switch statments in smpro_is_visible() - -Clang warns: - - drivers/hwmon/smpro-hwmon.c:378:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough] - default: - ^ - drivers/hwmon/smpro-hwmon.c:378:2: note: insert 'break;' to avoid fall-through - default: - ^ - break; - 1 error generated. - -Clang is a little more pedantic than GCC, which does not warn when -falling through to a case that is just break or return. Clang's version -is more in line with the kernel's own stance in deprecated.rst, which -states that all switch/case blocks must end in either break, -fallthrough, continue, goto, or return. - -Add the missing break to silence the warning. Additionally, adjust the -indentation of a break and add a default case to the inner switch -statement. - -Fixes: a87456864cbb ("hwmon: Add Ampere's Altra smpro-hwmon driver") -Link: https://github.com/ClangBuiltLinux/linux/issues/1751 -Signed-off-by: Nathan Chancellor -Link: https://lore.kernel.org/r/20221027231611.3824800-1-nathan@kernel.org -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/smpro-hwmon.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/drivers/hwmon/smpro-hwmon.c b/drivers/hwmon/smpro-hwmon.c -index ee54e21c2c123..a76c49dd8438d 100644 ---- a/drivers/hwmon/smpro-hwmon.c -+++ b/drivers/hwmon/smpro-hwmon.c -@@ -373,8 +373,11 @@ static umode_t smpro_is_visible(const void *data, enum hwmon_sensor_types type, - ret = regmap_read(hwmon->regmap, temperature[channel].reg, &value); - if (ret || value == 0xFFFF) - return 0; -- break; -+ break; -+ default: -+ break; - } -+ break; - default: - break; - } --- -cgit - - -From daec55ce62ad0bb6948c8edf84e7ec3b95720177 Mon Sep 17 00:00:00 2001 -From: Felix Nieuwenhuizen -Date: Thu, 27 Oct 2022 16:51:35 +0200 -Subject: hwmon: (pmbus/ltc2978) add support for LTC7132 - -Add support for LTC7132. -The relevant registers in the LTC7132 are identical to the LTC7880. -So it's just a matter of adding the chip id. - -Signed-off-by: Felix Nieuwenhuizen -Link: https://lore.kernel.org/r/20221027145135.31802-1-Felix.Nieuwenhuizen@etas.com -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/pmbus/ltc2978.c | 17 +++++++++++------ - 1 file changed, 11 insertions(+), 6 deletions(-) - -diff --git a/drivers/hwmon/pmbus/ltc2978.c b/drivers/hwmon/pmbus/ltc2978.c -index 6d2592731ba3d..79f480b4425d2 100644 ---- a/drivers/hwmon/pmbus/ltc2978.c -+++ b/drivers/hwmon/pmbus/ltc2978.c -@@ -23,7 +23,7 @@ enum chips { - /* Managers */ - ltc2972, ltc2974, ltc2975, ltc2977, ltc2978, ltc2979, ltc2980, - /* Controllers */ -- ltc3880, ltc3882, ltc3883, ltc3884, ltc3886, ltc3887, ltc3889, ltc7880, -+ ltc3880, ltc3882, ltc3883, ltc3884, ltc3886, ltc3887, ltc3889, ltc7132, ltc7880, - /* Modules */ - ltm2987, ltm4664, ltm4675, ltm4676, ltm4677, ltm4678, ltm4680, ltm4686, - ltm4700, -@@ -45,15 +45,14 @@ enum chips { - #define LTC2974_MFR_IOUT_PEAK 0xd7 - #define LTC2974_MFR_IOUT_MIN 0xd8 - --/* LTC3880, LTC3882, LTC3883, LTC3887, LTM4675, and LTM4676 */ -+/* LTC3880, LTC3882, LTC3883, LTC3887, LTM4675, LTM4676, LTC7132 */ - #define LTC3880_MFR_IOUT_PEAK 0xd7 - #define LTC3880_MFR_CLEAR_PEAKS 0xe3 - #define LTC3880_MFR_TEMPERATURE2_PEAK 0xf4 - --/* LTC3883, LTC3884, LTC3886, LTC3889 and LTC7880 only */ -+/* LTC3883, LTC3884, LTC3886, LTC3889, LTC7132, LTC7880 */ - #define LTC3883_MFR_IIN_PEAK 0xe1 - -- - /* LTC2975 only */ - #define LTC2975_MFR_IIN_PEAK 0xc4 - #define LTC2975_MFR_IIN_MIN 0xc5 -@@ -79,10 +78,11 @@ enum chips { - #define LTC3884_ID 0x4C00 - #define LTC3886_ID 0x4600 - #define LTC3887_ID 0x4700 --#define LTM2987_ID_A 0x8010 /* A/B for two die IDs */ --#define LTM2987_ID_B 0x8020 - #define LTC3889_ID 0x4900 -+#define LTC7132_ID 0x4CE0 - #define LTC7880_ID 0x49E0 -+#define LTM2987_ID_A 0x8010 /* A/B for two die IDs */ -+#define LTM2987_ID_B 0x8020 - #define LTM4664_ID 0x4120 - #define LTM4675_ID 0x47a0 - #define LTM4676_ID_REV1 0x4400 -@@ -547,6 +547,7 @@ static const struct i2c_device_id ltc2978_id[] = { - {"ltc3886", ltc3886}, - {"ltc3887", ltc3887}, - {"ltc3889", ltc3889}, -+ {"ltc7132", ltc7132}, - {"ltc7880", ltc7880}, - {"ltm2987", ltm2987}, - {"ltm4664", ltm4664}, -@@ -651,6 +652,8 @@ static int ltc2978_get_id(struct i2c_client *client) - return ltc3887; - else if (chip_id == LTC3889_ID) - return ltc3889; -+ else if (chip_id == LTC7132_ID) -+ return ltc7132; - else if (chip_id == LTC7880_ID) - return ltc7880; - else if (chip_id == LTM2987_ID_A || chip_id == LTM2987_ID_B) -@@ -831,6 +834,7 @@ static int ltc2978_probe(struct i2c_client *client) - case ltc3884: - case ltc3886: - case ltc3889: -+ case ltc7132: - case ltc7880: - case ltm4664: - case ltm4678: -@@ -902,6 +906,7 @@ static const struct of_device_id ltc2978_of_match[] = { - { .compatible = "lltc,ltc3886" }, - { .compatible = "lltc,ltc3887" }, - { .compatible = "lltc,ltc3889" }, -+ { .compatible = "lltc,ltc7132" }, - { .compatible = "lltc,ltc7880" }, - { .compatible = "lltc,ltm2987" }, - { .compatible = "lltc,ltm4664" }, --- -cgit - - -From 78d448a3725584b7c46d3d881035943f759135fd Mon Sep 17 00:00:00 2001 -From: Martin Blumenstingl -Date: Mon, 31 Oct 2022 22:51:40 +0100 -Subject: hwmon: (jc42) Consistently use bit and bitfield macros in the driver - -Use BIT() and GENMASK() macros for defining the bitfields inside the -registers. Also use FIELD_GET() and FIELD_PREP() where appropriate. This -makes the coding style within the driver consistent. No functional -changes intended. - -Signed-off-by: Martin Blumenstingl -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/jc42.c | 36 ++++++++++++++++++------------------ - 1 file changed, 18 insertions(+), 18 deletions(-) - -diff --git a/drivers/hwmon/jc42.c b/drivers/hwmon/jc42.c -index 6593d81cb901b..8523bf974310b 100644 ---- a/drivers/hwmon/jc42.c -+++ b/drivers/hwmon/jc42.c -@@ -10,6 +10,7 @@ - */ - - #include -+#include - #include - #include - #include -@@ -37,20 +38,19 @@ static const unsigned short normal_i2c[] = { - #define JC42_REG_SMBUS 0x22 /* NXP and Atmel, possibly others? */ - - /* Status bits in temperature register */ --#define JC42_ALARM_CRIT_BIT 15 --#define JC42_ALARM_MAX_BIT 14 --#define JC42_ALARM_MIN_BIT 13 -+#define JC42_ALARM_CRIT BIT(15) -+#define JC42_ALARM_MAX BIT(14) -+#define JC42_ALARM_MIN BIT(13) - - /* Configuration register defines */ --#define JC42_CFG_CRIT_ONLY (1 << 2) --#define JC42_CFG_TCRIT_LOCK (1 << 6) --#define JC42_CFG_EVENT_LOCK (1 << 7) --#define JC42_CFG_SHUTDOWN (1 << 8) --#define JC42_CFG_HYST_SHIFT 9 --#define JC42_CFG_HYST_MASK (0x03 << 9) -+#define JC42_CFG_CRIT_ONLY BIT(2) -+#define JC42_CFG_TCRIT_LOCK BIT(6) -+#define JC42_CFG_EVENT_LOCK BIT(7) -+#define JC42_CFG_SHUTDOWN BIT(8) -+#define JC42_CFG_HYST_MASK GENMASK(10, 9) - - /* Capabilities */ --#define JC42_CAP_RANGE (1 << 2) -+#define JC42_CAP_RANGE BIT(2) - - /* Manufacturer IDs */ - #define ADT_MANID 0x11d4 /* Analog Devices */ -@@ -277,8 +277,8 @@ static int jc42_read(struct device *dev, enum hwmon_sensor_types type, - break; - - temp = jc42_temp_from_reg(regval); -- hyst = jc42_hysteresis[(data->config & JC42_CFG_HYST_MASK) -- >> JC42_CFG_HYST_SHIFT]; -+ hyst = jc42_hysteresis[FIELD_GET(JC42_CFG_HYST_MASK, -+ data->config)]; - *val = temp - hyst; - break; - case hwmon_temp_crit_hyst: -@@ -288,8 +288,8 @@ static int jc42_read(struct device *dev, enum hwmon_sensor_types type, - break; - - temp = jc42_temp_from_reg(regval); -- hyst = jc42_hysteresis[(data->config & JC42_CFG_HYST_MASK) -- >> JC42_CFG_HYST_SHIFT]; -+ hyst = jc42_hysteresis[FIELD_GET(JC42_CFG_HYST_MASK, -+ data->config)]; - *val = temp - hyst; - break; - case hwmon_temp_min_alarm: -@@ -297,21 +297,21 @@ static int jc42_read(struct device *dev, enum hwmon_sensor_types type, - if (ret) - break; - -- *val = (regval >> JC42_ALARM_MIN_BIT) & 1; -+ *val = FIELD_GET(JC42_ALARM_MIN, regval); - break; - case hwmon_temp_max_alarm: - ret = regmap_read(data->regmap, JC42_REG_TEMP, ®val); - if (ret) - break; - -- *val = (regval >> JC42_ALARM_MAX_BIT) & 1; -+ *val = FIELD_GET(JC42_ALARM_MAX, regval); - break; - case hwmon_temp_crit_alarm: - ret = regmap_read(data->regmap, JC42_REG_TEMP, ®val); - if (ret) - break; - -- *val = (regval >> JC42_ALARM_CRIT_BIT) & 1; -+ *val = FIELD_GET(JC42_ALARM_CRIT, regval); - break; - default: - ret = -EOPNOTSUPP; -@@ -370,7 +370,7 @@ static int jc42_write(struct device *dev, enum hwmon_sensor_types type, - hyst = 3; /* 6.0 degrees C */ - } - data->config = (data->config & ~JC42_CFG_HYST_MASK) | -- (hyst << JC42_CFG_HYST_SHIFT); -+ FIELD_PREP(JC42_CFG_HYST_MASK, hyst); - ret = regmap_write(data->regmap, JC42_REG_CONFIG, - data->config); - break; --- -cgit - - -From c1cb98c55f470447479298aaec7f92219562613e Mon Sep 17 00:00:00 2001 -From: Quan Nguyen -Date: Wed, 2 Nov 2022 13:21:03 +0700 -Subject: docs: hwmon: (smpro-hwmon) Improve grammar and formatting - -Improve documentation grammar and formatting for the -Ampere(R)'s Altra(R) SMpro hwmon driver. - -Thanks Bagas for the changes in the link below. - -Link: https://lore.kernel.org/lkml/Y1aHiaZ1OpHZIzS9@google.com/T/#mfea2167b99384486a1b75d9304536015116c1821 -Signed-off-by: Quan Nguyen -Reviewed-by: Bagas Sanjaya -Link: https://lore.kernel.org/r/20221102062103.3135417-1-quan@os.amperecomputing.com -Signed-off-by: Guenter Roeck ---- - Documentation/hwmon/smpro-hwmon.rst | 111 ++++++++++++++++++------------------ - 1 file changed, 56 insertions(+), 55 deletions(-) - -diff --git a/Documentation/hwmon/smpro-hwmon.rst b/Documentation/hwmon/smpro-hwmon.rst -index 3a9b14dacf897..fb7b3665735bb 100644 ---- a/Documentation/hwmon/smpro-hwmon.rst -+++ b/Documentation/hwmon/smpro-hwmon.rst -@@ -7,39 +7,39 @@ Supported chips: - - * Ampere(R) Altra(R) - -- Prefix: 'smpro' -+ Prefix: ``smpro`` - -- Reference: Altra SoC BMC Interface Specification -+ Reference: `Altra SoC BMC Interface Specification` - - Author: Thu Nguyen - - Description - ----------- --This driver supports hardware monitoring for Ampere(R) Altra(R) SoC's based on the --SMpro co-processor (SMpro). --The following sensor types are supported by the driver: -+The smpro-hwmon driver supports hardware monitoring for Ampere(R) Altra(R) -+SoCs based on the SMpro co-processor (SMpro). The following sensor metrics -+are supported by the driver: - - * temperature - * voltage - * current - * power - --The SMpro interface provides the registers to query the various sensors and -+The interface provides the registers to query the various sensors and - their values which are then exported to userspace by this driver. - - Usage Notes - ----------- - --SMpro hwmon driver creates at least two sysfs files for each sensor. -+The driver creates at least two sysfs files for each sensor. - --* File ``_label`` reports the sensor label. --* File ``_input`` returns the sensor value. -+* ``_label`` reports the sensor label. -+* ``_input`` returns the sensor value. - --The sysfs files are allocated in the SMpro root fs folder. --There is one root folder for each SMpro instance. -+The sysfs files are allocated in the SMpro rootfs folder, with one root -+directory for each instance. - --When the SoC is turned off, the driver will fail to read registers --and return -ENXIO. -+When the SoC is turned off, the driver will fail to read registers and -+return ``-ENXIO``. - - Sysfs entries - ------------- -@@ -48,48 +48,49 @@ The following sysfs files are supported: - - * Ampere(R) Altra(R): - --============ ============= ====== =============================================== --Name Unit Perm Description --temp1_input milli Celsius RO SoC temperature --temp2_input milli Celsius RO Max temperature reported among SoC VRDs --temp2_crit milli Celsius RO SoC VRD HOT Threshold temperature --temp3_input milli Celsius RO Max temperature reported among DIMM VRDs --temp4_input milli Celsius RO Max temperature reported among Core VRDs --temp5_input milli Celsius RO Temperature of DIMM0 on CH0 --temp5_crit milli Celsius RO MEM HOT Threshold for all DIMMs --temp6_input milli Celsius RO Temperature of DIMM0 on CH1 --temp6_crit milli Celsius RO MEM HOT Threshold for all DIMMs --temp7_input milli Celsius RO Temperature of DIMM0 on CH2 --temp7_crit milli Celsius RO MEM HOT Threshold for all DIMMs --temp8_input milli Celsius RO Temperature of DIMM0 on CH3 --temp8_crit milli Celsius RO MEM HOT Threshold for all DIMMs --temp9_input milli Celsius RO Temperature of DIMM0 on CH4 --temp9_crit milli Celsius RO MEM HOT Threshold for all DIMMs --temp10_input milli Celsius RO Temperature of DIMM0 on CH5 --temp10_crit milli Celsius RO MEM HOT Threshold for all DIMMs --temp11_input milli Celsius RO Temperature of DIMM0 on CH6 --temp11_crit milli Celsius RO MEM HOT Threshold for all DIMMs --temp12_input milli Celsius RO Temperature of DIMM0 on CH7 --temp12_crit milli Celsius RO MEM HOT Threshold for all DIMMs --temp13_input milli Celsius RO Max temperature reported among RCA VRDs --in0_input milli Volts RO Core voltage --in1_input milli Volts RO SoC voltage --in2_input milli Volts RO DIMM VRD1 voltage --in3_input milli Volts RO DIMM VRD2 voltage --in4_input milli Volts RO RCA VRD voltage --cur1_input milli Amperes RO Core VRD current --cur2_input milli Amperes RO SoC VRD current --cur3_input milli Amperes RO DIMM VRD1 current --cur4_input milli Amperes RO DIMM VRD2 current --cur5_input milli Amperes RO RCA VRD current --power1_input micro Watts RO Core VRD power --power2_input micro Watts RO SoC VRD power --power3_input micro Watts RO DIMM VRD1 power --power4_input micro Watts RO DIMM VRD2 power --power5_input micro Watts RO RCA VRD power --============ ============= ====== =============================================== -- --Example:: -+ ============ ============= ====== =============================================== -+ Name Unit Perm Description -+ ============ ============= ====== =============================================== -+ temp1_input millicelsius RO SoC temperature -+ temp2_input millicelsius RO Max temperature reported among SoC VRDs -+ temp2_crit millicelsius RO SoC VRD HOT Threshold temperature -+ temp3_input millicelsius RO Max temperature reported among DIMM VRDs -+ temp4_input millicelsius RO Max temperature reported among Core VRDs -+ temp5_input millicelsius RO Temperature of DIMM0 on CH0 -+ temp5_crit millicelsius RO MEM HOT Threshold for all DIMMs -+ temp6_input millicelsius RO Temperature of DIMM0 on CH1 -+ temp6_crit millicelsius RO MEM HOT Threshold for all DIMMs -+ temp7_input millicelsius RO Temperature of DIMM0 on CH2 -+ temp7_crit millicelsius RO MEM HOT Threshold for all DIMMs -+ temp8_input millicelsius RO Temperature of DIMM0 on CH3 -+ temp8_crit millicelsius RO MEM HOT Threshold for all DIMMs -+ temp9_input millicelsius RO Temperature of DIMM0 on CH4 -+ temp9_crit millicelsius RO MEM HOT Threshold for all DIMMs -+ temp10_input millicelsius RO Temperature of DIMM0 on CH5 -+ temp10_crit millicelsius RO MEM HOT Threshold for all DIMMs -+ temp11_input millicelsius RO Temperature of DIMM0 on CH6 -+ temp11_crit millicelsius RO MEM HOT Threshold for all DIMMs -+ temp12_input millicelsius RO Temperature of DIMM0 on CH7 -+ temp12_crit millicelsius RO MEM HOT Threshold for all DIMMs -+ temp13_input millicelsius RO Max temperature reported among RCA VRDs -+ in0_input millivolts RO Core voltage -+ in1_input millivolts RO SoC voltage -+ in2_input millivolts RO DIMM VRD1 voltage -+ in3_input millivolts RO DIMM VRD2 voltage -+ in4_input millivolts RO RCA VRD voltage -+ cur1_input milliamperes RO Core VRD current -+ cur2_input milliamperes RO SoC VRD current -+ cur3_input milliamperes RO DIMM VRD1 current -+ cur4_input milliamperes RO DIMM VRD2 current -+ cur5_input milliamperes RO RCA VRD current -+ power1_input microwatts RO Core VRD power -+ power2_input microwatts RO SoC VRD power -+ power3_input microwatts RO DIMM VRD1 power -+ power4_input microwatts RO DIMM VRD2 power -+ power5_input microwatts RO RCA VRD power -+ ============ ============= ====== =============================================== -+ -+ Example:: - - # cat in0_input - 830 --- -cgit - - -From 25f986887dd54a93edcc5cb499b2e42f4d9c359c Mon Sep 17 00:00:00 2001 -From: Christophe JAILLET -Date: Sun, 6 Nov 2022 20:34:16 +0100 -Subject: hwmon: Include when appropriate - -The kstrto() functions have been moved from kernel.h to -kstrtox.h. - -So, include the latter directly in the appropriate files. - -Signed-off-by: Christophe JAILLET -Link: https://lore.kernel.org/r/51688cf50bda44e2731381a31287c62319388783.1667763218.git.christophe.jaillet@wanadoo.fr -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/atxp1.c | 1 + - drivers/hwmon/gpio-fan.c | 1 + - drivers/hwmon/hwmon.c | 1 + - drivers/hwmon/lm90.c | 1 + - drivers/hwmon/mr75203.c | 1 + - drivers/hwmon/pcf8591.c | 1 + - drivers/hwmon/pmbus/q54sj108a2.c | 1 + - include/linux/hwmon-sysfs.h | 1 + - 8 files changed, 8 insertions(+) - -diff --git a/drivers/hwmon/atxp1.c b/drivers/hwmon/atxp1.c -index 4fd8de8022bc7..118297ea1dcfa 100644 ---- a/drivers/hwmon/atxp1.c -+++ b/drivers/hwmon/atxp1.c -@@ -16,6 +16,7 @@ - #include - #include - #include -+#include - #include - #include - #include -diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c -index ba408942dbe73..e75db6f64e8ce 100644 ---- a/drivers/hwmon/gpio-fan.c -+++ b/drivers/hwmon/gpio-fan.c -@@ -14,6 +14,7 @@ - #include - #include - #include -+#include - #include - #include - #include -diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c -index 4218750d5a66b..33edb5c02f7d7 100644 ---- a/drivers/hwmon/hwmon.c -+++ b/drivers/hwmon/hwmon.c -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - #include - #include - #include -diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c -index a3f95ba00dbff..6498d5acf7055 100644 ---- a/drivers/hwmon/lm90.c -+++ b/drivers/hwmon/lm90.c -@@ -103,6 +103,7 @@ - #include - #include - #include -+#include - #include - #include - #include -diff --git a/drivers/hwmon/mr75203.c b/drivers/hwmon/mr75203.c -index 394a4c7e46abc..50a8b9c3f94d6 100644 ---- a/drivers/hwmon/mr75203.c -+++ b/drivers/hwmon/mr75203.c -@@ -11,6 +11,7 @@ - #include - #include - #include -+#include - #include - #include - #include -diff --git a/drivers/hwmon/pcf8591.c b/drivers/hwmon/pcf8591.c -index af9614e918a45..1dbe209ae13f5 100644 ---- a/drivers/hwmon/pcf8591.c -+++ b/drivers/hwmon/pcf8591.c -@@ -14,6 +14,7 @@ - #include - #include - #include -+#include - - /* Insmod parameters */ - -diff --git a/drivers/hwmon/pmbus/q54sj108a2.c b/drivers/hwmon/pmbus/q54sj108a2.c -index fa298b4265a1c..d3ba129513240 100644 ---- a/drivers/hwmon/pmbus/q54sj108a2.c -+++ b/drivers/hwmon/pmbus/q54sj108a2.c -@@ -8,6 +8,7 @@ - - #include - #include -+#include - #include - #include - #include "pmbus.h" -diff --git a/include/linux/hwmon-sysfs.h b/include/linux/hwmon-sysfs.h -index cb26d02f52f37..d896713359cdc 100644 ---- a/include/linux/hwmon-sysfs.h -+++ b/include/linux/hwmon-sysfs.h -@@ -8,6 +8,7 @@ - #define _LINUX_HWMON_SYSFS_H - - #include -+#include - - struct sensor_device_attribute{ - struct device_attribute dev_attr; --- -cgit - - -From a1bedbcc1cf7c3d2b6b75156a6f90cadcb5e4809 Mon Sep 17 00:00:00 2001 -From: Frank Crawford -Date: Sun, 6 Nov 2022 10:25:32 +1100 -Subject: hwmon: (it87) Add DMI table for future extensions - -Add in DMI matching table to match various board quirks and settings. -This will be useful for future extentions, but will start with the -existing definition of the Shuttle SN68PT. - -Signed-off-by: Frank Crawford -Link: https://lore.kernel.org/r/20221105232531.1619387-1-frank@crawford.emu.id.au -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/it87.c | 72 ++++++++++++++++++++++++++++++++++++++-------------- - 1 file changed, 53 insertions(+), 19 deletions(-) - -diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c -index 73ed21ab325ba..9997f76b1f4aa 100644 ---- a/drivers/hwmon/it87.c -+++ b/drivers/hwmon/it87.c -@@ -567,6 +567,14 @@ struct it87_data { - s8 auto_temp[NUM_AUTO_PWM][5]; /* [nr][0] is point1_temp_hyst */ - }; - -+/* Board specific settings from DMI matching */ -+struct it87_dmi_data { -+ u8 skip_pwm; /* pwm channels to skip for this board */ -+}; -+ -+/* Global for results from DMI matching, if needed */ -+static struct it87_dmi_data *dmi_data; -+ - static int adc_lsb(const struct it87_data *data, int nr) - { - int lsb; -@@ -2393,7 +2401,6 @@ static int __init it87_find(int sioaddr, unsigned short *address, - { - int err; - u16 chip_type; -- const char *board_vendor, *board_name; - const struct it87_devices *config; - - err = superio_enter(sioaddr); -@@ -2812,24 +2819,9 @@ static int __init it87_find(int sioaddr, unsigned short *address, - if (sio_data->beep_pin) - pr_info("Beeping is supported\n"); - -- /* Disable specific features based on DMI strings */ -- board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); -- board_name = dmi_get_system_info(DMI_BOARD_NAME); -- if (board_vendor && board_name) { -- if (strcmp(board_vendor, "nVIDIA") == 0 && -- strcmp(board_name, "FN68PT") == 0) { -- /* -- * On the Shuttle SN68PT, FAN_CTL2 is apparently not -- * connected to a fan, but to something else. One user -- * has reported instant system power-off when changing -- * the PWM2 duty cycle, so we disable it. -- * I use the board name string as the trigger in case -- * the same board is ever used in other systems. -- */ -- pr_info("Disabling pwm2 due to hardware constraints\n"); -- sio_data->skip_pwm = BIT(1); -- } -- } -+ /* Set values based on DMI matches */ -+ if (dmi_data) -+ sio_data->skip_pwm |= dmi_data->skip_pwm; - - exit: - superio_exit(sioaddr); -@@ -3307,6 +3299,46 @@ exit_device_put: - return err; - } - -+/* callback function for DMI */ -+static int it87_dmi_cb(const struct dmi_system_id *dmi_entry) -+{ -+ dmi_data = dmi_entry->driver_data; -+ -+ if (dmi_data && dmi_data->skip_pwm) -+ pr_info("Disabling pwm2 due to hardware constraints\n"); -+ -+ return 1; -+} -+ -+/* -+ * On the Shuttle SN68PT, FAN_CTL2 is apparently not -+ * connected to a fan, but to something else. One user -+ * has reported instant system power-off when changing -+ * the PWM2 duty cycle, so we disable it. -+ * I use the board name string as the trigger in case -+ * the same board is ever used in other systems. -+ */ -+static struct it87_dmi_data nvidia_fn68pt = { -+ .skip_pwm = BIT(1), -+}; -+ -+#define IT87_DMI_MATCH_VND(vendor, name, cb, data) \ -+ { \ -+ .callback = cb, \ -+ .matches = { \ -+ DMI_EXACT_MATCH(DMI_BOARD_VENDOR, vendor), \ -+ DMI_EXACT_MATCH(DMI_BOARD_NAME, name), \ -+ }, \ -+ .driver_data = data, \ -+ } -+ -+static const struct dmi_system_id it87_dmi_table[] __initconst = { -+ IT87_DMI_MATCH_VND("nVIDIA", "FN68PT", it87_dmi_cb, &nvidia_fn68pt), -+ { } -+ -+}; -+MODULE_DEVICE_TABLE(dmi, it87_dmi_table); -+ - static int __init sm_it87_init(void) - { - int sioaddr[2] = { REG_2E, REG_4E }; -@@ -3319,6 +3351,8 @@ static int __init sm_it87_init(void) - if (err) - return err; - -+ dmi_check_system(it87_dmi_table); -+ - for (i = 0; i < ARRAY_SIZE(sioaddr); i++) { - memset(&sio_data, 0, sizeof(struct it87_sio_data)); - isa_address[i] = 0; --- -cgit - - -From d5d896b838222fcd037c91c9e0e8f6ab719db05f Mon Sep 17 00:00:00 2001 -From: Aleksa Savic -Date: Mon, 7 Nov 2022 15:24:55 +0100 -Subject: hwmon: (aquacomputer_d5next) Clear up macros and comments - -Reorganize macro definitions into sections for each supported -device, with additional comments on their purpose. This should -make it easier to follow what report each offset is coming -from. Also, reformat per-device initializations in -aqc_probe() to organize them into sections (fan info, -temp sensors, other parameters and lastly labels). - -No functional changes. - -Signed-off-by: Aleksa Savic -Link: https://lore.kernel.org/r/20221107142455.655998-1-savicaleksa83@gmail.com -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/aquacomputer_d5next.c | 97 ++++++++++++++++++++++++------------- - 1 file changed, 63 insertions(+), 34 deletions(-) - -diff --git a/drivers/hwmon/aquacomputer_d5next.c b/drivers/hwmon/aquacomputer_d5next.c -index 608f57f59cf94..49d3f9876fe80 100644 ---- a/drivers/hwmon/aquacomputer_d5next.c -+++ b/drivers/hwmon/aquacomputer_d5next.c -@@ -59,7 +59,7 @@ static u8 secondary_ctrl_report[] = { - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x34, 0xC6 - }; - --/* Register offsets for all Aquacomputer devices */ -+/* Sensor sizes and offsets for all Aquacomputer devices */ - #define AQC_TEMP_SENSOR_SIZE 0x02 - #define AQC_TEMP_SENSOR_DISCONNECTED 0x7FFF - #define AQC_FAN_PERCENT_OFFSET 0x00 -@@ -68,67 +68,80 @@ static u8 secondary_ctrl_report[] = { - #define AQC_FAN_POWER_OFFSET 0x06 - #define AQC_FAN_SPEED_OFFSET 0x08 - --/* Register offsets for the D5 Next pump */ --#define D5NEXT_POWER_CYCLES 0x18 --#define D5NEXT_COOLANT_TEMP 0x57 -+/* Specs of the D5 Next pump */ - #define D5NEXT_NUM_FANS 2 - #define D5NEXT_NUM_SENSORS 1 - #define D5NEXT_NUM_VIRTUAL_SENSORS 8 --#define D5NEXT_VIRTUAL_SENSORS_START 0x3f -+#define D5NEXT_CTRL_REPORT_SIZE 0x329 -+ -+/* Sensor report offsets for the D5 Next pump */ -+#define D5NEXT_POWER_CYCLES 0x18 -+#define D5NEXT_COOLANT_TEMP 0x57 - #define D5NEXT_PUMP_OFFSET 0x6c - #define D5NEXT_FAN_OFFSET 0x5f - #define D5NEXT_5V_VOLTAGE 0x39 - #define D5NEXT_12V_VOLTAGE 0x37 --#define D5NEXT_CTRL_REPORT_SIZE 0x329 --#define D5NEXT_TEMP_CTRL_OFFSET 0x2D -+#define D5NEXT_VIRTUAL_SENSORS_START 0x3f - static u8 d5next_sensor_fan_offsets[] = { D5NEXT_PUMP_OFFSET, D5NEXT_FAN_OFFSET }; - --/* Pump and fan speed registers in D5 Next control report (from 0-100%) */ --static u16 d5next_ctrl_fan_offsets[] = { 0x97, 0x42 }; -+/* Control report offsets for the D5 Next pump */ -+#define D5NEXT_TEMP_CTRL_OFFSET 0x2D /* Temperature sensor offsets location */ -+static u16 d5next_ctrl_fan_offsets[] = { 0x97, 0x42 }; /* Pump and fan speed (from 0-100%) */ - --/* Register offsets for the Farbwerk RGB controller */ -+/* Spec and sensor report offset for the Farbwerk RGB controller */ - #define FARBWERK_NUM_SENSORS 4 - #define FARBWERK_SENSOR_START 0x2f - --/* Register offsets for the Farbwerk 360 RGB controller */ -+/* Specs of the Farbwerk 360 RGB controller */ - #define FARBWERK360_NUM_SENSORS 4 --#define FARBWERK360_SENSOR_START 0x32 - #define FARBWERK360_NUM_VIRTUAL_SENSORS 16 --#define FARBWERK360_VIRTUAL_SENSORS_START 0x3a - #define FARBWERK360_CTRL_REPORT_SIZE 0x682 -+ -+/* Sensor report offsets for the Farbwerk 360 */ -+#define FARBWERK360_SENSOR_START 0x32 -+#define FARBWERK360_VIRTUAL_SENSORS_START 0x3a -+ -+/* Control report offsets for the Farbwerk 360 */ - #define FARBWERK360_TEMP_CTRL_OFFSET 0x8 - --/* Register offsets for the Octo fan controller */ --#define OCTO_POWER_CYCLES 0x18 -+/* Specs of the Octo fan controller */ - #define OCTO_NUM_FANS 8 - #define OCTO_NUM_SENSORS 4 --#define OCTO_SENSOR_START 0x3D - #define OCTO_NUM_VIRTUAL_SENSORS 16 --#define OCTO_VIRTUAL_SENSORS_START 0x45 - #define OCTO_CTRL_REPORT_SIZE 0x65F --#define OCTO_TEMP_CTRL_OFFSET 0xA -+ -+/* Sensor report offsets for the Octo */ -+#define OCTO_POWER_CYCLES 0x18 -+#define OCTO_SENSOR_START 0x3D -+#define OCTO_VIRTUAL_SENSORS_START 0x45 - static u8 octo_sensor_fan_offsets[] = { 0x7D, 0x8A, 0x97, 0xA4, 0xB1, 0xBE, 0xCB, 0xD8 }; - --/* Fan speed registers in Octo control report (from 0-100%) */ -+/* Control report offsets for the Octo */ -+#define OCTO_TEMP_CTRL_OFFSET 0xA -+/* Fan speed offsets (0-100%) */ - static u16 octo_ctrl_fan_offsets[] = { 0x5B, 0xB0, 0x105, 0x15A, 0x1AF, 0x204, 0x259, 0x2AE }; - --/* Register offsets for the Quadro fan controller */ --#define QUADRO_POWER_CYCLES 0x18 -+/* Specs of Quadro fan controller */ - #define QUADRO_NUM_FANS 4 - #define QUADRO_NUM_SENSORS 4 --#define QUADRO_SENSOR_START 0x34 - #define QUADRO_NUM_VIRTUAL_SENSORS 16 --#define QUADRO_VIRTUAL_SENSORS_START 0x3c - #define QUADRO_CTRL_REPORT_SIZE 0x3c1 -+ -+/* Sensor report offsets for the Quadro */ -+#define QUADRO_POWER_CYCLES 0x18 -+#define QUADRO_SENSOR_START 0x34 -+#define QUADRO_VIRTUAL_SENSORS_START 0x3c - #define QUADRO_FLOW_SENSOR_OFFSET 0x6e --#define QUADRO_TEMP_CTRL_OFFSET 0xA - static u8 quadro_sensor_fan_offsets[] = { 0x70, 0x7D, 0x8A, 0x97 }; - --/* Fan speed registers in Quadro control report (from 0-100%) */ --static u16 quadro_ctrl_fan_offsets[] = { 0x37, 0x8c, 0xe1, 0x136 }; -+/* Control report offsets for the Quadro */ -+#define QUADRO_TEMP_CTRL_OFFSET 0xA -+static u16 quadro_ctrl_fan_offsets[] = { 0x37, 0x8c, 0xe1, 0x136 }; /* Fan speed offsets (0-100%) */ - --/* Register offsets for the High Flow Next */ -+/* Specs of High Flow Next flow sensor */ - #define HIGHFLOWNEXT_NUM_SENSORS 2 -+ -+/* Sensor report offsets for the High Flow Next */ - #define HIGHFLOWNEXT_SENSOR_START 85 - #define HIGHFLOWNEXT_FLOW 81 - #define HIGHFLOWNEXT_WATER_QUALITY 89 -@@ -903,14 +916,17 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id) - priv->num_fans = D5NEXT_NUM_FANS; - priv->fan_sensor_offsets = d5next_sensor_fan_offsets; - priv->fan_ctrl_offsets = d5next_ctrl_fan_offsets; -+ - priv->num_temp_sensors = D5NEXT_NUM_SENSORS; - priv->temp_sensor_start_offset = D5NEXT_COOLANT_TEMP; - priv->num_virtual_temp_sensors = D5NEXT_NUM_VIRTUAL_SENSORS; - priv->virtual_temp_sensor_start_offset = D5NEXT_VIRTUAL_SENSORS_START; -- priv->power_cycle_count_offset = D5NEXT_POWER_CYCLES; -- priv->buffer_size = D5NEXT_CTRL_REPORT_SIZE; - priv->temp_ctrl_offset = D5NEXT_TEMP_CTRL_OFFSET; - -+ priv->buffer_size = D5NEXT_CTRL_REPORT_SIZE; -+ -+ priv->power_cycle_count_offset = D5NEXT_POWER_CYCLES; -+ - priv->temp_label = label_d5next_temp; - priv->virtual_temp_label = label_virtual_temp_sensors; - priv->speed_label = label_d5next_speeds; -@@ -922,20 +938,25 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id) - priv->kind = farbwerk; - - priv->num_fans = 0; -+ - priv->num_temp_sensors = FARBWERK_NUM_SENSORS; - priv->temp_sensor_start_offset = FARBWERK_SENSOR_START; -+ - priv->temp_label = label_temp_sensors; - break; - case USB_PRODUCT_ID_FARBWERK360: - priv->kind = farbwerk360; - - priv->num_fans = 0; -+ - priv->num_temp_sensors = FARBWERK360_NUM_SENSORS; - priv->temp_sensor_start_offset = FARBWERK360_SENSOR_START; - priv->num_virtual_temp_sensors = FARBWERK360_NUM_VIRTUAL_SENSORS; - priv->virtual_temp_sensor_start_offset = FARBWERK360_VIRTUAL_SENSORS_START; -- priv->buffer_size = FARBWERK360_CTRL_REPORT_SIZE; - priv->temp_ctrl_offset = FARBWERK360_TEMP_CTRL_OFFSET; -+ -+ priv->buffer_size = FARBWERK360_CTRL_REPORT_SIZE; -+ - priv->temp_label = label_temp_sensors; - priv->virtual_temp_label = label_virtual_temp_sensors; - break; -@@ -945,14 +966,17 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id) - priv->num_fans = OCTO_NUM_FANS; - priv->fan_sensor_offsets = octo_sensor_fan_offsets; - priv->fan_ctrl_offsets = octo_ctrl_fan_offsets; -+ - priv->num_temp_sensors = OCTO_NUM_SENSORS; - priv->temp_sensor_start_offset = OCTO_SENSOR_START; - priv->num_virtual_temp_sensors = OCTO_NUM_VIRTUAL_SENSORS; - priv->virtual_temp_sensor_start_offset = OCTO_VIRTUAL_SENSORS_START; -- priv->power_cycle_count_offset = OCTO_POWER_CYCLES; -- priv->buffer_size = OCTO_CTRL_REPORT_SIZE; - priv->temp_ctrl_offset = OCTO_TEMP_CTRL_OFFSET; - -+ priv->buffer_size = OCTO_CTRL_REPORT_SIZE; -+ -+ priv->power_cycle_count_offset = OCTO_POWER_CYCLES; -+ - priv->temp_label = label_temp_sensors; - priv->virtual_temp_label = label_virtual_temp_sensors; - priv->speed_label = label_fan_speed; -@@ -966,14 +990,17 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id) - priv->num_fans = QUADRO_NUM_FANS; - priv->fan_sensor_offsets = quadro_sensor_fan_offsets; - priv->fan_ctrl_offsets = quadro_ctrl_fan_offsets; -+ - priv->num_temp_sensors = QUADRO_NUM_SENSORS; - priv->temp_sensor_start_offset = QUADRO_SENSOR_START; - priv->num_virtual_temp_sensors = QUADRO_NUM_VIRTUAL_SENSORS; - priv->virtual_temp_sensor_start_offset = QUADRO_VIRTUAL_SENSORS_START; -- priv->power_cycle_count_offset = QUADRO_POWER_CYCLES; -+ priv->temp_ctrl_offset = QUADRO_TEMP_CTRL_OFFSET; -+ - priv->buffer_size = QUADRO_CTRL_REPORT_SIZE; -+ - priv->flow_sensor_offset = QUADRO_FLOW_SENSOR_OFFSET; -- priv->temp_ctrl_offset = QUADRO_TEMP_CTRL_OFFSET; -+ priv->power_cycle_count_offset = QUADRO_POWER_CYCLES; - - priv->temp_label = label_temp_sensors; - priv->virtual_temp_label = label_virtual_temp_sensors; -@@ -986,8 +1013,10 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id) - priv->kind = highflownext; - - priv->num_fans = 0; -+ - priv->num_temp_sensors = HIGHFLOWNEXT_NUM_SENSORS; - priv->temp_sensor_start_offset = HIGHFLOWNEXT_SENSOR_START; -+ - priv->power_cycle_count_offset = QUADRO_POWER_CYCLES; - - priv->temp_label = label_highflownext_temp_sensors; --- -cgit - - -From ed264e8a7d18c5fec2587ed750c87b75d5348210 Mon Sep 17 00:00:00 2001 -From: Joaquín Ignacio Aramendía -Date: Fri, 4 Nov 2022 11:07:00 -0300 -Subject: hwmon: add OneXPlayer mini AMD sensors driver -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Sensors driver for OXP Handhelds from One-Netbook that expose fan reading -and control via hwmon sysfs. - -As far as I could gather all OXP boards have the same DMI strings and -they can be told appart only by the boot cpu vendor (Intel/AMD). -Currently only AMD boards are supported since Intel have different EC -registers and values to read/write. - -Fan control is provided via pwm interface in the range [0-255]. AMD -boards have [0-100] as range in the EC, the written value is scaled to -accommodate for that. - -Signed-off-by: Joaquín Ignacio Aramendía -Link: https://lore.kernel.org/r/20221104140659.593608-1-samsagax@gmail.com -[groeck: Removed misleading comment about module_platform_driver()] -Signed-off-by: Guenter Roeck ---- - Documentation/hwmon/index.rst | 1 + - Documentation/hwmon/oxp-sensors.rst | 34 +++++ - MAINTAINERS | 6 + - drivers/hwmon/Kconfig | 11 ++ - drivers/hwmon/Makefile | 1 + - drivers/hwmon/oxp-sensors.c | 256 ++++++++++++++++++++++++++++++++++++ - 6 files changed, 309 insertions(+) - create mode 100644 Documentation/hwmon/oxp-sensors.rst - create mode 100644 drivers/hwmon/oxp-sensors.c - -diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst -index ddff3c5713d74..fe2cc6b73634c 100644 ---- a/Documentation/hwmon/index.rst -+++ b/Documentation/hwmon/index.rst -@@ -160,6 +160,7 @@ Hardware Monitoring Kernel Drivers - nzxt-kraken2 - nzxt-smart2 - occ -+ oxp-sensors - pc87360 - pc87427 - pcf8591 -diff --git a/Documentation/hwmon/oxp-sensors.rst b/Documentation/hwmon/oxp-sensors.rst -new file mode 100644 -index 0000000000000..f612dddc964ae ---- /dev/null -+++ b/Documentation/hwmon/oxp-sensors.rst -@@ -0,0 +1,34 @@ -+.. SPDX-License-Identifier: GPL-2.0-or-later -+ -+Kernel driver oxp-sensors -+========================= -+ -+Author: -+ - Joaquín Ignacio Aramendía -+ -+Description: -+------------ -+ -+One X Player devices from One Netbook provide fan readings and fan control -+through its Embedded Controller. -+ -+Currently only supports AMD boards from the One X Player lineup. Intel boards -+could be supported if we could figure out the EC registers and values to write -+to since the EC layout and model is different. -+ -+Sysfs entries -+------------- -+ -+The following attributes are supported: -+ -+fan1_input -+ Read Only. Reads current fan RMP. -+ -+pwm1_enable -+ Read Write. Enable manual fan control. Write "1" to set to manual, write "0" -+ to let the EC control de fan speed. Read this attribute to see current status. -+ -+pwm1 -+ Read Write. Read this attribute to see current duty cycle in the range [0-255]. -+ When pwm1_enable is set to "1" (manual) write any value in the range [0-255] -+ to set fan speed. -diff --git a/MAINTAINERS b/MAINTAINERS -index 1daadaa4d48be..90220659206cb 100644 ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -15345,6 +15345,12 @@ S: Maintained - F: drivers/mtd/nand/onenand/ - F: include/linux/mtd/onenand*.h - -+ONEXPLAYER FAN DRIVER -+M: Joaquín Ignacio Aramendía -+L: linux-hwmon@vger.kernel.org -+S: Maintained -+F: drivers/hwmon/oxp-sensors.c -+ - ONION OMEGA2+ BOARD - M: Harvey Hunt - L: linux-mips@vger.kernel.org -diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig -index a5253abb7ea72..3176c33af6c69 100644 ---- a/drivers/hwmon/Kconfig -+++ b/drivers/hwmon/Kconfig -@@ -1616,6 +1616,17 @@ config SENSORS_NZXT_SMART2 - - source "drivers/hwmon/occ/Kconfig" - -+config SENSORS_OXP -+ tristate "OneXPlayer EC fan control" -+ depends on ACPI -+ depends on X86 -+ help -+ If you say yes here you get support for fan readings and control over -+ OneXPlayer handheld devices. Only OneXPlayer mini AMD handheld variant -+ boards are supported. -+ -+ Can also be built as a module. In that case it will be called oxp-sensors. -+ - config SENSORS_PCF8591 - tristate "Philips PCF8591 ADC/DAC" - depends on I2C -diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile -index c5cd7e3a67ffd..e2e4e87b282f5 100644 ---- a/drivers/hwmon/Makefile -+++ b/drivers/hwmon/Makefile -@@ -167,6 +167,7 @@ obj-$(CONFIG_SENSORS_NSA320) += nsa320-hwmon.o - obj-$(CONFIG_SENSORS_NTC_THERMISTOR) += ntc_thermistor.o - obj-$(CONFIG_SENSORS_NZXT_KRAKEN2) += nzxt-kraken2.o - obj-$(CONFIG_SENSORS_NZXT_SMART2) += nzxt-smart2.o -+obj-$(CONFIG_SENSORS_OXP) += oxp-sensors.o - obj-$(CONFIG_SENSORS_PC87360) += pc87360.o - obj-$(CONFIG_SENSORS_PC87427) += pc87427.o - obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o -diff --git a/drivers/hwmon/oxp-sensors.c b/drivers/hwmon/oxp-sensors.c -new file mode 100644 -index 0000000000000..b1653eb5e6707 ---- /dev/null -+++ b/drivers/hwmon/oxp-sensors.c -@@ -0,0 +1,256 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * Platform driver for OXP Handhelds that expose fan reading and control -+ * via hwmon sysfs. -+ * -+ * All boards have the same DMI strings and they are told appart by the -+ * boot cpu vendor (Intel/AMD). Currently only AMD boards are supported -+ * but the code is made to be simple to add other handheld boards in the -+ * future. -+ * Fan control is provided via pwm interface in the range [0-255]. AMD -+ * boards use [0-100] as range in the EC, the written value is scaled to -+ * accommodate for that. -+ * -+ * Copyright (C) 2022 Joaquín I. Aramendía -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* Handle ACPI lock mechanism */ -+static u32 oxp_mutex; -+ -+#define ACPI_LOCK_DELAY_MS 500 -+ -+static bool lock_global_acpi_lock(void) -+{ -+ return ACPI_SUCCESS(acpi_acquire_global_lock(ACPI_LOCK_DELAY_MS, &oxp_mutex)); -+} -+ -+static bool unlock_global_acpi_lock(void) -+{ -+ return ACPI_SUCCESS(acpi_release_global_lock(oxp_mutex)); -+} -+ -+#define OXP_SENSOR_FAN_REG 0x76 /* Fan reading is 2 registers long */ -+#define OXP_SENSOR_PWM_ENABLE_REG 0x4A /* PWM enable is 1 register long */ -+#define OXP_SENSOR_PWM_REG 0x4B /* PWM reading is 1 register long */ -+ -+static const struct dmi_system_id dmi_table[] = { -+ { -+ .matches = { -+ DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"), -+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONE XPLAYER"), -+ }, -+ }, -+ {}, -+}; -+ -+/* Helper functions to handle EC read/write */ -+static int read_from_ec(u8 reg, int size, long *val) -+{ -+ int i; -+ int ret; -+ u8 buffer; -+ -+ if (!lock_global_acpi_lock()) -+ return -EBUSY; -+ -+ *val = 0; -+ for (i = 0; i < size; i++) { -+ ret = ec_read(reg + i, &buffer); -+ if (ret) -+ return ret; -+ *val <<= i * 8; -+ *val += buffer; -+ } -+ -+ if (!unlock_global_acpi_lock()) -+ return -EBUSY; -+ -+ return 0; -+} -+ -+static int write_to_ec(const struct device *dev, u8 reg, u8 value) -+{ -+ int ret; -+ -+ if (!lock_global_acpi_lock()) -+ return -EBUSY; -+ -+ ret = ec_write(reg, value); -+ -+ if (!unlock_global_acpi_lock()) -+ return -EBUSY; -+ -+ return ret; -+} -+ -+static int oxp_pwm_enable(const struct device *dev) -+{ -+ return write_to_ec(dev, OXP_SENSOR_PWM_ENABLE_REG, 0x01); -+} -+ -+static int oxp_pwm_disable(const struct device *dev) -+{ -+ return write_to_ec(dev, OXP_SENSOR_PWM_ENABLE_REG, 0x00); -+} -+ -+/* Callbacks for hwmon interface */ -+static umode_t oxp_ec_hwmon_is_visible(const void *drvdata, -+ enum hwmon_sensor_types type, u32 attr, int channel) -+{ -+ switch (type) { -+ case hwmon_fan: -+ return 0444; -+ case hwmon_pwm: -+ return 0644; -+ default: -+ return 0; -+ } -+} -+ -+static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type, -+ u32 attr, int channel, long *val) -+{ -+ int ret; -+ -+ switch (type) { -+ case hwmon_fan: -+ switch (attr) { -+ case hwmon_fan_input: -+ return read_from_ec(OXP_SENSOR_FAN_REG, 2, val); -+ default: -+ break; -+ } -+ break; -+ case hwmon_pwm: -+ switch (attr) { -+ case hwmon_pwm_input: -+ ret = read_from_ec(OXP_SENSOR_PWM_REG, 2, val); -+ if (ret) -+ return ret; -+ *val = (*val * 255) / 100; -+ return 0; -+ case hwmon_pwm_enable: -+ return read_from_ec(OXP_SENSOR_PWM_ENABLE_REG, 1, val); -+ default: -+ break; -+ } -+ break; -+ default: -+ break; -+ } -+ return -EOPNOTSUPP; -+} -+ -+static int oxp_platform_write(struct device *dev, enum hwmon_sensor_types type, -+ u32 attr, int channel, long val) -+{ -+ switch (type) { -+ case hwmon_pwm: -+ switch (attr) { -+ case hwmon_pwm_enable: -+ if (val == 1) -+ return oxp_pwm_enable(dev); -+ else if (val == 0) -+ return oxp_pwm_disable(dev); -+ return -EINVAL; -+ case hwmon_pwm_input: -+ if (val < 0 || val > 255) -+ return -EINVAL; -+ val = (val * 100) / 255; -+ return write_to_ec(dev, OXP_SENSOR_PWM_REG, val); -+ default: -+ break; -+ } -+ break; -+ default: -+ break; -+ } -+ return -EOPNOTSUPP; -+} -+ -+/* Known sensors in the OXP EC controllers */ -+static const struct hwmon_channel_info *oxp_platform_sensors[] = { -+ HWMON_CHANNEL_INFO(fan, -+ HWMON_F_INPUT), -+ HWMON_CHANNEL_INFO(pwm, -+ HWMON_PWM_INPUT | HWMON_PWM_ENABLE), -+ NULL, -+}; -+ -+static const struct hwmon_ops oxp_ec_hwmon_ops = { -+ .is_visible = oxp_ec_hwmon_is_visible, -+ .read = oxp_platform_read, -+ .write = oxp_platform_write, -+}; -+ -+static const struct hwmon_chip_info oxp_ec_chip_info = { -+ .ops = &oxp_ec_hwmon_ops, -+ .info = oxp_platform_sensors, -+}; -+ -+/* Initialization logic */ -+static int oxp_platform_probe(struct platform_device *pdev) -+{ -+ const struct dmi_system_id *dmi_entry; -+ struct device *dev = &pdev->dev; -+ struct device *hwdev; -+ -+ /* -+ * Have to check for AMD processor here because DMI strings are the -+ * same between Intel and AMD boards, the only way to tell them appart -+ * is the CPU. -+ * Intel boards seem to have different EC registers and values to -+ * read/write. -+ */ -+ dmi_entry = dmi_first_match(dmi_table); -+ if (!dmi_entry || boot_cpu_data.x86_vendor != X86_VENDOR_AMD) -+ return -ENODEV; -+ -+ hwdev = devm_hwmon_device_register_with_info(dev, "oxpec", NULL, -+ &oxp_ec_chip_info, NULL); -+ -+ return PTR_ERR_OR_ZERO(hwdev); -+} -+ -+static struct platform_driver oxp_platform_driver = { -+ .driver = { -+ .name = "oxp-platform", -+ }, -+ .probe = oxp_platform_probe, -+}; -+ -+static struct platform_device *oxp_platform_device; -+ -+static int __init oxp_platform_init(void) -+{ -+ oxp_platform_device = -+ platform_create_bundle(&oxp_platform_driver, -+ oxp_platform_probe, NULL, 0, NULL, 0); -+ -+ return PTR_ERR_OR_ZERO(oxp_platform_device); -+} -+ -+static void __exit oxp_platform_exit(void) -+{ -+ platform_device_unregister(oxp_platform_device); -+ platform_driver_unregister(&oxp_platform_driver); -+} -+ -+MODULE_DEVICE_TABLE(dmi, dmi_table); -+ -+module_init(oxp_platform_init); -+module_exit(oxp_platform_exit); -+ -+MODULE_AUTHOR("Joaquín Ignacio Aramendía "); -+MODULE_DESCRIPTION("Platform driver that handles EC sensors of OneXPlayer devices"); -+MODULE_LICENSE("GPL"); --- -cgit - - -From 5c0e64dde80ffe78d930db4e38e6218598aecd85 Mon Sep 17 00:00:00 2001 -From: Zhang Rui -Date: Tue, 8 Nov 2022 15:50:49 +0800 -Subject: hwmon: (coretemp) Remove obsolete temp_data->valid - -Checking for the valid bit of IA32_THERM_STATUS is removed in commit -bf6ea084ebb5 ("hwmon: (coretemp) Do not return -EAGAIN for low -temperatures"), and temp_data->valid is set and never cleared when the -temperature has been read once. - -Remove the obsolete temp_data->valid field. - -Signed-off-by: Zhang Rui -Link: https://lore.kernel.org/r/20221108075051.5139-2-rui.zhang@intel.com -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/coretemp.c | 5 +---- - 1 file changed, 1 insertion(+), 4 deletions(-) - -diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c -index 9bee4d33fbdf0..27d88c3a3487f 100644 ---- a/drivers/hwmon/coretemp.c -+++ b/drivers/hwmon/coretemp.c -@@ -64,7 +64,6 @@ MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius"); - * @attr_size: Total number of pre-core attrs displayed in the sysfs. - * @is_pkg_data: If this is 1, the temp_data holds pkgtemp data. - * Otherwise, temp_data holds coretemp data. -- * @valid: If this is 1, the current temperature is valid. - */ - struct temp_data { - int temp; -@@ -76,7 +75,6 @@ struct temp_data { - u32 status_reg; - int attr_size; - bool is_pkg_data; -- bool valid; - struct sensor_device_attribute sd_attrs[TOTAL_ATTRS]; - char attr_name[TOTAL_ATTRS][CORETEMP_NAME_LENGTH]; - struct attribute *attrs[TOTAL_ATTRS + 1]; -@@ -157,7 +155,7 @@ static ssize_t show_temp(struct device *dev, - mutex_lock(&tdata->update_lock); - - /* Check whether the time interval has elapsed */ -- if (!tdata->valid || time_after(jiffies, tdata->last_updated + HZ)) { -+ if (time_after(jiffies, tdata->last_updated + HZ)) { - rdmsr_on_cpu(tdata->cpu, tdata->status_reg, &eax, &edx); - /* - * Ignore the valid bit. In all observed cases the register -@@ -166,7 +164,6 @@ static ssize_t show_temp(struct device *dev, - * really help at all. - */ - tdata->temp = tdata->tjmax - ((eax >> 16) & 0x7f) * 1000; -- tdata->valid = true; - tdata->last_updated = jiffies; - } - --- -cgit - - -From 07619140e2a12484ea262b8845fd09e099f843a8 Mon Sep 17 00:00:00 2001 -From: Christophe JAILLET -Date: Sun, 13 Nov 2022 10:13:16 +0100 -Subject: hwmon: Remove some useless #include - - is not needed for these drivers. Remove the -corresponding #include. - -Signed-off-by: Christophe JAILLET -Link: https://lore.kernel.org/r/41610f64a69bd0245ebc811fcff10ee54e93ac46.1668330765.git.christophe.jaillet@wanadoo.fr -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/vt8231.c | 1 - - drivers/hwmon/w83l786ng.c | 1 - - 2 files changed, 2 deletions(-) - -diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c -index 3b7f8922b0d5a..b7c6392ba6737 100644 ---- a/drivers/hwmon/vt8231.c -+++ b/drivers/hwmon/vt8231.c +diff -rupN linux-6.1.2.orig/drivers/hwmon/vt8231.c linux-6.1.2/drivers/hwmon/vt8231.c +--- linux-6.1.2.orig/drivers/hwmon/vt8231.c 2022-12-31 16:12:06.942585573 -0500 ++++ linux-6.1.2/drivers/hwmon/vt8231.c 2022-12-31 16:19:53.953180971 -0500 @@ -22,7 +22,6 @@ #include #include @@ -3432,10 +2668,9 @@ index 3b7f8922b0d5a..b7c6392ba6737 100644 #include #include #include -diff --git a/drivers/hwmon/w83l786ng.c b/drivers/hwmon/w83l786ng.c -index 2c4646fa84260..5597e1c2d95cf 100644 ---- a/drivers/hwmon/w83l786ng.c -+++ b/drivers/hwmon/w83l786ng.c +diff -rupN linux-6.1.2.orig/drivers/hwmon/w83l786ng.c linux-6.1.2/drivers/hwmon/w83l786ng.c +--- linux-6.1.2.orig/drivers/hwmon/w83l786ng.c 2022-12-31 16:12:06.942585573 -0500 ++++ linux-6.1.2/drivers/hwmon/w83l786ng.c 2022-12-31 16:19:53.953180971 -0500 @@ -16,7 +16,6 @@ #include #include @@ -3444,642 +2679,20 @@ index 2c4646fa84260..5597e1c2d95cf 100644 #include #include #include --- -cgit - - -From 2bc0e6d07ee50497043112d677fdd34327cf025c Mon Sep 17 00:00:00 2001 -From: Zhang Rui -Date: Sun, 13 Nov 2022 23:31:43 +0800 -Subject: hwmon: (coretemp) rearrange tjmax handing code - -Rearrange the tjmax handling code so that it can be used directly in -the sysfs attribute callbacks without forward declarations. - -No functional change in this patch. - -Signed-off-by: Zhang Rui -Link: https://lore.kernel.org/r/20221113153145.32696-2-rui.zhang@intel.com -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/coretemp.c | 156 +++++++++++++++++++++++------------------------ - 1 file changed, 78 insertions(+), 78 deletions(-) - -diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c -index 27d88c3a3487f..6b6ee563e0087 100644 ---- a/drivers/hwmon/coretemp.c -+++ b/drivers/hwmon/coretemp.c -@@ -93,84 +93,6 @@ struct platform_data { - struct device_attribute name_attr; - }; +diff -rupN linux-6.1.2.orig/include/linux/hwmon-sysfs.h linux-6.1.2/include/linux/hwmon-sysfs.h +--- linux-6.1.2.orig/include/linux/hwmon-sysfs.h 2022-12-31 16:12:07.878571532 -0500 ++++ linux-6.1.2/include/linux/hwmon-sysfs.h 2022-12-31 16:19:53.949181008 -0500 +@@ -8,6 +8,7 @@ + #define _LINUX_HWMON_SYSFS_H --/* Keep track of how many zone pointers we allocated in init() */ --static int max_zones __read_mostly; --/* Array of zone pointers. Serialized by cpu hotplug lock */ --static struct platform_device **zone_devices; -- --static ssize_t show_label(struct device *dev, -- struct device_attribute *devattr, char *buf) --{ -- struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); -- struct platform_data *pdata = dev_get_drvdata(dev); -- struct temp_data *tdata = pdata->core_data[attr->index]; -- -- if (tdata->is_pkg_data) -- return sprintf(buf, "Package id %u\n", pdata->pkg_id); -- -- return sprintf(buf, "Core %u\n", tdata->cpu_core_id); --} -- --static ssize_t show_crit_alarm(struct device *dev, -- struct device_attribute *devattr, char *buf) --{ -- u32 eax, edx; -- struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); -- struct platform_data *pdata = dev_get_drvdata(dev); -- struct temp_data *tdata = pdata->core_data[attr->index]; -- -- mutex_lock(&tdata->update_lock); -- rdmsr_on_cpu(tdata->cpu, tdata->status_reg, &eax, &edx); -- mutex_unlock(&tdata->update_lock); -- -- return sprintf(buf, "%d\n", (eax >> 5) & 1); --} -- --static ssize_t show_tjmax(struct device *dev, -- struct device_attribute *devattr, char *buf) --{ -- struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); -- struct platform_data *pdata = dev_get_drvdata(dev); -- -- return sprintf(buf, "%d\n", pdata->core_data[attr->index]->tjmax); --} -- --static ssize_t show_ttarget(struct device *dev, -- struct device_attribute *devattr, char *buf) --{ -- struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); -- struct platform_data *pdata = dev_get_drvdata(dev); -- -- return sprintf(buf, "%d\n", pdata->core_data[attr->index]->ttarget); --} -- --static ssize_t show_temp(struct device *dev, -- struct device_attribute *devattr, char *buf) --{ -- u32 eax, edx; -- struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); -- struct platform_data *pdata = dev_get_drvdata(dev); -- struct temp_data *tdata = pdata->core_data[attr->index]; -- -- mutex_lock(&tdata->update_lock); -- -- /* Check whether the time interval has elapsed */ -- if (time_after(jiffies, tdata->last_updated + HZ)) { -- rdmsr_on_cpu(tdata->cpu, tdata->status_reg, &eax, &edx); -- /* -- * Ignore the valid bit. In all observed cases the register -- * value is either low or zero if the valid bit is 0. -- * Return it instead of reporting an error which doesn't -- * really help at all. -- */ -- tdata->temp = tdata->tjmax - ((eax >> 16) & 0x7f) * 1000; -- tdata->last_updated = jiffies; -- } -- -- mutex_unlock(&tdata->update_lock); -- return sprintf(buf, "%d\n", tdata->temp); --} -- - struct tjmax_pci { - unsigned int device; - int tjmax; -@@ -376,6 +298,84 @@ static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev) - return adjust_tjmax(c, id, dev); - } + #include ++#include -+/* Keep track of how many zone pointers we allocated in init() */ -+static int max_zones __read_mostly; -+/* Array of zone pointers. Serialized by cpu hotplug lock */ -+static struct platform_device **zone_devices; -+ -+static ssize_t show_label(struct device *dev, -+ struct device_attribute *devattr, char *buf) -+{ -+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); -+ struct platform_data *pdata = dev_get_drvdata(dev); -+ struct temp_data *tdata = pdata->core_data[attr->index]; -+ -+ if (tdata->is_pkg_data) -+ return sprintf(buf, "Package id %u\n", pdata->pkg_id); -+ -+ return sprintf(buf, "Core %u\n", tdata->cpu_core_id); -+} -+ -+static ssize_t show_crit_alarm(struct device *dev, -+ struct device_attribute *devattr, char *buf) -+{ -+ u32 eax, edx; -+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); -+ struct platform_data *pdata = dev_get_drvdata(dev); -+ struct temp_data *tdata = pdata->core_data[attr->index]; -+ -+ mutex_lock(&tdata->update_lock); -+ rdmsr_on_cpu(tdata->cpu, tdata->status_reg, &eax, &edx); -+ mutex_unlock(&tdata->update_lock); -+ -+ return sprintf(buf, "%d\n", (eax >> 5) & 1); -+} -+ -+static ssize_t show_tjmax(struct device *dev, -+ struct device_attribute *devattr, char *buf) -+{ -+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); -+ struct platform_data *pdata = dev_get_drvdata(dev); -+ -+ return sprintf(buf, "%d\n", pdata->core_data[attr->index]->tjmax); -+} -+ -+static ssize_t show_ttarget(struct device *dev, -+ struct device_attribute *devattr, char *buf) -+{ -+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); -+ struct platform_data *pdata = dev_get_drvdata(dev); -+ -+ return sprintf(buf, "%d\n", pdata->core_data[attr->index]->ttarget); -+} -+ -+static ssize_t show_temp(struct device *dev, -+ struct device_attribute *devattr, char *buf) -+{ -+ u32 eax, edx; -+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); -+ struct platform_data *pdata = dev_get_drvdata(dev); -+ struct temp_data *tdata = pdata->core_data[attr->index]; -+ -+ mutex_lock(&tdata->update_lock); -+ -+ /* Check whether the time interval has elapsed */ -+ if (time_after(jiffies, tdata->last_updated + HZ)) { -+ rdmsr_on_cpu(tdata->cpu, tdata->status_reg, &eax, &edx); -+ /* -+ * Ignore the valid bit. In all observed cases the register -+ * value is either low or zero if the valid bit is 0. -+ * Return it instead of reporting an error which doesn't -+ * really help at all. -+ */ -+ tdata->temp = tdata->tjmax - ((eax >> 16) & 0x7f) * 1000; -+ tdata->last_updated = jiffies; -+ } -+ -+ mutex_unlock(&tdata->update_lock); -+ return sprintf(buf, "%d\n", tdata->temp); -+} -+ - static int create_core_attrs(struct temp_data *tdata, struct device *dev, - int attr_no) - { --- -cgit - - -From c0c67f8761cec1fe36c21d85b1a5400ea7ac30cd Mon Sep 17 00:00:00 2001 -From: Zhang Rui -Date: Sun, 13 Nov 2022 23:31:44 +0800 -Subject: hwmon: (coretemp) Add support for dynamic tjmax - -Tjmax value retrieved from MSR_IA32_TEMPERATURE_TARGET can be changed at -runtime when the Intel SST-PP (Intel Speed Select Technology - -Performance Profile) level is changed. - -Improve the code to always use updated tjmax when it can be retrieved -from MSR_IA32_TEMPERATURE_TARGET. - -When tjmax can not be retrieved from MSR_IA32_TEMPERATURE_TARGET, still -follow the previous logic and always use a static tjmax value. - -Signed-off-by: Zhang Rui -Link: https://lore.kernel.org/r/20221113153145.32696-3-rui.zhang@intel.com -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/coretemp.c | 46 +++++++++++++++++++++++++++++++--------------- - 1 file changed, 31 insertions(+), 15 deletions(-) - -diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c -index 6b6ee563e0087..5e03cfbbe99b8 100644 ---- a/drivers/hwmon/coretemp.c -+++ b/drivers/hwmon/coretemp.c -@@ -55,6 +55,8 @@ MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius"); - - /* - * Per-Core Temperature Data -+ * @tjmax: The static tjmax value when tjmax cannot be retrieved from -+ * IA32_TEMPERATURE_TARGET MSR. - * @last_updated: The time when the current temperature value was updated - * earlier (in jiffies). - * @cpu_core_id: The CPU Core from which temperature values should be read -@@ -259,20 +261,25 @@ static bool cpu_has_tjmax(struct cpuinfo_x86 *c) - model != 0x36; - } - --static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev) -+static int get_tjmax(struct temp_data *tdata, struct device *dev) - { -+ struct cpuinfo_x86 *c = &cpu_data(tdata->cpu); - int err; - u32 eax, edx; - u32 val; - -+ /* use static tjmax once it is set */ -+ if (tdata->tjmax) -+ return tdata->tjmax; -+ - /* - * A new feature of current Intel(R) processors, the - * IA32_TEMPERATURE_TARGET contains the TjMax value - */ -- err = rdmsr_safe_on_cpu(id, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx); -+ err = rdmsr_safe_on_cpu(tdata->cpu, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx); - if (err) { - if (cpu_has_tjmax(c)) -- dev_warn(dev, "Unable to read TjMax from CPU %u\n", id); -+ dev_warn(dev, "Unable to read TjMax from CPU %u\n", tdata->cpu); - } else { - val = (eax >> 16) & 0xff; - /* -@@ -288,14 +295,15 @@ static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev) - if (force_tjmax) { - dev_notice(dev, "TjMax forced to %d degrees C by user\n", - force_tjmax); -- return force_tjmax * 1000; -+ tdata->tjmax = force_tjmax * 1000; -+ } else { -+ /* -+ * An assumption is made for early CPUs and unreadable MSR. -+ * NOTE: the calculated value may not be correct. -+ */ -+ tdata->tjmax = adjust_tjmax(c, tdata->cpu, dev); - } -- -- /* -- * An assumption is made for early CPUs and unreadable MSR. -- * NOTE: the calculated value may not be correct. -- */ -- return adjust_tjmax(c, id, dev); -+ return tdata->tjmax; - } - - /* Keep track of how many zone pointers we allocated in init() */ -@@ -336,8 +344,14 @@ static ssize_t show_tjmax(struct device *dev, - { - struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); - struct platform_data *pdata = dev_get_drvdata(dev); -+ struct temp_data *tdata = pdata->core_data[attr->index]; -+ int tjmax; -+ -+ mutex_lock(&tdata->update_lock); -+ tjmax = get_tjmax(tdata, dev); -+ mutex_unlock(&tdata->update_lock); - -- return sprintf(buf, "%d\n", pdata->core_data[attr->index]->tjmax); -+ return sprintf(buf, "%d\n", tjmax); - } - - static ssize_t show_ttarget(struct device *dev, -@@ -356,9 +370,11 @@ static ssize_t show_temp(struct device *dev, - struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); - struct platform_data *pdata = dev_get_drvdata(dev); - struct temp_data *tdata = pdata->core_data[attr->index]; -+ int tjmax; - - mutex_lock(&tdata->update_lock); - -+ tjmax = get_tjmax(tdata, dev); - /* Check whether the time interval has elapsed */ - if (time_after(jiffies, tdata->last_updated + HZ)) { - rdmsr_on_cpu(tdata->cpu, tdata->status_reg, &eax, &edx); -@@ -368,7 +384,7 @@ static ssize_t show_temp(struct device *dev, - * Return it instead of reporting an error which doesn't - * really help at all. - */ -- tdata->temp = tdata->tjmax - ((eax >> 16) & 0x7f) * 1000; -+ tdata->temp = tjmax - ((eax >> 16) & 0x7f) * 1000; - tdata->last_updated = jiffies; - } - -@@ -453,7 +469,7 @@ static int create_core_data(struct platform_device *pdev, unsigned int cpu, - struct platform_data *pdata = platform_get_drvdata(pdev); - struct cpuinfo_x86 *c = &cpu_data(cpu); - u32 eax, edx; -- int err, index, attr_no; -+ int err, index, attr_no, tjmax; - - /* - * Find attr number for sysfs: -@@ -488,7 +504,7 @@ static int create_core_data(struct platform_device *pdev, unsigned int cpu, - goto exit_free; - - /* We can access status register. Get Critical Temperature */ -- tdata->tjmax = get_tjmax(c, cpu, &pdev->dev); -+ tjmax = get_tjmax(tdata, &pdev->dev); - - /* - * Read the still undocumented bits 8:15 of IA32_TEMPERATURE_TARGET. -@@ -500,7 +516,7 @@ static int create_core_data(struct platform_device *pdev, unsigned int cpu, - &eax, &edx); - if (!err) { - tdata->ttarget -- = tdata->tjmax - ((eax >> 8) & 0xff) * 1000; -+ = tjmax - ((eax >> 8) & 0xff) * 1000; - tdata->attr_size++; - } - } --- -cgit - - -From fae30e3c203e0f854d0420b50e54e31a75b6a8a4 Mon Sep 17 00:00:00 2001 -From: Zhang Rui -Date: Sun, 13 Nov 2022 23:31:45 +0800 -Subject: hwmon: (coretemp) Add support for dynamic ttarget - -Tjmax value retrieved from MSR_IA32_TEMPERATURE_TARGET can be changed at -runtime when the Intel SST-PP (Intel Speed Select Technology - -Performance Profile) level is changed. As a result, the ttarget value -also becomes dyamic. - -Improve the code to always get updated ttarget value. - -Signed-off-by: Zhang Rui -Link: https://lore.kernel.org/r/20221113153145.32696-4-rui.zhang@intel.com -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/coretemp.c | 57 ++++++++++++++++++++++++++++++++++-------------- - 1 file changed, 41 insertions(+), 16 deletions(-) - -diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c -index 5e03cfbbe99b8..ca7a9b373bbd6 100644 ---- a/drivers/hwmon/coretemp.c -+++ b/drivers/hwmon/coretemp.c -@@ -69,7 +69,6 @@ MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius"); - */ - struct temp_data { - int temp; -- int ttarget; - int tjmax; - unsigned long last_updated; - unsigned int cpu; -@@ -306,6 +305,30 @@ static int get_tjmax(struct temp_data *tdata, struct device *dev) - return tdata->tjmax; - } - -+static int get_ttarget(struct temp_data *tdata, struct device *dev) -+{ -+ u32 eax, edx; -+ int tjmax, ttarget_offset, ret; -+ -+ /* -+ * ttarget is valid only if tjmax can be retrieved from -+ * MSR_IA32_TEMPERATURE_TARGET -+ */ -+ if (tdata->tjmax) -+ return -ENODEV; -+ -+ ret = rdmsr_safe_on_cpu(tdata->cpu, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx); -+ if (ret) -+ return ret; -+ -+ tjmax = (eax >> 16) & 0xff; -+ -+ /* Read the still undocumented bits 8:15 of IA32_TEMPERATURE_TARGET. */ -+ ttarget_offset = (eax >> 8) & 0xff; -+ -+ return (tjmax - ttarget_offset) * 1000; -+} -+ - /* Keep track of how many zone pointers we allocated in init() */ - static int max_zones __read_mostly; - /* Array of zone pointers. Serialized by cpu hotplug lock */ -@@ -359,8 +382,16 @@ static ssize_t show_ttarget(struct device *dev, - { - struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); - struct platform_data *pdata = dev_get_drvdata(dev); -+ struct temp_data *tdata = pdata->core_data[attr->index]; -+ int ttarget; - -- return sprintf(buf, "%d\n", pdata->core_data[attr->index]->ttarget); -+ mutex_lock(&tdata->update_lock); -+ ttarget = get_ttarget(tdata, dev); -+ mutex_unlock(&tdata->update_lock); -+ -+ if (ttarget < 0) -+ return ttarget; -+ return sprintf(buf, "%d\n", ttarget); - } - - static ssize_t show_temp(struct device *dev, -@@ -469,7 +500,7 @@ static int create_core_data(struct platform_device *pdev, unsigned int cpu, - struct platform_data *pdata = platform_get_drvdata(pdev); - struct cpuinfo_x86 *c = &cpu_data(cpu); - u32 eax, edx; -- int err, index, attr_no, tjmax; -+ int err, index, attr_no; - - /* - * Find attr number for sysfs: -@@ -503,23 +534,17 @@ static int create_core_data(struct platform_device *pdev, unsigned int cpu, - if (err) - goto exit_free; - -- /* We can access status register. Get Critical Temperature */ -- tjmax = get_tjmax(tdata, &pdev->dev); -+ /* Make sure tdata->tjmax is a valid indicator for dynamic/static tjmax */ -+ get_tjmax(tdata, &pdev->dev); - - /* -- * Read the still undocumented bits 8:15 of IA32_TEMPERATURE_TARGET. -- * The target temperature is available on older CPUs but not in this -- * register. Atoms don't have the register at all. -+ * The target temperature is available on older CPUs but not in the -+ * MSR_IA32_TEMPERATURE_TARGET register. Atoms don't have the register -+ * at all. - */ -- if (c->x86_model > 0xe && c->x86_model != 0x1c) { -- err = rdmsr_safe_on_cpu(cpu, MSR_IA32_TEMPERATURE_TARGET, -- &eax, &edx); -- if (!err) { -- tdata->ttarget -- = tjmax - ((eax >> 8) & 0xff) * 1000; -+ if (c->x86_model > 0xe && c->x86_model != 0x1c) -+ if (get_ttarget(tdata, &pdev->dev) >= 0) - tdata->attr_size++; -- } -- } - - pdata->core_data[attr_no] = tdata; - --- -cgit - - -From 1864069c695d475e0ce98a335c62274b81be57b4 Mon Sep 17 00:00:00 2001 -From: Denis Pauk -Date: Mon, 14 Nov 2022 23:44:56 +0200 -Subject: hwmon: (nct6775) add ASUS CROSSHAIR VIII/TUF/ProArt B550M - -Boards such as -* ProArt B550-CREATOR -* ProArt Z490-CREATOR 10G -* ROG CROSSHAIR VIII EXTREME -* ROG CROSSHAIR VIII HERO (WI-FI) -* TUF GAMING B550M-E -* TUF GAMING B550M-E (WI-FI) -* TUF GAMING B550M-PLUS WIFI II -have got a nct6775 chip, but by default there's no use of it -because of resource conflict with WMI method. - -This commit adds such boards to the WMI monitoring list. - -BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=204807 -Signed-off-by: Denis Pauk -Reported-by: yutesdb -Tested-by: yutesdb -Link: https://lore.kernel.org/r/20221114214456.3891-1-pauk.denis@gmail.com -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/nct6775-platform.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/drivers/hwmon/nct6775-platform.c b/drivers/hwmon/nct6775-platform.c -index b347837842139..bf43f73dc835f 100644 ---- a/drivers/hwmon/nct6775-platform.c -+++ b/drivers/hwmon/nct6775-platform.c -@@ -1043,7 +1043,9 @@ static struct platform_device *pdev[2]; - - static const char * const asus_wmi_boards[] = { - "PRO H410T", -+ "ProArt B550-CREATOR", - "ProArt X570-CREATOR WIFI", -+ "ProArt Z490-CREATOR 10G", - "Pro B550M-C", - "Pro WS X570-ACE", - "PRIME B360-PLUS", -@@ -1055,8 +1057,10 @@ static const char * const asus_wmi_boards[] = { - "PRIME X570-P", - "PRIME X570-PRO", - "ROG CROSSHAIR VIII DARK HERO", -+ "ROG CROSSHAIR VIII EXTREME", - "ROG CROSSHAIR VIII FORMULA", - "ROG CROSSHAIR VIII HERO", -+ "ROG CROSSHAIR VIII HERO (WI-FI)", - "ROG CROSSHAIR VIII IMPACT", - "ROG STRIX B550-A GAMING", - "ROG STRIX B550-E GAMING", -@@ -1080,8 +1084,11 @@ static const char * const asus_wmi_boards[] = { - "ROG STRIX Z490-G GAMING (WI-FI)", - "ROG STRIX Z490-H GAMING", - "ROG STRIX Z490-I GAMING", -+ "TUF GAMING B550M-E", -+ "TUF GAMING B550M-E (WI-FI)", - "TUF GAMING B550M-PLUS", - "TUF GAMING B550M-PLUS (WI-FI)", -+ "TUF GAMING B550M-PLUS WIFI II", - "TUF GAMING B550-PLUS", - "TUF GAMING B550-PLUS WIFI II", - "TUF GAMING B550-PRO", --- -cgit - - -From ef9948dfe1056a89f699edc8eb691a8ed99eda5e Mon Sep 17 00:00:00 2001 -From: Patrick Rudolph -Date: Thu, 17 Nov 2022 19:40:22 +0100 -Subject: hwmon: (pmbus) Add power good support - -Update error flags with regulation out if regulator is on & power -good status bit is set - -Signed-off-by: Patrick Rudolph -Signed-off-by: Naresh Solanki -Link: https://lore.kernel.org/r/20221117184022.1808508-1-Naresh.Solanki@9elements.com -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/pmbus/pmbus_core.c | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c -index 7ec04934747e1..20ca26e19db75 100644 ---- a/drivers/hwmon/pmbus/pmbus_core.c -+++ b/drivers/hwmon/pmbus/pmbus_core.c -@@ -2827,9 +2827,13 @@ static int pmbus_regulator_get_error_flags(struct regulator_dev *rdev, unsigned - if (status < 0) - return status; - -- if (pmbus_regulator_is_enabled(rdev) && (status & PB_STATUS_OFF)) -- *flags |= REGULATOR_ERROR_FAIL; -+ if (pmbus_regulator_is_enabled(rdev)) { -+ if (status & PB_STATUS_OFF) -+ *flags |= REGULATOR_ERROR_FAIL; - -+ if (status & PB_STATUS_POWER_GOOD_N) -+ *flags |= REGULATOR_ERROR_REGULATION_OUT; -+ } - /* - * Unlike most other status bits, PB_STATUS_{IOUT_OC,VOUT_OV} are - * defined strictly as fault indicators (not warnings). --- -cgit - - -From 59882c7f6714141300882af3d39ca6ffecf54ec2 Mon Sep 17 00:00:00 2001 -From: Christophe JAILLET -Date: Sun, 20 Nov 2022 10:34:41 +0100 -Subject: hwmon: (gsc-hwmon) Switch to flexible array to simplify code - -Using flexible array is more straight forward. It - - saves 1 pointer in the 'gsc_hwmon_platform_data' structure - - saves an indirection when using this array - - saves some LoC and avoids some always spurious pointer arithmetic - -Signed-off-by: Christophe JAILLET -Link: https://lore.kernel.org/r/61a23e1d642397cfcecc4ac3bb0ab485d257987d.1668936855.git.christophe.jaillet@wanadoo.fr -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/gsc-hwmon.c | 6 ++---- - include/linux/platform_data/gsc_hwmon.h | 5 ++--- - 2 files changed, 4 insertions(+), 7 deletions(-) - -diff --git a/drivers/hwmon/gsc-hwmon.c b/drivers/hwmon/gsc-hwmon.c -index b60ec95b5edbf..73e5d92b200b0 100644 ---- a/drivers/hwmon/gsc-hwmon.c -+++ b/drivers/hwmon/gsc-hwmon.c -@@ -257,13 +257,10 @@ gsc_hwmon_get_devtree_pdata(struct device *dev) - if (nchannels == 0) - return ERR_PTR(-ENODEV); - -- pdata = devm_kzalloc(dev, -- sizeof(*pdata) + nchannels * sizeof(*ch), -+ pdata = devm_kzalloc(dev, struct_size(pdata, channels, nchannels), - GFP_KERNEL); - if (!pdata) - return ERR_PTR(-ENOMEM); -- ch = (struct gsc_hwmon_channel *)(pdata + 1); -- pdata->channels = ch; - pdata->nchannels = nchannels; - - /* fan controller base address */ -@@ -277,6 +274,7 @@ gsc_hwmon_get_devtree_pdata(struct device *dev) - - of_node_put(fan); - -+ ch = pdata->channels; - /* allocate structures for channels and count instances of each type */ - device_for_each_child_node(dev, child) { - if (fwnode_property_read_string(child, "label", &ch->name)) { -diff --git a/include/linux/platform_data/gsc_hwmon.h b/include/linux/platform_data/gsc_hwmon.h -index 281f499eda979..f2781aa7eff85 100644 ---- a/include/linux/platform_data/gsc_hwmon.h -+++ b/include/linux/platform_data/gsc_hwmon.h + struct sensor_device_attribute{ + struct device_attribute dev_attr; +diff -rupN linux-6.1.2.orig/include/linux/platform_data/gsc_hwmon.h linux-6.1.2/include/linux/platform_data/gsc_hwmon.h +--- linux-6.1.2.orig/include/linux/platform_data/gsc_hwmon.h 2022-12-31 16:12:07.910571053 -0500 ++++ linux-6.1.2/include/linux/platform_data/gsc_hwmon.h 2022-12-31 16:19:55.381168081 -0500 @@ -29,18 +29,17 @@ struct gsc_hwmon_channel { /** @@ -4101,745 +2714,19 @@ index 281f499eda979..f2781aa7eff85 100644 + struct gsc_hwmon_channel channels[]; }; #endif --- -cgit - - -From 3ca0f12a02582c3dd4029294ab0245ba77c27a77 Mon Sep 17 00:00:00 2001 -From: Joaquín Ignacio Aramendía -Date: Fri, 25 Nov 2022 08:49:01 -0300 -Subject: hwmon: (oxp-sensors) Add AOK ZOE and Mini PRO -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add support for the AOK ZOE A1 and OXP Mini PRO handheld devices. -DMI strings are added to this driver since the same EC layout is used and -has similar specs as the OXP mini AMD. - -The added devices are: -- OneXPlayer mini PRO (AMD 6800U) -- AOK ZOE A1 (AMD 6800U) - -Signed-off-by: Joaquín Ignacio Aramendía -Link: https://lore.kernel.org/r/20221125114901.11309-1-samsagax@gmail.com -Signed-off-by: Guenter Roeck ---- - Documentation/hwmon/oxp-sensors.rst | 16 ++++++++++++--- - drivers/hwmon/oxp-sensors.c | 40 +++++++++++++++++++++++++++++++------ - 2 files changed, 47 insertions(+), 9 deletions(-) - -diff --git a/Documentation/hwmon/oxp-sensors.rst b/Documentation/hwmon/oxp-sensors.rst -index f612dddc964ae..39c588ec5c506 100644 ---- a/Documentation/hwmon/oxp-sensors.rst -+++ b/Documentation/hwmon/oxp-sensors.rst -@@ -12,9 +12,19 @@ Description: - One X Player devices from One Netbook provide fan readings and fan control - through its Embedded Controller. +diff -rupN linux-6.1.2.orig/MAINTAINERS linux-6.1.2/MAINTAINERS +--- linux-6.1.2.orig/MAINTAINERS 2022-12-31 16:12:05.838602157 -0500 ++++ linux-6.1.2/MAINTAINERS 2022-12-31 16:19:53.953180971 -0500 +@@ -15345,6 +15345,12 @@ S: Maintained + F: drivers/mtd/nand/onenand/ + F: include/linux/mtd/onenand*.h --Currently only supports AMD boards from the One X Player lineup. Intel boards --could be supported if we could figure out the EC registers and values to write --to since the EC layout and model is different. -+Currently only supports AMD boards from the One X Player and AOK ZOE lineup. -+Intel boards could be supported if we could figure out the EC registers and -+values to write to since the EC layout and model is different. ++ONEXPLAYER FAN DRIVER ++M: Joaquín Ignacio Aramendía ++L: linux-hwmon@vger.kernel.org ++S: Maintained ++F: drivers/hwmon/oxp-sensors.c + -+Supported devices -+----------------- -+ -+Currently the driver supports the following handhelds: -+ -+ - AOK ZOE A1 -+ - OneXPlayer AMD -+ - OneXPlayer mini AMD -+ - OneXPlayer mini AMD PRO - - Sysfs entries - ------------- -diff --git a/drivers/hwmon/oxp-sensors.c b/drivers/hwmon/oxp-sensors.c -index b1653eb5e6707..c04277676b727 100644 ---- a/drivers/hwmon/oxp-sensors.c -+++ b/drivers/hwmon/oxp-sensors.c -@@ -3,13 +3,14 @@ - * Platform driver for OXP Handhelds that expose fan reading and control - * via hwmon sysfs. - * -- * All boards have the same DMI strings and they are told appart by the -+ * Old boards have the same DMI strings and they are told appart by the - * boot cpu vendor (Intel/AMD). Currently only AMD boards are supported - * but the code is made to be simple to add other handheld boards in the - * future. -- * Fan control is provided via pwm interface in the range [0-255]. AMD -- * boards use [0-100] as range in the EC, the written value is scaled to -- * accommodate for that. -+ * Fan control is provided via pwm interface in the range [0-255]. -+ * Old AMD boards use [0-100] as range in the EC, the written value is -+ * scaled to accommodate for that. Newer boards like the mini PRO and -+ * AOK ZOE are not scaled but have the same EC layout. - * - * Copyright (C) 2022 Joaquín I. Aramendía - */ -@@ -39,16 +40,39 @@ static bool unlock_global_acpi_lock(void) - return ACPI_SUCCESS(acpi_release_global_lock(oxp_mutex)); - } - -+enum oxp_board { -+ aok_zoe_a1 = 1, -+ oxp_mini_amd, -+ oxp_mini_amd_pro, -+}; -+ -+static enum oxp_board board; -+ - #define OXP_SENSOR_FAN_REG 0x76 /* Fan reading is 2 registers long */ - #define OXP_SENSOR_PWM_ENABLE_REG 0x4A /* PWM enable is 1 register long */ - #define OXP_SENSOR_PWM_REG 0x4B /* PWM reading is 1 register long */ - - static const struct dmi_system_id dmi_table[] = { -+ { -+ .matches = { -+ DMI_MATCH(DMI_BOARD_VENDOR, "AOKZOE"), -+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "AOKZOE A1 AR07"), -+ }, -+ .driver_data = (void *) &(enum oxp_board) {aok_zoe_a1}, -+ }, - { - .matches = { - DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"), - DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONE XPLAYER"), - }, -+ .driver_data = (void *) &(enum oxp_board) {oxp_mini_amd}, -+ }, -+ { -+ .matches = { -+ DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"), -+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONEXPLAYER Mini Pro"), -+ }, -+ .driver_data = (void *) &(enum oxp_board) {oxp_mini_amd_pro}, - }, - {}, - }; -@@ -137,7 +161,8 @@ static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type, - ret = read_from_ec(OXP_SENSOR_PWM_REG, 2, val); - if (ret) - return ret; -- *val = (*val * 255) / 100; -+ if (board == oxp_mini_amd) -+ *val = (*val * 255) / 100; - return 0; - case hwmon_pwm_enable: - return read_from_ec(OXP_SENSOR_PWM_ENABLE_REG, 1, val); -@@ -166,7 +191,8 @@ static int oxp_platform_write(struct device *dev, enum hwmon_sensor_types type, - case hwmon_pwm_input: - if (val < 0 || val > 255) - return -EINVAL; -- val = (val * 100) / 255; -+ if (board == oxp_mini_amd) -+ val = (val * 100) / 255; - return write_to_ec(dev, OXP_SENSOR_PWM_REG, val); - default: - break; -@@ -216,6 +242,8 @@ static int oxp_platform_probe(struct platform_device *pdev) - if (!dmi_entry || boot_cpu_data.x86_vendor != X86_VENDOR_AMD) - return -ENODEV; - -+ board = *((enum oxp_board *) dmi_entry->driver_data); -+ - hwdev = devm_hwmon_device_register_with_info(dev, "oxpec", NULL, - &oxp_ec_chip_info, NULL); - --- -cgit - - -From c05f477c4ba36e007c03ff4f834f43bc4e37692b Mon Sep 17 00:00:00 2001 -From: Patrick Rudolph -Date: Thu, 24 Nov 2022 20:36:42 +0100 -Subject: hwmon: (pmbus/core) Implement regulator get_status - -Add get_status for pmbus_regulator_ops. - -Signed-off-by: Patrick Rudolph -Signed-off-by: Naresh Solanki -Link: https://lore.kernel.org/r/20221124193642.4081054-1-Naresh.Solanki@9elements.com -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/pmbus/pmbus_core.c | 44 ++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 44 insertions(+) - -diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c -index 20ca26e19db75..95e95783972ab 100644 ---- a/drivers/hwmon/pmbus/pmbus_core.c -+++ b/drivers/hwmon/pmbus/pmbus_core.c -@@ -2855,6 +2855,49 @@ static int pmbus_regulator_get_error_flags(struct regulator_dev *rdev, unsigned - return 0; - } - -+static int pmbus_regulator_get_status(struct regulator_dev *rdev) -+{ -+ struct device *dev = rdev_get_dev(rdev); -+ struct i2c_client *client = to_i2c_client(dev->parent); -+ struct pmbus_data *data = i2c_get_clientdata(client); -+ u8 page = rdev_get_id(rdev); -+ int status, ret; -+ -+ mutex_lock(&data->update_lock); -+ status = pmbus_get_status(client, page, PMBUS_STATUS_WORD); -+ if (status < 0) { -+ ret = status; -+ goto unlock; -+ } -+ -+ if (status & PB_STATUS_OFF) { -+ ret = REGULATOR_STATUS_OFF; -+ goto unlock; -+ } -+ -+ /* If regulator is ON & reports power good then return ON */ -+ if (!(status & PB_STATUS_POWER_GOOD_N)) { -+ ret = REGULATOR_STATUS_ON; -+ goto unlock; -+ } -+ -+ ret = pmbus_regulator_get_error_flags(rdev, &status); -+ if (ret) -+ goto unlock; -+ -+ if (status & (REGULATOR_ERROR_UNDER_VOLTAGE | REGULATOR_ERROR_OVER_CURRENT | -+ REGULATOR_ERROR_REGULATION_OUT | REGULATOR_ERROR_FAIL | REGULATOR_ERROR_OVER_TEMP)) { -+ ret = REGULATOR_STATUS_ERROR; -+ goto unlock; -+ } -+ -+ ret = REGULATOR_STATUS_UNDEFINED; -+ -+unlock: -+ mutex_unlock(&data->update_lock); -+ return ret; -+} -+ - static int pmbus_regulator_get_low_margin(struct i2c_client *client, int page) - { - struct pmbus_data *data = i2c_get_clientdata(client); -@@ -2995,6 +3038,7 @@ const struct regulator_ops pmbus_regulator_ops = { - .disable = pmbus_regulator_disable, - .is_enabled = pmbus_regulator_is_enabled, - .get_error_flags = pmbus_regulator_get_error_flags, -+ .get_status = pmbus_regulator_get_status, - .get_voltage = pmbus_regulator_get_voltage, - .set_voltage = pmbus_regulator_set_voltage, - .list_voltage = pmbus_regulator_list_voltage, --- -cgit - - -From 6ff838f2877dcd5ec7db0745a2652a048a697991 Mon Sep 17 00:00:00 2001 -From: Aleksa Savic -Date: Sat, 26 Nov 2022 08:13:13 +0100 -Subject: hwmon: (aquacomputer_d5next) Add support for Quadro flow sensor - pulses - -Add support for reading and writing flow sensor pulses value on -the Aquacomputer Quadro. Implemented by Leonard Anderweit [1]. - -[1] https://github.com/aleksamagicka/aquacomputer_d5next-hwmon/pull/45 - -Originally-from: Leonard Anderweit -Signed-off-by: Aleksa Savic -Link: https://lore.kernel.org/r/20221126071313.34356-1-savicaleksa83@gmail.com -Signed-off-by: Guenter Roeck ---- - Documentation/hwmon/aquacomputer_d5next.rst | 3 +- - drivers/hwmon/aquacomputer_d5next.c | 66 +++++++++++++++++++++++------ - 2 files changed, 55 insertions(+), 14 deletions(-) - -diff --git a/Documentation/hwmon/aquacomputer_d5next.rst b/Documentation/hwmon/aquacomputer_d5next.rst -index 15226346434dd..637bdbc8fcad4 100644 ---- a/Documentation/hwmon/aquacomputer_d5next.rst -+++ b/Documentation/hwmon/aquacomputer_d5next.rst -@@ -39,7 +39,7 @@ current. - - The Quadro exposes four physical and sixteen virtual temperature sensors, a flow - sensor and four PWM controllable fans, along with their speed (in RPM), power, --voltage and current. -+voltage and current. Flow sensor pulses are also available. - - The Farbwerk and Farbwerk 360 expose four temperature sensors. Additionally, - sixteen virtual temperature sensors of the Farbwerk 360 are exposed. -@@ -64,6 +64,7 @@ Sysfs entries - temp[1-20]_input Physical/virtual temperature sensors (in millidegrees Celsius) - temp[1-4]_offset Temperature sensor correction offset (in millidegrees Celsius) - fan[1-8]_input Pump/fan speed (in RPM) / Flow speed (in dL/h) -+fan5_pulses Quadro flow sensor pulses - power[1-8]_input Pump/fan power (in micro Watts) - in[0-7]_input Pump/fan voltage (in milli Volts) - curr[1-8]_input Pump/fan current (in milli Amperes) -diff --git a/drivers/hwmon/aquacomputer_d5next.c b/drivers/hwmon/aquacomputer_d5next.c -index 49d3f9876fe80..9cc10080160b0 100644 ---- a/drivers/hwmon/aquacomputer_d5next.c -+++ b/drivers/hwmon/aquacomputer_d5next.c -@@ -136,6 +136,7 @@ static u8 quadro_sensor_fan_offsets[] = { 0x70, 0x7D, 0x8A, 0x97 }; - - /* Control report offsets for the Quadro */ - #define QUADRO_TEMP_CTRL_OFFSET 0xA -+#define QUADRO_FLOW_PULSES_CTRL_OFFSET 0x6 - static u16 quadro_ctrl_fan_offsets[] = { 0x37, 0x8c, 0xe1, 0x136 }; /* Fan speed offsets (0-100%) */ - - /* Specs of High Flow Next flow sensor */ -@@ -303,6 +304,7 @@ struct aqc_data { - u16 temp_ctrl_offset; - u16 power_cycle_count_offset; - u8 flow_sensor_offset; -+ u8 flow_pulses_ctrl_offset; - - /* General info, same across all devices */ - u32 serial_number[2]; -@@ -461,20 +463,34 @@ static umode_t aqc_is_visible(const void *data, enum hwmon_sensor_types type, u3 - } - break; - case hwmon_fan: -- switch (priv->kind) { -- case highflownext: -- /* Special case to support flow sensor, water quality and conductivity */ -- if (channel < 3) -- return 0444; -+ switch (attr) { -+ case hwmon_fan_input: -+ case hwmon_fan_label: -+ switch (priv->kind) { -+ case highflownext: -+ /* Special case to support flow sensor, water quality -+ * and conductivity -+ */ -+ if (channel < 3) -+ return 0444; -+ break; -+ case quadro: -+ /* Special case to support flow sensor */ -+ if (channel < priv->num_fans + 1) -+ return 0444; -+ break; -+ default: -+ if (channel < priv->num_fans) -+ return 0444; -+ break; -+ } - break; -- case quadro: -- /* Special case to support flow sensor */ -- if (channel < priv->num_fans + 1) -- return 0444; -+ case hwmon_fan_pulses: -+ /* Special case for Quadro flow sensor */ -+ if (priv->kind == quadro && channel == priv->num_fans) -+ return 0644; - break; - default: -- if (channel < priv->num_fans) -- return 0444; - break; - } - break; -@@ -552,7 +568,18 @@ static int aqc_read(struct device *dev, enum hwmon_sensor_types type, u32 attr, - } - break; - case hwmon_fan: -- *val = priv->speed_input[channel]; -+ switch (attr) { -+ case hwmon_fan_input: -+ *val = priv->speed_input[channel]; -+ break; -+ case hwmon_fan_pulses: -+ ret = aqc_get_ctrl_val(priv, priv->flow_pulses_ctrl_offset, val); -+ if (ret < 0) -+ return ret; -+ break; -+ default: -+ break; -+ } - break; - case hwmon_power: - *val = priv->power_input[channel]; -@@ -632,6 +659,18 @@ static int aqc_write(struct device *dev, enum hwmon_sensor_types type, u32 attr, - return -EOPNOTSUPP; - } - break; -+ case hwmon_fan: -+ switch (attr) { -+ case hwmon_fan_pulses: -+ val = clamp_val(val, 10, 1000); -+ ret = aqc_set_ctrl_val(priv, priv->flow_pulses_ctrl_offset, val); -+ if (ret < 0) -+ return ret; -+ break; -+ default: -+ break; -+ } -+ break; - case hwmon_pwm: - switch (attr) { - case hwmon_pwm_input: -@@ -691,7 +730,7 @@ static const struct hwmon_channel_info *aqc_info[] = { - HWMON_F_INPUT | HWMON_F_LABEL, - HWMON_F_INPUT | HWMON_F_LABEL, - HWMON_F_INPUT | HWMON_F_LABEL, -- HWMON_F_INPUT | HWMON_F_LABEL, -+ HWMON_F_INPUT | HWMON_F_LABEL | HWMON_F_PULSES, - HWMON_F_INPUT | HWMON_F_LABEL, - HWMON_F_INPUT | HWMON_F_LABEL, - HWMON_F_INPUT | HWMON_F_LABEL), -@@ -1000,6 +1039,7 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id) - priv->buffer_size = QUADRO_CTRL_REPORT_SIZE; - - priv->flow_sensor_offset = QUADRO_FLOW_SENSOR_OFFSET; -+ priv->flow_pulses_ctrl_offset = QUADRO_FLOW_PULSES_CTRL_OFFSET; - priv->power_cycle_count_offset = QUADRO_POWER_CYCLES; - - priv->temp_label = label_temp_sensors; --- -cgit - - -From 0cd3ba682ae27cbe17c41f85b8e6db6da38296b2 Mon Sep 17 00:00:00 2001 -From: Joaquín Ignacio Aramendía -Date: Mon, 28 Nov 2022 15:52:06 -0300 -Subject: hwmon: (oxp-sensors) Fix pwm reading -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -PWM reading is only 1 register long. - -Signed-off-by: Joaquín Ignacio Aramendía -Link: https://lore.kernel.org/r/20221128185206.212022-1-samsagax@gmail.com -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/oxp-sensors.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/hwmon/oxp-sensors.c b/drivers/hwmon/oxp-sensors.c -index c04277676b727..f84ec8f8eda91 100644 ---- a/drivers/hwmon/oxp-sensors.c -+++ b/drivers/hwmon/oxp-sensors.c -@@ -158,7 +158,7 @@ static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type, - case hwmon_pwm: - switch (attr) { - case hwmon_pwm_input: -- ret = read_from_ec(OXP_SENSOR_PWM_REG, 2, val); -+ ret = read_from_ec(OXP_SENSOR_PWM_REG, 1, val); - if (ret) - return ret; - if (board == oxp_mini_amd) --- -cgit - - -From 4e6104b1e70020ad500f0fab7238898dd2ea2a38 Mon Sep 17 00:00:00 2001 -From: ye xingchen -Date: Thu, 1 Dec 2022 11:30:31 +0800 -Subject: hwmon: use sysfs_emit() to instead of scnprintf() - -Replace the open-code with sysfs_emit() to simplify the code. - -Signed-off-by: ye xingchen -Link: https://lore.kernel.org/r/202212011130317080061@zte.com.cn -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/ds1621.c | 2 +- - drivers/hwmon/lm73.c | 6 +++--- - drivers/hwmon/sht3x.c | 12 ++++++------ - 3 files changed, 10 insertions(+), 10 deletions(-) - -diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c -index 0886abf6ebab1..e803d6393b9e5 100644 ---- a/drivers/hwmon/ds1621.c -+++ b/drivers/hwmon/ds1621.c -@@ -269,7 +269,7 @@ static ssize_t update_interval_show(struct device *dev, - struct device_attribute *da, char *buf) - { - struct ds1621_data *data = dev_get_drvdata(dev); -- return scnprintf(buf, PAGE_SIZE, "%hu\n", data->update_interval); -+ return sysfs_emit(buf, "%hu\n", data->update_interval); - } - - static ssize_t update_interval_store(struct device *dev, -diff --git a/drivers/hwmon/lm73.c b/drivers/hwmon/lm73.c -index 1346b3b3f4635..b6433ae2d75c3 100644 ---- a/drivers/hwmon/lm73.c -+++ b/drivers/hwmon/lm73.c -@@ -92,7 +92,7 @@ static ssize_t temp_show(struct device *dev, struct device_attribute *da, - /* use integer division instead of equivalent right shift to - guarantee arithmetic shift and preserve the sign */ - temp = (((s16) err) * 250) / 32; -- return scnprintf(buf, PAGE_SIZE, "%d\n", temp); -+ return sysfs_emit(buf, "%d\n", temp); - } - - static ssize_t convrate_store(struct device *dev, struct device_attribute *da, -@@ -137,7 +137,7 @@ static ssize_t convrate_show(struct device *dev, struct device_attribute *da, - int res; - - res = (data->ctrl & LM73_CTRL_RES_MASK) >> LM73_CTRL_RES_SHIFT; -- return scnprintf(buf, PAGE_SIZE, "%hu\n", lm73_convrates[res]); -+ return sysfs_emit(buf, "%hu\n", lm73_convrates[res]); - } - - static ssize_t maxmin_alarm_show(struct device *dev, -@@ -154,7 +154,7 @@ static ssize_t maxmin_alarm_show(struct device *dev, - data->ctrl = ctrl; - mutex_unlock(&data->lock); - -- return scnprintf(buf, PAGE_SIZE, "%d\n", (ctrl >> attr->index) & 1); -+ return sysfs_emit(buf, "%d\n", (ctrl >> attr->index) & 1); - - abort: - mutex_unlock(&data->lock); -diff --git a/drivers/hwmon/sht3x.c b/drivers/hwmon/sht3x.c -index 3f279aa1cee5e..8305e44d9ab20 100644 ---- a/drivers/hwmon/sht3x.c -+++ b/drivers/hwmon/sht3x.c -@@ -320,7 +320,7 @@ static ssize_t temp1_limit_show(struct device *dev, - u8 index = to_sensor_dev_attr(attr)->index; - int temperature_limit = data->temperature_limits[index]; - -- return scnprintf(buf, PAGE_SIZE, "%d\n", temperature_limit); -+ return sysfs_emit(buf, "%d\n", temperature_limit); - } - - static ssize_t humidity1_limit_show(struct device *dev, -@@ -331,7 +331,7 @@ static ssize_t humidity1_limit_show(struct device *dev, - u8 index = to_sensor_dev_attr(attr)->index; - u32 humidity_limit = data->humidity_limits[index]; - -- return scnprintf(buf, PAGE_SIZE, "%u\n", humidity_limit); -+ return sysfs_emit(buf, "%u\n", humidity_limit); - } - - /* -@@ -483,7 +483,7 @@ static ssize_t temp1_alarm_show(struct device *dev, - if (ret) - return ret; - -- return scnprintf(buf, PAGE_SIZE, "%d\n", !!(buffer[0] & 0x04)); -+ return sysfs_emit(buf, "%d\n", !!(buffer[0] & 0x04)); - } - - static ssize_t humidity1_alarm_show(struct device *dev, -@@ -498,7 +498,7 @@ static ssize_t humidity1_alarm_show(struct device *dev, - if (ret) - return ret; - -- return scnprintf(buf, PAGE_SIZE, "%d\n", !!(buffer[0] & 0x08)); -+ return sysfs_emit(buf, "%d\n", !!(buffer[0] & 0x08)); - } - - static ssize_t heater_enable_show(struct device *dev, -@@ -513,7 +513,7 @@ static ssize_t heater_enable_show(struct device *dev, - if (ret) - return ret; - -- return scnprintf(buf, PAGE_SIZE, "%d\n", !!(buffer[0] & 0x20)); -+ return sysfs_emit(buf, "%d\n", !!(buffer[0] & 0x20)); - } - - static ssize_t heater_enable_store(struct device *dev, -@@ -550,7 +550,7 @@ static ssize_t update_interval_show(struct device *dev, - { - struct sht3x_data *data = dev_get_drvdata(dev); - -- return scnprintf(buf, PAGE_SIZE, "%u\n", -+ return sysfs_emit(buf, "%u\n", - mode_to_update_interval[data->mode]); - } - --- -cgit - - -From 688fcd047ef0f0aeee16d0fefaff065fa69eb642 Mon Sep 17 00:00:00 2001 -From: Armin Wolf -Date: Wed, 30 Nov 2022 19:34:18 +0100 -Subject: hwmon: (dell-smm) Move error message to make probing silent - -If dell-smm-hwmon loads on unsupported hardware like the -Dell XPS 17 9710, an error message is printed. -This might confuse users, as drivers are expected to be -silent if no supported hardware is found. -Reorder the error message so its only printed when the -driver is loaded with the "force" option being set. -Also reword the error message slightly. - -Tested on a Dell Inspiron 3505. - -Signed-off-by: Armin Wolf -Link: https://lore.kernel.org/r/20221130183418.357246-1-W_Armin@gmx.de -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/dell-smm-hwmon.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c -index 1572b54160158..7ac778aedc68d 100644 ---- a/drivers/hwmon/dell-smm-hwmon.c -+++ b/drivers/hwmon/dell-smm-hwmon.c -@@ -1447,9 +1447,10 @@ static int __init i8k_init(void) - */ - if (i8k_get_dell_signature(I8K_SMM_GET_DELL_SIG1) && - i8k_get_dell_signature(I8K_SMM_GET_DELL_SIG2)) { -- pr_err("unable to get SMM Dell signature\n"); - if (!force) - return -ENODEV; -+ -+ pr_err("Unable to get Dell SMM signature\n"); - } - - dell_smm_device = platform_create_bundle(&dell_smm_driver, dell_smm_probe, NULL, 0, NULL, --- -cgit - - -From 4d50591ebf60ccf79380fff3a4c23659c61c482f Mon Sep 17 00:00:00 2001 -From: Xingjiang Qiao -Date: Tue, 6 Dec 2022 13:53:30 +0800 -Subject: hwmon: (emc2305) fix unable to probe emc2301/2/3 - -The definitions of 'EMC2305_REG_PRODUCT_ID' and 'EMC2305_REG_DEVICE' are -both '0xfd', they actually return the same value, but the values returned -by emc2301/2/3/5 are different, so probe emc2301/2/3 will fail, This patch -fixes that. - -Signed-off-by: Xingjiang Qiao -Link: https://lore.kernel.org/r/20221206055331.170459-1-nanpuyue@gmail.com -Fixes: 0d8400c5a2ce1 ("hwmon: (emc2305) add support for EMC2301/2/3/5 RPM-based PWM Fan Speed Controller.") -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/emc2305.c | 7 +------ - 1 file changed, 1 insertion(+), 6 deletions(-) - -diff --git a/drivers/hwmon/emc2305.c b/drivers/hwmon/emc2305.c -index f222fcf3b6aa1..232238e3231b0 100644 ---- a/drivers/hwmon/emc2305.c -+++ b/drivers/hwmon/emc2305.c -@@ -16,7 +16,6 @@ static const unsigned short - emc2305_normal_i2c[] = { 0x27, 0x2c, 0x2d, 0x2e, 0x2f, 0x4c, 0x4d, I2C_CLIENT_END }; - - #define EMC2305_REG_DRIVE_FAIL_STATUS 0x27 --#define EMC2305_REG_DEVICE 0xfd - #define EMC2305_REG_VENDOR 0xfe - #define EMC2305_FAN_MAX 0xff - #define EMC2305_FAN_MIN 0x00 -@@ -524,7 +523,7 @@ static int emc2305_probe(struct i2c_client *client) - struct device *dev = &client->dev; - struct emc2305_data *data; - struct emc2305_platform_data *pdata; -- int vendor, device; -+ int vendor; - int ret; - int i; - -@@ -535,10 +534,6 @@ static int emc2305_probe(struct i2c_client *client) - if (vendor != EMC2305_VENDOR) - return -ENODEV; - -- device = i2c_smbus_read_byte_data(client, EMC2305_REG_DEVICE); -- if (device != EMC2305_DEVICE) -- return -ENODEV; -- - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); - if (!data) - return -ENOMEM; --- -cgit - - -From 364ffd2537c44cb6914ff5669153f4a86fffad29 Mon Sep 17 00:00:00 2001 -From: Xingjiang Qiao -Date: Tue, 6 Dec 2022 13:53:31 +0800 -Subject: hwmon: (emc2305) fix pwm never being able to set lower - -There are fields 'last_hwmon_state' and 'last_thermal_state' in the -structure 'emc2305_cdev_data', which respectively store the cooling state -set by the 'hwmon' and 'thermal' subsystem, and the driver author hopes -that if the state set by 'hwmon' is lower than the value set by 'thermal', -the driver will just save it without actually setting the pwm. Currently, -the 'last_thermal_state' also be updated by 'hwmon', which will cause the -cooling state to never be set to a lower value. This patch fixes that. - -Signed-off-by: Xingjiang Qiao -Link: https://lore.kernel.org/r/20221206055331.170459-2-nanpuyue@gmail.com -Fixes: 0d8400c5a2ce1 ("hwmon: (emc2305) add support for EMC2301/2/3/5 RPM-based PWM Fan Speed Controller.") -[groeck: renamed emc2305_set_cur_state_shim -> __emc2305_set_cur_state] -Signed-off-by: Guenter Roeck ---- - drivers/hwmon/emc2305.c | 37 ++++++++++++++++++++++++------------- - 1 file changed, 24 insertions(+), 13 deletions(-) - -diff --git a/drivers/hwmon/emc2305.c b/drivers/hwmon/emc2305.c -index 232238e3231b0..6ad055e5868e6 100644 ---- a/drivers/hwmon/emc2305.c -+++ b/drivers/hwmon/emc2305.c -@@ -171,22 +171,12 @@ static int emc2305_get_max_state(struct thermal_cooling_device *cdev, unsigned l - return 0; - } - --static int emc2305_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state) -+static int __emc2305_set_cur_state(struct emc2305_data *data, int cdev_idx, unsigned long state) - { -- int cdev_idx, ret; -- struct emc2305_data *data = cdev->devdata; -+ int ret; - struct i2c_client *client = data->client; - u8 val, i; - -- if (state > data->max_state) -- return -EINVAL; -- -- cdev_idx = emc2305_get_cdev_idx(cdev); -- if (cdev_idx < 0) -- return cdev_idx; -- -- /* Save thermal state. */ -- data->cdev_data[cdev_idx].last_thermal_state = state; - state = max_t(unsigned long, state, data->cdev_data[cdev_idx].last_hwmon_state); - - val = EMC2305_PWM_STATE2DUTY(state, data->max_state, EMC2305_FAN_MAX); -@@ -211,6 +201,27 @@ static int emc2305_set_cur_state(struct thermal_cooling_device *cdev, unsigned l - return 0; - } - -+static int emc2305_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state) -+{ -+ int cdev_idx, ret; -+ struct emc2305_data *data = cdev->devdata; -+ -+ if (state > data->max_state) -+ return -EINVAL; -+ -+ cdev_idx = emc2305_get_cdev_idx(cdev); -+ if (cdev_idx < 0) -+ return cdev_idx; -+ -+ /* Save thermal state. */ -+ data->cdev_data[cdev_idx].last_thermal_state = state; -+ ret = __emc2305_set_cur_state(data, cdev_idx, state); -+ if (ret < 0) -+ return ret; -+ -+ return 0; -+} -+ - static const struct thermal_cooling_device_ops emc2305_cooling_ops = { - .get_max_state = emc2305_get_max_state, - .get_cur_state = emc2305_get_cur_state, -@@ -401,7 +412,7 @@ emc2305_write(struct device *dev, enum hwmon_sensor_types type, u32 attr, int ch - */ - if (data->cdev_data[cdev_idx].last_hwmon_state >= - data->cdev_data[cdev_idx].last_thermal_state) -- return emc2305_set_cur_state(data->cdev_data[cdev_idx].cdev, -+ return __emc2305_set_cur_state(data, cdev_idx, - data->cdev_data[cdev_idx].last_hwmon_state); - return 0; - } --- -cgit - + ONION OMEGA2+ BOARD + M: Harvey Hunt + L: linux-mips@vger.kernel.org diff --git a/packages/kernel/linux/patches/X86_64/003-patch-6.1-rc7-rt5.patch b/packages/kernel/linux/patches/X86_64/003-patch-6.1-rc7-rt5.patch index f5f61561b..6cd8cb409 100644 --- a/packages/kernel/linux/patches/X86_64/003-patch-6.1-rc7-rt5.patch +++ b/packages/kernel/linux/patches/X86_64/003-patch-6.1-rc7-rt5.patch @@ -1,7 +1,43 @@ -diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig -index a08c9d092a332..4ce79eb994a6e 100644 ---- a/arch/arm/Kconfig -+++ b/arch/arm/Kconfig +diff -rupN linux-6.1.2.orig/arch/arm/include/asm/thread_info.h linux-6.1.2/arch/arm/include/asm/thread_info.h +--- linux-6.1.2.orig/arch/arm/include/asm/thread_info.h 2022-12-31 16:12:05.934600714 -0500 ++++ linux-6.1.2/arch/arm/include/asm/thread_info.h 2022-12-31 16:12:36.258153758 -0500 +@@ -62,6 +62,7 @@ struct cpu_context_save { + struct thread_info { + unsigned long flags; /* low level flags */ + int preempt_count; /* 0 => preemptable, <0 => bug */ ++ int preempt_lazy_count; /* 0 => preemptable, <0 => bug */ + __u32 cpu; /* cpu */ + __u32 cpu_domain; /* cpu domain */ + struct cpu_context_save cpu_context; /* cpu context */ +@@ -133,6 +134,7 @@ extern int vfp_restore_user_hwstate(stru + #define TIF_SYSCALL_TRACEPOINT 6 /* syscall tracepoint instrumentation */ + #define TIF_SECCOMP 7 /* seccomp syscall filtering active */ + #define TIF_NOTIFY_SIGNAL 8 /* signal notifications exist */ ++#define TIF_NEED_RESCHED_LAZY 9 + + #define TIF_USING_IWMMXT 17 + #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ +@@ -147,6 +149,7 @@ extern int vfp_restore_user_hwstate(stru + #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) + #define _TIF_SECCOMP (1 << TIF_SECCOMP) + #define _TIF_NOTIFY_SIGNAL (1 << TIF_NOTIFY_SIGNAL) ++#define _TIF_NEED_RESCHED_LAZY (1 << TIF_NEED_RESCHED_LAZY) + #define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT) + + /* Checks for any syscall work in entry-common.S */ +@@ -156,7 +159,8 @@ extern int vfp_restore_user_hwstate(stru + /* + * Change these and you break ASM code in entry-common.S + */ +-#define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \ ++#define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_NEED_RESCHED_LAZY | \ ++ _TIF_SIGPENDING | \ + _TIF_NOTIFY_RESUME | _TIF_UPROBE | \ + _TIF_NOTIFY_SIGNAL) + +diff -rupN linux-6.1.2.orig/arch/arm/Kconfig linux-6.1.2/arch/arm/Kconfig +--- linux-6.1.2.orig/arch/arm/Kconfig 2022-12-31 16:12:05.850601977 -0500 ++++ linux-6.1.2/arch/arm/Kconfig 2022-12-31 16:12:36.258153758 -0500 @@ -32,6 +32,7 @@ config ARM select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT if CPU_V7 select ARCH_SUPPORTS_ATOMIC_RMW @@ -28,48 +64,9 @@ index a08c9d092a332..4ce79eb994a6e 100644 select MMU_GATHER_RCU_TABLE_FREE if SMP && ARM_LPAE select HAVE_REGS_AND_STACK_ACCESS_API select HAVE_RSEQ -diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h -index aecc403b28804..1b56e56f8f415 100644 ---- a/arch/arm/include/asm/thread_info.h -+++ b/arch/arm/include/asm/thread_info.h -@@ -62,6 +62,7 @@ struct cpu_context_save { - struct thread_info { - unsigned long flags; /* low level flags */ - int preempt_count; /* 0 => preemptable, <0 => bug */ -+ int preempt_lazy_count; /* 0 => preemptable, <0 => bug */ - __u32 cpu; /* cpu */ - __u32 cpu_domain; /* cpu domain */ - struct cpu_context_save cpu_context; /* cpu context */ -@@ -133,6 +134,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp *, - #define TIF_SYSCALL_TRACEPOINT 6 /* syscall tracepoint instrumentation */ - #define TIF_SECCOMP 7 /* seccomp syscall filtering active */ - #define TIF_NOTIFY_SIGNAL 8 /* signal notifications exist */ -+#define TIF_NEED_RESCHED_LAZY 9 - - #define TIF_USING_IWMMXT 17 - #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ -@@ -147,6 +149,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp *, - #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) - #define _TIF_SECCOMP (1 << TIF_SECCOMP) - #define _TIF_NOTIFY_SIGNAL (1 << TIF_NOTIFY_SIGNAL) -+#define _TIF_NEED_RESCHED_LAZY (1 << TIF_NEED_RESCHED_LAZY) - #define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT) - - /* Checks for any syscall work in entry-common.S */ -@@ -156,7 +159,8 @@ extern int vfp_restore_user_hwstate(struct user_vfp *, - /* - * Change these and you break ASM code in entry-common.S - */ --#define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \ -+#define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_NEED_RESCHED_LAZY | \ -+ _TIF_SIGPENDING | \ - _TIF_NOTIFY_RESUME | _TIF_UPROBE | \ - _TIF_NOTIFY_SIGNAL) - -diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c -index 2c8d76fd7c662..c3bdec7d2df9c 100644 ---- a/arch/arm/kernel/asm-offsets.c -+++ b/arch/arm/kernel/asm-offsets.c +diff -rupN linux-6.1.2.orig/arch/arm/kernel/asm-offsets.c linux-6.1.2/arch/arm/kernel/asm-offsets.c +--- linux-6.1.2.orig/arch/arm/kernel/asm-offsets.c 2022-12-31 16:12:05.938600653 -0500 ++++ linux-6.1.2/arch/arm/kernel/asm-offsets.c 2022-12-31 16:12:36.258153758 -0500 @@ -43,6 +43,7 @@ int main(void) BLANK(); DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); @@ -78,11 +75,10 @@ index 2c8d76fd7c662..c3bdec7d2df9c 100644 DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); DEFINE(TI_CPU_DOMAIN, offsetof(struct thread_info, cpu_domain)); DEFINE(TI_CPU_SAVE, offsetof(struct thread_info, cpu_context)); -diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S -index c39303e5c2347..cfb4660e9feab 100644 ---- a/arch/arm/kernel/entry-armv.S -+++ b/arch/arm/kernel/entry-armv.S -@@ -222,11 +222,18 @@ ENDPROC(__dabt_svc) +diff -rupN linux-6.1.2.orig/arch/arm/kernel/entry-armv.S linux-6.1.2/arch/arm/kernel/entry-armv.S +--- linux-6.1.2.orig/arch/arm/kernel/entry-armv.S 2022-12-31 16:12:05.938600653 -0500 ++++ linux-6.1.2/arch/arm/kernel/entry-armv.S 2022-12-31 16:12:36.258153758 -0500 +@@ -222,11 +222,18 @@ __irq_svc: #ifdef CONFIG_PREEMPTION ldr r8, [tsk, #TI_PREEMPT] @ get preempt count @@ -103,7 +99,7 @@ index c39303e5c2347..cfb4660e9feab 100644 #endif svc_exit r5, irq = 1 @ return from exception -@@ -241,8 +248,14 @@ ENDPROC(__irq_svc) +@@ -241,8 +248,14 @@ svc_preempt: 1: bl preempt_schedule_irq @ irq en/disable is done inside ldr r0, [tsk, #TI_FLAGS] @ get new tasks TI_FLAGS tst r0, #_TIF_NEED_RESCHED @@ -119,11 +115,10 @@ index c39303e5c2347..cfb4660e9feab 100644 #endif __und_fault: -diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c -index e07f359254c3c..b50a3248e79f3 100644 ---- a/arch/arm/kernel/signal.c -+++ b/arch/arm/kernel/signal.c -@@ -607,7 +607,8 @@ do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall) +diff -rupN linux-6.1.2.orig/arch/arm/kernel/signal.c linux-6.1.2/arch/arm/kernel/signal.c +--- linux-6.1.2.orig/arch/arm/kernel/signal.c 2022-12-31 16:12:05.938600653 -0500 ++++ linux-6.1.2/arch/arm/kernel/signal.c 2022-12-31 16:12:36.258153758 -0500 +@@ -607,7 +607,8 @@ do_work_pending(struct pt_regs *regs, un */ trace_hardirqs_off(); do { @@ -133,11 +128,10 @@ index e07f359254c3c..b50a3248e79f3 100644 schedule(); } else { if (unlikely(!user_mode(regs))) -diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c -index 46cccd6bf705a..480a1976a9dce 100644 ---- a/arch/arm/mm/fault.c -+++ b/arch/arm/mm/fault.c -@@ -421,6 +421,9 @@ do_translation_fault(unsigned long addr, unsigned int fsr, +diff -rupN linux-6.1.2.orig/arch/arm/mm/fault.c linux-6.1.2/arch/arm/mm/fault.c +--- linux-6.1.2.orig/arch/arm/mm/fault.c 2022-12-31 16:12:05.978600052 -0500 ++++ linux-6.1.2/arch/arm/mm/fault.c 2022-12-31 16:12:36.258153758 -0500 +@@ -435,6 +435,9 @@ do_translation_fault(unsigned long addr, if (addr < TASK_SIZE) return do_page_fault(addr, fsr, regs); @@ -147,7 +141,7 @@ index 46cccd6bf705a..480a1976a9dce 100644 if (user_mode(regs)) goto bad_area; -@@ -491,6 +494,9 @@ do_translation_fault(unsigned long addr, unsigned int fsr, +@@ -505,6 +508,9 @@ do_translation_fault(unsigned long addr, static int do_sect_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) { @@ -157,31 +151,10 @@ index 46cccd6bf705a..480a1976a9dce 100644 do_bad_area(addr, fsr, regs); return 0; } -diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig -index 505c8a1ccbe0c..6c01b2b970c7e 100644 ---- a/arch/arm64/Kconfig -+++ b/arch/arm64/Kconfig -@@ -93,6 +93,7 @@ config ARM64 - select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 - select ARCH_SUPPORTS_NUMA_BALANCING - select ARCH_SUPPORTS_PAGE_TABLE_CHECK -+ select ARCH_SUPPORTS_RT - select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT - select ARCH_WANT_DEFAULT_BPF_JIT - select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT -@@ -200,6 +201,7 @@ config ARM64 - select HAVE_PERF_USER_STACK_DUMP - select HAVE_PREEMPT_DYNAMIC_KEY - select HAVE_REGS_AND_STACK_ACCESS_API -+ select HAVE_PREEMPT_LAZY - select HAVE_POSIX_CPU_TIMERS_TASK_WORK - select HAVE_FUNCTION_ARG_ACCESS_API - select MMU_GATHER_RCU_TABLE_FREE -diff --git a/arch/arm64/include/asm/preempt.h b/arch/arm64/include/asm/preempt.h -index 0159b625cc7f0..a5486918e5eeb 100644 ---- a/arch/arm64/include/asm/preempt.h -+++ b/arch/arm64/include/asm/preempt.h -@@ -71,13 +71,36 @@ static inline bool __preempt_count_dec_and_test(void) +diff -rupN linux-6.1.2.orig/arch/arm64/include/asm/preempt.h linux-6.1.2/arch/arm64/include/asm/preempt.h +--- linux-6.1.2.orig/arch/arm64/include/asm/preempt.h 2022-12-31 16:12:06.030599271 -0500 ++++ linux-6.1.2/arch/arm64/include/asm/preempt.h 2022-12-31 16:12:36.258153758 -0500 +@@ -71,13 +71,36 @@ static inline bool __preempt_count_dec_a * interrupt occurring between the non-atomic READ_ONCE/WRITE_ONCE * pair. */ @@ -219,10 +192,9 @@ index 0159b625cc7f0..a5486918e5eeb 100644 } #ifdef CONFIG_PREEMPTION -diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h -index 848739c15de82..4b7148fd5551f 100644 ---- a/arch/arm64/include/asm/thread_info.h -+++ b/arch/arm64/include/asm/thread_info.h +diff -rupN linux-6.1.2.orig/arch/arm64/include/asm/thread_info.h linux-6.1.2/arch/arm64/include/asm/thread_info.h +--- linux-6.1.2.orig/arch/arm64/include/asm/thread_info.h 2022-12-31 16:12:06.030599271 -0500 ++++ linux-6.1.2/arch/arm64/include/asm/thread_info.h 2022-12-31 16:12:36.258153758 -0500 @@ -26,6 +26,7 @@ struct thread_info { #ifdef CONFIG_ARM64_SW_TTBR0_PAN u64 ttbr0; /* saved TTBR0_EL1 */ @@ -231,7 +203,7 @@ index 848739c15de82..4b7148fd5551f 100644 union { u64 preempt_count; /* 0 => preemptible, <0 => bug */ struct { -@@ -68,6 +69,7 @@ int arch_dup_task_struct(struct task_struct *dst, +@@ -68,6 +69,7 @@ int arch_dup_task_struct(struct task_str #define TIF_UPROBE 4 /* uprobe breakpoint or singlestep */ #define TIF_MTE_ASYNC_FAULT 5 /* MTE Asynchronous Tag Check Fault */ #define TIF_NOTIFY_SIGNAL 6 /* signal notifications exist */ @@ -239,7 +211,7 @@ index 848739c15de82..4b7148fd5551f 100644 #define TIF_SYSCALL_TRACE 8 /* syscall trace active */ #define TIF_SYSCALL_AUDIT 9 /* syscall auditing */ #define TIF_SYSCALL_TRACEPOINT 10 /* syscall tracepoint for ftrace */ -@@ -100,8 +102,10 @@ int arch_dup_task_struct(struct task_struct *dst, +@@ -100,8 +102,10 @@ int arch_dup_task_struct(struct task_str #define _TIF_SVE (1 << TIF_SVE) #define _TIF_MTE_ASYNC_FAULT (1 << TIF_MTE_ASYNC_FAULT) #define _TIF_NOTIFY_SIGNAL (1 << TIF_NOTIFY_SIGNAL) @@ -251,7 +223,7 @@ index 848739c15de82..4b7148fd5551f 100644 _TIF_NOTIFY_RESUME | _TIF_FOREIGN_FPSTATE | \ _TIF_UPROBE | _TIF_MTE_ASYNC_FAULT | \ _TIF_NOTIFY_SIGNAL) -@@ -110,6 +114,8 @@ int arch_dup_task_struct(struct task_struct *dst, +@@ -110,6 +114,8 @@ int arch_dup_task_struct(struct task_str _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP | \ _TIF_SYSCALL_EMU) @@ -260,10 +232,28 @@ index 848739c15de82..4b7148fd5551f 100644 #ifdef CONFIG_SHADOW_CALL_STACK #define INIT_SCS \ .scs_base = init_shadow_call_stack, \ -diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c -index 1197e7679882e..e74c0415f67ea 100644 ---- a/arch/arm64/kernel/asm-offsets.c -+++ b/arch/arm64/kernel/asm-offsets.c +diff -rupN linux-6.1.2.orig/arch/arm64/Kconfig linux-6.1.2/arch/arm64/Kconfig +--- linux-6.1.2.orig/arch/arm64/Kconfig 2022-12-31 16:12:05.982599992 -0500 ++++ linux-6.1.2/arch/arm64/Kconfig 2022-12-31 16:12:36.258153758 -0500 +@@ -93,6 +93,7 @@ config ARM64 + select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 + select ARCH_SUPPORTS_NUMA_BALANCING + select ARCH_SUPPORTS_PAGE_TABLE_CHECK ++ select ARCH_SUPPORTS_RT + select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT + select ARCH_WANT_DEFAULT_BPF_JIT + select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT +@@ -200,6 +201,7 @@ config ARM64 + select HAVE_PERF_USER_STACK_DUMP + select HAVE_PREEMPT_DYNAMIC_KEY + select HAVE_REGS_AND_STACK_ACCESS_API ++ select HAVE_PREEMPT_LAZY + select HAVE_POSIX_CPU_TIMERS_TASK_WORK + select HAVE_FUNCTION_ARG_ACCESS_API + select MMU_GATHER_RCU_TABLE_FREE +diff -rupN linux-6.1.2.orig/arch/arm64/kernel/asm-offsets.c linux-6.1.2/arch/arm64/kernel/asm-offsets.c +--- linux-6.1.2.orig/arch/arm64/kernel/asm-offsets.c 2022-12-31 16:12:06.030599271 -0500 ++++ linux-6.1.2/arch/arm64/kernel/asm-offsets.c 2022-12-31 16:12:36.258153758 -0500 @@ -32,6 +32,7 @@ int main(void) DEFINE(TSK_TI_CPU, offsetof(struct task_struct, thread_info.cpu)); DEFINE(TSK_TI_FLAGS, offsetof(struct task_struct, thread_info.flags)); @@ -272,11 +262,10 @@ index 1197e7679882e..e74c0415f67ea 100644 #ifdef CONFIG_ARM64_SW_TTBR0_PAN DEFINE(TSK_TI_TTBR0, offsetof(struct task_struct, thread_info.ttbr0)); #endif -diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c -index 9ad911f1647c8..545c41a84411e 100644 ---- a/arch/arm64/kernel/signal.c -+++ b/arch/arm64/kernel/signal.c -@@ -1103,7 +1103,7 @@ static void do_signal(struct pt_regs *regs) +diff -rupN linux-6.1.2.orig/arch/arm64/kernel/signal.c linux-6.1.2/arch/arm64/kernel/signal.c +--- linux-6.1.2.orig/arch/arm64/kernel/signal.c 2022-12-31 16:12:06.034599210 -0500 ++++ linux-6.1.2/arch/arm64/kernel/signal.c 2022-12-31 16:12:36.258153758 -0500 +@@ -1103,7 +1103,7 @@ static void do_signal(struct pt_regs *re void do_notify_resume(struct pt_regs *regs, unsigned long thread_flags) { do { @@ -285,34 +274,10 @@ index 9ad911f1647c8..545c41a84411e 100644 /* Unmask Debug and SError for the next task */ local_daif_restore(DAIF_PROCCTX_NOIRQ); -diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig -index 2ca5418457ed2..d8a89c5f8f458 100644 ---- a/arch/powerpc/Kconfig -+++ b/arch/powerpc/Kconfig -@@ -151,6 +151,7 @@ config PPC - select ARCH_STACKWALK - select ARCH_SUPPORTS_ATOMIC_RMW - select ARCH_SUPPORTS_DEBUG_PAGEALLOC if PPC_BOOK3S || PPC_8xx || 40x -+ select ARCH_SUPPORTS_RT if HAVE_POSIX_CPU_TIMERS_TASK_WORK - select ARCH_USE_BUILTIN_BSWAP - select ARCH_USE_CMPXCHG_LOCKREF if PPC64 - select ARCH_USE_MEMTEST -@@ -243,8 +244,10 @@ config PPC - select HAVE_PERF_EVENTS_NMI if PPC64 - select HAVE_PERF_REGS - select HAVE_PERF_USER_STACK_DUMP -+ select HAVE_PREEMPT_LAZY - select HAVE_REGS_AND_STACK_ACCESS_API - select HAVE_RELIABLE_STACKTRACE -+ select HAVE_POSIX_CPU_TIMERS_TASK_WORK if !KVM - select HAVE_RSEQ - select HAVE_SETUP_PER_CPU_AREA if PPC64 - select HAVE_SOFTIRQ_ON_OWN_STACK -diff --git a/arch/powerpc/include/asm/stackprotector.h b/arch/powerpc/include/asm/stackprotector.h -index 1c8460e235838..b1653c160bab9 100644 ---- a/arch/powerpc/include/asm/stackprotector.h -+++ b/arch/powerpc/include/asm/stackprotector.h -@@ -24,7 +24,11 @@ static __always_inline void boot_init_stack_canary(void) +diff -rupN linux-6.1.2.orig/arch/powerpc/include/asm/stackprotector.h linux-6.1.2/arch/powerpc/include/asm/stackprotector.h +--- linux-6.1.2.orig/arch/powerpc/include/asm/stackprotector.h 2022-12-31 16:12:06.170597168 -0500 ++++ linux-6.1.2/arch/powerpc/include/asm/stackprotector.h 2022-12-31 16:12:36.258153758 -0500 +@@ -24,7 +24,11 @@ static __always_inline void boot_init_st unsigned long canary; /* Try to get a semi random initial value. */ @@ -324,10 +289,9 @@ index 1c8460e235838..b1653c160bab9 100644 canary ^= mftb(); canary ^= LINUX_VERSION_CODE; canary &= CANARY_MASK; -diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h -index af58f1ed3952e..520864de8bb27 100644 ---- a/arch/powerpc/include/asm/thread_info.h -+++ b/arch/powerpc/include/asm/thread_info.h +diff -rupN linux-6.1.2.orig/arch/powerpc/include/asm/thread_info.h linux-6.1.2/arch/powerpc/include/asm/thread_info.h +--- linux-6.1.2.orig/arch/powerpc/include/asm/thread_info.h 2022-12-31 16:12:06.170597168 -0500 ++++ linux-6.1.2/arch/powerpc/include/asm/thread_info.h 2022-12-31 16:12:36.258153758 -0500 @@ -53,6 +53,8 @@ struct thread_info { int preempt_count; /* 0 => preemptable, @@ -382,11 +346,32 @@ index af58f1ed3952e..520864de8bb27 100644 /* Bits in local_flags */ /* Don't move TLF_NAPPING without adjusting the code in entry_32.S */ -diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c -index fc6631a805272..6cb6a3b79663c 100644 ---- a/arch/powerpc/kernel/interrupt.c -+++ b/arch/powerpc/kernel/interrupt.c -@@ -184,7 +184,7 @@ interrupt_exit_user_prepare_main(unsigned long ret, struct pt_regs *regs) +diff -rupN linux-6.1.2.orig/arch/powerpc/Kconfig linux-6.1.2/arch/powerpc/Kconfig +--- linux-6.1.2.orig/arch/powerpc/Kconfig 2022-12-31 16:12:06.142597588 -0500 ++++ linux-6.1.2/arch/powerpc/Kconfig 2022-12-31 16:12:36.258153758 -0500 +@@ -151,6 +151,7 @@ config PPC + select ARCH_STACKWALK + select ARCH_SUPPORTS_ATOMIC_RMW + select ARCH_SUPPORTS_DEBUG_PAGEALLOC if PPC_BOOK3S || PPC_8xx || 40x ++ select ARCH_SUPPORTS_RT if HAVE_POSIX_CPU_TIMERS_TASK_WORK + select ARCH_USE_BUILTIN_BSWAP + select ARCH_USE_CMPXCHG_LOCKREF if PPC64 + select ARCH_USE_MEMTEST +@@ -243,8 +244,10 @@ config PPC + select HAVE_PERF_EVENTS_NMI if PPC64 + select HAVE_PERF_REGS + select HAVE_PERF_USER_STACK_DUMP ++ select HAVE_PREEMPT_LAZY + select HAVE_REGS_AND_STACK_ACCESS_API + select HAVE_RELIABLE_STACKTRACE ++ select HAVE_POSIX_CPU_TIMERS_TASK_WORK if !KVM + select HAVE_RSEQ + select HAVE_SETUP_PER_CPU_AREA if PPC64 + select HAVE_SOFTIRQ_ON_OWN_STACK +diff -rupN linux-6.1.2.orig/arch/powerpc/kernel/interrupt.c linux-6.1.2/arch/powerpc/kernel/interrupt.c +--- linux-6.1.2.orig/arch/powerpc/kernel/interrupt.c 2022-12-31 16:12:06.174597108 -0500 ++++ linux-6.1.2/arch/powerpc/kernel/interrupt.c 2022-12-31 16:12:36.258153758 -0500 +@@ -184,7 +184,7 @@ again: ti_flags = read_thread_flags(); while (unlikely(ti_flags & (_TIF_USER_WORK_MASK & ~_TIF_RESTORE_TM))) { local_irq_enable(); @@ -395,7 +380,7 @@ index fc6631a805272..6cb6a3b79663c 100644 schedule(); } else { /* -@@ -396,11 +396,15 @@ notrace unsigned long interrupt_exit_kernel_prepare(struct pt_regs *regs) +@@ -396,11 +396,15 @@ notrace unsigned long interrupt_exit_ker /* Returning to a kernel context with local irqs enabled. */ WARN_ON_ONCE(!(regs->msr & MSR_EE)); again: @@ -412,10 +397,9 @@ index fc6631a805272..6cb6a3b79663c 100644 } } -diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c -index 9bdd79aa51cfc..038f8355b29ca 100644 ---- a/arch/powerpc/kernel/traps.c -+++ b/arch/powerpc/kernel/traps.c +diff -rupN linux-6.1.2.orig/arch/powerpc/kernel/traps.c linux-6.1.2/arch/powerpc/kernel/traps.c +--- linux-6.1.2.orig/arch/powerpc/kernel/traps.c 2022-12-31 16:12:06.178597048 -0500 ++++ linux-6.1.2/arch/powerpc/kernel/traps.c 2022-12-31 16:12:36.262153700 -0500 @@ -261,12 +261,17 @@ static char *get_mmu_str(void) static int __die(const char *str, struct pt_regs *regs, long err) @@ -435,10 +419,9 @@ index 9bdd79aa51cfc..038f8355b29ca 100644 IS_ENABLED(CONFIG_SMP) ? " SMP" : "", IS_ENABLED(CONFIG_SMP) ? (" NR_CPUS=" __stringify(NR_CPUS)) : "", debug_pagealloc_enabled() ? " DEBUG_PAGEALLOC" : "", -diff --git a/arch/powerpc/kvm/Kconfig b/arch/powerpc/kvm/Kconfig -index a9f57dad6d916..a0b528d4bb7cd 100644 ---- a/arch/powerpc/kvm/Kconfig -+++ b/arch/powerpc/kvm/Kconfig +diff -rupN linux-6.1.2.orig/arch/powerpc/kvm/Kconfig linux-6.1.2/arch/powerpc/kvm/Kconfig +--- linux-6.1.2.orig/arch/powerpc/kvm/Kconfig 2022-12-31 16:12:06.178597048 -0500 ++++ linux-6.1.2/arch/powerpc/kvm/Kconfig 2022-12-31 16:12:36.262153700 -0500 @@ -225,6 +225,7 @@ config KVM_E500MC config KVM_MPIC bool "KVM in-kernel MPIC emulation" @@ -447,10 +430,9 @@ index a9f57dad6d916..a0b528d4bb7cd 100644 select HAVE_KVM_IRQCHIP select HAVE_KVM_IRQFD select HAVE_KVM_IRQ_ROUTING -diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c -index 561adac690229..61c4c0610aa6a 100644 ---- a/arch/powerpc/platforms/pseries/iommu.c -+++ b/arch/powerpc/platforms/pseries/iommu.c +diff -rupN linux-6.1.2.orig/arch/powerpc/platforms/pseries/iommu.c linux-6.1.2/arch/powerpc/platforms/pseries/iommu.c +--- linux-6.1.2.orig/arch/powerpc/platforms/pseries/iommu.c 2022-12-31 16:12:06.198596747 -0500 ++++ linux-6.1.2/arch/powerpc/platforms/pseries/iommu.c 2022-12-31 16:12:36.262153700 -0500 @@ -24,6 +24,7 @@ #include #include @@ -459,7 +441,7 @@ index 561adac690229..61c4c0610aa6a 100644 #include #include #include -@@ -195,7 +196,13 @@ static int tce_build_pSeriesLP(unsigned long liobn, long tcenum, long tceshift, +@@ -195,7 +196,13 @@ static int tce_build_pSeriesLP(unsigned return ret; } @@ -474,7 +456,7 @@ index 561adac690229..61c4c0610aa6a 100644 static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, long npages, unsigned long uaddr, -@@ -218,9 +225,10 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, +@@ -218,9 +225,10 @@ static int tce_buildmulti_pSeriesLP(stru direction, attrs); } @@ -487,7 +469,7 @@ index 561adac690229..61c4c0610aa6a 100644 /* This is safe to do since interrupts are off when we're called * from iommu_alloc{,_sg}() -@@ -229,12 +237,12 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, +@@ -229,12 +237,12 @@ static int tce_buildmulti_pSeriesLP(stru tcep = (__be64 *)__get_free_page(GFP_ATOMIC); /* If allocation fails, fall back to the loop implementation */ if (!tcep) { @@ -502,7 +484,7 @@ index 561adac690229..61c4c0610aa6a 100644 } rpn = __pa(uaddr) >> tceshift; -@@ -264,7 +272,7 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, +@@ -264,7 +272,7 @@ static int tce_buildmulti_pSeriesLP(stru tcenum += limit; } while (npages > 0 && !rc); @@ -511,7 +493,7 @@ index 561adac690229..61c4c0610aa6a 100644 if (unlikely(rc == H_NOT_ENOUGH_RESOURCES)) { ret = (int)rc; -@@ -440,16 +448,17 @@ static int tce_setrange_multi_pSeriesLP(unsigned long start_pfn, +@@ -440,16 +448,17 @@ static int tce_setrange_multi_pSeriesLP( DMA_BIDIRECTIONAL, 0); } @@ -533,7 +515,7 @@ index 561adac690229..61c4c0610aa6a 100644 } proto_tce = TCE_PCI_READ | TCE_PCI_WRITE; -@@ -492,7 +501,7 @@ static int tce_setrange_multi_pSeriesLP(unsigned long start_pfn, +@@ -492,7 +501,7 @@ static int tce_setrange_multi_pSeriesLP( /* error cleanup: caller will clear whole range */ @@ -542,31 +524,10 @@ index 561adac690229..61c4c0610aa6a 100644 return rc; } -diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig -index 67745ceab0dbc..34d36d1f269ae 100644 ---- a/arch/x86/Kconfig -+++ b/arch/x86/Kconfig -@@ -112,6 +112,7 @@ config X86 - select ARCH_USES_CFI_TRAPS if X86_64 && CFI_CLANG - select ARCH_SUPPORTS_LTO_CLANG - select ARCH_SUPPORTS_LTO_CLANG_THIN -+ select ARCH_SUPPORTS_RT - select ARCH_USE_BUILTIN_BSWAP - select ARCH_USE_MEMTEST - select ARCH_USE_QUEUED_RWLOCKS -@@ -249,6 +250,7 @@ config X86 - select HAVE_PCI - select HAVE_PERF_REGS - select HAVE_PERF_USER_STACK_DUMP -+ select HAVE_PREEMPT_LAZY - select MMU_GATHER_RCU_TABLE_FREE if PARAVIRT - select MMU_GATHER_MERGE_VMAS - select HAVE_POSIX_CPU_TIMERS_TASK_WORK -diff --git a/arch/x86/include/asm/preempt.h b/arch/x86/include/asm/preempt.h -index 5f6daea1ee248..cd20b4a5719a4 100644 ---- a/arch/x86/include/asm/preempt.h -+++ b/arch/x86/include/asm/preempt.h -@@ -90,17 +90,48 @@ static __always_inline void __preempt_count_sub(int val) +diff -rupN linux-6.1.2.orig/arch/x86/include/asm/preempt.h linux-6.1.2/arch/x86/include/asm/preempt.h +--- linux-6.1.2.orig/arch/x86/include/asm/preempt.h 2022-12-31 16:12:06.286595425 -0500 ++++ linux-6.1.2/arch/x86/include/asm/preempt.h 2022-12-31 16:12:36.262153700 -0500 +@@ -90,17 +90,48 @@ static __always_inline void __preempt_co * a decrement which hits zero means we have no preempt_count and should * reschedule. */ @@ -616,10 +577,9 @@ index 5f6daea1ee248..cd20b4a5719a4 100644 } #ifdef CONFIG_PREEMPTION -diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h -index f0cb881c1d690..fd8fb76f324fc 100644 ---- a/arch/x86/include/asm/thread_info.h -+++ b/arch/x86/include/asm/thread_info.h +diff -rupN linux-6.1.2.orig/arch/x86/include/asm/thread_info.h linux-6.1.2/arch/x86/include/asm/thread_info.h +--- linux-6.1.2.orig/arch/x86/include/asm/thread_info.h 2022-12-31 16:12:06.290595365 -0500 ++++ linux-6.1.2/arch/x86/include/asm/thread_info.h 2022-12-31 16:12:36.262153700 -0500 @@ -57,6 +57,8 @@ struct thread_info { unsigned long flags; /* low level flags */ unsigned long syscall_work; /* SYSCALL_WORK_ flags */ @@ -653,11 +613,29 @@ index f0cb881c1d690..fd8fb76f324fc 100644 #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) #define _TIF_IO_BITMAP (1 << TIF_IO_BITMAP) #define _TIF_SPEC_FORCE_UPDATE (1 << TIF_SPEC_FORCE_UPDATE) -diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c -index 966aab902d19a..ee69e44436916 100644 ---- a/drivers/block/zram/zram_drv.c -+++ b/drivers/block/zram/zram_drv.c -@@ -57,6 +57,40 @@ static void zram_free_page(struct zram *zram, size_t index); +diff -rupN linux-6.1.2.orig/arch/x86/Kconfig linux-6.1.2/arch/x86/Kconfig +--- linux-6.1.2.orig/arch/x86/Kconfig 2022-12-31 16:12:06.270595666 -0500 ++++ linux-6.1.2/arch/x86/Kconfig 2022-12-31 16:12:36.262153700 -0500 +@@ -112,6 +112,7 @@ config X86 + select ARCH_USES_CFI_TRAPS if X86_64 && CFI_CLANG + select ARCH_SUPPORTS_LTO_CLANG + select ARCH_SUPPORTS_LTO_CLANG_THIN ++ select ARCH_SUPPORTS_RT + select ARCH_USE_BUILTIN_BSWAP + select ARCH_USE_MEMTEST + select ARCH_USE_QUEUED_RWLOCKS +@@ -249,6 +250,7 @@ config X86 + select HAVE_PCI + select HAVE_PERF_REGS + select HAVE_PERF_USER_STACK_DUMP ++ select HAVE_PREEMPT_LAZY + select MMU_GATHER_RCU_TABLE_FREE if PARAVIRT + select MMU_GATHER_MERGE_VMAS + select HAVE_POSIX_CPU_TIMERS_TASK_WORK +diff -rupN linux-6.1.2.orig/drivers/block/zram/zram_drv.c linux-6.1.2/drivers/block/zram/zram_drv.c +--- linux-6.1.2.orig/drivers/block/zram/zram_drv.c 2022-12-31 16:12:06.362594285 -0500 ++++ linux-6.1.2/drivers/block/zram/zram_drv.c 2022-12-31 16:12:36.262153700 -0500 +@@ -57,6 +57,40 @@ static void zram_free_page(struct zram * static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec, u32 index, int offset, struct bio *bio); @@ -698,7 +676,7 @@ index 966aab902d19a..ee69e44436916 100644 static int zram_slot_trylock(struct zram *zram, u32 index) { -@@ -72,6 +106,7 @@ static void zram_slot_unlock(struct zram *zram, u32 index) +@@ -72,6 +106,7 @@ static void zram_slot_unlock(struct zram { bit_spin_unlock(ZRAM_LOCK, &zram->table[index].flags); } @@ -706,7 +684,7 @@ index 966aab902d19a..ee69e44436916 100644 static inline bool init_done(struct zram *zram) { -@@ -1187,6 +1222,7 @@ static bool zram_meta_alloc(struct zram *zram, u64 disksize) +@@ -1187,6 +1222,7 @@ static bool zram_meta_alloc(struct zram if (!huge_class_size) huge_class_size = zs_huge_class_size(zram->mem_pool); @@ -714,10 +692,9 @@ index 966aab902d19a..ee69e44436916 100644 return true; } -diff --git a/drivers/block/zram/zram_drv.h b/drivers/block/zram/zram_drv.h -index a2bda53020fdd..ae7950b26db52 100644 ---- a/drivers/block/zram/zram_drv.h -+++ b/drivers/block/zram/zram_drv.h +diff -rupN linux-6.1.2.orig/drivers/block/zram/zram_drv.h linux-6.1.2/drivers/block/zram/zram_drv.h +--- linux-6.1.2.orig/drivers/block/zram/zram_drv.h 2022-12-31 16:12:06.362594285 -0500 ++++ linux-6.1.2/drivers/block/zram/zram_drv.h 2022-12-31 16:12:36.262153700 -0500 @@ -62,6 +62,9 @@ struct zram_table_entry { unsigned long element; }; @@ -728,11 +705,10 @@ index a2bda53020fdd..ae7950b26db52 100644 #ifdef CONFIG_ZRAM_MEMORY_TRACKING ktime_t ac_time; #endif -diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c -index bcff6429e0b4f..4a9ae338a2bdf 100644 ---- a/drivers/char/tpm/tpm_tis.c -+++ b/drivers/char/tpm/tpm_tis.c -@@ -50,6 +50,31 @@ static inline struct tpm_tis_tcg_phy *to_tpm_tis_tcg_phy(struct tpm_tis_data *da +diff -rupN linux-6.1.2.orig/drivers/char/tpm/tpm_tis.c linux-6.1.2/drivers/char/tpm/tpm_tis.c +--- linux-6.1.2.orig/drivers/char/tpm/tpm_tis.c 2022-12-31 16:12:06.370594164 -0500 ++++ linux-6.1.2/drivers/char/tpm/tpm_tis.c 2022-12-31 16:12:36.262153700 -0500 +@@ -50,6 +50,31 @@ static inline struct tpm_tis_tcg_phy *to return container_of(data, struct tpm_tis_tcg_phy, priv); } @@ -764,7 +740,7 @@ index bcff6429e0b4f..4a9ae338a2bdf 100644 static int interrupts = -1; module_param(interrupts, int, 0444); MODULE_PARM_DESC(interrupts, "Enable interrupts"); -@@ -185,12 +210,12 @@ static int tpm_tcg_write_bytes(struct tpm_tis_data *data, u32 addr, u16 len, +@@ -185,12 +210,12 @@ static int tpm_tcg_write_bytes(struct tp switch (io_mode) { case TPM_TIS_PHYS_8: while (len--) @@ -779,23 +755,10 @@ index bcff6429e0b4f..4a9ae338a2bdf 100644 break; } -diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig -index 3efce05d7b57c..392d517030960 100644 ---- a/drivers/gpu/drm/i915/Kconfig -+++ b/drivers/gpu/drm/i915/Kconfig -@@ -3,7 +3,6 @@ config DRM_I915 - tristate "Intel 8xx/9xx/G3x/G4x/HD Graphics" - depends on DRM - depends on X86 && PCI -- depends on !PREEMPT_RT - select INTEL_GTT if X86 - select INTERVAL_TREE - # we need shmfs for the swappable backing store, and in particular -diff --git a/drivers/gpu/drm/i915/display/intel_crtc.c b/drivers/gpu/drm/i915/display/intel_crtc.c -index 6792a9056f46f..43cedfef104f1 100644 ---- a/drivers/gpu/drm/i915/display/intel_crtc.c -+++ b/drivers/gpu/drm/i915/display/intel_crtc.c -@@ -521,7 +521,8 @@ void intel_pipe_update_start(struct intel_crtc_state *new_crtc_state) +diff -rupN linux-6.1.2.orig/drivers/gpu/drm/i915/display/intel_crtc.c linux-6.1.2/drivers/gpu/drm/i915/display/intel_crtc.c +--- linux-6.1.2.orig/drivers/gpu/drm/i915/display/intel_crtc.c 2022-12-31 16:12:06.818587436 -0500 ++++ linux-6.1.2/drivers/gpu/drm/i915/display/intel_crtc.c 2022-12-31 16:12:36.262153700 -0500 +@@ -521,7 +521,8 @@ void intel_pipe_update_start(struct inte */ intel_psr_wait_for_idle_locked(new_crtc_state); @@ -805,7 +768,7 @@ index 6792a9056f46f..43cedfef104f1 100644 crtc->debug.min_vbl = min; crtc->debug.max_vbl = max; -@@ -546,11 +547,13 @@ void intel_pipe_update_start(struct intel_crtc_state *new_crtc_state) +@@ -546,11 +547,13 @@ void intel_pipe_update_start(struct inte break; } @@ -821,7 +784,7 @@ index 6792a9056f46f..43cedfef104f1 100644 } finish_wait(wq, &wait); -@@ -583,7 +586,8 @@ void intel_pipe_update_start(struct intel_crtc_state *new_crtc_state) +@@ -583,7 +586,8 @@ void intel_pipe_update_start(struct inte return; irq_disable: @@ -831,7 +794,7 @@ index 6792a9056f46f..43cedfef104f1 100644 } #if IS_ENABLED(CONFIG_DRM_I915_DEBUG_VBLANK_EVADE) -@@ -684,7 +688,8 @@ void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state) +@@ -684,7 +688,8 @@ void intel_pipe_update_end(struct intel_ */ intel_vrr_send_push(new_crtc_state); @@ -841,11 +804,10 @@ index 6792a9056f46f..43cedfef104f1 100644 if (intel_vgpu_active(dev_priv)) return; -diff --git a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c -index ecc990ec1b952..8d04b10681f0d 100644 ---- a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c -+++ b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c -@@ -312,10 +312,9 @@ void __intel_breadcrumbs_park(struct intel_breadcrumbs *b) +diff -rupN linux-6.1.2.orig/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c linux-6.1.2/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c +--- linux-6.1.2.orig/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c 2022-12-31 16:12:06.826587315 -0500 ++++ linux-6.1.2/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c 2022-12-31 16:12:36.262153700 -0500 +@@ -312,10 +312,9 @@ void __intel_breadcrumbs_park(struct int /* Kick the work once more to drain the signalers, and disarm the irq */ irq_work_sync(&b->irq_work); while (READ_ONCE(b->irq_armed) && !atomic_read(&b->active)) { @@ -858,11 +820,10 @@ index ecc990ec1b952..8d04b10681f0d 100644 } } -diff --git a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c -index c718e6dc40b51..0e592999b7d60 100644 ---- a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c -+++ b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c -@@ -1302,7 +1302,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine) +diff -rupN linux-6.1.2.orig/drivers/gpu/drm/i915/gt/intel_execlists_submission.c linux-6.1.2/drivers/gpu/drm/i915/gt/intel_execlists_submission.c +--- linux-6.1.2.orig/drivers/gpu/drm/i915/gt/intel_execlists_submission.c 2022-12-31 16:12:06.826587315 -0500 ++++ linux-6.1.2/drivers/gpu/drm/i915/gt/intel_execlists_submission.c 2022-12-31 16:12:36.262153700 -0500 +@@ -1302,7 +1302,7 @@ static void execlists_dequeue(struct int * and context switches) submission. */ @@ -871,7 +832,7 @@ index c718e6dc40b51..0e592999b7d60 100644 /* * If the queue is higher priority than the last -@@ -1402,7 +1402,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine) +@@ -1402,7 +1402,7 @@ static void execlists_dequeue(struct int * Even if ELSP[1] is occupied and not worthy * of timeslices, our queue might be. */ @@ -880,7 +841,7 @@ index c718e6dc40b51..0e592999b7d60 100644 return; } } -@@ -1428,7 +1428,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine) +@@ -1428,7 +1428,7 @@ static void execlists_dequeue(struct int if (last && !can_merge_rq(last, rq)) { spin_unlock(&ve->base.sched_engine->lock); @@ -889,7 +850,7 @@ index c718e6dc40b51..0e592999b7d60 100644 return; /* leave this for another sibling */ } -@@ -1590,7 +1590,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine) +@@ -1590,7 +1590,7 @@ done: */ sched_engine->queue_priority_hint = queue_prio(sched_engine); i915_sched_engine_reset_on_empty(sched_engine); @@ -898,7 +859,7 @@ index c718e6dc40b51..0e592999b7d60 100644 /* * We can skip poking the HW if we ended up with exactly the same set -@@ -1616,13 +1616,6 @@ static void execlists_dequeue(struct intel_engine_cs *engine) +@@ -1616,13 +1616,6 @@ done: } } @@ -912,7 +873,7 @@ index c718e6dc40b51..0e592999b7d60 100644 static void clear_ports(struct i915_request **ports, int count) { memset_p((void **)ports, NULL, count); -@@ -2468,7 +2461,7 @@ static void execlists_submission_tasklet(struct tasklet_struct *t) +@@ -2468,7 +2461,7 @@ static void execlists_submission_tasklet } if (!engine->execlists.pending[0]) { @@ -921,11 +882,10 @@ index c718e6dc40b51..0e592999b7d60 100644 start_timeslice(engine); } -diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c -index 86a42d9e80412..1bedfe061865e 100644 ---- a/drivers/gpu/drm/i915/i915_irq.c -+++ b/drivers/gpu/drm/i915/i915_irq.c -@@ -917,7 +917,8 @@ static bool i915_get_crtc_scanoutpos(struct drm_crtc *_crtc, +diff -rupN linux-6.1.2.orig/drivers/gpu/drm/i915/i915_irq.c linux-6.1.2/drivers/gpu/drm/i915/i915_irq.c +--- linux-6.1.2.orig/drivers/gpu/drm/i915/i915_irq.c 2022-12-31 16:12:06.834587196 -0500 ++++ linux-6.1.2/drivers/gpu/drm/i915/i915_irq.c 2022-12-31 16:12:36.262153700 -0500 +@@ -917,7 +917,8 @@ static bool i915_get_crtc_scanoutpos(str */ spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); @@ -935,7 +895,7 @@ index 86a42d9e80412..1bedfe061865e 100644 /* Get optional system timestamp before query. */ if (stime) -@@ -981,7 +982,8 @@ static bool i915_get_crtc_scanoutpos(struct drm_crtc *_crtc, +@@ -981,7 +982,8 @@ static bool i915_get_crtc_scanoutpos(str if (etime) *etime = ktime_get(); @@ -945,11 +905,10 @@ index 86a42d9e80412..1bedfe061865e 100644 spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); -diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c -index 62fad16a55e84..af07927650b24 100644 ---- a/drivers/gpu/drm/i915/i915_request.c -+++ b/drivers/gpu/drm/i915/i915_request.c -@@ -612,7 +612,6 @@ bool __i915_request_submit(struct i915_request *request) +diff -rupN linux-6.1.2.orig/drivers/gpu/drm/i915/i915_request.c linux-6.1.2/drivers/gpu/drm/i915/i915_request.c +--- linux-6.1.2.orig/drivers/gpu/drm/i915/i915_request.c 2022-12-31 16:12:06.834587196 -0500 ++++ linux-6.1.2/drivers/gpu/drm/i915/i915_request.c 2022-12-31 16:12:36.262153700 -0500 +@@ -612,7 +612,6 @@ bool __i915_request_submit(struct i915_r RQ_TRACE(request, "\n"); @@ -957,7 +916,7 @@ index 62fad16a55e84..af07927650b24 100644 lockdep_assert_held(&engine->sched_engine->lock); /* -@@ -721,7 +720,6 @@ void __i915_request_unsubmit(struct i915_request *request) +@@ -721,7 +720,6 @@ void __i915_request_unsubmit(struct i915 */ RQ_TRACE(request, "\n"); @@ -965,10 +924,9 @@ index 62fad16a55e84..af07927650b24 100644 lockdep_assert_held(&engine->sched_engine->lock); /* -diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h -index 37b5c9e9d260e..73f29d8008f0c 100644 ---- a/drivers/gpu/drm/i915/i915_trace.h -+++ b/drivers/gpu/drm/i915/i915_trace.h +diff -rupN linux-6.1.2.orig/drivers/gpu/drm/i915/i915_trace.h linux-6.1.2/drivers/gpu/drm/i915/i915_trace.h +--- linux-6.1.2.orig/drivers/gpu/drm/i915/i915_trace.h 2022-12-31 16:12:06.834587196 -0500 ++++ linux-6.1.2/drivers/gpu/drm/i915/i915_trace.h 2022-12-31 16:12:36.262153700 -0500 @@ -6,6 +6,10 @@ #if !defined(_I915_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ) #define _I915_TRACE_H_ @@ -980,7 +938,7 @@ index 37b5c9e9d260e..73f29d8008f0c 100644 #include #include #include -@@ -323,7 +327,7 @@ DEFINE_EVENT(i915_request, i915_request_add, +@@ -323,7 +327,7 @@ DEFINE_EVENT(i915_request, i915_request_ TP_ARGS(rq) ); @@ -989,11 +947,10 @@ index 37b5c9e9d260e..73f29d8008f0c 100644 DEFINE_EVENT(i915_request, i915_request_guc_submit, TP_PROTO(struct i915_request *rq), TP_ARGS(rq) -diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h -index 6c14d13364bf7..de58855e69268 100644 ---- a/drivers/gpu/drm/i915/i915_utils.h -+++ b/drivers/gpu/drm/i915/i915_utils.h -@@ -294,7 +294,7 @@ wait_remaining_ms_from_jiffies(unsigned long timestamp_jiffies, int to_wait_ms) +diff -rupN linux-6.1.2.orig/drivers/gpu/drm/i915/i915_utils.h linux-6.1.2/drivers/gpu/drm/i915/i915_utils.h +--- linux-6.1.2.orig/drivers/gpu/drm/i915/i915_utils.h 2022-12-31 16:12:06.834587196 -0500 ++++ linux-6.1.2/drivers/gpu/drm/i915/i915_utils.h 2022-12-31 16:12:36.262153700 -0500 +@@ -294,7 +294,7 @@ wait_remaining_ms_from_jiffies(unsigned #define wait_for(COND, MS) _wait_for((COND), (MS) * 1000, 10, 1000) /* If CONFIG_PREEMPT_COUNT is disabled, in_atomic() always reports false. */ @@ -1002,10 +959,20 @@ index 6c14d13364bf7..de58855e69268 100644 # define _WAIT_FOR_ATOMIC_CHECK(ATOMIC) WARN_ON_ONCE((ATOMIC) && !in_atomic()) #else # define _WAIT_FOR_ATOMIC_CHECK(ATOMIC) do { } while (0) -diff --git a/drivers/net/ethernet/alacritech/slic.h b/drivers/net/ethernet/alacritech/slic.h -index 4eecbdfff3ff1..82071d0e5f7fc 100644 ---- a/drivers/net/ethernet/alacritech/slic.h -+++ b/drivers/net/ethernet/alacritech/slic.h +diff -rupN linux-6.1.2.orig/drivers/gpu/drm/i915/Kconfig linux-6.1.2/drivers/gpu/drm/i915/Kconfig +--- linux-6.1.2.orig/drivers/gpu/drm/i915/Kconfig 2022-12-31 16:12:06.814587496 -0500 ++++ linux-6.1.2/drivers/gpu/drm/i915/Kconfig 2022-12-31 16:12:36.262153700 -0500 +@@ -3,7 +3,6 @@ config DRM_I915 + tristate "Intel 8xx/9xx/G3x/G4x/HD Graphics" + depends on DRM + depends on X86 && PCI +- depends on !PREEMPT_RT + select INTEL_GTT if X86 + select INTERVAL_TREE + # we need shmfs for the swappable backing store, and in particular +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/alacritech/slic.h linux-6.1.2/drivers/net/ethernet/alacritech/slic.h +--- linux-6.1.2.orig/drivers/net/ethernet/alacritech/slic.h 2022-12-31 16:12:07.218581432 -0500 ++++ linux-6.1.2/drivers/net/ethernet/alacritech/slic.h 2022-12-31 16:12:36.262153700 -0500 @@ -288,13 +288,13 @@ do { \ u64_stats_update_end(&(st)->syncp); \ } while (0) @@ -1026,11 +993,10 @@ index 4eecbdfff3ff1..82071d0e5f7fc 100644 } struct slic_upr { -diff --git a/drivers/net/ethernet/amazon/ena/ena_ethtool.c b/drivers/net/ethernet/amazon/ena/ena_ethtool.c -index 98d6386b7f398..48ae6d810f8f9 100644 ---- a/drivers/net/ethernet/amazon/ena/ena_ethtool.c -+++ b/drivers/net/ethernet/amazon/ena/ena_ethtool.c -@@ -118,9 +118,9 @@ static void ena_safe_update_stat(u64 *src, u64 *dst, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/amazon/ena/ena_ethtool.c linux-6.1.2/drivers/net/ethernet/amazon/ena/ena_ethtool.c +--- linux-6.1.2.orig/drivers/net/ethernet/amazon/ena/ena_ethtool.c 2022-12-31 16:12:07.218581432 -0500 ++++ linux-6.1.2/drivers/net/ethernet/amazon/ena/ena_ethtool.c 2022-12-31 16:12:36.262153700 -0500 +@@ -118,9 +118,9 @@ static void ena_safe_update_stat(u64 *sr unsigned int start; do { @@ -1042,11 +1008,10 @@ index 98d6386b7f398..48ae6d810f8f9 100644 } static void ena_queue_stats(struct ena_adapter *adapter, u64 **data) -diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c -index 5a454b58498fd..a95529a69cbb6 100644 ---- a/drivers/net/ethernet/amazon/ena/ena_netdev.c -+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c -@@ -3268,10 +3268,10 @@ static void ena_get_stats64(struct net_device *netdev, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/amazon/ena/ena_netdev.c linux-6.1.2/drivers/net/ethernet/amazon/ena/ena_netdev.c +--- linux-6.1.2.orig/drivers/net/ethernet/amazon/ena/ena_netdev.c 2022-12-31 16:12:07.218581432 -0500 ++++ linux-6.1.2/drivers/net/ethernet/amazon/ena/ena_netdev.c 2022-12-31 16:12:36.262153700 -0500 +@@ -3268,10 +3268,10 @@ static void ena_get_stats64(struct net_d tx_ring = &adapter->tx_ring[i]; do { @@ -1059,7 +1024,7 @@ index 5a454b58498fd..a95529a69cbb6 100644 stats->tx_packets += packets; stats->tx_bytes += bytes; -@@ -3279,20 +3279,20 @@ static void ena_get_stats64(struct net_device *netdev, +@@ -3279,20 +3279,20 @@ static void ena_get_stats64(struct net_d rx_ring = &adapter->rx_ring[i]; do { @@ -1084,11 +1049,10 @@ index 5a454b58498fd..a95529a69cbb6 100644 stats->rx_dropped = rx_drops; stats->tx_dropped = tx_drops; -diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c -index 25129e723b575..1e8d902e1c8ea 100644 ---- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c -+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c -@@ -934,7 +934,7 @@ unsigned int aq_ring_fill_stats_data(struct aq_ring_s *self, u64 *data) +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/aquantia/atlantic/aq_ring.c linux-6.1.2/drivers/net/ethernet/aquantia/atlantic/aq_ring.c +--- linux-6.1.2.orig/drivers/net/ethernet/aquantia/atlantic/aq_ring.c 2022-12-31 16:12:07.222581372 -0500 ++++ linux-6.1.2/drivers/net/ethernet/aquantia/atlantic/aq_ring.c 2022-12-31 16:12:36.262153700 -0500 +@@ -934,7 +934,7 @@ unsigned int aq_ring_fill_stats_data(str /* This data should mimic aq_ethtool_queue_rx_stat_names structure */ do { count = 0; @@ -1097,7 +1061,7 @@ index 25129e723b575..1e8d902e1c8ea 100644 data[count] = self->stats.rx.packets; data[++count] = self->stats.rx.jumbo_packets; data[++count] = self->stats.rx.lro_packets; -@@ -951,15 +951,15 @@ unsigned int aq_ring_fill_stats_data(struct aq_ring_s *self, u64 *data) +@@ -951,15 +951,15 @@ unsigned int aq_ring_fill_stats_data(str data[++count] = self->stats.rx.xdp_tx; data[++count] = self->stats.rx.xdp_invalid; data[++count] = self->stats.rx.xdp_redirect; @@ -1116,11 +1080,10 @@ index 25129e723b575..1e8d902e1c8ea 100644 } return ++count; -diff --git a/drivers/net/ethernet/asix/ax88796c_main.c b/drivers/net/ethernet/asix/ax88796c_main.c -index 8b7cdf015a16e..21376c79f6711 100644 ---- a/drivers/net/ethernet/asix/ax88796c_main.c -+++ b/drivers/net/ethernet/asix/ax88796c_main.c -@@ -662,12 +662,12 @@ static void ax88796c_get_stats64(struct net_device *ndev, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/asix/ax88796c_main.c linux-6.1.2/drivers/net/ethernet/asix/ax88796c_main.c +--- linux-6.1.2.orig/drivers/net/ethernet/asix/ax88796c_main.c 2022-12-31 16:12:07.226581312 -0500 ++++ linux-6.1.2/drivers/net/ethernet/asix/ax88796c_main.c 2022-12-31 16:12:36.262153700 -0500 +@@ -662,12 +662,12 @@ static void ax88796c_get_stats64(struct s = per_cpu_ptr(ax_local->stats, cpu); do { @@ -1135,11 +1098,10 @@ index 8b7cdf015a16e..21376c79f6711 100644 stats->rx_packets += rx_packets; stats->rx_bytes += rx_bytes; -diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c -index 7f876721596c1..b751dc8486dcd 100644 ---- a/drivers/net/ethernet/broadcom/b44.c -+++ b/drivers/net/ethernet/broadcom/b44.c -@@ -1680,7 +1680,7 @@ static void b44_get_stats64(struct net_device *dev, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/broadcom/b44.c linux-6.1.2/drivers/net/ethernet/broadcom/b44.c +--- linux-6.1.2.orig/drivers/net/ethernet/broadcom/b44.c 2022-12-31 16:12:07.226581312 -0500 ++++ linux-6.1.2/drivers/net/ethernet/broadcom/b44.c 2022-12-31 16:12:36.266153642 -0500 +@@ -1680,7 +1680,7 @@ static void b44_get_stats64(struct net_d unsigned int start; do { @@ -1148,7 +1110,7 @@ index 7f876721596c1..b751dc8486dcd 100644 /* Convert HW stats into rtnl_link_stats64 stats. */ nstat->rx_packets = hwstat->rx_pkts; -@@ -1714,7 +1714,7 @@ static void b44_get_stats64(struct net_device *dev, +@@ -1714,7 +1714,7 @@ static void b44_get_stats64(struct net_d /* Carrier lost counter seems to be broken for some devices */ nstat->tx_carrier_errors = hwstat->tx_carrier_lost; #endif @@ -1157,7 +1119,7 @@ index 7f876721596c1..b751dc8486dcd 100644 } -@@ -2082,12 +2082,12 @@ static void b44_get_ethtool_stats(struct net_device *dev, +@@ -2082,12 +2082,12 @@ static void b44_get_ethtool_stats(struct do { data_src = &hwstat->tx_good_octets; data_dst = data; @@ -1172,11 +1134,10 @@ index 7f876721596c1..b751dc8486dcd 100644 } static void b44_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) -diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c -index 425d6ccd5413a..f8b1adc389b39 100644 ---- a/drivers/net/ethernet/broadcom/bcmsysport.c -+++ b/drivers/net/ethernet/broadcom/bcmsysport.c -@@ -457,10 +457,10 @@ static void bcm_sysport_update_tx_stats(struct bcm_sysport_priv *priv, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/broadcom/bcmsysport.c linux-6.1.2/drivers/net/ethernet/broadcom/bcmsysport.c +--- linux-6.1.2.orig/drivers/net/ethernet/broadcom/bcmsysport.c 2022-12-31 16:12:07.226581312 -0500 ++++ linux-6.1.2/drivers/net/ethernet/broadcom/bcmsysport.c 2022-12-31 16:12:36.266153642 -0500 +@@ -457,10 +457,10 @@ static void bcm_sysport_update_tx_stats( for (q = 0; q < priv->netdev->num_tx_queues; q++) { ring = &priv->tx_rings[q]; do { @@ -1189,7 +1150,7 @@ index 425d6ccd5413a..f8b1adc389b39 100644 *tx_bytes += bytes; *tx_packets += packets; -@@ -504,9 +504,9 @@ static void bcm_sysport_get_stats(struct net_device *dev, +@@ -504,9 +504,9 @@ static void bcm_sysport_get_stats(struct if (s->stat_sizeof == sizeof(u64) && s->type == BCM_SYSPORT_STAT_NETDEV64) { do { @@ -1201,7 +1162,7 @@ index 425d6ccd5413a..f8b1adc389b39 100644 } else data[i] = *(u32 *)p; j++; -@@ -1878,10 +1878,10 @@ static void bcm_sysport_get_stats64(struct net_device *dev, +@@ -1878,10 +1878,10 @@ static void bcm_sysport_get_stats64(stru &stats->tx_packets); do { @@ -1214,11 +1175,10 @@ index 425d6ccd5413a..f8b1adc389b39 100644 } static void bcm_sysport_netif_start(struct net_device *dev) -diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c -index fdf10318758b4..5715b9ab2712e 100644 ---- a/drivers/net/ethernet/cortina/gemini.c -+++ b/drivers/net/ethernet/cortina/gemini.c -@@ -1919,7 +1919,7 @@ static void gmac_get_stats64(struct net_device *netdev, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/cortina/gemini.c linux-6.1.2/drivers/net/ethernet/cortina/gemini.c +--- linux-6.1.2.orig/drivers/net/ethernet/cortina/gemini.c 2022-12-31 16:12:07.242581072 -0500 ++++ linux-6.1.2/drivers/net/ethernet/cortina/gemini.c 2022-12-31 16:12:36.266153642 -0500 +@@ -1919,7 +1919,7 @@ static void gmac_get_stats64(struct net_ /* Racing with RX NAPI */ do { @@ -1227,7 +1187,7 @@ index fdf10318758b4..5715b9ab2712e 100644 stats->rx_packets = port->stats.rx_packets; stats->rx_bytes = port->stats.rx_bytes; -@@ -1931,11 +1931,11 @@ static void gmac_get_stats64(struct net_device *netdev, +@@ -1931,11 +1931,11 @@ static void gmac_get_stats64(struct net_ stats->rx_crc_errors = port->stats.rx_crc_errors; stats->rx_frame_errors = port->stats.rx_frame_errors; @@ -1241,7 +1201,7 @@ index fdf10318758b4..5715b9ab2712e 100644 stats->tx_errors = port->stats.tx_errors; stats->tx_packets = port->stats.tx_packets; -@@ -1945,15 +1945,15 @@ static void gmac_get_stats64(struct net_device *netdev, +@@ -1945,15 +1945,15 @@ static void gmac_get_stats64(struct net_ stats->rx_missed_errors = port->stats.rx_missed_errors; stats->rx_fifo_errors = port->stats.rx_fifo_errors; @@ -1260,7 +1220,7 @@ index fdf10318758b4..5715b9ab2712e 100644 stats->rx_dropped += stats->rx_missed_errors; } -@@ -2031,18 +2031,18 @@ static void gmac_get_ethtool_stats(struct net_device *netdev, +@@ -2031,18 +2031,18 @@ static void gmac_get_ethtool_stats(struc /* Racing with MIB interrupt */ do { p = values; @@ -1282,7 +1242,7 @@ index fdf10318758b4..5715b9ab2712e 100644 for (i = 0; i < RX_STATUS_NUM; i++) *p++ = port->rx_stats[i]; -@@ -2050,13 +2050,13 @@ static void gmac_get_ethtool_stats(struct net_device *netdev, +@@ -2050,13 +2050,13 @@ static void gmac_get_ethtool_stats(struc *p++ = port->rx_csum_stats[i]; *p++ = port->rx_napi_exits; @@ -1298,7 +1258,7 @@ index fdf10318758b4..5715b9ab2712e 100644 for (i = 0; i < TX_MAX_FRAGS; i++) { *values++ = port->tx_frag_stats[i]; -@@ -2065,7 +2065,7 @@ static void gmac_get_ethtool_stats(struct net_device *netdev, +@@ -2065,7 +2065,7 @@ static void gmac_get_ethtool_stats(struc *values++ = port->tx_frags_linearized; *values++ = port->tx_hw_csummed; @@ -1307,11 +1267,10 @@ index fdf10318758b4..5715b9ab2712e 100644 } static int gmac_get_ksettings(struct net_device *netdev, -diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c -index 77edc3d9b5057..a29de29bdf231 100644 ---- a/drivers/net/ethernet/emulex/benet/be_ethtool.c -+++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c -@@ -389,10 +389,10 @@ static void be_get_ethtool_stats(struct net_device *netdev, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/emulex/benet/be_ethtool.c linux-6.1.2/drivers/net/ethernet/emulex/benet/be_ethtool.c +--- linux-6.1.2.orig/drivers/net/ethernet/emulex/benet/be_ethtool.c 2022-12-31 16:12:07.246581013 -0500 ++++ linux-6.1.2/drivers/net/ethernet/emulex/benet/be_ethtool.c 2022-12-31 16:12:36.266153642 -0500 +@@ -389,10 +389,10 @@ static void be_get_ethtool_stats(struct struct be_rx_stats *stats = rx_stats(rxo); do { @@ -1324,7 +1283,7 @@ index 77edc3d9b5057..a29de29bdf231 100644 for (i = 2; i < ETHTOOL_RXSTATS_NUM; i++) { p = (u8 *)stats + et_rx_stats[i].offset; -@@ -405,19 +405,19 @@ static void be_get_ethtool_stats(struct net_device *netdev, +@@ -405,19 +405,19 @@ static void be_get_ethtool_stats(struct struct be_tx_stats *stats = tx_stats(txo); do { @@ -1348,11 +1307,10 @@ index 77edc3d9b5057..a29de29bdf231 100644 base += ETHTOOL_TXSTATS_NUM; } } -diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c -index a92a747615466..46fe3d74e2e98 100644 ---- a/drivers/net/ethernet/emulex/benet/be_main.c -+++ b/drivers/net/ethernet/emulex/benet/be_main.c -@@ -665,10 +665,10 @@ static void be_get_stats64(struct net_device *netdev, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/emulex/benet/be_main.c linux-6.1.2/drivers/net/ethernet/emulex/benet/be_main.c +--- linux-6.1.2.orig/drivers/net/ethernet/emulex/benet/be_main.c 2022-12-31 16:12:07.246581013 -0500 ++++ linux-6.1.2/drivers/net/ethernet/emulex/benet/be_main.c 2022-12-31 16:12:36.266153642 -0500 +@@ -665,10 +665,10 @@ static void be_get_stats64(struct net_de const struct be_rx_stats *rx_stats = rx_stats(rxo); do { @@ -1365,7 +1323,7 @@ index a92a747615466..46fe3d74e2e98 100644 stats->rx_packets += pkts; stats->rx_bytes += bytes; stats->multicast += rx_stats(rxo)->rx_mcast_pkts; -@@ -680,10 +680,10 @@ static void be_get_stats64(struct net_device *netdev, +@@ -680,10 +680,10 @@ static void be_get_stats64(struct net_de const struct be_tx_stats *tx_stats = tx_stats(txo); do { @@ -1378,7 +1336,7 @@ index a92a747615466..46fe3d74e2e98 100644 stats->tx_packets += pkts; stats->tx_bytes += bytes; } -@@ -2155,16 +2155,16 @@ static int be_get_new_eqd(struct be_eq_obj *eqo) +@@ -2155,16 +2155,16 @@ static int be_get_new_eqd(struct be_eq_o for_all_rx_queues_on_eq(adapter, eqo, rxo, i) { do { @@ -1399,10 +1357,9 @@ index a92a747615466..46fe3d74e2e98 100644 } /* Skip, if wrapped around or first calculation */ -diff --git a/drivers/net/ethernet/fungible/funeth/funeth_txrx.h b/drivers/net/ethernet/fungible/funeth/funeth_txrx.h -index 671f51135c269..53b7e95213a85 100644 ---- a/drivers/net/ethernet/fungible/funeth/funeth_txrx.h -+++ b/drivers/net/ethernet/fungible/funeth/funeth_txrx.h +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/fungible/funeth/funeth_txrx.h linux-6.1.2/drivers/net/ethernet/fungible/funeth/funeth_txrx.h +--- linux-6.1.2.orig/drivers/net/ethernet/fungible/funeth/funeth_txrx.h 2022-12-31 16:12:07.250580952 -0500 ++++ linux-6.1.2/drivers/net/ethernet/fungible/funeth/funeth_txrx.h 2022-12-31 16:12:36.266153642 -0500 @@ -206,9 +206,9 @@ struct funeth_rxq { #define FUN_QSTAT_READ(q, seq, stats_copy) \ @@ -1415,11 +1372,10 @@ index 671f51135c269..53b7e95213a85 100644 #define FUN_INT_NAME_LEN (IFNAMSIZ + 16) -diff --git a/drivers/net/ethernet/google/gve/gve_ethtool.c b/drivers/net/ethernet/google/gve/gve_ethtool.c -index 7b9a2d9d96243..50b384910c839 100644 ---- a/drivers/net/ethernet/google/gve/gve_ethtool.c -+++ b/drivers/net/ethernet/google/gve/gve_ethtool.c -@@ -177,14 +177,14 @@ gve_get_ethtool_stats(struct net_device *netdev, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/google/gve/gve_ethtool.c linux-6.1.2/drivers/net/ethernet/google/gve/gve_ethtool.c +--- linux-6.1.2.orig/drivers/net/ethernet/google/gve/gve_ethtool.c 2022-12-31 16:12:07.250580952 -0500 ++++ linux-6.1.2/drivers/net/ethernet/google/gve/gve_ethtool.c 2022-12-31 16:12:36.266153642 -0500 +@@ -177,14 +177,14 @@ gve_get_ethtool_stats(struct net_device struct gve_rx_ring *rx = &priv->rx[ring]; start = @@ -1436,7 +1392,7 @@ index 7b9a2d9d96243..50b384910c839 100644 start)); rx_pkts += tmp_rx_pkts; rx_bytes += tmp_rx_bytes; -@@ -198,10 +198,10 @@ gve_get_ethtool_stats(struct net_device *netdev, +@@ -198,10 +198,10 @@ gve_get_ethtool_stats(struct net_device if (priv->tx) { do { start = @@ -1449,7 +1405,7 @@ index 7b9a2d9d96243..50b384910c839 100644 start)); tx_pkts += tmp_tx_pkts; tx_bytes += tmp_tx_bytes; -@@ -259,13 +259,13 @@ gve_get_ethtool_stats(struct net_device *netdev, +@@ -259,13 +259,13 @@ gve_get_ethtool_stats(struct net_device data[i++] = rx->fill_cnt - rx->cnt; do { start = @@ -1465,7 +1421,7 @@ index 7b9a2d9d96243..50b384910c839 100644 start)); data[i++] = tmp_rx_bytes; data[i++] = rx->rx_cont_packet_cnt; -@@ -331,9 +331,9 @@ gve_get_ethtool_stats(struct net_device *netdev, +@@ -331,9 +331,9 @@ gve_get_ethtool_stats(struct net_device } do { start = @@ -1477,11 +1433,10 @@ index 7b9a2d9d96243..50b384910c839 100644 start)); data[i++] = tmp_tx_bytes; data[i++] = tx->wake_queue; -diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c -index d3e3ac242bfc3..5a229a01f49d0 100644 ---- a/drivers/net/ethernet/google/gve/gve_main.c -+++ b/drivers/net/ethernet/google/gve/gve_main.c -@@ -51,10 +51,10 @@ static void gve_get_stats(struct net_device *dev, struct rtnl_link_stats64 *s) +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/google/gve/gve_main.c linux-6.1.2/drivers/net/ethernet/google/gve/gve_main.c +--- linux-6.1.2.orig/drivers/net/ethernet/google/gve/gve_main.c 2022-12-31 16:12:07.250580952 -0500 ++++ linux-6.1.2/drivers/net/ethernet/google/gve/gve_main.c 2022-12-31 16:12:36.266153642 -0500 +@@ -51,10 +51,10 @@ static void gve_get_stats(struct net_dev for (ring = 0; ring < priv->rx_cfg.num_queues; ring++) { do { start = @@ -1494,7 +1449,7 @@ index d3e3ac242bfc3..5a229a01f49d0 100644 start)); s->rx_packets += packets; s->rx_bytes += bytes; -@@ -64,10 +64,10 @@ static void gve_get_stats(struct net_device *dev, struct rtnl_link_stats64 *s) +@@ -64,10 +64,10 @@ static void gve_get_stats(struct net_dev for (ring = 0; ring < priv->tx_cfg.num_queues; ring++) { do { start = @@ -1507,7 +1462,7 @@ index d3e3ac242bfc3..5a229a01f49d0 100644 start)); s->tx_packets += packets; s->tx_bytes += bytes; -@@ -1273,9 +1273,9 @@ void gve_handle_report_stats(struct gve_priv *priv) +@@ -1273,9 +1273,9 @@ void gve_handle_report_stats(struct gve_ } do { @@ -1519,11 +1474,10 @@ index d3e3ac242bfc3..5a229a01f49d0 100644 stats[stats_idx++] = (struct stats) { .stat_name = cpu_to_be32(TX_WAKE_CNT), .value = cpu_to_be64(priv->tx[idx].wake_queue), -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c -index 028577943ec57..0ec5730b17886 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c -@@ -2488,7 +2488,7 @@ static void hns3_fetch_stats(struct rtnl_link_stats64 *stats, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c linux-6.1.2/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +--- linux-6.1.2.orig/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c 2022-12-31 16:12:07.254580892 -0500 ++++ linux-6.1.2/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c 2022-12-31 16:12:36.266153642 -0500 +@@ -2488,7 +2488,7 @@ static void hns3_fetch_stats(struct rtnl unsigned int start; do { @@ -1532,7 +1486,7 @@ index 028577943ec57..0ec5730b17886 100644 if (is_tx) { stats->tx_bytes += ring->stats.tx_bytes; stats->tx_packets += ring->stats.tx_pkts; -@@ -2522,7 +2522,7 @@ static void hns3_fetch_stats(struct rtnl_link_stats64 *stats, +@@ -2522,7 +2522,7 @@ static void hns3_fetch_stats(struct rtnl stats->multicast += ring->stats.rx_multicast; stats->rx_length_errors += ring->stats.err_pkt_len; } @@ -1541,11 +1495,10 @@ index 028577943ec57..0ec5730b17886 100644 } static void hns3_nic_get_stats64(struct net_device *netdev, -diff --git a/drivers/net/ethernet/huawei/hinic/hinic_rx.c b/drivers/net/ethernet/huawei/hinic/hinic_rx.c -index d649c6e323c87..ceec8be2a73b4 100644 ---- a/drivers/net/ethernet/huawei/hinic/hinic_rx.c -+++ b/drivers/net/ethernet/huawei/hinic/hinic_rx.c -@@ -74,14 +74,14 @@ void hinic_rxq_get_stats(struct hinic_rxq *rxq, struct hinic_rxq_stats *stats) +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/huawei/hinic/hinic_rx.c linux-6.1.2/drivers/net/ethernet/huawei/hinic/hinic_rx.c +--- linux-6.1.2.orig/drivers/net/ethernet/huawei/hinic/hinic_rx.c 2022-12-31 16:12:07.254580892 -0500 ++++ linux-6.1.2/drivers/net/ethernet/huawei/hinic/hinic_rx.c 2022-12-31 16:12:36.266153642 -0500 +@@ -74,14 +74,14 @@ void hinic_rxq_get_stats(struct hinic_rx unsigned int start; do { @@ -1562,11 +1515,10 @@ index d649c6e323c87..ceec8be2a73b4 100644 } /** -diff --git a/drivers/net/ethernet/huawei/hinic/hinic_tx.c b/drivers/net/ethernet/huawei/hinic/hinic_tx.c -index e91476c8ff8b0..ad47ac51a139c 100644 ---- a/drivers/net/ethernet/huawei/hinic/hinic_tx.c -+++ b/drivers/net/ethernet/huawei/hinic/hinic_tx.c -@@ -99,14 +99,14 @@ void hinic_txq_get_stats(struct hinic_txq *txq, struct hinic_txq_stats *stats) +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/huawei/hinic/hinic_tx.c linux-6.1.2/drivers/net/ethernet/huawei/hinic/hinic_tx.c +--- linux-6.1.2.orig/drivers/net/ethernet/huawei/hinic/hinic_tx.c 2022-12-31 16:12:07.254580892 -0500 ++++ linux-6.1.2/drivers/net/ethernet/huawei/hinic/hinic_tx.c 2022-12-31 16:12:36.266153642 -0500 +@@ -99,14 +99,14 @@ void hinic_txq_get_stats(struct hinic_tx unsigned int start; do { @@ -1583,11 +1535,10 @@ index e91476c8ff8b0..ad47ac51a139c 100644 } /** -diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c -index 2cca9e84e31e1..34ab5ff9823b7 100644 ---- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c -+++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c -@@ -1229,10 +1229,10 @@ static void fm10k_get_stats64(struct net_device *netdev, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c linux-6.1.2/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +--- linux-6.1.2.orig/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c 2022-12-31 16:12:07.258580832 -0500 ++++ linux-6.1.2/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c 2022-12-31 16:12:36.266153642 -0500 +@@ -1229,10 +1229,10 @@ static void fm10k_get_stats64(struct net continue; do { @@ -1600,7 +1551,7 @@ index 2cca9e84e31e1..34ab5ff9823b7 100644 stats->rx_packets += packets; stats->rx_bytes += bytes; -@@ -1245,10 +1245,10 @@ static void fm10k_get_stats64(struct net_device *netdev, +@@ -1245,10 +1245,10 @@ static void fm10k_get_stats64(struct net continue; do { @@ -1613,11 +1564,10 @@ index 2cca9e84e31e1..34ab5ff9823b7 100644 stats->tx_packets += packets; stats->tx_bytes += bytes; -diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c -index 4a6a6e48c615b..cc269f9db99f3 100644 ---- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c -+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c -@@ -154,7 +154,7 @@ __i40e_add_ethtool_stats(u64 **data, void *pointer, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/intel/i40e/i40e_ethtool.c linux-6.1.2/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +--- linux-6.1.2.orig/drivers/net/ethernet/intel/i40e/i40e_ethtool.c 2022-12-31 16:12:07.262580772 -0500 ++++ linux-6.1.2/drivers/net/ethernet/intel/i40e/i40e_ethtool.c 2022-12-31 16:12:36.266153642 -0500 +@@ -154,7 +154,7 @@ __i40e_add_ethtool_stats(u64 **data, voi * @ring: the ring to copy * * Queue statistics must be copied while protected by @@ -1626,7 +1576,7 @@ index 4a6a6e48c615b..cc269f9db99f3 100644 * Assumes that queue stats are defined in i40e_gstrings_queue_stats. If the * ring pointer is null, zero out the queue stat values and update the data * pointer. Otherwise safely copy the stats from the ring into the supplied -@@ -172,16 +172,16 @@ i40e_add_queue_stats(u64 **data, struct i40e_ring *ring) +@@ -172,16 +172,16 @@ i40e_add_queue_stats(u64 **data, struct /* To avoid invalid statistics values, ensure that we keep retrying * the copy until we get a consistent value according to @@ -1646,11 +1596,10 @@ index 4a6a6e48c615b..cc269f9db99f3 100644 /* Once we successfully copy the stats in, update the data pointer */ *data += size; -diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c -index b5dcd15ced364..1a1fab94205df 100644 ---- a/drivers/net/ethernet/intel/i40e/i40e_main.c -+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c -@@ -419,10 +419,10 @@ static void i40e_get_netdev_stats_struct_tx(struct i40e_ring *ring, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/intel/i40e/i40e_main.c linux-6.1.2/drivers/net/ethernet/intel/i40e/i40e_main.c +--- linux-6.1.2.orig/drivers/net/ethernet/intel/i40e/i40e_main.c 2022-12-31 16:12:07.262580772 -0500 ++++ linux-6.1.2/drivers/net/ethernet/intel/i40e/i40e_main.c 2022-12-31 16:12:36.270153584 -0500 +@@ -419,10 +419,10 @@ static void i40e_get_netdev_stats_struct unsigned int start; do { @@ -1663,7 +1612,7 @@ index b5dcd15ced364..1a1fab94205df 100644 stats->tx_packets += packets; stats->tx_bytes += bytes; -@@ -472,10 +472,10 @@ static void i40e_get_netdev_stats_struct(struct net_device *netdev, +@@ -472,10 +472,10 @@ static void i40e_get_netdev_stats_struct if (!ring) continue; do { @@ -1676,7 +1625,7 @@ index b5dcd15ced364..1a1fab94205df 100644 stats->rx_packets += packets; stats->rx_bytes += bytes; -@@ -897,10 +897,10 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) +@@ -897,10 +897,10 @@ static void i40e_update_vsi_stats(struct continue; do { @@ -1689,7 +1638,7 @@ index b5dcd15ced364..1a1fab94205df 100644 tx_b += bytes; tx_p += packets; tx_restart += p->tx_stats.restart_queue; -@@ -915,10 +915,10 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) +@@ -915,10 +915,10 @@ static void i40e_update_vsi_stats(struct continue; do { @@ -1702,7 +1651,7 @@ index b5dcd15ced364..1a1fab94205df 100644 rx_b += bytes; rx_p += packets; rx_buf += p->rx_stats.alloc_buff_failed; -@@ -935,10 +935,10 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) +@@ -935,10 +935,10 @@ static void i40e_update_vsi_stats(struct continue; do { @@ -1715,11 +1664,10 @@ index b5dcd15ced364..1a1fab94205df 100644 tx_b += bytes; tx_p += packets; tx_restart += p->tx_stats.restart_queue; -diff --git a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c -index a056e15456153..d79ead5e8d0ca 100644 ---- a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c -+++ b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c -@@ -147,7 +147,7 @@ __iavf_add_ethtool_stats(u64 **data, void *pointer, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/intel/iavf/iavf_ethtool.c linux-6.1.2/drivers/net/ethernet/intel/iavf/iavf_ethtool.c +--- linux-6.1.2.orig/drivers/net/ethernet/intel/iavf/iavf_ethtool.c 2022-12-31 16:12:07.262580772 -0500 ++++ linux-6.1.2/drivers/net/ethernet/intel/iavf/iavf_ethtool.c 2022-12-31 16:12:36.270153584 -0500 +@@ -147,7 +147,7 @@ __iavf_add_ethtool_stats(u64 **data, voi * @ring: the ring to copy * * Queue statistics must be copied while protected by @@ -1728,7 +1676,7 @@ index a056e15456153..d79ead5e8d0ca 100644 * Assumes that queue stats are defined in iavf_gstrings_queue_stats. If the * ring pointer is null, zero out the queue stat values and update the data * pointer. Otherwise safely copy the stats from the ring into the supplied -@@ -165,14 +165,14 @@ iavf_add_queue_stats(u64 **data, struct iavf_ring *ring) +@@ -165,14 +165,14 @@ iavf_add_queue_stats(u64 **data, struct /* To avoid invalid statistics values, ensure that we keep retrying * the copy until we get a consistent value according to @@ -1746,11 +1694,10 @@ index a056e15456153..d79ead5e8d0ca 100644 /* Once we successfully copy the stats in, update the data pointer */ *data += size; -diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c -index ca2898467dcb5..4b41e0c78b7ed 100644 ---- a/drivers/net/ethernet/intel/ice/ice_main.c -+++ b/drivers/net/ethernet/intel/ice/ice_main.c -@@ -6370,10 +6370,10 @@ ice_fetch_u64_stats_per_ring(struct u64_stats_sync *syncp, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/intel/ice/ice_main.c linux-6.1.2/drivers/net/ethernet/intel/ice/ice_main.c +--- linux-6.1.2.orig/drivers/net/ethernet/intel/ice/ice_main.c 2022-12-31 16:12:07.266580712 -0500 ++++ linux-6.1.2/drivers/net/ethernet/intel/ice/ice_main.c 2022-12-31 16:12:36.270153584 -0500 +@@ -6370,10 +6370,10 @@ ice_fetch_u64_stats_per_ring(struct u64_ unsigned int start; do { @@ -1763,11 +1710,10 @@ index ca2898467dcb5..4b41e0c78b7ed 100644 } /** -diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c -index e5f3e7680dc66..36acec89d3d49 100644 ---- a/drivers/net/ethernet/intel/igb/igb_ethtool.c -+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c -@@ -2311,15 +2311,15 @@ static void igb_get_ethtool_stats(struct net_device *netdev, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/intel/igb/igb_ethtool.c linux-6.1.2/drivers/net/ethernet/intel/igb/igb_ethtool.c +--- linux-6.1.2.orig/drivers/net/ethernet/intel/igb/igb_ethtool.c 2022-12-31 16:12:07.266580712 -0500 ++++ linux-6.1.2/drivers/net/ethernet/intel/igb/igb_ethtool.c 2022-12-31 16:12:36.270153584 -0500 +@@ -2313,15 +2313,15 @@ static void igb_get_ethtool_stats(struct ring = adapter->tx_ring[j]; do { @@ -1787,7 +1733,7 @@ index e5f3e7680dc66..36acec89d3d49 100644 data[i+2] += restart2; i += IGB_TX_QUEUE_STATS_LEN; -@@ -2327,13 +2327,13 @@ static void igb_get_ethtool_stats(struct net_device *netdev, +@@ -2329,13 +2329,13 @@ static void igb_get_ethtool_stats(struct for (j = 0; j < adapter->num_rx_queues; j++) { ring = adapter->rx_ring[j]; do { @@ -1803,11 +1749,10 @@ index e5f3e7680dc66..36acec89d3d49 100644 i += IGB_RX_QUEUE_STATS_LEN; } spin_unlock(&adapter->stats64_lock); -diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c -index f8e32833226c1..d6c1c2e66f261 100644 ---- a/drivers/net/ethernet/intel/igb/igb_main.c -+++ b/drivers/net/ethernet/intel/igb/igb_main.c -@@ -6632,10 +6632,10 @@ void igb_update_stats(struct igb_adapter *adapter) +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/intel/igb/igb_main.c linux-6.1.2/drivers/net/ethernet/intel/igb/igb_main.c +--- linux-6.1.2.orig/drivers/net/ethernet/intel/igb/igb_main.c 2022-12-31 16:12:07.266580712 -0500 ++++ linux-6.1.2/drivers/net/ethernet/intel/igb/igb_main.c 2022-12-31 16:12:36.270153584 -0500 +@@ -6636,10 +6636,10 @@ void igb_update_stats(struct igb_adapter } do { @@ -1820,7 +1765,7 @@ index f8e32833226c1..d6c1c2e66f261 100644 bytes += _bytes; packets += _packets; } -@@ -6648,10 +6648,10 @@ void igb_update_stats(struct igb_adapter *adapter) +@@ -6652,10 +6652,10 @@ void igb_update_stats(struct igb_adapter for (i = 0; i < adapter->num_tx_queues; i++) { struct igb_ring *ring = adapter->tx_ring[i]; do { @@ -1833,11 +1778,10 @@ index f8e32833226c1..d6c1c2e66f261 100644 bytes += _bytes; packets += _packets; } -diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c -index 8cc077b712add..5a26a7805ef80 100644 ---- a/drivers/net/ethernet/intel/igc/igc_ethtool.c -+++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c -@@ -839,15 +839,15 @@ static void igc_ethtool_get_stats(struct net_device *netdev, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/intel/igc/igc_ethtool.c linux-6.1.2/drivers/net/ethernet/intel/igc/igc_ethtool.c +--- linux-6.1.2.orig/drivers/net/ethernet/intel/igc/igc_ethtool.c 2022-12-31 16:12:07.270580652 -0500 ++++ linux-6.1.2/drivers/net/ethernet/intel/igc/igc_ethtool.c 2022-12-31 16:12:36.270153584 -0500 +@@ -839,15 +839,15 @@ static void igc_ethtool_get_stats(struct ring = adapter->tx_ring[j]; do { @@ -1857,7 +1801,7 @@ index 8cc077b712add..5a26a7805ef80 100644 data[i + 2] += restart2; i += IGC_TX_QUEUE_STATS_LEN; -@@ -855,13 +855,13 @@ static void igc_ethtool_get_stats(struct net_device *netdev, +@@ -855,13 +855,13 @@ static void igc_ethtool_get_stats(struct for (j = 0; j < adapter->num_rx_queues; j++) { ring = adapter->rx_ring[j]; do { @@ -1873,11 +1817,10 @@ index 8cc077b712add..5a26a7805ef80 100644 i += IGC_RX_QUEUE_STATS_LEN; } spin_unlock(&adapter->stats64_lock); -diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c -index 34889be63e788..5d307b6e660ba 100644 ---- a/drivers/net/ethernet/intel/igc/igc_main.c -+++ b/drivers/net/ethernet/intel/igc/igc_main.c -@@ -4682,10 +4682,10 @@ void igc_update_stats(struct igc_adapter *adapter) +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/intel/igc/igc_main.c linux-6.1.2/drivers/net/ethernet/intel/igc/igc_main.c +--- linux-6.1.2.orig/drivers/net/ethernet/intel/igc/igc_main.c 2022-12-31 16:12:07.270580652 -0500 ++++ linux-6.1.2/drivers/net/ethernet/intel/igc/igc_main.c 2022-12-31 16:12:36.270153584 -0500 +@@ -4800,10 +4800,10 @@ void igc_update_stats(struct igc_adapter } do { @@ -1890,7 +1833,7 @@ index 34889be63e788..5d307b6e660ba 100644 bytes += _bytes; packets += _packets; } -@@ -4699,10 +4699,10 @@ void igc_update_stats(struct igc_adapter *adapter) +@@ -4817,10 +4817,10 @@ void igc_update_stats(struct igc_adapter struct igc_ring *ring = adapter->tx_ring[i]; do { @@ -1903,11 +1846,10 @@ index 34889be63e788..5d307b6e660ba 100644 bytes += _bytes; packets += _packets; } -diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c -index e88e3dfac8c21..eda7188e8df44 100644 ---- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c -+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c -@@ -1335,10 +1335,10 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c linux-6.1.2/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +--- linux-6.1.2.orig/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c 2022-12-31 16:12:07.270580652 -0500 ++++ linux-6.1.2/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c 2022-12-31 16:12:36.274153526 -0500 +@@ -1335,10 +1335,10 @@ static void ixgbe_get_ethtool_stats(stru } do { @@ -1920,7 +1862,7 @@ index e88e3dfac8c21..eda7188e8df44 100644 i += 2; } for (j = 0; j < IXGBE_NUM_RX_QUEUES; j++) { -@@ -1351,10 +1351,10 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev, +@@ -1351,10 +1351,10 @@ static void ixgbe_get_ethtool_stats(stru } do { @@ -1933,11 +1875,10 @@ index e88e3dfac8c21..eda7188e8df44 100644 i += 2; } -diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c -index 298cfbfcb7b6f..ab8370c413f3f 100644 ---- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c -+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c -@@ -9041,10 +9041,10 @@ static void ixgbe_get_ring_stats64(struct rtnl_link_stats64 *stats, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c linux-6.1.2/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +--- linux-6.1.2.orig/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c 2022-12-31 16:12:07.270580652 -0500 ++++ linux-6.1.2/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c 2022-12-31 16:12:36.274153526 -0500 +@@ -9041,10 +9041,10 @@ static void ixgbe_get_ring_stats64(struc if (ring) { do { @@ -1950,7 +1891,7 @@ index 298cfbfcb7b6f..ab8370c413f3f 100644 stats->tx_packets += packets; stats->tx_bytes += bytes; } -@@ -9064,10 +9064,10 @@ static void ixgbe_get_stats64(struct net_device *netdev, +@@ -9064,10 +9064,10 @@ static void ixgbe_get_stats64(struct net if (ring) { do { @@ -1963,11 +1904,10 @@ index 298cfbfcb7b6f..ab8370c413f3f 100644 stats->rx_packets += packets; stats->rx_bytes += bytes; } -diff --git a/drivers/net/ethernet/intel/ixgbevf/ethtool.c b/drivers/net/ethernet/intel/ixgbevf/ethtool.c -index ccfa6b91aac63..296915414a7cf 100644 ---- a/drivers/net/ethernet/intel/ixgbevf/ethtool.c -+++ b/drivers/net/ethernet/intel/ixgbevf/ethtool.c -@@ -458,10 +458,10 @@ static void ixgbevf_get_ethtool_stats(struct net_device *netdev, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/intel/ixgbevf/ethtool.c linux-6.1.2/drivers/net/ethernet/intel/ixgbevf/ethtool.c +--- linux-6.1.2.orig/drivers/net/ethernet/intel/ixgbevf/ethtool.c 2022-12-31 16:12:07.270580652 -0500 ++++ linux-6.1.2/drivers/net/ethernet/intel/ixgbevf/ethtool.c 2022-12-31 16:12:36.274153526 -0500 +@@ -458,10 +458,10 @@ static void ixgbevf_get_ethtool_stats(st } do { @@ -1980,7 +1920,7 @@ index ccfa6b91aac63..296915414a7cf 100644 i += 2; } -@@ -475,10 +475,10 @@ static void ixgbevf_get_ethtool_stats(struct net_device *netdev, +@@ -475,10 +475,10 @@ static void ixgbevf_get_ethtool_stats(st } do { @@ -1993,7 +1933,7 @@ index ccfa6b91aac63..296915414a7cf 100644 i += 2; } -@@ -492,10 +492,10 @@ static void ixgbevf_get_ethtool_stats(struct net_device *netdev, +@@ -492,10 +492,10 @@ static void ixgbevf_get_ethtool_stats(st } do { @@ -2006,11 +1946,10 @@ index ccfa6b91aac63..296915414a7cf 100644 i += 2; } } -diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c -index 99933e89717ad..be733677bdc88 100644 ---- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c -+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c -@@ -4350,10 +4350,10 @@ static void ixgbevf_get_tx_ring_stats(struct rtnl_link_stats64 *stats, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c linux-6.1.2/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +--- linux-6.1.2.orig/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c 2022-12-31 16:12:07.270580652 -0500 ++++ linux-6.1.2/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c 2022-12-31 16:12:36.274153526 -0500 +@@ -4350,10 +4350,10 @@ static void ixgbevf_get_tx_ring_stats(st if (ring) { do { @@ -2023,7 +1962,7 @@ index 99933e89717ad..be733677bdc88 100644 stats->tx_bytes += bytes; stats->tx_packets += packets; } -@@ -4376,10 +4376,10 @@ static void ixgbevf_get_stats(struct net_device *netdev, +@@ -4376,10 +4376,10 @@ static void ixgbevf_get_stats(struct net for (i = 0; i < adapter->num_rx_queues; i++) { ring = adapter->rx_ring[i]; do { @@ -2036,11 +1975,10 @@ index 99933e89717ad..be733677bdc88 100644 stats->rx_bytes += bytes; stats->rx_packets += packets; } -diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c -index ff3e361e06e78..81dc57a69fd0a 100644 ---- a/drivers/net/ethernet/marvell/mvneta.c -+++ b/drivers/net/ethernet/marvell/mvneta.c -@@ -813,14 +813,14 @@ mvneta_get_stats64(struct net_device *dev, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/marvell/mvneta.c linux-6.1.2/drivers/net/ethernet/marvell/mvneta.c +--- linux-6.1.2.orig/drivers/net/ethernet/marvell/mvneta.c 2022-12-31 16:12:07.274580592 -0500 ++++ linux-6.1.2/drivers/net/ethernet/marvell/mvneta.c 2022-12-31 16:12:36.274153526 -0500 +@@ -813,14 +813,14 @@ mvneta_get_stats64(struct net_device *de cpu_stats = per_cpu_ptr(pp->stats, cpu); do { @@ -2057,7 +1995,7 @@ index ff3e361e06e78..81dc57a69fd0a 100644 stats->rx_packets += rx_packets; stats->rx_bytes += rx_bytes; -@@ -4762,7 +4762,7 @@ mvneta_ethtool_update_pcpu_stats(struct mvneta_port *pp, +@@ -4762,7 +4762,7 @@ mvneta_ethtool_update_pcpu_stats(struct stats = per_cpu_ptr(pp->stats, cpu); do { @@ -2066,7 +2004,7 @@ index ff3e361e06e78..81dc57a69fd0a 100644 skb_alloc_error = stats->es.skb_alloc_error; refill_error = stats->es.refill_error; xdp_redirect = stats->es.ps.xdp_redirect; -@@ -4772,7 +4772,7 @@ mvneta_ethtool_update_pcpu_stats(struct mvneta_port *pp, +@@ -4772,7 +4772,7 @@ mvneta_ethtool_update_pcpu_stats(struct xdp_xmit_err = stats->es.ps.xdp_xmit_err; xdp_tx = stats->es.ps.xdp_tx; xdp_tx_err = stats->es.ps.xdp_tx_err; @@ -2075,11 +2013,10 @@ index ff3e361e06e78..81dc57a69fd0a 100644 es->skb_alloc_error += skb_alloc_error; es->refill_error += refill_error; -diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c -index b399bdb1ca362..6d4c778b10fbb 100644 ---- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c -+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c -@@ -2008,7 +2008,7 @@ mvpp2_get_xdp_stats(struct mvpp2_port *port, struct mvpp2_pcpu_stats *xdp_stats) +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c linux-6.1.2/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +--- linux-6.1.2.orig/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c 2022-12-31 16:12:07.274580592 -0500 ++++ linux-6.1.2/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c 2022-12-31 16:12:36.274153526 -0500 +@@ -2008,7 +2008,7 @@ mvpp2_get_xdp_stats(struct mvpp2_port *p cpu_stats = per_cpu_ptr(port->stats, cpu); do { @@ -2088,7 +2025,7 @@ index b399bdb1ca362..6d4c778b10fbb 100644 xdp_redirect = cpu_stats->xdp_redirect; xdp_pass = cpu_stats->xdp_pass; xdp_drop = cpu_stats->xdp_drop; -@@ -2016,7 +2016,7 @@ mvpp2_get_xdp_stats(struct mvpp2_port *port, struct mvpp2_pcpu_stats *xdp_stats) +@@ -2016,7 +2016,7 @@ mvpp2_get_xdp_stats(struct mvpp2_port *p xdp_xmit_err = cpu_stats->xdp_xmit_err; xdp_tx = cpu_stats->xdp_tx; xdp_tx_err = cpu_stats->xdp_tx_err; @@ -2097,7 +2034,7 @@ index b399bdb1ca362..6d4c778b10fbb 100644 xdp_stats->xdp_redirect += xdp_redirect; xdp_stats->xdp_pass += xdp_pass; -@@ -5115,12 +5115,12 @@ mvpp2_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) +@@ -5115,12 +5115,12 @@ mvpp2_get_stats64(struct net_device *dev cpu_stats = per_cpu_ptr(port->stats, cpu); do { @@ -2112,11 +2049,10 @@ index b399bdb1ca362..6d4c778b10fbb 100644 stats->rx_packets += rx_packets; stats->rx_bytes += rx_bytes; -diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c -index ab33ba1c3023c..ff97b140886ae 100644 ---- a/drivers/net/ethernet/marvell/sky2.c -+++ b/drivers/net/ethernet/marvell/sky2.c -@@ -3894,19 +3894,19 @@ static void sky2_get_stats(struct net_device *dev, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/marvell/sky2.c linux-6.1.2/drivers/net/ethernet/marvell/sky2.c +--- linux-6.1.2.orig/drivers/net/ethernet/marvell/sky2.c 2022-12-31 16:12:07.278580532 -0500 ++++ linux-6.1.2/drivers/net/ethernet/marvell/sky2.c 2022-12-31 16:12:36.274153526 -0500 +@@ -3894,19 +3894,19 @@ static void sky2_get_stats(struct net_de u64 _bytes, _packets; do { @@ -2140,11 +2076,10 @@ index ab33ba1c3023c..ff97b140886ae 100644 stats->tx_packets = _packets; stats->tx_bytes = _bytes; -diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -index 1d36619c5ec91..81349cf15ce0c 100644 ---- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c -+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -865,7 +865,7 @@ static void mtk_get_stats64(struct net_device *dev, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/mediatek/mtk_eth_soc.c linux-6.1.2/drivers/net/ethernet/mediatek/mtk_eth_soc.c +--- linux-6.1.2.orig/drivers/net/ethernet/mediatek/mtk_eth_soc.c 2022-12-31 16:12:07.278580532 -0500 ++++ linux-6.1.2/drivers/net/ethernet/mediatek/mtk_eth_soc.c 2022-12-31 16:12:36.274153526 -0500 +@@ -865,7 +865,7 @@ static void mtk_get_stats64(struct net_d } do { @@ -2153,7 +2088,7 @@ index 1d36619c5ec91..81349cf15ce0c 100644 storage->rx_packets = hw_stats->rx_packets; storage->tx_packets = hw_stats->tx_packets; storage->rx_bytes = hw_stats->rx_bytes; -@@ -877,7 +877,7 @@ static void mtk_get_stats64(struct net_device *dev, +@@ -877,7 +877,7 @@ static void mtk_get_stats64(struct net_d storage->rx_crc_errors = hw_stats->rx_fcs_errors; storage->rx_errors = hw_stats->rx_checksum_errors; storage->tx_aborted_errors = hw_stats->tx_skip; @@ -2162,7 +2097,7 @@ index 1d36619c5ec91..81349cf15ce0c 100644 storage->tx_errors = dev->stats.tx_errors; storage->rx_dropped = dev->stats.rx_dropped; -@@ -3688,13 +3688,13 @@ static void mtk_get_ethtool_stats(struct net_device *dev, +@@ -3707,13 +3707,13 @@ static void mtk_get_ethtool_stats(struct do { data_dst = data; @@ -2178,11 +2113,10 @@ index 1d36619c5ec91..81349cf15ce0c 100644 } static int mtk_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, -diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c -index 5bcf5bceff710..6ed496f6cbfb2 100644 ---- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c -+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c -@@ -827,12 +827,12 @@ mlxsw_sp_port_get_sw_stats64(const struct net_device *dev, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/mellanox/mlxsw/spectrum.c linux-6.1.2/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +--- linux-6.1.2.orig/drivers/net/ethernet/mellanox/mlxsw/spectrum.c 2022-12-31 16:12:07.294580292 -0500 ++++ linux-6.1.2/drivers/net/ethernet/mellanox/mlxsw/spectrum.c 2022-12-31 16:12:36.278153469 -0500 +@@ -827,12 +827,12 @@ mlxsw_sp_port_get_sw_stats64(const struc for_each_possible_cpu(i) { p = per_cpu_ptr(mlxsw_sp_port->pcpu_stats, i); do { @@ -2197,11 +2131,10 @@ index 5bcf5bceff710..6ed496f6cbfb2 100644 stats->rx_packets += rx_packets; stats->rx_bytes += rx_bytes; -diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c -index 9259a74eca40b..318dbbb482797 100644 ---- a/drivers/net/ethernet/microsoft/mana/mana_en.c -+++ b/drivers/net/ethernet/microsoft/mana/mana_en.c -@@ -315,10 +315,10 @@ static void mana_get_stats64(struct net_device *ndev, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/microsoft/mana/mana_en.c linux-6.1.2/drivers/net/ethernet/microsoft/mana/mana_en.c +--- linux-6.1.2.orig/drivers/net/ethernet/microsoft/mana/mana_en.c 2022-12-31 16:12:07.298580232 -0500 ++++ linux-6.1.2/drivers/net/ethernet/microsoft/mana/mana_en.c 2022-12-31 16:12:36.278153469 -0500 +@@ -315,10 +315,10 @@ static void mana_get_stats64(struct net_ rx_stats = &apc->rxqs[q]->stats; do { @@ -2214,7 +2147,7 @@ index 9259a74eca40b..318dbbb482797 100644 st->rx_packets += packets; st->rx_bytes += bytes; -@@ -328,10 +328,10 @@ static void mana_get_stats64(struct net_device *ndev, +@@ -328,10 +328,10 @@ static void mana_get_stats64(struct net_ tx_stats = &apc->tx_qp[q].txq.stats; do { @@ -2227,11 +2160,10 @@ index 9259a74eca40b..318dbbb482797 100644 st->tx_packets += packets; st->tx_bytes += bytes; -diff --git a/drivers/net/ethernet/microsoft/mana/mana_ethtool.c b/drivers/net/ethernet/microsoft/mana/mana_ethtool.c -index c530db76880f0..96d55c91c9698 100644 ---- a/drivers/net/ethernet/microsoft/mana/mana_ethtool.c -+++ b/drivers/net/ethernet/microsoft/mana/mana_ethtool.c -@@ -90,13 +90,13 @@ static void mana_get_ethtool_stats(struct net_device *ndev, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/microsoft/mana/mana_ethtool.c linux-6.1.2/drivers/net/ethernet/microsoft/mana/mana_ethtool.c +--- linux-6.1.2.orig/drivers/net/ethernet/microsoft/mana/mana_ethtool.c 2022-12-31 16:12:07.298580232 -0500 ++++ linux-6.1.2/drivers/net/ethernet/microsoft/mana/mana_ethtool.c 2022-12-31 16:12:36.278153469 -0500 +@@ -90,13 +90,13 @@ static void mana_get_ethtool_stats(struc rx_stats = &apc->rxqs[q]->stats; do { @@ -2247,7 +2179,7 @@ index c530db76880f0..96d55c91c9698 100644 data[i++] = packets; data[i++] = bytes; -@@ -109,11 +109,11 @@ static void mana_get_ethtool_stats(struct net_device *ndev, +@@ -109,11 +109,11 @@ static void mana_get_ethtool_stats(struc tx_stats = &apc->tx_qp[q].txq.stats; do { @@ -2261,11 +2193,10 @@ index c530db76880f0..96d55c91c9698 100644 data[i++] = packets; data[i++] = bytes; -diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c -index 27f4786ace4fb..a5ca5c4a7896f 100644 ---- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c -+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c -@@ -1631,21 +1631,21 @@ static void nfp_net_stat64(struct net_device *netdev, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/netronome/nfp/nfp_net_common.c linux-6.1.2/drivers/net/ethernet/netronome/nfp/nfp_net_common.c +--- linux-6.1.2.orig/drivers/net/ethernet/netronome/nfp/nfp_net_common.c 2022-12-31 16:12:07.302580173 -0500 ++++ linux-6.1.2/drivers/net/ethernet/netronome/nfp/nfp_net_common.c 2022-12-31 16:12:36.278153469 -0500 +@@ -1631,21 +1631,21 @@ static void nfp_net_stat64(struct net_de unsigned int start; do { @@ -2291,11 +2222,10 @@ index 27f4786ace4fb..a5ca5c4a7896f 100644 stats->tx_packets += data[0]; stats->tx_bytes += data[1]; stats->tx_errors += data[2]; -diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c -index 991059d6cb32e..e82ddb0677aa9 100644 ---- a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c -+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c -@@ -686,7 +686,7 @@ static u64 *nfp_vnic_get_sw_stats(struct net_device *netdev, u64 *data) +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c linux-6.1.2/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c +--- linux-6.1.2.orig/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c 2022-12-31 16:12:07.306580112 -0500 ++++ linux-6.1.2/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c 2022-12-31 16:12:36.278153469 -0500 +@@ -686,7 +686,7 @@ static u64 *nfp_vnic_get_sw_stats(struct unsigned int start; do { @@ -2304,7 +2234,7 @@ index 991059d6cb32e..e82ddb0677aa9 100644 data[0] = nn->r_vecs[i].rx_pkts; tmp[0] = nn->r_vecs[i].hw_csum_rx_ok; tmp[1] = nn->r_vecs[i].hw_csum_rx_inner_ok; -@@ -694,10 +694,10 @@ static u64 *nfp_vnic_get_sw_stats(struct net_device *netdev, u64 *data) +@@ -694,10 +694,10 @@ static u64 *nfp_vnic_get_sw_stats(struct tmp[3] = nn->r_vecs[i].hw_csum_rx_error; tmp[4] = nn->r_vecs[i].rx_replace_buf_alloc_fail; tmp[5] = nn->r_vecs[i].hw_tls_rx; @@ -2317,7 +2247,7 @@ index 991059d6cb32e..e82ddb0677aa9 100644 data[1] = nn->r_vecs[i].tx_pkts; data[2] = nn->r_vecs[i].tx_busy; tmp[6] = nn->r_vecs[i].hw_csum_tx; -@@ -707,7 +707,7 @@ static u64 *nfp_vnic_get_sw_stats(struct net_device *netdev, u64 *data) +@@ -707,7 +707,7 @@ static u64 *nfp_vnic_get_sw_stats(struct tmp[10] = nn->r_vecs[i].hw_tls_tx; tmp[11] = nn->r_vecs[i].tls_tx_fallback; tmp[12] = nn->r_vecs[i].tls_tx_no_fallback; @@ -2326,11 +2256,10 @@ index 991059d6cb32e..e82ddb0677aa9 100644 data += NN_RVEC_PER_Q_STATS; -diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c -index 8b77582bdfa01..a6b6ca1fd55ee 100644 ---- a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c -+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c -@@ -134,13 +134,13 @@ nfp_repr_get_host_stats64(const struct net_device *netdev, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c linux-6.1.2/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c +--- linux-6.1.2.orig/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c 2022-12-31 16:12:07.306580112 -0500 ++++ linux-6.1.2/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c 2022-12-31 16:12:36.278153469 -0500 +@@ -134,13 +134,13 @@ nfp_repr_get_host_stats64(const struct n repr_stats = per_cpu_ptr(repr->stats, i); do { @@ -2346,11 +2275,10 @@ index 8b77582bdfa01..a6b6ca1fd55ee 100644 stats->tx_bytes += tbytes; stats->tx_packets += tpkts; -diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c -index daa028729d444..0605d1ee490dd 100644 ---- a/drivers/net/ethernet/nvidia/forcedeth.c -+++ b/drivers/net/ethernet/nvidia/forcedeth.c -@@ -1734,12 +1734,12 @@ static void nv_get_stats(int cpu, struct fe_priv *np, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/nvidia/forcedeth.c linux-6.1.2/drivers/net/ethernet/nvidia/forcedeth.c +--- linux-6.1.2.orig/drivers/net/ethernet/nvidia/forcedeth.c 2022-12-31 16:12:07.306580112 -0500 ++++ linux-6.1.2/drivers/net/ethernet/nvidia/forcedeth.c 2022-12-31 16:12:36.278153469 -0500 +@@ -1734,12 +1734,12 @@ static void nv_get_stats(int cpu, struct u64 tx_packets, tx_bytes, tx_dropped; do { @@ -2365,7 +2293,7 @@ index daa028729d444..0605d1ee490dd 100644 storage->rx_packets += rx_packets; storage->rx_bytes += rx_bytes; -@@ -1747,11 +1747,11 @@ static void nv_get_stats(int cpu, struct fe_priv *np, +@@ -1747,11 +1747,11 @@ static void nv_get_stats(int cpu, struct storage->rx_missed_errors += rx_missed_errors; do { @@ -2379,11 +2307,10 @@ index daa028729d444..0605d1ee490dd 100644 storage->tx_packets += tx_packets; storage->tx_bytes += tx_bytes; -diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c -index 1b2119b1d48aa..3f5e6572d20e7 100644 ---- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c -+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c -@@ -135,9 +135,9 @@ static void rmnet_get_stats64(struct net_device *dev, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c linux-6.1.2/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c +--- linux-6.1.2.orig/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c 2022-12-31 16:12:07.314579992 -0500 ++++ linux-6.1.2/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c 2022-12-31 16:12:36.278153469 -0500 +@@ -135,9 +135,9 @@ static void rmnet_get_stats64(struct net pcpu_ptr = per_cpu_ptr(priv->pcpu_stats, cpu); do { @@ -2395,11 +2322,10 @@ index 1b2119b1d48aa..3f5e6572d20e7 100644 total_stats.rx_pkts += snapshot.rx_pkts; total_stats.rx_bytes += snapshot.rx_bytes; -diff --git a/drivers/net/ethernet/realtek/8139too.c b/drivers/net/ethernet/realtek/8139too.c -index 469e2e229c6e7..9ce0e8a64ba83 100644 ---- a/drivers/net/ethernet/realtek/8139too.c -+++ b/drivers/net/ethernet/realtek/8139too.c -@@ -2532,16 +2532,16 @@ rtl8139_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/realtek/8139too.c linux-6.1.2/drivers/net/ethernet/realtek/8139too.c +--- linux-6.1.2.orig/drivers/net/ethernet/realtek/8139too.c 2022-12-31 16:12:07.314579992 -0500 ++++ linux-6.1.2/drivers/net/ethernet/realtek/8139too.c 2022-12-31 16:12:36.278153469 -0500 +@@ -2532,16 +2532,16 @@ rtl8139_get_stats64(struct net_device *d netdev_stats_to_stats64(stats, &dev->stats); do { @@ -2420,11 +2346,10 @@ index 469e2e229c6e7..9ce0e8a64ba83 100644 } /* Set or clear the multicast filter for this adaptor. -diff --git a/drivers/net/ethernet/socionext/sni_ave.c b/drivers/net/ethernet/socionext/sni_ave.c -index d2c6a5dfdc0e1..b7e24ae92525a 100644 ---- a/drivers/net/ethernet/socionext/sni_ave.c -+++ b/drivers/net/ethernet/socionext/sni_ave.c -@@ -1508,16 +1508,16 @@ static void ave_get_stats64(struct net_device *ndev, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/socionext/sni_ave.c linux-6.1.2/drivers/net/ethernet/socionext/sni_ave.c +--- linux-6.1.2.orig/drivers/net/ethernet/socionext/sni_ave.c 2022-12-31 16:12:07.326579812 -0500 ++++ linux-6.1.2/drivers/net/ethernet/socionext/sni_ave.c 2022-12-31 16:12:36.278153469 -0500 +@@ -1508,16 +1508,16 @@ static void ave_get_stats64(struct net_d unsigned int start; do { @@ -2445,11 +2370,10 @@ index d2c6a5dfdc0e1..b7e24ae92525a 100644 stats->rx_errors = priv->stats_rx.errors; stats->tx_errors = priv->stats_tx.errors; -diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c -index c50b137f92d7b..c67699ef220ed 100644 ---- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c -+++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c -@@ -1362,12 +1362,12 @@ static void am65_cpsw_nuss_ndo_get_stats(struct net_device *dev, +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/ti/am65-cpsw-nuss.c linux-6.1.2/drivers/net/ethernet/ti/am65-cpsw-nuss.c +--- linux-6.1.2.orig/drivers/net/ethernet/ti/am65-cpsw-nuss.c 2022-12-31 16:12:07.330579752 -0500 ++++ linux-6.1.2/drivers/net/ethernet/ti/am65-cpsw-nuss.c 2022-12-31 16:12:36.278153469 -0500 +@@ -1366,12 +1366,12 @@ static void am65_cpsw_nuss_ndo_get_stats cpu_stats = per_cpu_ptr(ndev_priv->stats, cpu); do { @@ -2464,11 +2388,10 @@ index c50b137f92d7b..c67699ef220ed 100644 stats->rx_packets += rx_packets; stats->rx_bytes += rx_bytes; -diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c -index aba70bef48945..8b776f9cdb3f3 100644 ---- a/drivers/net/ethernet/ti/netcp_core.c -+++ b/drivers/net/ethernet/ti/netcp_core.c -@@ -1916,16 +1916,16 @@ netcp_get_stats(struct net_device *ndev, struct rtnl_link_stats64 *stats) +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/ti/netcp_core.c linux-6.1.2/drivers/net/ethernet/ti/netcp_core.c +--- linux-6.1.2.orig/drivers/net/ethernet/ti/netcp_core.c 2022-12-31 16:12:07.330579752 -0500 ++++ linux-6.1.2/drivers/net/ethernet/ti/netcp_core.c 2022-12-31 16:12:36.278153469 -0500 +@@ -1916,16 +1916,16 @@ netcp_get_stats(struct net_device *ndev, unsigned int start; do { @@ -2489,11 +2412,10 @@ index aba70bef48945..8b776f9cdb3f3 100644 stats->rx_packets = rxpackets; stats->rx_bytes = rxbytes; -diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c -index 0fb15a17b5472..d716e6fe26e1c 100644 ---- a/drivers/net/ethernet/via/via-rhine.c -+++ b/drivers/net/ethernet/via/via-rhine.c -@@ -2217,16 +2217,16 @@ rhine_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/via/via-rhine.c linux-6.1.2/drivers/net/ethernet/via/via-rhine.c +--- linux-6.1.2.orig/drivers/net/ethernet/via/via-rhine.c 2022-12-31 16:12:07.330579752 -0500 ++++ linux-6.1.2/drivers/net/ethernet/via/via-rhine.c 2022-12-31 16:12:36.278153469 -0500 +@@ -2217,16 +2217,16 @@ rhine_get_stats64(struct net_device *dev netdev_stats_to_stats64(stats, &dev->stats); do { @@ -2514,11 +2436,10 @@ index 0fb15a17b5472..d716e6fe26e1c 100644 } static void rhine_set_rx_mode(struct net_device *dev) -diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c -index d1d772580da98..441e1058104fa 100644 ---- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c -+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c -@@ -1305,16 +1305,16 @@ axienet_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) +diff -rupN linux-6.1.2.orig/drivers/net/ethernet/xilinx/xilinx_axienet_main.c linux-6.1.2/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +--- linux-6.1.2.orig/drivers/net/ethernet/xilinx/xilinx_axienet_main.c 2022-12-31 16:12:07.334579692 -0500 ++++ linux-6.1.2/drivers/net/ethernet/xilinx/xilinx_axienet_main.c 2022-12-31 16:12:36.278153469 -0500 +@@ -1305,16 +1305,16 @@ axienet_get_stats64(struct net_device *d netdev_stats_to_stats64(stats, &dev->stats); do { @@ -2539,11 +2460,10 @@ index d1d772580da98..441e1058104fa 100644 } static const struct net_device_ops axienet_netdev_ops = { -diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c -index 89eb4f179a3ce..f9b219e6cd58b 100644 ---- a/drivers/net/hyperv/netvsc_drv.c -+++ b/drivers/net/hyperv/netvsc_drv.c -@@ -1264,12 +1264,12 @@ static void netvsc_get_vf_stats(struct net_device *net, +diff -rupN linux-6.1.2.orig/drivers/net/hyperv/netvsc_drv.c linux-6.1.2/drivers/net/hyperv/netvsc_drv.c +--- linux-6.1.2.orig/drivers/net/hyperv/netvsc_drv.c 2022-12-31 16:12:07.334579692 -0500 ++++ linux-6.1.2/drivers/net/hyperv/netvsc_drv.c 2022-12-31 16:12:36.278153469 -0500 +@@ -1264,12 +1264,12 @@ static void netvsc_get_vf_stats(struct n unsigned int start; do { @@ -2558,7 +2478,7 @@ index 89eb4f179a3ce..f9b219e6cd58b 100644 tot->rx_packets += rx_packets; tot->tx_packets += tx_packets; -@@ -1294,12 +1294,12 @@ static void netvsc_get_pcpu_stats(struct net_device *net, +@@ -1294,12 +1294,12 @@ static void netvsc_get_pcpu_stats(struct unsigned int start; do { @@ -2573,7 +2493,7 @@ index 89eb4f179a3ce..f9b219e6cd58b 100644 this_tot->rx_packets = this_tot->vf_rx_packets; this_tot->tx_packets = this_tot->vf_tx_packets; this_tot->rx_bytes = this_tot->vf_rx_bytes; -@@ -1318,20 +1318,20 @@ static void netvsc_get_pcpu_stats(struct net_device *net, +@@ -1318,20 +1318,20 @@ static void netvsc_get_pcpu_stats(struct tx_stats = &nvchan->tx_stats; do { @@ -2598,7 +2518,7 @@ index 89eb4f179a3ce..f9b219e6cd58b 100644 this_tot->rx_bytes += bytes; this_tot->rx_packets += packets; -@@ -1370,21 +1370,21 @@ static void netvsc_get_stats64(struct net_device *net, +@@ -1370,21 +1370,21 @@ static void netvsc_get_stats64(struct ne tx_stats = &nvchan->tx_stats; do { @@ -2624,7 +2544,7 @@ index 89eb4f179a3ce..f9b219e6cd58b 100644 t->rx_bytes += bytes; t->rx_packets += packets; -@@ -1527,24 +1527,24 @@ static void netvsc_get_ethtool_stats(struct net_device *dev, +@@ -1527,24 +1527,24 @@ static void netvsc_get_ethtool_stats(str tx_stats = &nvdev->chan_table[j].tx_stats; do { @@ -2653,11 +2573,10 @@ index 89eb4f179a3ce..f9b219e6cd58b 100644 data[i++] = packets; data[i++] = bytes; data[i++] = xdp_drop; -diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c -index 1c64d5347b8e0..78253ad57b2ef 100644 ---- a/drivers/net/ifb.c -+++ b/drivers/net/ifb.c -@@ -162,18 +162,18 @@ static void ifb_stats64(struct net_device *dev, +diff -rupN linux-6.1.2.orig/drivers/net/ifb.c linux-6.1.2/drivers/net/ifb.c +--- linux-6.1.2.orig/drivers/net/ifb.c 2022-12-31 16:12:07.338579632 -0500 ++++ linux-6.1.2/drivers/net/ifb.c 2022-12-31 16:12:36.278153469 -0500 +@@ -162,18 +162,18 @@ static void ifb_stats64(struct net_devic for (i = 0; i < dev->num_tx_queues; i++,txp++) { do { @@ -2680,7 +2599,7 @@ index 1c64d5347b8e0..78253ad57b2ef 100644 stats->tx_packets += packets; stats->tx_bytes += bytes; } -@@ -245,12 +245,12 @@ static void ifb_fill_stats_data(u64 **data, +@@ -245,12 +245,12 @@ static void ifb_fill_stats_data(u64 **da int j; do { @@ -2695,11 +2614,10 @@ index 1c64d5347b8e0..78253ad57b2ef 100644 *data += IFB_Q_STATS_LEN; } -diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c -index 796a38f9d7b24..b15dd9a3ad540 100644 ---- a/drivers/net/ipvlan/ipvlan_main.c -+++ b/drivers/net/ipvlan/ipvlan_main.c -@@ -301,13 +301,13 @@ static void ipvlan_get_stats64(struct net_device *dev, +diff -rupN linux-6.1.2.orig/drivers/net/ipvlan/ipvlan_main.c linux-6.1.2/drivers/net/ipvlan/ipvlan_main.c +--- linux-6.1.2.orig/drivers/net/ipvlan/ipvlan_main.c 2022-12-31 16:12:07.338579632 -0500 ++++ linux-6.1.2/drivers/net/ipvlan/ipvlan_main.c 2022-12-31 16:12:36.278153469 -0500 +@@ -301,13 +301,13 @@ static void ipvlan_get_stats64(struct ne for_each_possible_cpu(idx) { pcptr = per_cpu_ptr(ipvlan->pcpu_stats, idx); do { @@ -2715,11 +2633,10 @@ index 796a38f9d7b24..b15dd9a3ad540 100644 strt)); s->rx_packets += rx_pkts; -diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c -index 14e8d04cb4347..c4ad98d39ea60 100644 ---- a/drivers/net/loopback.c -+++ b/drivers/net/loopback.c -@@ -106,10 +106,10 @@ void dev_lstats_read(struct net_device *dev, u64 *packets, u64 *bytes) +diff -rupN linux-6.1.2.orig/drivers/net/loopback.c linux-6.1.2/drivers/net/loopback.c +--- linux-6.1.2.orig/drivers/net/loopback.c 2022-12-31 16:12:07.338579632 -0500 ++++ linux-6.1.2/drivers/net/loopback.c 2022-12-31 16:12:36.278153469 -0500 +@@ -106,10 +106,10 @@ void dev_lstats_read(struct net_device * lb_stats = per_cpu_ptr(dev->lstats, i); do { @@ -2732,11 +2649,10 @@ index 14e8d04cb4347..c4ad98d39ea60 100644 *bytes += tbytes; *packets += tpackets; } -diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c -index f41f67b583db2..d73b9d535b7a6 100644 ---- a/drivers/net/macsec.c -+++ b/drivers/net/macsec.c -@@ -2793,9 +2793,9 @@ static void get_rx_sc_stats(struct net_device *dev, +diff -rupN linux-6.1.2.orig/drivers/net/macsec.c linux-6.1.2/drivers/net/macsec.c +--- linux-6.1.2.orig/drivers/net/macsec.c 2022-12-31 16:12:07.338579632 -0500 ++++ linux-6.1.2/drivers/net/macsec.c 2022-12-31 16:12:36.278153469 -0500 +@@ -2801,9 +2801,9 @@ static void get_rx_sc_stats(struct net_d stats = per_cpu_ptr(rx_sc->stats, cpu); do { @@ -2748,7 +2664,7 @@ index f41f67b583db2..d73b9d535b7a6 100644 sum->InOctetsValidated += tmp.InOctetsValidated; sum->InOctetsDecrypted += tmp.InOctetsDecrypted; -@@ -2874,9 +2874,9 @@ static void get_tx_sc_stats(struct net_device *dev, +@@ -2882,9 +2882,9 @@ static void get_tx_sc_stats(struct net_d stats = per_cpu_ptr(macsec_priv(dev)->secy.tx_sc.stats, cpu); do { @@ -2760,7 +2676,7 @@ index f41f67b583db2..d73b9d535b7a6 100644 sum->OutPktsProtected += tmp.OutPktsProtected; sum->OutPktsEncrypted += tmp.OutPktsEncrypted; -@@ -2930,9 +2930,9 @@ static void get_secy_stats(struct net_device *dev, struct macsec_dev_stats *sum) +@@ -2938,9 +2938,9 @@ static void get_secy_stats(struct net_de stats = per_cpu_ptr(macsec_priv(dev)->stats, cpu); do { @@ -2772,11 +2688,10 @@ index f41f67b583db2..d73b9d535b7a6 100644 sum->OutPktsUntagged += tmp.OutPktsUntagged; sum->InPktsUntagged += tmp.InPktsUntagged; -diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c -index b8cc55b2d721c..99a971929c8ed 100644 ---- a/drivers/net/macvlan.c -+++ b/drivers/net/macvlan.c -@@ -948,13 +948,13 @@ static void macvlan_dev_get_stats64(struct net_device *dev, +diff -rupN linux-6.1.2.orig/drivers/net/macvlan.c linux-6.1.2/drivers/net/macvlan.c +--- linux-6.1.2.orig/drivers/net/macvlan.c 2022-12-31 16:12:07.338579632 -0500 ++++ linux-6.1.2/drivers/net/macvlan.c 2022-12-31 16:12:36.282153411 -0500 +@@ -948,13 +948,13 @@ static void macvlan_dev_get_stats64(stru for_each_possible_cpu(i) { p = per_cpu_ptr(vlan->pcpu_stats, i); do { @@ -2792,11 +2707,10 @@ index b8cc55b2d721c..99a971929c8ed 100644 stats->rx_packets += rx_packets; stats->rx_bytes += rx_bytes; -diff --git a/drivers/net/mhi_net.c b/drivers/net/mhi_net.c -index 0b9d379791332..3d322ac4f6a59 100644 ---- a/drivers/net/mhi_net.c -+++ b/drivers/net/mhi_net.c -@@ -104,19 +104,19 @@ static void mhi_ndo_get_stats64(struct net_device *ndev, +diff -rupN linux-6.1.2.orig/drivers/net/mhi_net.c linux-6.1.2/drivers/net/mhi_net.c +--- linux-6.1.2.orig/drivers/net/mhi_net.c 2022-12-31 16:12:07.338579632 -0500 ++++ linux-6.1.2/drivers/net/mhi_net.c 2022-12-31 16:12:36.282153411 -0500 +@@ -104,19 +104,19 @@ static void mhi_ndo_get_stats64(struct n unsigned int start; do { @@ -2820,11 +2734,10 @@ index 0b9d379791332..3d322ac4f6a59 100644 } static const struct net_device_ops mhi_netdev_ops = { -diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c -index 9a1a5b2036240..e470e3398abc2 100644 ---- a/drivers/net/netdevsim/netdev.c -+++ b/drivers/net/netdevsim/netdev.c -@@ -67,10 +67,10 @@ nsim_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) +diff -rupN linux-6.1.2.orig/drivers/net/netdevsim/netdev.c linux-6.1.2/drivers/net/netdevsim/netdev.c +--- linux-6.1.2.orig/drivers/net/netdevsim/netdev.c 2022-12-31 16:12:07.342579572 -0500 ++++ linux-6.1.2/drivers/net/netdevsim/netdev.c 2022-12-31 16:12:36.282153411 -0500 +@@ -67,10 +67,10 @@ nsim_get_stats64(struct net_device *dev, unsigned int start; do { @@ -2837,11 +2750,10 @@ index 9a1a5b2036240..e470e3398abc2 100644 } static int -diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c -index 62ade69295a94..d10606f257c43 100644 ---- a/drivers/net/team/team.c -+++ b/drivers/net/team/team.c -@@ -1865,13 +1865,13 @@ team_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) +diff -rupN linux-6.1.2.orig/drivers/net/team/team.c linux-6.1.2/drivers/net/team/team.c +--- linux-6.1.2.orig/drivers/net/team/team.c 2022-12-31 16:12:07.346579512 -0500 ++++ linux-6.1.2/drivers/net/team/team.c 2022-12-31 16:12:36.282153411 -0500 +@@ -1865,13 +1865,13 @@ team_get_stats64(struct net_device *dev, for_each_possible_cpu(i) { p = per_cpu_ptr(team->pcpu_stats, i); do { @@ -2857,11 +2769,10 @@ index 62ade69295a94..d10606f257c43 100644 stats->rx_packets += rx_packets; stats->rx_bytes += rx_bytes; -diff --git a/drivers/net/team/team_mode_loadbalance.c b/drivers/net/team/team_mode_loadbalance.c -index b095a4b4957bb..18d99fda997cf 100644 ---- a/drivers/net/team/team_mode_loadbalance.c -+++ b/drivers/net/team/team_mode_loadbalance.c -@@ -466,9 +466,9 @@ static void __lb_one_cpu_stats_add(struct lb_stats *acc_stats, +diff -rupN linux-6.1.2.orig/drivers/net/team/team_mode_loadbalance.c linux-6.1.2/drivers/net/team/team_mode_loadbalance.c +--- linux-6.1.2.orig/drivers/net/team/team_mode_loadbalance.c 2022-12-31 16:12:07.346579512 -0500 ++++ linux-6.1.2/drivers/net/team/team_mode_loadbalance.c 2022-12-31 16:12:36.282153411 -0500 +@@ -466,9 +466,9 @@ static void __lb_one_cpu_stats_add(struc struct lb_stats tmp; do { @@ -2873,11 +2784,10 @@ index b095a4b4957bb..18d99fda997cf 100644 acc_stats->tx_bytes += tmp.tx_bytes; } -diff --git a/drivers/net/veth.c b/drivers/net/veth.c -index 09682ea3354e9..740506c44427d 100644 ---- a/drivers/net/veth.c -+++ b/drivers/net/veth.c -@@ -182,12 +182,12 @@ static void veth_get_ethtool_stats(struct net_device *dev, +diff -rupN linux-6.1.2.orig/drivers/net/veth.c linux-6.1.2/drivers/net/veth.c +--- linux-6.1.2.orig/drivers/net/veth.c 2022-12-31 16:12:07.346579512 -0500 ++++ linux-6.1.2/drivers/net/veth.c 2022-12-31 16:12:36.282153411 -0500 +@@ -182,12 +182,12 @@ static void veth_get_ethtool_stats(struc size_t offset; do { @@ -2892,7 +2802,7 @@ index 09682ea3354e9..740506c44427d 100644 idx += VETH_RQ_STATS_LEN; } -@@ -203,12 +203,12 @@ static void veth_get_ethtool_stats(struct net_device *dev, +@@ -203,12 +203,12 @@ static void veth_get_ethtool_stats(struc tx_idx += (i % dev->real_num_tx_queues) * VETH_TQ_STATS_LEN; do { @@ -2907,7 +2817,7 @@ index 09682ea3354e9..740506c44427d 100644 } } -@@ -379,13 +379,13 @@ static void veth_stats_rx(struct veth_stats *result, struct net_device *dev) +@@ -379,13 +379,13 @@ static void veth_stats_rx(struct veth_st unsigned int start; do { @@ -2923,11 +2833,10 @@ index 09682ea3354e9..740506c44427d 100644 result->peer_tq_xdp_xmit_err += peer_tq_xdp_xmit_err; result->xdp_tx_err += xdp_tx_err; result->xdp_packets += packets; -diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c -index 86e52454b5b5c..19eee0655b996 100644 ---- a/drivers/net/virtio_net.c -+++ b/drivers/net/virtio_net.c -@@ -2069,18 +2069,18 @@ static void virtnet_stats(struct net_device *dev, +diff -rupN linux-6.1.2.orig/drivers/net/virtio_net.c linux-6.1.2/drivers/net/virtio_net.c +--- linux-6.1.2.orig/drivers/net/virtio_net.c 2022-12-31 16:12:07.346579512 -0500 ++++ linux-6.1.2/drivers/net/virtio_net.c 2022-12-31 16:12:36.282153411 -0500 +@@ -2069,18 +2069,18 @@ static void virtnet_stats(struct net_dev struct send_queue *sq = &vi->sq[i]; do { @@ -2950,7 +2859,7 @@ index 86e52454b5b5c..19eee0655b996 100644 tot->rx_packets += rpackets; tot->tx_packets += tpackets; -@@ -2691,12 +2691,12 @@ static void virtnet_get_ethtool_stats(struct net_device *dev, +@@ -2691,12 +2691,12 @@ static void virtnet_get_ethtool_stats(st stats_base = (u8 *)&rq->stats; do { @@ -2965,7 +2874,7 @@ index 86e52454b5b5c..19eee0655b996 100644 idx += VIRTNET_RQ_STATS_LEN; } -@@ -2705,12 +2705,12 @@ static void virtnet_get_ethtool_stats(struct net_device *dev, +@@ -2705,12 +2705,12 @@ static void virtnet_get_ethtool_stats(st stats_base = (u8 *)&sq->stats; do { @@ -2980,11 +2889,10 @@ index 86e52454b5b5c..19eee0655b996 100644 idx += VIRTNET_SQ_STATS_LEN; } } -diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c -index badf6f09ae51c..6b5a4d036d153 100644 ---- a/drivers/net/vrf.c -+++ b/drivers/net/vrf.c -@@ -159,13 +159,13 @@ static void vrf_get_stats64(struct net_device *dev, +diff -rupN linux-6.1.2.orig/drivers/net/vrf.c linux-6.1.2/drivers/net/vrf.c +--- linux-6.1.2.orig/drivers/net/vrf.c 2022-12-31 16:12:07.346579512 -0500 ++++ linux-6.1.2/drivers/net/vrf.c 2022-12-31 16:12:36.282153411 -0500 +@@ -159,13 +159,13 @@ static void vrf_get_stats64(struct net_d dstats = per_cpu_ptr(dev->dstats, i); do { @@ -3000,11 +2908,10 @@ index badf6f09ae51c..6b5a4d036d153 100644 stats->tx_bytes += tbytes; stats->tx_packets += tpkts; stats->tx_dropped += tdrops; -diff --git a/drivers/net/vxlan/vxlan_vnifilter.c b/drivers/net/vxlan/vxlan_vnifilter.c -index 3e04af4c5daa1..a3de081cda5ee 100644 ---- a/drivers/net/vxlan/vxlan_vnifilter.c -+++ b/drivers/net/vxlan/vxlan_vnifilter.c -@@ -129,9 +129,9 @@ static void vxlan_vnifilter_stats_get(const struct vxlan_vni_node *vninode, +diff -rupN linux-6.1.2.orig/drivers/net/vxlan/vxlan_vnifilter.c linux-6.1.2/drivers/net/vxlan/vxlan_vnifilter.c +--- linux-6.1.2.orig/drivers/net/vxlan/vxlan_vnifilter.c 2022-12-31 16:12:07.346579512 -0500 ++++ linux-6.1.2/drivers/net/vxlan/vxlan_vnifilter.c 2022-12-31 16:12:36.282153411 -0500 +@@ -129,9 +129,9 @@ static void vxlan_vnifilter_stats_get(co pstats = per_cpu_ptr(vninode->stats, i); do { @@ -3016,11 +2923,10 @@ index 3e04af4c5daa1..a3de081cda5ee 100644 dest->rx_packets += temp.rx_packets; dest->rx_bytes += temp.rx_bytes; -diff --git a/drivers/net/wwan/mhi_wwan_mbim.c b/drivers/net/wwan/mhi_wwan_mbim.c -index ef70bb7c88ad6..3f72ae943b294 100644 ---- a/drivers/net/wwan/mhi_wwan_mbim.c -+++ b/drivers/net/wwan/mhi_wwan_mbim.c -@@ -456,19 +456,19 @@ static void mhi_mbim_ndo_get_stats64(struct net_device *ndev, +diff -rupN linux-6.1.2.orig/drivers/net/wwan/mhi_wwan_mbim.c linux-6.1.2/drivers/net/wwan/mhi_wwan_mbim.c +--- linux-6.1.2.orig/drivers/net/wwan/mhi_wwan_mbim.c 2022-12-31 16:12:07.426578312 -0500 ++++ linux-6.1.2/drivers/net/wwan/mhi_wwan_mbim.c 2022-12-31 16:12:36.282153411 -0500 +@@ -456,19 +456,19 @@ static void mhi_mbim_ndo_get_stats64(str unsigned int start; do { @@ -3044,11 +2950,10 @@ index ef70bb7c88ad6..3f72ae943b294 100644 } static void mhi_mbim_ul_callback(struct mhi_device *mhi_dev, -diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c -index 9af2b027c19c6..ef4e53bf56044 100644 ---- a/drivers/net/xen-netfront.c -+++ b/drivers/net/xen-netfront.c -@@ -1392,16 +1392,16 @@ static void xennet_get_stats64(struct net_device *dev, +diff -rupN linux-6.1.2.orig/drivers/net/xen-netfront.c linux-6.1.2/drivers/net/xen-netfront.c +--- linux-6.1.2.orig/drivers/net/xen-netfront.c 2022-12-31 16:12:07.430578252 -0500 ++++ linux-6.1.2/drivers/net/xen-netfront.c 2022-12-31 16:12:36.282153411 -0500 +@@ -1392,16 +1392,16 @@ static void xennet_get_stats64(struct ne unsigned int start; do { @@ -3069,10 +2974,9 @@ index 9af2b027c19c6..ef4e53bf56044 100644 tot->rx_packets += rx_packets; tot->tx_packets += tx_packets; -diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c -index 5f9aedd1f0b65..dabe89666efdb 100644 ---- a/drivers/spi/spi.c -+++ b/drivers/spi/spi.c +diff -rupN linux-6.1.2.orig/drivers/spi/spi.c linux-6.1.2/drivers/spi/spi.c +--- linux-6.1.2.orig/drivers/spi/spi.c 2022-12-31 16:12:07.586575912 -0500 ++++ linux-6.1.2/drivers/spi/spi.c 2022-12-31 16:12:36.282153411 -0500 @@ -127,10 +127,10 @@ do { \ unsigned int start; \ pcpu_stats = per_cpu_ptr(in, i); \ @@ -3086,11 +2990,207 @@ index 5f9aedd1f0b65..dabe89666efdb 100644 &pcpu_stats->syncp, start)); \ ret += inc; \ } \ -diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h -index 287153d325365..82cbe22a96338 100644 ---- a/drivers/tty/serial/8250/8250.h -+++ b/drivers/tty/serial/8250/8250.h -@@ -177,12 +177,49 @@ static inline void serial_dl_write(struct uart_8250_port *up, int value) +diff -rupN linux-6.1.2.orig/drivers/tty/serial/8250/8250_aspeed_vuart.c linux-6.1.2/drivers/tty/serial/8250/8250_aspeed_vuart.c +--- linux-6.1.2.orig/drivers/tty/serial/8250/8250_aspeed_vuart.c 2022-12-31 16:12:07.662574772 -0500 ++++ linux-6.1.2/drivers/tty/serial/8250/8250_aspeed_vuart.c 2022-12-31 16:12:36.282153411 -0500 +@@ -278,7 +278,7 @@ static void __aspeed_vuart_set_throttle( + up->ier &= ~irqs; + if (!throttle) + up->ier |= irqs; +- serial_out(up, UART_IER, up->ier); ++ serial8250_set_IER(up, up->ier); + } + static void aspeed_vuart_set_throttle(struct uart_port *port, bool throttle) + { +diff -rupN linux-6.1.2.orig/drivers/tty/serial/8250/8250_bcm7271.c linux-6.1.2/drivers/tty/serial/8250/8250_bcm7271.c +--- linux-6.1.2.orig/drivers/tty/serial/8250/8250_bcm7271.c 2022-12-31 16:12:07.662574772 -0500 ++++ linux-6.1.2/drivers/tty/serial/8250/8250_bcm7271.c 2022-12-31 16:12:36.282153411 -0500 +@@ -609,7 +609,7 @@ static int brcmuart_startup(struct uart_ + * will handle this. + */ + up->ier &= ~UART_IER_RDI; +- serial_port_out(port, UART_IER, up->ier); ++ serial8250_set_IER(up, up->ier); + + priv->tx_running = false; + priv->dma.rx_dma = NULL; +@@ -775,10 +775,12 @@ static int brcmuart_handle_irq(struct ua + unsigned int iir = serial_port_in(p, UART_IIR); + struct brcmuart_priv *priv = p->private_data; + struct uart_8250_port *up = up_to_u8250p(p); ++ unsigned long cs_flags; + unsigned int status; + unsigned long flags; + unsigned int ier; + unsigned int mcr; ++ bool is_console; + int handled = 0; + + /* +@@ -789,6 +791,10 @@ static int brcmuart_handle_irq(struct ua + spin_lock_irqsave(&p->lock, flags); + status = serial_port_in(p, UART_LSR); + if ((status & UART_LSR_DR) == 0) { ++ is_console = uart_console(p); ++ ++ if (is_console) ++ printk_cpu_sync_get_irqsave(cs_flags); + + ier = serial_port_in(p, UART_IER); + /* +@@ -809,6 +815,9 @@ static int brcmuart_handle_irq(struct ua + serial_port_in(p, UART_RX); + } + ++ if (is_console) ++ printk_cpu_sync_put_irqrestore(cs_flags); ++ + handled = 1; + } + spin_unlock_irqrestore(&p->lock, flags); +@@ -823,8 +832,10 @@ static enum hrtimer_restart brcmuart_hrt + struct brcmuart_priv *priv = container_of(t, struct brcmuart_priv, hrt); + struct uart_port *p = priv->up; + struct uart_8250_port *up = up_to_u8250p(p); ++ unsigned long cs_flags; + unsigned int status; + unsigned long flags; ++ bool is_console; + + if (priv->shutdown) + return HRTIMER_NORESTART; +@@ -846,12 +857,20 @@ static enum hrtimer_restart brcmuart_hrt + /* re-enable receive unless upper layer has disabled it */ + if ((up->ier & (UART_IER_RLSI | UART_IER_RDI)) == + (UART_IER_RLSI | UART_IER_RDI)) { ++ is_console = uart_console(p); ++ ++ if (is_console) ++ printk_cpu_sync_get_irqsave(cs_flags); ++ + status = serial_port_in(p, UART_IER); + status |= (UART_IER_RLSI | UART_IER_RDI); + serial_port_out(p, UART_IER, status); + status = serial_port_in(p, UART_MCR); + status |= UART_MCR_RTS; + serial_port_out(p, UART_MCR, status); ++ ++ if (is_console) ++ printk_cpu_sync_put_irqrestore(cs_flags); + } + spin_unlock_irqrestore(&p->lock, flags); + return HRTIMER_NORESTART; +diff -rupN linux-6.1.2.orig/drivers/tty/serial/8250/8250_core.c linux-6.1.2/drivers/tty/serial/8250/8250_core.c +--- linux-6.1.2.orig/drivers/tty/serial/8250/8250_core.c 2022-12-31 16:12:07.662574772 -0500 ++++ linux-6.1.2/drivers/tty/serial/8250/8250_core.c 2022-12-31 16:12:36.282153411 -0500 +@@ -255,8 +255,11 @@ static void serial8250_timeout(struct ti + static void serial8250_backup_timeout(struct timer_list *t) + { + struct uart_8250_port *up = from_timer(up, t, timer); ++ struct uart_port *port = &up->port; + unsigned int iir, ier = 0, lsr; ++ unsigned long cs_flags; + unsigned long flags; ++ bool is_console; + + spin_lock_irqsave(&up->port.lock, flags); + +@@ -265,8 +268,16 @@ static void serial8250_backup_timeout(st + * based handler. + */ + if (up->port.irq) { ++ is_console = uart_console(port); ++ ++ if (is_console) ++ printk_cpu_sync_get_irqsave(cs_flags); ++ + ier = serial_in(up, UART_IER); + serial_out(up, UART_IER, 0); ++ ++ if (is_console) ++ printk_cpu_sync_put_irqrestore(cs_flags); + } + + iir = serial_in(up, UART_IIR); +@@ -289,7 +300,7 @@ static void serial8250_backup_timeout(st + serial8250_tx_chars(up); + + if (up->port.irq) +- serial_out(up, UART_IER, ier); ++ serial8250_set_IER(up, ier); + + spin_unlock_irqrestore(&up->port.lock, flags); + +@@ -575,6 +586,14 @@ serial8250_register_ports(struct uart_dr + + #ifdef CONFIG_SERIAL_8250_CONSOLE + ++static void univ8250_console_write_atomic(struct console *co, const char *s, ++ unsigned int count) ++{ ++ struct uart_8250_port *up = &serial8250_ports[co->index]; ++ ++ serial8250_console_write_atomic(up, s, count); ++} ++ + static void univ8250_console_write(struct console *co, const char *s, + unsigned int count) + { +@@ -668,6 +687,7 @@ static int univ8250_console_match(struct + + static struct console univ8250_console = { + .name = "ttyS", ++ .write_atomic = univ8250_console_write_atomic, + .write = univ8250_console_write, + .device = uart_console_device, + .setup = univ8250_console_setup, +@@ -961,7 +981,7 @@ static void serial_8250_overrun_backoff_ + spin_lock_irqsave(&port->lock, flags); + up->ier |= UART_IER_RLSI | UART_IER_RDI; + up->port.read_status_mask |= UART_LSR_DR; +- serial_out(up, UART_IER, up->ier); ++ serial8250_set_IER(up, up->ier); + spin_unlock_irqrestore(&port->lock, flags); + } + +diff -rupN linux-6.1.2.orig/drivers/tty/serial/8250/8250_exar.c linux-6.1.2/drivers/tty/serial/8250/8250_exar.c +--- linux-6.1.2.orig/drivers/tty/serial/8250/8250_exar.c 2022-12-31 16:12:07.662574772 -0500 ++++ linux-6.1.2/drivers/tty/serial/8250/8250_exar.c 2022-12-31 16:12:36.282153411 -0500 +@@ -179,6 +179,8 @@ static void xr17v35x_set_divisor(struct + + static int xr17v35x_startup(struct uart_port *port) + { ++ struct uart_8250_port *up = up_to_u8250p(port); ++ + /* + * First enable access to IER [7:5], ISR [5:4], FCR [5:4], + * MCR [7:5] and MSR [7:0] +@@ -189,7 +191,7 @@ static int xr17v35x_startup(struct uart_ + * Make sure all interrups are masked until initialization is + * complete and the FIFOs are cleared + */ +- serial_port_out(port, UART_IER, 0); ++ serial8250_set_IER(up, 0); + + return serial8250_do_startup(port); + } +diff -rupN linux-6.1.2.orig/drivers/tty/serial/8250/8250_fsl.c linux-6.1.2/drivers/tty/serial/8250/8250_fsl.c +--- linux-6.1.2.orig/drivers/tty/serial/8250/8250_fsl.c 2022-12-31 16:12:07.662574772 -0500 ++++ linux-6.1.2/drivers/tty/serial/8250/8250_fsl.c 2022-12-31 16:12:36.282153411 -0500 +@@ -58,7 +58,8 @@ int fsl8250_handle_irq(struct uart_port + if ((orig_lsr & UART_LSR_OE) && (up->overrun_backoff_time_ms > 0)) { + unsigned long delay; + +- up->ier = port->serial_in(port, UART_IER); ++ up->ier = serial8250_in_IER(up); ++ + if (up->ier & (UART_IER_RLSI | UART_IER_RDI)) { + port->ops->stop_rx(port); + } else { +diff -rupN linux-6.1.2.orig/drivers/tty/serial/8250/8250.h linux-6.1.2/drivers/tty/serial/8250/8250.h +--- linux-6.1.2.orig/drivers/tty/serial/8250/8250.h 2022-12-31 16:12:07.662574772 -0500 ++++ linux-6.1.2/drivers/tty/serial/8250/8250.h 2022-12-31 16:12:36.282153411 -0500 +@@ -177,12 +177,49 @@ static inline void serial_dl_write(struc up->dl_write(up, value); } @@ -3141,7 +3241,7 @@ index 287153d325365..82cbe22a96338 100644 return true; } -@@ -191,7 +228,7 @@ static inline bool serial8250_clear_THRI(struct uart_8250_port *up) +@@ -191,7 +228,7 @@ static inline bool serial8250_clear_THRI if (!(up->ier & UART_IER_THRI)) return false; up->ier &= ~UART_IER_THRI; @@ -3150,213 +3250,10 @@ index 287153d325365..82cbe22a96338 100644 return true; } -diff --git a/drivers/tty/serial/8250/8250_aspeed_vuart.c b/drivers/tty/serial/8250/8250_aspeed_vuart.c -index 9d2a7856784f7..7cc6b527c088b 100644 ---- a/drivers/tty/serial/8250/8250_aspeed_vuart.c -+++ b/drivers/tty/serial/8250/8250_aspeed_vuart.c -@@ -278,7 +278,7 @@ static void __aspeed_vuart_set_throttle(struct uart_8250_port *up, - up->ier &= ~irqs; - if (!throttle) - up->ier |= irqs; -- serial_out(up, UART_IER, up->ier); -+ serial8250_set_IER(up, up->ier); - } - static void aspeed_vuart_set_throttle(struct uart_port *port, bool throttle) - { -diff --git a/drivers/tty/serial/8250/8250_bcm7271.c b/drivers/tty/serial/8250/8250_bcm7271.c -index fa8ccf204d860..ccf63c001e56d 100644 ---- a/drivers/tty/serial/8250/8250_bcm7271.c -+++ b/drivers/tty/serial/8250/8250_bcm7271.c -@@ -609,7 +609,7 @@ static int brcmuart_startup(struct uart_port *port) - * will handle this. - */ - up->ier &= ~UART_IER_RDI; -- serial_port_out(port, UART_IER, up->ier); -+ serial8250_set_IER(up, up->ier); - - priv->tx_running = false; - priv->dma.rx_dma = NULL; -@@ -775,10 +775,12 @@ static int brcmuart_handle_irq(struct uart_port *p) - unsigned int iir = serial_port_in(p, UART_IIR); - struct brcmuart_priv *priv = p->private_data; - struct uart_8250_port *up = up_to_u8250p(p); -+ unsigned long cs_flags; - unsigned int status; - unsigned long flags; - unsigned int ier; - unsigned int mcr; -+ bool is_console; - int handled = 0; - - /* -@@ -789,6 +791,10 @@ static int brcmuart_handle_irq(struct uart_port *p) - spin_lock_irqsave(&p->lock, flags); - status = serial_port_in(p, UART_LSR); - if ((status & UART_LSR_DR) == 0) { -+ is_console = uart_console(p); -+ -+ if (is_console) -+ printk_cpu_sync_get_irqsave(cs_flags); - - ier = serial_port_in(p, UART_IER); - /* -@@ -809,6 +815,9 @@ static int brcmuart_handle_irq(struct uart_port *p) - serial_port_in(p, UART_RX); - } - -+ if (is_console) -+ printk_cpu_sync_put_irqrestore(cs_flags); -+ - handled = 1; - } - spin_unlock_irqrestore(&p->lock, flags); -@@ -823,8 +832,10 @@ static enum hrtimer_restart brcmuart_hrtimer_func(struct hrtimer *t) - struct brcmuart_priv *priv = container_of(t, struct brcmuart_priv, hrt); - struct uart_port *p = priv->up; - struct uart_8250_port *up = up_to_u8250p(p); -+ unsigned long cs_flags; - unsigned int status; - unsigned long flags; -+ bool is_console; - - if (priv->shutdown) - return HRTIMER_NORESTART; -@@ -846,12 +857,20 @@ static enum hrtimer_restart brcmuart_hrtimer_func(struct hrtimer *t) - /* re-enable receive unless upper layer has disabled it */ - if ((up->ier & (UART_IER_RLSI | UART_IER_RDI)) == - (UART_IER_RLSI | UART_IER_RDI)) { -+ is_console = uart_console(p); -+ -+ if (is_console) -+ printk_cpu_sync_get_irqsave(cs_flags); -+ - status = serial_port_in(p, UART_IER); - status |= (UART_IER_RLSI | UART_IER_RDI); - serial_port_out(p, UART_IER, status); - status = serial_port_in(p, UART_MCR); - status |= UART_MCR_RTS; - serial_port_out(p, UART_MCR, status); -+ -+ if (is_console) -+ printk_cpu_sync_put_irqrestore(cs_flags); - } - spin_unlock_irqrestore(&p->lock, flags); - return HRTIMER_NORESTART; -diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c -index 94fbf0add2ce2..196d0c55dfe99 100644 ---- a/drivers/tty/serial/8250/8250_core.c -+++ b/drivers/tty/serial/8250/8250_core.c -@@ -255,8 +255,11 @@ static void serial8250_timeout(struct timer_list *t) - static void serial8250_backup_timeout(struct timer_list *t) - { - struct uart_8250_port *up = from_timer(up, t, timer); -+ struct uart_port *port = &up->port; - unsigned int iir, ier = 0, lsr; -+ unsigned long cs_flags; - unsigned long flags; -+ bool is_console; - - spin_lock_irqsave(&up->port.lock, flags); - -@@ -265,8 +268,16 @@ static void serial8250_backup_timeout(struct timer_list *t) - * based handler. - */ - if (up->port.irq) { -+ is_console = uart_console(port); -+ -+ if (is_console) -+ printk_cpu_sync_get_irqsave(cs_flags); -+ - ier = serial_in(up, UART_IER); - serial_out(up, UART_IER, 0); -+ -+ if (is_console) -+ printk_cpu_sync_put_irqrestore(cs_flags); - } - - iir = serial_in(up, UART_IIR); -@@ -289,7 +300,7 @@ static void serial8250_backup_timeout(struct timer_list *t) - serial8250_tx_chars(up); - - if (up->port.irq) -- serial_out(up, UART_IER, ier); -+ serial8250_set_IER(up, ier); - - spin_unlock_irqrestore(&up->port.lock, flags); - -@@ -575,6 +586,14 @@ serial8250_register_ports(struct uart_driver *drv, struct device *dev) - - #ifdef CONFIG_SERIAL_8250_CONSOLE - -+static void univ8250_console_write_atomic(struct console *co, const char *s, -+ unsigned int count) -+{ -+ struct uart_8250_port *up = &serial8250_ports[co->index]; -+ -+ serial8250_console_write_atomic(up, s, count); -+} -+ - static void univ8250_console_write(struct console *co, const char *s, - unsigned int count) - { -@@ -668,6 +687,7 @@ static int univ8250_console_match(struct console *co, char *name, int idx, - - static struct console univ8250_console = { - .name = "ttyS", -+ .write_atomic = univ8250_console_write_atomic, - .write = univ8250_console_write, - .device = uart_console_device, - .setup = univ8250_console_setup, -@@ -961,7 +981,7 @@ static void serial_8250_overrun_backoff_work(struct work_struct *work) - spin_lock_irqsave(&port->lock, flags); - up->ier |= UART_IER_RLSI | UART_IER_RDI; - up->port.read_status_mask |= UART_LSR_DR; -- serial_out(up, UART_IER, up->ier); -+ serial8250_set_IER(up, up->ier); - spin_unlock_irqrestore(&port->lock, flags); - } - -diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c -index 314a05e009df9..9809517de8270 100644 ---- a/drivers/tty/serial/8250/8250_exar.c -+++ b/drivers/tty/serial/8250/8250_exar.c -@@ -179,6 +179,8 @@ static void xr17v35x_set_divisor(struct uart_port *p, unsigned int baud, - - static int xr17v35x_startup(struct uart_port *port) - { -+ struct uart_8250_port *up = up_to_u8250p(port); -+ - /* - * First enable access to IER [7:5], ISR [5:4], FCR [5:4], - * MCR [7:5] and MSR [7:0] -@@ -189,7 +191,7 @@ static int xr17v35x_startup(struct uart_port *port) - * Make sure all interrups are masked until initialization is - * complete and the FIFOs are cleared - */ -- serial_port_out(port, UART_IER, 0); -+ serial8250_set_IER(up, 0); - - return serial8250_do_startup(port); - } -diff --git a/drivers/tty/serial/8250/8250_fsl.c b/drivers/tty/serial/8250/8250_fsl.c -index 8aad15622a2e5..74bb85b705e7f 100644 ---- a/drivers/tty/serial/8250/8250_fsl.c -+++ b/drivers/tty/serial/8250/8250_fsl.c -@@ -58,7 +58,8 @@ int fsl8250_handle_irq(struct uart_port *port) - if ((orig_lsr & UART_LSR_OE) && (up->overrun_backoff_time_ms > 0)) { - unsigned long delay; - -- up->ier = port->serial_in(port, UART_IER); -+ up->ier = serial8250_in_IER(up); -+ - if (up->ier & (UART_IER_RLSI | UART_IER_RDI)) { - port->ops->stop_rx(port); - } else { -diff --git a/drivers/tty/serial/8250/8250_ingenic.c b/drivers/tty/serial/8250/8250_ingenic.c -index 2b2f5d8d24b91..2b78e6c394fb9 100644 ---- a/drivers/tty/serial/8250/8250_ingenic.c -+++ b/drivers/tty/serial/8250/8250_ingenic.c -@@ -146,6 +146,7 @@ OF_EARLYCON_DECLARE(x1000_uart, "ingenic,x1000-uart", +diff -rupN linux-6.1.2.orig/drivers/tty/serial/8250/8250_ingenic.c linux-6.1.2/drivers/tty/serial/8250/8250_ingenic.c +--- linux-6.1.2.orig/drivers/tty/serial/8250/8250_ingenic.c 2022-12-31 16:12:07.662574772 -0500 ++++ linux-6.1.2/drivers/tty/serial/8250/8250_ingenic.c 2022-12-31 16:12:36.282153411 -0500 +@@ -146,6 +146,7 @@ OF_EARLYCON_DECLARE(x1000_uart, "ingenic static void ingenic_uart_serial_out(struct uart_port *p, int offset, int value) { @@ -3364,7 +3261,7 @@ index 2b2f5d8d24b91..2b78e6c394fb9 100644 int ier; switch (offset) { -@@ -167,7 +168,7 @@ static void ingenic_uart_serial_out(struct uart_port *p, int offset, int value) +@@ -167,7 +168,7 @@ static void ingenic_uart_serial_out(stru * If we have enabled modem status IRQs we should enable * modem mode. */ @@ -3373,11 +3270,10 @@ index 2b2f5d8d24b91..2b78e6c394fb9 100644 if (ier & UART_IER_MSI) value |= UART_MCR_MDCE | UART_MCR_FCM; -diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c -index fb1d5ec0940e6..3e7203909d6ae 100644 ---- a/drivers/tty/serial/8250/8250_mtk.c -+++ b/drivers/tty/serial/8250/8250_mtk.c -@@ -222,12 +222,40 @@ static void mtk8250_shutdown(struct uart_port *port) +diff -rupN linux-6.1.2.orig/drivers/tty/serial/8250/8250_mtk.c linux-6.1.2/drivers/tty/serial/8250/8250_mtk.c +--- linux-6.1.2.orig/drivers/tty/serial/8250/8250_mtk.c 2022-12-31 16:12:07.662574772 -0500 ++++ linux-6.1.2/drivers/tty/serial/8250/8250_mtk.c 2022-12-31 16:12:36.282153411 -0500 +@@ -222,12 +222,40 @@ static void mtk8250_shutdown(struct uart static void mtk8250_disable_intrs(struct uart_8250_port *up, int mask) { @@ -3420,11 +3316,10 @@ index fb1d5ec0940e6..3e7203909d6ae 100644 } static void mtk8250_set_flow_ctrl(struct uart_8250_port *up, int mode) -diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c -index 3f33014022f0e..594378d3c0652 100644 ---- a/drivers/tty/serial/8250/8250_omap.c -+++ b/drivers/tty/serial/8250/8250_omap.c -@@ -328,7 +328,7 @@ static void omap8250_restore_regs(struct uart_8250_port *up) +diff -rupN linux-6.1.2.orig/drivers/tty/serial/8250/8250_omap.c linux-6.1.2/drivers/tty/serial/8250/8250_omap.c +--- linux-6.1.2.orig/drivers/tty/serial/8250/8250_omap.c 2022-12-31 16:12:07.662574772 -0500 ++++ linux-6.1.2/drivers/tty/serial/8250/8250_omap.c 2022-12-31 16:12:36.282153411 -0500 +@@ -328,7 +328,7 @@ static void omap8250_restore_regs(struct /* drop TCR + TLR access, we setup XON/XOFF later */ serial8250_out_MCR(up, mcr); @@ -3433,7 +3328,7 @@ index 3f33014022f0e..594378d3c0652 100644 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); serial_dl_write(up, priv->quot); -@@ -518,7 +518,7 @@ static void omap_8250_pm(struct uart_port *port, unsigned int state, +@@ -518,7 +518,7 @@ static void omap_8250_pm(struct uart_por serial_out(up, UART_EFR, efr | UART_EFR_ECB); serial_out(up, UART_LCR, 0); @@ -3442,7 +3337,7 @@ index 3f33014022f0e..594378d3c0652 100644 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); serial_out(up, UART_EFR, efr); serial_out(up, UART_LCR, 0); -@@ -639,7 +639,7 @@ static irqreturn_t omap8250_irq(int irq, void *dev_id) +@@ -639,7 +639,7 @@ static irqreturn_t omap8250_irq(int irq, if ((lsr & UART_LSR_OE) && up->overrun_backoff_time_ms > 0) { unsigned long delay; @@ -3451,7 +3346,7 @@ index 3f33014022f0e..594378d3c0652 100644 if (up->ier & (UART_IER_RLSI | UART_IER_RDI)) { port->ops->stop_rx(port); } else { -@@ -698,7 +698,7 @@ static int omap_8250_startup(struct uart_port *port) +@@ -698,7 +698,7 @@ static int omap_8250_startup(struct uart goto err; up->ier = UART_IER_RLSI | UART_IER_RDI; @@ -3460,7 +3355,7 @@ index 3f33014022f0e..594378d3c0652 100644 #ifdef CONFIG_PM up->capabilities |= UART_CAP_RPM; -@@ -739,7 +739,7 @@ static void omap_8250_shutdown(struct uart_port *port) +@@ -739,7 +739,7 @@ static void omap_8250_shutdown(struct ua serial_out(up, UART_OMAP_EFR2, 0x0); up->ier = 0; @@ -3469,7 +3364,7 @@ index 3f33014022f0e..594378d3c0652 100644 if (up->dma) serial8250_release_dma(up); -@@ -787,7 +787,7 @@ static void omap_8250_unthrottle(struct uart_port *port) +@@ -787,7 +787,7 @@ static void omap_8250_unthrottle(struct up->dma->rx_dma(up); up->ier |= UART_IER_RLSI | UART_IER_RDI; port->read_status_mask |= UART_LSR_DR; @@ -3478,7 +3373,7 @@ index 3f33014022f0e..594378d3c0652 100644 spin_unlock_irqrestore(&port->lock, flags); pm_runtime_mark_last_busy(port->dev); -@@ -878,7 +878,7 @@ static void __dma_rx_complete(void *param) +@@ -878,7 +878,7 @@ static void __dma_rx_complete(void *para __dma_rx_do_complete(p); if (!priv->throttled) { p->ier |= UART_IER_RLSI | UART_IER_RDI; @@ -3487,7 +3382,7 @@ index 3f33014022f0e..594378d3c0652 100644 if (!(priv->habit & UART_HAS_EFR2)) omap_8250_rx_dma(p); } -@@ -935,7 +935,7 @@ static int omap_8250_rx_dma(struct uart_8250_port *p) +@@ -935,7 +935,7 @@ static int omap_8250_rx_dma(struct uart_ * callback to run. */ p->ier &= ~(UART_IER_RLSI | UART_IER_RDI); @@ -3496,7 +3391,7 @@ index 3f33014022f0e..594378d3c0652 100644 } goto out; } -@@ -1148,12 +1148,12 @@ static void am654_8250_handle_rx_dma(struct uart_8250_port *up, u8 iir, +@@ -1148,12 +1148,12 @@ static void am654_8250_handle_rx_dma(str * periodic timeouts, re-enable interrupts. */ up->ier &= ~(UART_IER_RLSI | UART_IER_RDI); @@ -3511,11 +3406,10 @@ index 3f33014022f0e..594378d3c0652 100644 } } -diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c -index 388172289627a..8dab3b7ab3c9e 100644 ---- a/drivers/tty/serial/8250/8250_port.c -+++ b/drivers/tty/serial/8250/8250_port.c -@@ -743,7 +743,7 @@ static void serial8250_set_sleep(struct uart_8250_port *p, int sleep) +diff -rupN linux-6.1.2.orig/drivers/tty/serial/8250/8250_port.c linux-6.1.2/drivers/tty/serial/8250/8250_port.c +--- linux-6.1.2.orig/drivers/tty/serial/8250/8250_port.c 2022-12-31 16:12:07.662574772 -0500 ++++ linux-6.1.2/drivers/tty/serial/8250/8250_port.c 2022-12-31 16:12:36.282153411 -0500 +@@ -743,7 +743,7 @@ static void serial8250_set_sleep(struct serial_out(p, UART_EFR, UART_EFR_ECB); serial_out(p, UART_LCR, 0); } @@ -3524,7 +3418,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 if (p->capabilities & UART_CAP_EFR) { serial_out(p, UART_LCR, UART_LCR_CONF_MODE_B); serial_out(p, UART_EFR, efr); -@@ -754,12 +754,29 @@ static void serial8250_set_sleep(struct uart_8250_port *p, int sleep) +@@ -754,12 +754,29 @@ static void serial8250_set_sleep(struct serial8250_rpm_put(p); } @@ -3558,7 +3452,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 } #ifdef CONFIG_SERIAL_8250_RSA -@@ -1025,8 +1042,11 @@ static int broken_efr(struct uart_8250_port *up) +@@ -1025,8 +1042,11 @@ static int broken_efr(struct uart_8250_p */ static void autoconfig_16550a(struct uart_8250_port *up) { @@ -3570,7 +3464,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 up->port.type = PORT_16550A; up->capabilities |= UART_CAP_FIFO; -@@ -1138,6 +1158,11 @@ static void autoconfig_16550a(struct uart_8250_port *up) +@@ -1138,6 +1158,11 @@ static void autoconfig_16550a(struct uar return; } @@ -3582,7 +3476,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 /* * Try writing and reading the UART_IER_UUE bit (b6). * If it works, this is probably one of the Xscale platform's -@@ -1173,6 +1198,9 @@ static void autoconfig_16550a(struct uart_8250_port *up) +@@ -1173,6 +1198,9 @@ static void autoconfig_16550a(struct uar } serial_out(up, UART_IER, iersave); @@ -3592,7 +3486,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 /* * We distinguish between 16550A and U6 16550A by counting * how many bytes are in the FIFO. -@@ -1195,8 +1223,10 @@ static void autoconfig(struct uart_8250_port *up) +@@ -1195,8 +1223,10 @@ static void autoconfig(struct uart_8250_ unsigned char status1, scratch, scratch2, scratch3; unsigned char save_lcr, save_mcr; struct uart_port *port = &up->port; @@ -3603,7 +3497,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 if (!port->iobase && !port->mapbase && !port->membase) return; -@@ -1214,6 +1244,11 @@ static void autoconfig(struct uart_8250_port *up) +@@ -1214,6 +1244,11 @@ static void autoconfig(struct uart_8250_ up->bugs = 0; if (!(port->flags & UPF_BUGGY_UART)) { @@ -3615,7 +3509,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 /* * Do a simple existence test first; if we fail this, * there's no point trying anything else. -@@ -1243,6 +1278,10 @@ static void autoconfig(struct uart_8250_port *up) +@@ -1243,6 +1278,10 @@ static void autoconfig(struct uart_8250_ #endif scratch3 = serial_in(up, UART_IER) & 0x0f; serial_out(up, UART_IER, scratch); @@ -3626,7 +3520,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 if (scratch2 != 0 || scratch3 != 0x0F) { /* * We failed; there's nothing here -@@ -1366,7 +1405,9 @@ static void autoconfig_irq(struct uart_8250_port *up) +@@ -1366,7 +1405,9 @@ static void autoconfig_irq(struct uart_8 unsigned char save_mcr, save_ier; unsigned char save_ICP = 0; unsigned int ICP = 0; @@ -3636,7 +3530,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 int irq; if (port->flags & UPF_FOURPORT) { -@@ -1376,8 +1417,12 @@ static void autoconfig_irq(struct uart_8250_port *up) +@@ -1376,8 +1417,12 @@ static void autoconfig_irq(struct uart_8 inb_p(ICP); } @@ -3650,7 +3544,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 /* forget possible initially masked and pending IRQ */ probe_irq_off(probe_irq_on()); -@@ -1409,8 +1454,10 @@ static void autoconfig_irq(struct uart_8250_port *up) +@@ -1409,8 +1454,10 @@ static void autoconfig_irq(struct uart_8 if (port->flags & UPF_FOURPORT) outb_p(save_ICP, ICP); @@ -3662,7 +3556,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 port->irq = (irq > 0) ? irq : 0; } -@@ -1423,7 +1470,7 @@ static void serial8250_stop_rx(struct uart_port *port) +@@ -1423,7 +1470,7 @@ static void serial8250_stop_rx(struct ua up->ier &= ~(UART_IER_RLSI | UART_IER_RDI); up->port.read_status_mask &= ~UART_LSR_DR; @@ -3671,7 +3565,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 serial8250_rpm_put(up); } -@@ -1453,7 +1500,7 @@ void serial8250_em485_stop_tx(struct uart_8250_port *p) +@@ -1453,7 +1500,7 @@ void serial8250_em485_stop_tx(struct uar serial8250_clear_and_reinit_fifos(p); p->ier |= UART_IER_RLSI | UART_IER_RDI; @@ -3680,7 +3574,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 } } EXPORT_SYMBOL_GPL(serial8250_em485_stop_tx); -@@ -1702,7 +1749,7 @@ static void serial8250_disable_ms(struct uart_port *port) +@@ -1702,7 +1749,7 @@ static void serial8250_disable_ms(struct mctrl_gpio_disable_ms(up->gpios); up->ier &= ~UART_IER_MSI; @@ -3689,7 +3583,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 } static void serial8250_enable_ms(struct uart_port *port) -@@ -1718,7 +1765,7 @@ static void serial8250_enable_ms(struct uart_port *port) +@@ -1718,7 +1765,7 @@ static void serial8250_enable_ms(struct up->ier |= UART_IER_MSI; serial8250_rpm_get(up); @@ -3698,7 +3592,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 serial8250_rpm_put(up); } -@@ -2155,8 +2202,7 @@ static void serial8250_put_poll_char(struct uart_port *port, +@@ -2155,8 +2202,7 @@ static void serial8250_put_poll_char(str /* * First save the IER then disable the interrupts */ @@ -3708,7 +3602,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 wait_for_xmitr(up, UART_LSR_BOTH_EMPTY); /* -@@ -2169,7 +2215,7 @@ static void serial8250_put_poll_char(struct uart_port *port, +@@ -2169,7 +2215,7 @@ static void serial8250_put_poll_char(str * and restore the IER */ wait_for_xmitr(up, UART_LSR_BOTH_EMPTY); @@ -3717,7 +3611,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 serial8250_rpm_put(up); } -@@ -2178,8 +2224,10 @@ static void serial8250_put_poll_char(struct uart_port *port, +@@ -2178,8 +2224,10 @@ static void serial8250_put_poll_char(str int serial8250_do_startup(struct uart_port *port) { struct uart_8250_port *up = up_to_u8250p(port); @@ -3728,7 +3622,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 int retval; u16 lsr; -@@ -2200,7 +2248,7 @@ int serial8250_do_startup(struct uart_port *port) +@@ -2200,7 +2248,7 @@ int serial8250_do_startup(struct uart_po up->acr = 0; serial_port_out(port, UART_LCR, UART_LCR_CONF_MODE_B); serial_port_out(port, UART_EFR, UART_EFR_ECB); @@ -3737,7 +3631,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 serial_port_out(port, UART_LCR, 0); serial_icr_write(up, UART_CSR, 0); /* Reset the UART */ serial_port_out(port, UART_LCR, UART_LCR_CONF_MODE_B); -@@ -2210,7 +2258,7 @@ int serial8250_do_startup(struct uart_port *port) +@@ -2210,7 +2258,7 @@ int serial8250_do_startup(struct uart_po if (port->type == PORT_DA830) { /* Reset the port */ @@ -3746,7 +3640,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 serial_port_out(port, UART_DA830_PWREMU_MGMT, 0); mdelay(10); -@@ -2309,6 +2357,8 @@ int serial8250_do_startup(struct uart_port *port) +@@ -2309,6 +2357,8 @@ int serial8250_do_startup(struct uart_po if (retval) goto out; @@ -3755,7 +3649,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 if (port->irq && !(up->port.flags & UPF_NO_THRE_TEST)) { unsigned char iir1; -@@ -2325,6 +2375,9 @@ int serial8250_do_startup(struct uart_port *port) +@@ -2325,6 +2375,9 @@ int serial8250_do_startup(struct uart_po */ spin_lock_irqsave(&port->lock, flags); @@ -3765,7 +3659,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 wait_for_xmitr(up, UART_LSR_THRE); serial_port_out_sync(port, UART_IER, UART_IER_THRI); udelay(1); /* allow THRE to set */ -@@ -2335,6 +2388,9 @@ int serial8250_do_startup(struct uart_port *port) +@@ -2335,6 +2388,9 @@ int serial8250_do_startup(struct uart_po iir = serial_port_in(port, UART_IIR); serial_port_out(port, UART_IER, 0); @@ -3775,7 +3669,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 spin_unlock_irqrestore(&port->lock, flags); if (port->irqflags & IRQF_SHARED) -@@ -2389,10 +2445,14 @@ int serial8250_do_startup(struct uart_port *port) +@@ -2389,10 +2445,14 @@ int serial8250_do_startup(struct uart_po * Do a quick test to see if we receive an interrupt when we enable * the TX irq. */ @@ -3790,7 +3684,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 if (lsr & UART_LSR_TEMT && iir & UART_IIR_NO_INT) { if (!(up->bugs & UART_BUG_TXEN)) { -@@ -2424,7 +2484,7 @@ int serial8250_do_startup(struct uart_port *port) +@@ -2424,7 +2484,7 @@ dont_test_tx_en: if (up->dma) { const char *msg = NULL; @@ -3799,7 +3693,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 msg = "forbid DMA for kernel console"; else if (serial8250_request_dma(up)) msg = "failed to request DMA"; -@@ -2475,7 +2535,7 @@ void serial8250_do_shutdown(struct uart_port *port) +@@ -2475,7 +2535,7 @@ void serial8250_do_shutdown(struct uart_ */ spin_lock_irqsave(&port->lock, flags); up->ier = 0; @@ -3808,7 +3702,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 spin_unlock_irqrestore(&port->lock, flags); synchronize_irq(port->irq); -@@ -2841,7 +2901,7 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, +@@ -2841,7 +2901,7 @@ serial8250_do_set_termios(struct uart_po if (up->capabilities & UART_CAP_RTOIE) up->ier |= UART_IER_RTOIE; @@ -3817,7 +3711,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 if (up->capabilities & UART_CAP_EFR) { unsigned char efr = 0; -@@ -3306,7 +3366,7 @@ EXPORT_SYMBOL_GPL(serial8250_set_defaults); +@@ -3306,7 +3366,7 @@ EXPORT_SYMBOL_GPL(serial8250_set_default #ifdef CONFIG_SERIAL_8250_CONSOLE @@ -3826,7 +3720,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 { struct uart_8250_port *up = up_to_u8250p(port); -@@ -3314,6 +3374,18 @@ static void serial8250_console_putchar(struct uart_port *port, unsigned char ch) +@@ -3314,6 +3374,18 @@ static void serial8250_console_putchar(s serial_port_out(port, UART_TX, ch); } @@ -3845,7 +3739,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 /* * Restore serial console when h/w power-off detected */ -@@ -3340,6 +3412,32 @@ static void serial8250_console_restore(struct uart_8250_port *up) +@@ -3340,6 +3412,32 @@ static void serial8250_console_restore(s serial8250_out_MCR(up, up->mcr | UART_MCR_DTR | UART_MCR_RTS); } @@ -3878,7 +3772,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 /* * Print a string to the serial port using the device FIFO * -@@ -3385,20 +3483,15 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s, +@@ -3385,20 +3483,15 @@ void serial8250_console_write(struct uar struct uart_port *port = &up->port; unsigned long flags; unsigned int ier, use_fifo; @@ -3901,7 +3795,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 /* check scratch reg to see if port powered off during system sleep */ if (up->canary && (up->canary != serial_port_in(port, UART_SCR))) { -@@ -3432,10 +3525,12 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s, +@@ -3432,10 +3525,12 @@ void serial8250_console_write(struct uar */ !(up->port.flags & UPF_CONS_FLOW); @@ -3914,7 +3808,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 /* * Finally, wait for transmitter to become empty -@@ -3448,8 +3543,7 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s, +@@ -3448,8 +3543,7 @@ void serial8250_console_write(struct uar if (em485->tx_stopped) up->rs485_stop_tx(up); } @@ -3924,7 +3818,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 /* * The receive handling will happen properly because the -@@ -3461,8 +3555,7 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s, +@@ -3461,8 +3555,7 @@ void serial8250_console_write(struct uar if (up->msr_saved_flags) serial8250_modem_status(up); @@ -3934,7 +3828,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 } static unsigned int probe_baud(struct uart_port *port) -@@ -3482,6 +3575,7 @@ static unsigned int probe_baud(struct uart_port *port) +@@ -3482,6 +3575,7 @@ static unsigned int probe_baud(struct ua int serial8250_console_setup(struct uart_port *port, char *options, bool probe) { @@ -3942,7 +3836,7 @@ index 388172289627a..8dab3b7ab3c9e 100644 int baud = 9600; int bits = 8; int parity = 'n'; -@@ -3491,6 +3585,8 @@ int serial8250_console_setup(struct uart_port *port, char *options, bool probe) +@@ -3491,6 +3585,8 @@ int serial8250_console_setup(struct uart if (!port->iobase && !port->membase) return -ENODEV; @@ -3951,10 +3845,9 @@ index 388172289627a..8dab3b7ab3c9e 100644 if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); else if (probe) -diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kconfig -index b0f62345bc846..bdd5ed63a4361 100644 ---- a/drivers/tty/serial/8250/Kconfig -+++ b/drivers/tty/serial/8250/Kconfig +diff -rupN linux-6.1.2.orig/drivers/tty/serial/8250/Kconfig linux-6.1.2/drivers/tty/serial/8250/Kconfig +--- linux-6.1.2.orig/drivers/tty/serial/8250/Kconfig 2022-12-31 16:12:07.662574772 -0500 ++++ linux-6.1.2/drivers/tty/serial/8250/Kconfig 2022-12-31 16:12:36.282153411 -0500 @@ -9,6 +9,7 @@ config SERIAL_8250 depends on !S390 select SERIAL_CORE @@ -3963,11 +3856,10 @@ index b0f62345bc846..bdd5ed63a4361 100644 help This selects whether you want to include the driver for the standard serial ports. The standard answer is Y. People who might say N -diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c -index 5cdced39eafdb..f991b18dda30e 100644 ---- a/drivers/tty/serial/amba-pl011.c -+++ b/drivers/tty/serial/amba-pl011.c -@@ -2308,18 +2308,24 @@ pl011_console_write(struct console *co, const char *s, unsigned int count) +diff -rupN linux-6.1.2.orig/drivers/tty/serial/amba-pl011.c linux-6.1.2/drivers/tty/serial/amba-pl011.c +--- linux-6.1.2.orig/drivers/tty/serial/amba-pl011.c 2022-12-31 16:12:07.662574772 -0500 ++++ linux-6.1.2/drivers/tty/serial/amba-pl011.c 2022-12-31 16:12:36.286153353 -0500 +@@ -2320,18 +2320,24 @@ pl011_console_write(struct console *co, { struct uart_amba_port *uap = amba_ports[co->index]; unsigned int old_cr = 0, new_cr; @@ -3996,7 +3888,7 @@ index 5cdced39eafdb..f991b18dda30e 100644 /* * First save the CR then disable the interrupts -@@ -2345,8 +2351,7 @@ pl011_console_write(struct console *co, const char *s, unsigned int count) +@@ -2357,8 +2363,7 @@ pl011_console_write(struct console *co, pl011_write(old_cr, uap, REG_CR); if (locked) @@ -4006,11 +3898,10 @@ index 5cdced39eafdb..f991b18dda30e 100644 clk_disable(uap->clk); } -diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c -index 7d0d2718ef595..aa216fdbcb1d7 100644 ---- a/drivers/tty/serial/omap-serial.c -+++ b/drivers/tty/serial/omap-serial.c -@@ -1241,13 +1241,10 @@ serial_omap_console_write(struct console *co, const char *s, +diff -rupN linux-6.1.2.orig/drivers/tty/serial/omap-serial.c linux-6.1.2/drivers/tty/serial/omap-serial.c +--- linux-6.1.2.orig/drivers/tty/serial/omap-serial.c 2022-12-31 16:12:07.666574712 -0500 ++++ linux-6.1.2/drivers/tty/serial/omap-serial.c 2022-12-31 16:12:36.286153353 -0500 +@@ -1241,13 +1241,10 @@ serial_omap_console_write(struct console unsigned int ier; int locked = 1; @@ -4027,7 +3918,7 @@ index 7d0d2718ef595..aa216fdbcb1d7 100644 /* * First save the IER then disable the interrupts -@@ -1274,8 +1271,7 @@ serial_omap_console_write(struct console *co, const char *s, +@@ -1274,8 +1271,7 @@ serial_omap_console_write(struct console check_modem_status(up); if (locked) @@ -4037,11 +3928,10 @@ index 7d0d2718ef595..aa216fdbcb1d7 100644 } static int __init -diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c -index d2b2720db6ca7..18e623325887f 100644 ---- a/drivers/tty/sysrq.c -+++ b/drivers/tty/sysrq.c -@@ -581,6 +581,7 @@ void __handle_sysrq(int key, bool check_mask) +diff -rupN linux-6.1.2.orig/drivers/tty/sysrq.c linux-6.1.2/drivers/tty/sysrq.c +--- linux-6.1.2.orig/drivers/tty/sysrq.c 2022-12-31 16:12:07.666574712 -0500 ++++ linux-6.1.2/drivers/tty/sysrq.c 2022-12-31 16:12:36.286153353 -0500 +@@ -581,6 +581,7 @@ void __handle_sysrq(int key, bool check_ rcu_sysrq_start(); rcu_read_lock(); @@ -4049,7 +3939,7 @@ index d2b2720db6ca7..18e623325887f 100644 /* * Raise the apparent loglevel to maximum so that the sysrq header * is shown to provide the user with positive feedback. We do not -@@ -622,6 +623,7 @@ void __handle_sysrq(int key, bool check_mask) +@@ -622,6 +623,7 @@ void __handle_sysrq(int key, bool check_ pr_cont("\n"); console_loglevel = orig_log_level; } @@ -4057,10 +3947,9 @@ index d2b2720db6ca7..18e623325887f 100644 rcu_read_unlock(); rcu_sysrq_end(); -diff --git a/drivers/vdpa/vdpa_user/iova_domain.h b/drivers/vdpa/vdpa_user/iova_domain.h -index 4e0e50e7ac153..173e979b84a93 100644 ---- a/drivers/vdpa/vdpa_user/iova_domain.h -+++ b/drivers/vdpa/vdpa_user/iova_domain.h +diff -rupN linux-6.1.2.orig/drivers/vdpa/vdpa_user/iova_domain.h linux-6.1.2/drivers/vdpa/vdpa_user/iova_domain.h +--- linux-6.1.2.orig/drivers/vdpa/vdpa_user/iova_domain.h 2022-12-31 16:12:07.706574112 -0500 ++++ linux-6.1.2/drivers/vdpa/vdpa_user/iova_domain.h 2022-12-31 16:12:36.286153353 -0500 @@ -14,7 +14,6 @@ #include #include @@ -4069,10 +3958,9 @@ index 4e0e50e7ac153..173e979b84a93 100644 #define IOVA_START_PFN 1 -diff --git a/include/linux/console.h b/include/linux/console.h -index 8c1686e2c2337..8a813cbaf9285 100644 ---- a/include/linux/console.h -+++ b/include/linux/console.h +diff -rupN linux-6.1.2.orig/include/linux/console.h linux-6.1.2/include/linux/console.h +--- linux-6.1.2.orig/include/linux/console.h 2022-12-31 16:12:07.866571712 -0500 ++++ linux-6.1.2/include/linux/console.h 2022-12-31 16:12:36.286153353 -0500 @@ -16,6 +16,7 @@ #include @@ -4137,10 +4025,9 @@ index 8c1686e2c2337..8a813cbaf9285 100644 CONSOLE_FLUSH_PENDING, CONSOLE_REPLAY_ALL, }; -diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h -index d95ab85f96ba5..3dc3704a3cdbb 100644 ---- a/include/linux/entry-common.h -+++ b/include/linux/entry-common.h +diff -rupN linux-6.1.2.orig/include/linux/entry-common.h linux-6.1.2/include/linux/entry-common.h +--- linux-6.1.2.orig/include/linux/entry-common.h 2022-12-31 16:12:07.870571652 -0500 ++++ linux-6.1.2/include/linux/entry-common.h 2022-12-31 16:12:36.286153353 -0500 @@ -57,9 +57,15 @@ # define ARCH_EXIT_TO_USER_MODE_WORK (0) #endif @@ -4158,11 +4045,10 @@ index d95ab85f96ba5..3dc3704a3cdbb 100644 ARCH_EXIT_TO_USER_MODE_WORK) /** -diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h -index a92bce40b04b3..bf82980f569df 100644 ---- a/include/linux/interrupt.h -+++ b/include/linux/interrupt.h -@@ -605,6 +605,35 @@ extern void __raise_softirq_irqoff(unsigned int nr); +diff -rupN linux-6.1.2.orig/include/linux/interrupt.h linux-6.1.2/include/linux/interrupt.h +--- linux-6.1.2.orig/include/linux/interrupt.h 2022-12-31 16:12:07.882571472 -0500 ++++ linux-6.1.2/include/linux/interrupt.h 2022-12-31 16:12:36.286153353 -0500 +@@ -605,6 +605,35 @@ extern void __raise_softirq_irqoff(unsig extern void raise_softirq_irqoff(unsigned int nr); extern void raise_softirq(unsigned int nr); @@ -4198,10 +4084,9 @@ index a92bce40b04b3..bf82980f569df 100644 DECLARE_PER_CPU(struct task_struct *, ksoftirqd); static inline struct task_struct *this_cpu_ksoftirqd(void) -diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h -index 1f1099dac3f05..1023f349af716 100644 ---- a/include/linux/lockdep.h -+++ b/include/linux/lockdep.h +diff -rupN linux-6.1.2.orig/include/linux/lockdep.h linux-6.1.2/include/linux/lockdep.h +--- linux-6.1.2.orig/include/linux/lockdep.h 2022-12-31 16:12:07.886571412 -0500 ++++ linux-6.1.2/include/linux/lockdep.h 2022-12-31 16:12:36.286153353 -0500 @@ -435,7 +435,6 @@ enum xhlock_context_t { XHLOCK_CTX_NR, }; @@ -4210,11 +4095,10 @@ index 1f1099dac3f05..1023f349af716 100644 /* * To initialize a lockdep_map statically use this macro. * Note that _name must not be NULL. -diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h -index eddf8ee270e74..46cc24349426b 100644 ---- a/include/linux/netdevice.h -+++ b/include/linux/netdevice.h -@@ -3156,7 +3156,11 @@ struct softnet_data { +diff -rupN linux-6.1.2.orig/include/linux/netdevice.h linux-6.1.2/include/linux/netdevice.h +--- linux-6.1.2.orig/include/linux/netdevice.h 2022-12-31 16:12:07.902571173 -0500 ++++ linux-6.1.2/include/linux/netdevice.h 2022-12-31 16:12:36.286153353 -0500 +@@ -3163,7 +3163,11 @@ struct softnet_data { int defer_count; int defer_ipi_scheduled; struct sk_buff *defer_list; @@ -4226,10 +4110,9 @@ index eddf8ee270e74..46cc24349426b 100644 }; static inline void input_queue_head_incr(struct softnet_data *sd) -diff --git a/include/linux/preempt.h b/include/linux/preempt.h -index 0df425bf9bd75..12f59cdaaedda 100644 ---- a/include/linux/preempt.h -+++ b/include/linux/preempt.h +diff -rupN linux-6.1.2.orig/include/linux/preempt.h linux-6.1.2/include/linux/preempt.h +--- linux-6.1.2.orig/include/linux/preempt.h 2022-12-31 16:12:07.918570933 -0500 ++++ linux-6.1.2/include/linux/preempt.h 2022-12-31 16:12:36.286153353 -0500 @@ -196,6 +196,20 @@ extern void preempt_count_sub(int val); #define preempt_count_inc() preempt_count_add(1) #define preempt_count_dec() preempt_count_sub(1) @@ -4333,10 +4216,9 @@ index 0df425bf9bd75..12f59cdaaedda 100644 #endif /* CONFIG_SMP */ -diff --git a/include/linux/printk.h b/include/linux/printk.h -index 8c81806c2e99f..f8c4e4fa6d7d5 100644 ---- a/include/linux/printk.h -+++ b/include/linux/printk.h +diff -rupN linux-6.1.2.orig/include/linux/printk.h linux-6.1.2/include/linux/printk.h +--- linux-6.1.2.orig/include/linux/printk.h 2022-12-31 16:12:07.918570933 -0500 ++++ linux-6.1.2/include/linux/printk.h 2022-12-31 16:12:36.286153353 -0500 @@ -168,6 +168,9 @@ extern void __printk_safe_exit(void); */ #define printk_deferred_enter __printk_safe_enter @@ -4347,7 +4229,7 @@ index 8c81806c2e99f..f8c4e4fa6d7d5 100644 /* * Please don't use printk_ratelimit(), because it shares ratelimiting state -@@ -219,6 +222,18 @@ static inline void printk_deferred_exit(void) +@@ -219,6 +222,18 @@ static inline void printk_deferred_exit( { } @@ -4366,11 +4248,10 @@ index 8c81806c2e99f..f8c4e4fa6d7d5 100644 static inline int printk_ratelimit(void) { return 0; -diff --git a/include/linux/sched.h b/include/linux/sched.h -index ffb6eb55cd135..a4c1e3638cb17 100644 ---- a/include/linux/sched.h -+++ b/include/linux/sched.h -@@ -2059,6 +2059,43 @@ static inline int test_tsk_need_resched(struct task_struct *tsk) +diff -rupN linux-6.1.2.orig/include/linux/sched.h linux-6.1.2/include/linux/sched.h +--- linux-6.1.2.orig/include/linux/sched.h 2022-12-31 16:12:07.922570872 -0500 ++++ linux-6.1.2/include/linux/sched.h 2022-12-31 16:12:36.286153353 -0500 +@@ -2059,6 +2059,43 @@ static inline int test_tsk_need_resched( return unlikely(test_tsk_thread_flag(tsk,TIF_NEED_RESCHED)); } @@ -4414,10 +4295,9 @@ index ffb6eb55cd135..a4c1e3638cb17 100644 /* * cond_resched() and cond_resched_lock(): latency reduction via * explicit rescheduling in places that are safe. The return -diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h -index 19376bee96676..4be94aa44d43c 100644 ---- a/include/linux/serial_8250.h -+++ b/include/linux/serial_8250.h +diff -rupN linux-6.1.2.orig/include/linux/serial_8250.h linux-6.1.2/include/linux/serial_8250.h +--- linux-6.1.2.orig/include/linux/serial_8250.h 2022-12-31 16:12:07.926570812 -0500 ++++ linux-6.1.2/include/linux/serial_8250.h 2022-12-31 16:12:36.286153353 -0500 @@ -7,6 +7,7 @@ #ifndef _LINUX_SERIAL_8250_H #define _LINUX_SERIAL_8250_H @@ -4435,7 +4315,7 @@ index 19376bee96676..4be94aa44d43c 100644 struct uart_8250_dma *dma; const struct uart_8250_ops *ops; -@@ -180,6 +183,8 @@ void serial8250_init_port(struct uart_8250_port *up); +@@ -180,6 +183,8 @@ void serial8250_init_port(struct uart_82 void serial8250_set_defaults(struct uart_8250_port *up); void serial8250_console_write(struct uart_8250_port *up, const char *s, unsigned int count); @@ -4444,11 +4324,10 @@ index 19376bee96676..4be94aa44d43c 100644 int serial8250_console_setup(struct uart_port *port, char *options, bool probe); int serial8250_console_exit(struct uart_port *port); -diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h -index 9f392ec76f2bb..779e0e96b9cb0 100644 ---- a/include/linux/thread_info.h -+++ b/include/linux/thread_info.h -@@ -177,7 +177,17 @@ static __always_inline unsigned long read_ti_thread_flags(struct thread_info *ti +diff -rupN linux-6.1.2.orig/include/linux/thread_info.h linux-6.1.2/include/linux/thread_info.h +--- linux-6.1.2.orig/include/linux/thread_info.h 2022-12-31 16:12:07.934570692 -0500 ++++ linux-6.1.2/include/linux/thread_info.h 2022-12-31 16:12:36.286153353 -0500 +@@ -177,7 +177,17 @@ static __always_inline unsigned long rea clear_ti_thread_flag(task_thread_info(t), TIF_##fl) #endif /* !CONFIG_GENERIC_ENTRY */ @@ -4467,10 +4346,9 @@ index 9f392ec76f2bb..779e0e96b9cb0 100644 #ifndef CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES static inline int arch_within_stack_frames(const void * const stack, -diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h -index 20749bd9db718..224bf60d6563c 100644 ---- a/include/linux/trace_events.h -+++ b/include/linux/trace_events.h +diff -rupN linux-6.1.2.orig/include/linux/trace_events.h linux-6.1.2/include/linux/trace_events.h +--- linux-6.1.2.orig/include/linux/trace_events.h 2022-12-31 16:12:07.934570692 -0500 ++++ linux-6.1.2/include/linux/trace_events.h 2022-12-31 16:12:36.286153353 -0500 @@ -70,6 +70,7 @@ struct trace_entry { unsigned char flags; unsigned char preempt_count; @@ -4479,7 +4357,7 @@ index 20749bd9db718..224bf60d6563c 100644 }; #define TRACE_EVENT_TYPE_MAX \ -@@ -159,9 +160,10 @@ static inline void tracing_generic_entry_update(struct trace_entry *entry, +@@ -159,9 +160,10 @@ static inline void tracing_generic_entry unsigned int trace_ctx) { entry->preempt_count = trace_ctx & 0xff; @@ -4505,11 +4383,10 @@ index 20749bd9db718..224bf60d6563c 100644 TRACE_FLAG_NMI = 0x40, TRACE_FLAG_BH_OFF = 0x80, }; -diff --git a/include/linux/u64_stats_sync.h b/include/linux/u64_stats_sync.h -index 46040d66334a8..ffe48e69b3f3a 100644 ---- a/include/linux/u64_stats_sync.h -+++ b/include/linux/u64_stats_sync.h -@@ -213,16 +213,4 @@ static inline bool u64_stats_fetch_retry(const struct u64_stats_sync *syncp, +diff -rupN linux-6.1.2.orig/include/linux/u64_stats_sync.h linux-6.1.2/include/linux/u64_stats_sync.h +--- linux-6.1.2.orig/include/linux/u64_stats_sync.h 2022-12-31 16:12:07.934570692 -0500 ++++ linux-6.1.2/include/linux/u64_stats_sync.h 2022-12-31 16:12:36.286153353 -0500 +@@ -213,16 +213,4 @@ static inline bool u64_stats_fetch_retry return __u64_stats_fetch_retry(syncp, start); } @@ -4526,10 +4403,9 @@ index 46040d66334a8..ffe48e69b3f3a 100644 -} - #endif /* _LINUX_U64_STATS_SYNC_H */ -diff --git a/init/Kconfig b/init/Kconfig -index 94125d3b6893c..b0357269f4a5b 100644 ---- a/init/Kconfig -+++ b/init/Kconfig +diff -rupN linux-6.1.2.orig/init/Kconfig linux-6.1.2/init/Kconfig +--- linux-6.1.2.orig/init/Kconfig 2022-12-31 16:12:07.998569732 -0500 ++++ linux-6.1.2/init/Kconfig 2022-12-31 16:12:36.286153353 -0500 @@ -1581,6 +1581,10 @@ config PRINTK very difficult to diagnose system problems, saying N here is strongly discouraged. @@ -4541,27 +4417,10 @@ index 94125d3b6893c..b0357269f4a5b 100644 config BUG bool "BUG() support" if EXPERT default y -diff --git a/kernel/Kconfig.preempt b/kernel/Kconfig.preempt -index c2f1fd95a8214..260c08efeb486 100644 ---- a/kernel/Kconfig.preempt -+++ b/kernel/Kconfig.preempt -@@ -1,5 +1,11 @@ - # SPDX-License-Identifier: GPL-2.0-only - -+config HAVE_PREEMPT_LAZY -+ bool -+ -+config PREEMPT_LAZY -+ def_bool y if HAVE_PREEMPT_LAZY && PREEMPT_RT -+ - config PREEMPT_NONE_BUILD - bool - -diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c -index 7b373a5e861f4..71d8eb131928d 100644 ---- a/kernel/bpf/syscall.c -+++ b/kernel/bpf/syscall.c -@@ -2117,11 +2117,11 @@ static void bpf_prog_get_stats(const struct bpf_prog *prog, +diff -rupN linux-6.1.2.orig/kernel/bpf/syscall.c linux-6.1.2/kernel/bpf/syscall.c +--- linux-6.1.2.orig/kernel/bpf/syscall.c 2022-12-31 16:12:08.006569613 -0500 ++++ linux-6.1.2/kernel/bpf/syscall.c 2022-12-31 16:12:36.286153353 -0500 +@@ -2117,11 +2117,11 @@ static void bpf_prog_get_stats(const str st = per_cpu_ptr(prog->stats, cpu); do { @@ -4575,11 +4434,10 @@ index 7b373a5e861f4..71d8eb131928d 100644 nsecs += tnsecs; cnt += tcnt; misses += tmisses; -diff --git a/kernel/entry/common.c b/kernel/entry/common.c -index 846add8394c41..51de1080cb93f 100644 ---- a/kernel/entry/common.c -+++ b/kernel/entry/common.c -@@ -155,7 +155,7 @@ static unsigned long exit_to_user_mode_loop(struct pt_regs *regs, +diff -rupN linux-6.1.2.orig/kernel/entry/common.c linux-6.1.2/kernel/entry/common.c +--- linux-6.1.2.orig/kernel/entry/common.c 2022-12-31 16:12:08.010569553 -0500 ++++ linux-6.1.2/kernel/entry/common.c 2022-12-31 16:12:36.286153353 -0500 +@@ -155,7 +155,7 @@ static unsigned long exit_to_user_mode_l local_irq_enable_exit_to_user(ti_work); @@ -4588,7 +4446,7 @@ index 846add8394c41..51de1080cb93f 100644 schedule(); if (ti_work & _TIF_UPROBE) -@@ -385,7 +385,7 @@ void raw_irqentry_exit_cond_resched(void) +@@ -385,7 +385,7 @@ void raw_irqentry_exit_cond_resched(void rcu_irq_exit_check_preempt(); if (IS_ENABLED(CONFIG_DEBUG_ENTRY)) WARN_ON_ONCE(!on_thread_stack()); @@ -4597,11 +4455,10 @@ index 846add8394c41..51de1080cb93f 100644 preempt_schedule_irq(); } } -diff --git a/kernel/hung_task.c b/kernel/hung_task.c -index c71889f3f3fc2..e2d2344cb9f4c 100644 ---- a/kernel/hung_task.c -+++ b/kernel/hung_task.c -@@ -127,6 +127,8 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout) +diff -rupN linux-6.1.2.orig/kernel/hung_task.c linux-6.1.2/kernel/hung_task.c +--- linux-6.1.2.orig/kernel/hung_task.c 2022-12-31 16:12:08.002569672 -0500 ++++ linux-6.1.2/kernel/hung_task.c 2022-12-31 16:12:36.286153353 -0500 +@@ -127,6 +127,8 @@ static void check_hung_task(struct task_ * complain: */ if (sysctl_hung_task_warnings) { @@ -4610,7 +4467,7 @@ index c71889f3f3fc2..e2d2344cb9f4c 100644 if (sysctl_hung_task_warnings > 0) sysctl_hung_task_warnings--; pr_err("INFO: task %s:%d blocked for more than %ld seconds.\n", -@@ -142,6 +144,8 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout) +@@ -142,6 +144,8 @@ static void check_hung_task(struct task_ if (sysctl_hung_task_all_cpu_backtrace) hung_task_show_all_bt = true; @@ -4619,7 +4476,7 @@ index c71889f3f3fc2..e2d2344cb9f4c 100644 } touch_nmi_watchdog(); -@@ -212,12 +216,17 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout) +@@ -212,12 +216,17 @@ static void check_hung_uninterruptible_t } unlock: rcu_read_unlock(); @@ -4638,10 +4495,24 @@ index c71889f3f3fc2..e2d2344cb9f4c 100644 } if (hung_task_call_panic) -diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c -index 65dba9076f312..ab18048e21864 100644 ---- a/kernel/ksysfs.c -+++ b/kernel/ksysfs.c +diff -rupN linux-6.1.2.orig/kernel/Kconfig.preempt linux-6.1.2/kernel/Kconfig.preempt +--- linux-6.1.2.orig/kernel/Kconfig.preempt 2022-12-31 16:12:08.002569672 -0500 ++++ linux-6.1.2/kernel/Kconfig.preempt 2022-12-31 16:12:36.286153353 -0500 +@@ -1,5 +1,11 @@ + # SPDX-License-Identifier: GPL-2.0-only + ++config HAVE_PREEMPT_LAZY ++ bool ++ ++config PREEMPT_LAZY ++ def_bool y if HAVE_PREEMPT_LAZY && PREEMPT_RT ++ + config PREEMPT_NONE_BUILD + bool + +diff -rupN linux-6.1.2.orig/kernel/ksysfs.c linux-6.1.2/kernel/ksysfs.c +--- linux-6.1.2.orig/kernel/ksysfs.c 2022-12-31 16:12:08.002569672 -0500 ++++ linux-6.1.2/kernel/ksysfs.c 2022-12-31 16:12:36.286153353 -0500 @@ -142,6 +142,15 @@ KERNEL_ATTR_RO(vmcoreinfo); #endif /* CONFIG_CRASH_CORE */ @@ -4658,20 +4529,19 @@ index 65dba9076f312..ab18048e21864 100644 /* whether file capabilities are enabled */ static ssize_t fscaps_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) -@@ -232,6 +241,9 @@ static struct attribute * kernel_attrs[] = { - #ifndef CONFIG_TINY_RCU +@@ -233,6 +242,9 @@ static struct attribute * kernel_attrs[] &rcu_expedited_attr.attr, &rcu_normal_attr.attr, -+#endif + #endif +#ifdef CONFIG_PREEMPT_RT + &realtime_attr.attr, - #endif ++#endif NULL }; -diff --git a/kernel/panic.c b/kernel/panic.c -index da323209f5833..dbd61a2cc6b16 100644 ---- a/kernel/panic.c -+++ b/kernel/panic.c + +diff -rupN linux-6.1.2.orig/kernel/panic.c linux-6.1.2/kernel/panic.c +--- linux-6.1.2.orig/kernel/panic.c 2022-12-31 16:12:08.006569613 -0500 ++++ linux-6.1.2/kernel/panic.c 2022-12-31 16:12:36.286153353 -0500 @@ -257,7 +257,6 @@ void panic(const char *fmt, ...) panic_smp_self_stop(); @@ -4708,7 +4578,7 @@ index da323209f5833..dbd61a2cc6b16 100644 crash_smp_send_stop(); } -@@ -601,6 +607,8 @@ void __warn(const char *file, int line, void *caller, unsigned taint, +@@ -601,6 +607,8 @@ void __warn(const char *file, int line, { disable_trace_on_warning(); @@ -4717,7 +4587,7 @@ index da323209f5833..dbd61a2cc6b16 100644 if (file) pr_warn("WARNING: CPU: %d PID: %d at %s:%d %pS\n", raw_smp_processor_id(), current->pid, file, line, -@@ -630,6 +638,8 @@ void __warn(const char *file, int line, void *caller, unsigned taint, +@@ -630,6 +638,8 @@ void __warn(const char *file, int line, /* Just a warning, don't kill lockdep. */ add_taint(taint, LOCKDEP_STILL_OK); @@ -4726,10 +4596,9 @@ index da323209f5833..dbd61a2cc6b16 100644 } #ifndef __WARN_FLAGS -diff --git a/kernel/printk/internal.h b/kernel/printk/internal.h -index d947ca6c84f99..e7d8578860adf 100644 ---- a/kernel/printk/internal.h -+++ b/kernel/printk/internal.h +diff -rupN linux-6.1.2.orig/kernel/printk/internal.h linux-6.1.2/kernel/printk/internal.h +--- linux-6.1.2.orig/kernel/printk/internal.h 2022-12-31 16:12:08.014569493 -0500 ++++ linux-6.1.2/kernel/printk/internal.h 2022-12-31 16:12:36.286153353 -0500 @@ -20,6 +20,8 @@ enum printk_info_flags { LOG_CONT = 8, /* text is a fragment of a continuation line */ }; @@ -4739,10 +4608,9 @@ index d947ca6c84f99..e7d8578860adf 100644 __printf(4, 0) int vprintk_store(int facility, int level, const struct dev_printk_info *dev_info, -diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c -index e4f1e7478b521..581f92acf05ac 100644 ---- a/kernel/printk/printk.c -+++ b/kernel/printk/printk.c +diff -rupN linux-6.1.2.orig/kernel/printk/printk.c linux-6.1.2/kernel/printk/printk.c +--- linux-6.1.2.orig/kernel/printk/printk.c 2022-12-31 16:12:08.014569493 -0500 ++++ linux-6.1.2/kernel/printk/printk.c 2022-12-31 16:12:36.286153353 -0500 @@ -44,6 +44,7 @@ #include #include @@ -4751,11 +4619,10 @@ index e4f1e7478b521..581f92acf05ac 100644 #include #include #include -@@ -220,6 +221,36 @@ int devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write, - } +@@ -221,6 +222,36 @@ int devkmsg_sysctl_set_loglvl(struct ctl #endif /* CONFIG_PRINTK && CONFIG_SYSCTL */ -+/* + /* + * Used to synchronize printing kthreads against direct printing via + * console_trylock/console_unlock. + * @@ -4785,9 +4652,10 @@ index e4f1e7478b521..581f92acf05ac 100644 +/* Block console kthreads to avoid processing new messages. */ +bool block_console_kthreads; + - /* ++/* * Helper macros to handle lockdep when locking/unlocking console_sem. We use * macros instead of functions so that _RET_IP_ contains useful information. + */ @@ -268,14 +299,49 @@ static bool panic_in_progress(void) } @@ -4801,15 +4669,15 @@ index e4f1e7478b521..581f92acf05ac 100644 + * Tracks whether kthread printers are all blocked. A value of true implies + * that the console is locked via console_lock() or the console is suspended. + * Writing to this variable requires holding @console_sem. - */ --static int console_locked, console_suspended; ++ */ +static bool console_kthreads_blocked; + +/* + * Block all kthread printers from a schedulable context. + * + * Requires holding @console_sem. -+ */ + */ +-static int console_locked, console_suspended; +static void console_kthreads_block(void) +{ + struct console *con; @@ -4845,7 +4713,7 @@ index e4f1e7478b521..581f92acf05ac 100644 /* * Array of consoles built from command line options (console=) -@@ -358,7 +424,75 @@ static int console_msg_format = MSG_FORMAT_DEFAULT; +@@ -358,7 +424,75 @@ static int console_msg_format = MSG_FORM /* syslog_lock protects syslog_* variables and write access to clear_seq. */ static DEFINE_MUTEX(syslog_lock); @@ -4921,7 +4789,7 @@ index e4f1e7478b521..581f92acf05ac 100644 DECLARE_WAIT_QUEUE_HEAD(log_wait); /* All 3 protected by @syslog_lock. */ /* the next printk record to read by syslog(READ) or /proc/kmsg */ -@@ -1847,6 +1981,7 @@ static int console_lock_spinning_disable_and_check(void) +@@ -1847,6 +1981,7 @@ static int console_lock_spinning_disable return 1; } @@ -4929,7 +4797,7 @@ index e4f1e7478b521..581f92acf05ac 100644 /** * console_trylock_spinning - try to get console_lock by busy waiting * -@@ -1920,6 +2055,7 @@ static int console_trylock_spinning(void) +@@ -1920,6 +2055,7 @@ static int console_trylock_spinning(void return 1; } @@ -4937,7 +4805,7 @@ index e4f1e7478b521..581f92acf05ac 100644 /* * Call the specified console driver, asking it to write out the specified -@@ -1927,19 +2063,28 @@ static int console_trylock_spinning(void) +@@ -1927,19 +2063,28 @@ static int console_trylock_spinning(void * dropped, a dropped message will be written out first. */ static void call_console_driver(struct console *con, const char *text, size_t len, @@ -4972,7 +4840,7 @@ index e4f1e7478b521..581f92acf05ac 100644 } /* -@@ -2249,10 +2394,22 @@ asmlinkage int vprintk_emit(int facility, int level, +@@ -2249,10 +2394,22 @@ asmlinkage int vprintk_emit(int facility printed_len = vprintk_store(facility, level, dev_info, fmt, args); /* If called from the scheduler, we can not call up(). */ @@ -4997,7 +4865,7 @@ index e4f1e7478b521..581f92acf05ac 100644 * printing of all remaining records to all consoles so that * this context can return as soon as possible. Hopefully * another printk() caller will take over the printing. -@@ -2267,6 +2424,7 @@ asmlinkage int vprintk_emit(int facility, int level, +@@ -2267,6 +2424,7 @@ asmlinkage int vprintk_emit(int facility if (console_trylock_spinning()) console_unlock(); preempt_enable(); @@ -5005,7 +4873,7 @@ index e4f1e7478b521..581f92acf05ac 100644 } wake_up_klogd(); -@@ -2293,9 +2451,81 @@ asmlinkage __visible int _printk(const char *fmt, ...) +@@ -2293,9 +2451,81 @@ asmlinkage __visible int _printk(const c } EXPORT_SYMBOL(_printk); @@ -5087,7 +4955,7 @@ index e4f1e7478b521..581f92acf05ac 100644 #else /* CONFIG_PRINTK */ #define CONSOLE_LOG_MAX 0 -@@ -2306,6 +2536,8 @@ static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progre +@@ -2306,6 +2536,8 @@ static bool __pr_flush(struct console *c #define prb_first_valid_seq(rb) 0 #define prb_next_seq(rb) 0 @@ -5096,7 +4964,7 @@ index e4f1e7478b521..581f92acf05ac 100644 static u64 syslog_seq; static size_t record_print_text(const struct printk_record *r, -@@ -2324,12 +2556,14 @@ static ssize_t msg_print_ext_body(char *buf, size_t size, +@@ -2324,12 +2556,14 @@ static ssize_t msg_print_ext_body(char * static void console_lock_spinning_enable(void) { } static int console_lock_spinning_disable_and_check(void) { return 0; } static void call_console_driver(struct console *con, const char *text, size_t len, @@ -5112,7 +4980,7 @@ index e4f1e7478b521..581f92acf05ac 100644 #endif /* CONFIG_PRINTK */ -@@ -2548,6 +2782,14 @@ static int console_cpu_notify(unsigned int cpu) +@@ -2548,6 +2782,14 @@ static int console_cpu_notify(unsigned i /* If trylock fails, someone else is doing the printing */ if (console_trylock()) console_unlock(); @@ -5169,7 +5037,7 @@ index e4f1e7478b521..581f92acf05ac 100644 } EXPORT_SYMBOL(is_console_locked); -@@ -2619,18 +2876,9 @@ static bool abandon_console_lock_in_panic(void) +@@ -2619,18 +2876,9 @@ static bool abandon_console_lock_in_pani return atomic_read(&panic_cpu) != raw_smp_processor_id(); } @@ -5190,7 +5058,7 @@ index e4f1e7478b521..581f92acf05ac 100644 return false; /* -@@ -2639,18 +2887,116 @@ static inline bool console_is_usable(struct console *con) +@@ -2639,18 +2887,116 @@ static inline bool console_is_usable(str * cope (CON_ANYTIME) don't call them until this CPU is officially up. */ if (!cpu_online(raw_smp_processor_id()) && @@ -5348,10 +5216,10 @@ index e4f1e7478b521..581f92acf05ac 100644 - *handover = false; + if (handover) + *handover = false; ++ ++ seq = read_console_seq(con); - if (!prb_read_valid(prb, con->seq, &r)) -+ seq = read_console_seq(con); -+ + if (!prb_read_valid(prb, seq, &r)) return false; @@ -5368,7 +5236,7 @@ index e4f1e7478b521..581f92acf05ac 100644 suppress_panic_printk = 1; pr_warn_once("Too many dropped messages. Suppress messages on non-panic CPUs to prevent livelock.\n"); } -@@ -2700,7 +3057,7 @@ static bool console_emit_next_record(struct console *con, char *text, char *ext_ +@@ -2700,7 +3057,7 @@ static bool console_emit_next_record(str /* Skip record that has level above the console loglevel. */ if (suppress_message_printing(r.info->level)) { @@ -5377,7 +5245,7 @@ index e4f1e7478b521..581f92acf05ac 100644 goto skip; } -@@ -2714,31 +3071,65 @@ static bool console_emit_next_record(struct console *con, char *text, char *ext_ +@@ -2714,32 +3071,66 @@ static bool console_emit_next_record(str len = record_print_text(&r, console_msg_format & MSG_FORMAT_SYSLOG, printk_time); } @@ -5430,7 +5298,7 @@ index e4f1e7478b521..581f92acf05ac 100644 return true; } -+/* + /* + * Print a record for a given console, but allow another printk() caller to + * take over the console_lock and continue printing. + * @@ -5458,10 +5326,11 @@ index e4f1e7478b521..581f92acf05ac 100644 + return __console_emit_next_record(con, text, ext_text, dropped_text, false, handover); +} + - /* ++/* * Print out all remaining records to all consoles. * -@@ -2757,8 +3148,8 @@ static bool console_emit_next_record(struct console *con, char *text, char *ext_ + * @do_cond_resched is set by the caller. It can be true only in schedulable +@@ -2757,8 +3148,8 @@ skip: * were flushed to all usable consoles. A returned false informs the caller * that everything was not flushed (either there were no usable consoles or * another context has taken over printing or it is a panic situation and this @@ -5472,7 +5341,7 @@ index e4f1e7478b521..581f92acf05ac 100644 * * Requires the console_lock. */ -@@ -2775,24 +3166,26 @@ static bool console_flush_all(bool do_cond_resched, u64 *next_seq, bool *handove +@@ -2775,24 +3166,26 @@ static bool console_flush_all(bool do_co *handover = false; do { @@ -5506,7 +5375,7 @@ index e4f1e7478b521..581f92acf05ac 100644 } if (*handover) return false; -@@ -2817,6 +3210,68 @@ static bool console_flush_all(bool do_cond_resched, u64 *next_seq, bool *handove +@@ -2817,6 +3210,68 @@ static bool console_flush_all(bool do_co return any_usable; } @@ -5602,7 +5471,7 @@ index e4f1e7478b521..581f92acf05ac 100644 /* * If someone else is holding the console lock, trylock will fail * and may_schedule may be set. Ignore and proceed to unlock so -@@ -2945,7 +3408,7 @@ void console_flush_on_panic(enum con_flush_mode mode) +@@ -2945,7 +3408,7 @@ void console_flush_on_panic(enum con_flu seq = prb_first_valid_seq(prb); for_each_console(c) @@ -5611,7 +5480,7 @@ index e4f1e7478b521..581f92acf05ac 100644 } console_unlock(); } -@@ -3185,16 +3648,27 @@ void register_console(struct console *newcon) +@@ -3185,16 +3648,27 @@ void register_console(struct console *ne console_drivers->next = newcon; } @@ -5650,7 +5519,7 @@ index e4f1e7478b521..581f92acf05ac 100644 struct console *con; int res; -@@ -3255,9 +3730,26 @@ int unregister_console(struct console *console) +@@ -3255,9 +3730,26 @@ int unregister_console(struct console *c console_drivers->flags |= CON_CONSDEV; console->flags &= ~CON_ENABLED; @@ -5698,7 +5567,7 @@ index e4f1e7478b521..581f92acf05ac 100644 #if defined CONFIG_PRINTK /* If @con is specified, only wait for that console. Otherwise wait for all. */ static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progress) -@@ -3374,7 +3880,7 @@ static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progre +@@ -3374,7 +3880,7 @@ static bool __pr_flush(struct console *c for_each_console(c) { if (con && con != c) continue; @@ -5707,7 +5576,7 @@ index e4f1e7478b521..581f92acf05ac 100644 continue; printk_seq = c->seq; if (printk_seq < seq) -@@ -3433,11 +3939,214 @@ static bool pr_flush(int timeout_ms, bool reset_on_progress) +@@ -3433,11 +3939,214 @@ static bool pr_flush(int timeout_ms, boo return __pr_flush(NULL, timeout_ms, reset_on_progress); } @@ -5924,7 +5793,7 @@ index e4f1e7478b521..581f92acf05ac 100644 static DEFINE_PER_CPU(int, printk_pending); -@@ -3445,10 +4154,14 @@ static void wake_up_klogd_work_func(struct irq_work *irq_work) +@@ -3445,10 +4154,14 @@ static void wake_up_klogd_work_func(stru { int pending = this_cpu_xchg(printk_pending, 0); @@ -5973,10 +5842,9 @@ index e4f1e7478b521..581f92acf05ac 100644 } void printk_trigger_flush(void) -diff --git a/kernel/printk/printk_safe.c b/kernel/printk/printk_safe.c -index ef0f9a2044da1..caac4de1ea59a 100644 ---- a/kernel/printk/printk_safe.c -+++ b/kernel/printk/printk_safe.c +diff -rupN linux-6.1.2.orig/kernel/printk/printk_safe.c linux-6.1.2/kernel/printk/printk_safe.c +--- linux-6.1.2.orig/kernel/printk/printk_safe.c 2022-12-31 16:12:08.014569493 -0500 ++++ linux-6.1.2/kernel/printk/printk_safe.c 2022-12-31 16:12:36.286153353 -0500 @@ -8,7 +8,9 @@ #include #include @@ -5987,7 +5855,7 @@ index ef0f9a2044da1..caac4de1ea59a 100644 #include "internal.h" -@@ -50,3 +52,33 @@ asmlinkage int vprintk(const char *fmt, va_list args) +@@ -50,3 +52,33 @@ asmlinkage int vprintk(const char *fmt, return vprintk_default(fmt, args); } EXPORT_SYMBOL(vprintk); @@ -6021,11 +5889,10 @@ index ef0f9a2044da1..caac4de1ea59a 100644 + timeout_ms -= 1; + } +} -diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c -index 503c2aa845a4a..dcd8c0e44c000 100644 ---- a/kernel/rcu/rcutorture.c -+++ b/kernel/rcu/rcutorture.c -@@ -2363,6 +2363,12 @@ static int rcutorture_booster_init(unsigned int cpu) +diff -rupN linux-6.1.2.orig/kernel/rcu/rcutorture.c linux-6.1.2/kernel/rcu/rcutorture.c +--- linux-6.1.2.orig/kernel/rcu/rcutorture.c 2022-12-31 16:12:08.018569433 -0500 ++++ linux-6.1.2/kernel/rcu/rcutorture.c 2022-12-31 16:12:36.290153295 -0500 +@@ -2363,6 +2363,12 @@ static int rcutorture_booster_init(unsig WARN_ON_ONCE(!t); sp.sched_priority = 2; sched_setscheduler_nocheck(t, SCHED_FIFO, &sp); @@ -6038,11 +5905,10 @@ index 503c2aa845a4a..dcd8c0e44c000 100644 } /* Don't allow time recalculation while creating a new task. */ -diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h -index 5653560573e22..dcbbcf93d608a 100644 ---- a/kernel/rcu/tree_stall.h -+++ b/kernel/rcu/tree_stall.h -@@ -642,6 +642,7 @@ static void print_cpu_stall(unsigned long gps) +diff -rupN linux-6.1.2.orig/kernel/rcu/tree_stall.h linux-6.1.2/kernel/rcu/tree_stall.h +--- linux-6.1.2.orig/kernel/rcu/tree_stall.h 2022-12-31 16:12:08.018569433 -0500 ++++ linux-6.1.2/kernel/rcu/tree_stall.h 2022-12-31 16:12:36.290153295 -0500 +@@ -642,6 +642,7 @@ static void print_cpu_stall(unsigned lon * See Documentation/RCU/stallwarn.rst for info on how to debug * RCU CPU stall warnings. */ @@ -6050,7 +5916,7 @@ index 5653560573e22..dcbbcf93d608a 100644 trace_rcu_stall_warning(rcu_state.name, TPS("SelfDetected")); pr_err("INFO: %s self-detected stall on CPU\n", rcu_state.name); raw_spin_lock_irqsave_rcu_node(rdp->mynode, flags); -@@ -676,6 +677,7 @@ static void print_cpu_stall(unsigned long gps) +@@ -676,6 +677,7 @@ static void print_cpu_stall(unsigned lon */ set_tsk_need_resched(current); set_preempt_need_resched(); @@ -6058,10 +5924,9 @@ index 5653560573e22..dcbbcf93d608a 100644 } static void check_cpu_stall(struct rcu_data *rdp) -diff --git a/kernel/reboot.c b/kernel/reboot.c -index 3bba88c7ffc6b..57cedc3306603 100644 ---- a/kernel/reboot.c -+++ b/kernel/reboot.c +diff -rupN linux-6.1.2.orig/kernel/reboot.c linux-6.1.2/kernel/reboot.c +--- linux-6.1.2.orig/kernel/reboot.c 2022-12-31 16:12:08.006569613 -0500 ++++ linux-6.1.2/kernel/reboot.c 2022-12-31 16:12:36.290153295 -0500 @@ -82,6 +82,7 @@ void kernel_restart_prepare(char *cmd) { blocking_notifier_call_chain(&reboot_notifier_list, SYS_RESTART, cmd); @@ -6070,7 +5935,7 @@ index 3bba88c7ffc6b..57cedc3306603 100644 usermodehelper_disable(); device_shutdown(); } -@@ -282,6 +283,7 @@ static void kernel_shutdown_prepare(enum system_states state) +@@ -282,6 +283,7 @@ static void kernel_shutdown_prepare(enum blocking_notifier_call_chain(&reboot_notifier_list, (state == SYSTEM_HALT) ? SYS_HALT : SYS_POWER_OFF, NULL); system_state = state; @@ -6090,7 +5955,7 @@ index 3bba88c7ffc6b..57cedc3306603 100644 } return ret; -@@ -851,6 +855,7 @@ static int __orderly_poweroff(bool force) +@@ -851,6 +855,7 @@ static int __orderly_poweroff(bool force ret = run_cmd(poweroff_cmd); if (ret && force) { @@ -6098,7 +5963,7 @@ index 3bba88c7ffc6b..57cedc3306603 100644 pr_warn("Failed to start orderly shutdown: forcing the issue\n"); /* -@@ -860,6 +865,7 @@ static int __orderly_poweroff(bool force) +@@ -860,6 +865,7 @@ static int __orderly_poweroff(bool force */ emergency_sync(); kernel_power_off(); @@ -6115,7 +5980,7 @@ index 3bba88c7ffc6b..57cedc3306603 100644 /* * We have reached here after the emergency shutdown waiting period has * expired. This means orderly_poweroff has not been able to shut off -@@ -933,6 +941,8 @@ static void hw_failure_emergency_poweroff_func(struct work_struct *work) +@@ -933,6 +941,8 @@ static void hw_failure_emergency_powerof */ pr_emerg("Hardware protection shutdown failed. Trying emergency restart\n"); emergency_restart(); @@ -6124,7 +5989,7 @@ index 3bba88c7ffc6b..57cedc3306603 100644 } static DECLARE_DELAYED_WORK(hw_failure_emergency_poweroff_work, -@@ -971,11 +981,13 @@ void hw_protection_shutdown(const char *reason, int ms_until_forced) +@@ -971,11 +981,13 @@ void hw_protection_shutdown(const char * { static atomic_t allow_proceed = ATOMIC_INIT(1); @@ -6139,7 +6004,7 @@ index 3bba88c7ffc6b..57cedc3306603 100644 /* * Queue a backup emergency shutdown in the event of -@@ -983,6 +995,8 @@ void hw_protection_shutdown(const char *reason, int ms_until_forced) +@@ -983,6 +995,8 @@ void hw_protection_shutdown(const char * */ hw_failure_emergency_poweroff(ms_until_forced); orderly_poweroff(true); @@ -6148,10 +6013,9 @@ index 3bba88c7ffc6b..57cedc3306603 100644 } EXPORT_SYMBOL_GPL(hw_protection_shutdown); -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index daff72f003858..44d1c2133964f 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c +diff -rupN linux-6.1.2.orig/kernel/sched/core.c linux-6.1.2/kernel/sched/core.c +--- linux-6.1.2.orig/kernel/sched/core.c 2022-12-31 16:12:08.018569433 -0500 ++++ linux-6.1.2/kernel/sched/core.c 2022-12-31 16:12:36.290153295 -0500 @@ -1040,6 +1040,46 @@ void resched_curr(struct rq *rq) trace_sched_wake_idle_without_ipi(cpu); } @@ -6215,7 +6079,7 @@ index daff72f003858..44d1c2133964f 100644 preempt_enable(); } EXPORT_SYMBOL_GPL(migrate_enable); -@@ -3245,6 +3287,76 @@ int migrate_swap(struct task_struct *cur, struct task_struct *p, +@@ -3245,6 +3287,76 @@ out: } #endif /* CONFIG_NUMA_BALANCING */ @@ -6292,7 +6156,7 @@ index daff72f003858..44d1c2133964f 100644 /* * wait_task_inactive - wait for a thread to unschedule. * -@@ -3263,7 +3375,7 @@ int migrate_swap(struct task_struct *cur, struct task_struct *p, +@@ -3263,7 +3375,7 @@ out: */ unsigned long wait_task_inactive(struct task_struct *p, unsigned int match_state) { @@ -6301,7 +6165,7 @@ index daff72f003858..44d1c2133964f 100644 struct rq_flags rf; unsigned long ncsw; struct rq *rq; -@@ -3289,7 +3401,7 @@ unsigned long wait_task_inactive(struct task_struct *p, unsigned int match_state +@@ -3289,7 +3401,7 @@ unsigned long wait_task_inactive(struct * is actually now running somewhere else! */ while (task_on_cpu(rq, p)) { @@ -6310,7 +6174,7 @@ index daff72f003858..44d1c2133964f 100644 return 0; cpu_relax(); } -@@ -3302,9 +3414,10 @@ unsigned long wait_task_inactive(struct task_struct *p, unsigned int match_state +@@ -3302,9 +3414,10 @@ unsigned long wait_task_inactive(struct rq = task_rq_lock(p, &rf); trace_sched_wait_task(p); running = task_on_cpu(rq, p); @@ -6323,7 +6187,7 @@ index daff72f003858..44d1c2133964f 100644 ncsw = p->nvcsw | LONG_MIN; /* sets MSB */ task_rq_unlock(rq, p, &rf); -@@ -3334,7 +3447,7 @@ unsigned long wait_task_inactive(struct task_struct *p, unsigned int match_state +@@ -3334,7 +3447,7 @@ unsigned long wait_task_inactive(struct * running right now), it's preempted, and we should * yield - it could be a while. */ @@ -6332,7 +6196,7 @@ index daff72f003858..44d1c2133964f 100644 ktime_t to = NSEC_PER_SEC / HZ; set_current_state(TASK_UNINTERRUPTIBLE); -@@ -4615,6 +4728,9 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p) +@@ -4615,6 +4728,9 @@ int sched_fork(unsigned long clone_flags p->on_cpu = 0; #endif init_task_preempt_count(p); @@ -6342,7 +6206,7 @@ index daff72f003858..44d1c2133964f 100644 #ifdef CONFIG_SMP plist_node_init(&p->pushable_tasks, MAX_PRIO); RB_CLEAR_NODE(&p->pushable_dl_tasks); -@@ -6484,6 +6600,7 @@ static void __sched notrace __schedule(unsigned int sched_mode) +@@ -6484,6 +6600,7 @@ static void __sched notrace __schedule(u next = pick_next_task(rq, prev, &rf); clear_tsk_need_resched(prev); @@ -6350,7 +6214,7 @@ index daff72f003858..44d1c2133964f 100644 clear_preempt_need_resched(); #ifdef CONFIG_SCHED_DEBUG rq->last_seen_need_resched_ns = 0; -@@ -6698,6 +6815,30 @@ static void __sched notrace preempt_schedule_common(void) +@@ -6698,6 +6815,30 @@ static void __sched notrace preempt_sche } while (need_resched()); } @@ -6381,7 +6245,7 @@ index daff72f003858..44d1c2133964f 100644 #ifdef CONFIG_PREEMPTION /* * This is the entry point to schedule() from in-kernel preemption -@@ -6711,6 +6852,8 @@ asmlinkage __visible void __sched notrace preempt_schedule(void) +@@ -6711,6 +6852,8 @@ asmlinkage __visible void __sched notrac */ if (likely(!preemptible())) return; @@ -6390,7 +6254,7 @@ index daff72f003858..44d1c2133964f 100644 preempt_schedule_common(); } NOKPROBE_SYMBOL(preempt_schedule); -@@ -6758,6 +6901,9 @@ asmlinkage __visible void __sched notrace preempt_schedule_notrace(void) +@@ -6758,6 +6901,9 @@ asmlinkage __visible void __sched notrac if (likely(!preemptible())) return; @@ -6400,7 +6264,7 @@ index daff72f003858..44d1c2133964f 100644 do { /* * Because the function tracer can trace preempt_count_sub() -@@ -9015,7 +9161,9 @@ void __init init_idle(struct task_struct *idle, int cpu) +@@ -9015,7 +9161,9 @@ void __init init_idle(struct task_struct /* Set the preempt count _outside_ the spinlocks! */ init_idle_preempt_count(idle, cpu); @@ -6411,11 +6275,10 @@ index daff72f003858..44d1c2133964f 100644 /* * The idle tasks have their own, simple scheduling class: */ -diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c -index e4a0b8bd941c7..7f1d2c0b744d9 100644 ---- a/kernel/sched/fair.c -+++ b/kernel/sched/fair.c -@@ -4756,7 +4756,7 @@ check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr) +diff -rupN linux-6.1.2.orig/kernel/sched/fair.c linux-6.1.2/kernel/sched/fair.c +--- linux-6.1.2.orig/kernel/sched/fair.c 2022-12-31 16:12:08.018569433 -0500 ++++ linux-6.1.2/kernel/sched/fair.c 2022-12-31 16:12:36.290153295 -0500 +@@ -4883,7 +4883,7 @@ check_preempt_tick(struct cfs_rq *cfs_rq ideal_runtime = sched_slice(cfs_rq, curr); delta_exec = curr->sum_exec_runtime - curr->prev_sum_exec_runtime; if (delta_exec > ideal_runtime) { @@ -6424,7 +6287,7 @@ index e4a0b8bd941c7..7f1d2c0b744d9 100644 /* * The current task ran long enough, ensure it doesn't get * re-elected due to buddy favours. -@@ -4780,7 +4780,7 @@ check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr) +@@ -4907,7 +4907,7 @@ check_preempt_tick(struct cfs_rq *cfs_rq return; if (delta > ideal_runtime) @@ -6433,7 +6296,7 @@ index e4a0b8bd941c7..7f1d2c0b744d9 100644 } static void -@@ -4926,7 +4926,7 @@ entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr, int queued) +@@ -5053,7 +5053,7 @@ entity_tick(struct cfs_rq *cfs_rq, struc * validating it and just reschedule. */ if (queued) { @@ -6442,7 +6305,7 @@ index e4a0b8bd941c7..7f1d2c0b744d9 100644 return; } /* -@@ -5075,7 +5075,7 @@ static void __account_cfs_rq_runtime(struct cfs_rq *cfs_rq, u64 delta_exec) +@@ -5202,7 +5202,7 @@ static void __account_cfs_rq_runtime(str * hierarchy can be throttled */ if (!assign_cfs_rq_runtime(cfs_rq) && likely(cfs_rq->curr)) @@ -6451,7 +6314,7 @@ index e4a0b8bd941c7..7f1d2c0b744d9 100644 } static __always_inline -@@ -5826,7 +5826,7 @@ static void hrtick_start_fair(struct rq *rq, struct task_struct *p) +@@ -5953,7 +5953,7 @@ static void hrtick_start_fair(struct rq if (delta < 0) { if (task_current(rq, p)) @@ -6460,7 +6323,7 @@ index e4a0b8bd941c7..7f1d2c0b744d9 100644 return; } hrtick_start(rq, delta); -@@ -7473,7 +7473,7 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_ +@@ -7632,7 +7632,7 @@ static void check_preempt_wakeup(struct return; preempt: @@ -6469,7 +6332,7 @@ index e4a0b8bd941c7..7f1d2c0b744d9 100644 /* * Only set the backward buddy when the current task is still * on the rq. This can happen when a wakeup gets interleaved -@@ -11622,7 +11622,7 @@ static void task_fork_fair(struct task_struct *p) +@@ -11785,7 +11785,7 @@ static void task_fork_fair(struct task_s * 'current' within the tree based on its new key value. */ swap(curr->vruntime, se->vruntime); @@ -6478,7 +6341,7 @@ index e4a0b8bd941c7..7f1d2c0b744d9 100644 } se->vruntime -= cfs_rq->min_vruntime; -@@ -11649,7 +11649,7 @@ prio_changed_fair(struct rq *rq, struct task_struct *p, int oldprio) +@@ -11812,7 +11812,7 @@ prio_changed_fair(struct rq *rq, struct */ if (task_current(rq, p)) { if (p->prio > oldprio) @@ -6487,10 +6350,9 @@ index e4a0b8bd941c7..7f1d2c0b744d9 100644 } else check_preempt_curr(rq, p, 0); } -diff --git a/kernel/sched/features.h b/kernel/sched/features.h -index ee7f23c76bd33..e13090e33f3c4 100644 ---- a/kernel/sched/features.h -+++ b/kernel/sched/features.h +diff -rupN linux-6.1.2.orig/kernel/sched/features.h linux-6.1.2/kernel/sched/features.h +--- linux-6.1.2.orig/kernel/sched/features.h 2022-12-31 16:12:08.018569433 -0500 ++++ linux-6.1.2/kernel/sched/features.h 2022-12-31 16:12:36.290153295 -0500 @@ -48,6 +48,9 @@ SCHED_FEAT(NONTASK_CAPACITY, true) #ifdef CONFIG_PREEMPT_RT @@ -6501,11 +6363,10 @@ index ee7f23c76bd33..e13090e33f3c4 100644 #else /* -diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h -index a4a20046e586e..f0451bf28b6f6 100644 ---- a/kernel/sched/sched.h -+++ b/kernel/sched/sched.h -@@ -2350,6 +2350,15 @@ extern void reweight_task(struct task_struct *p, int prio); +diff -rupN linux-6.1.2.orig/kernel/sched/sched.h linux-6.1.2/kernel/sched/sched.h +--- linux-6.1.2.orig/kernel/sched/sched.h 2022-12-31 16:12:08.018569433 -0500 ++++ linux-6.1.2/kernel/sched/sched.h 2022-12-31 16:12:36.290153295 -0500 +@@ -2350,6 +2350,15 @@ extern void reweight_task(struct task_st extern void resched_curr(struct rq *rq); extern void resched_cpu(int cpu); @@ -6521,11 +6382,10 @@ index a4a20046e586e..f0451bf28b6f6 100644 extern struct rt_bandwidth def_rt_bandwidth; extern void init_rt_bandwidth(struct rt_bandwidth *rt_b, u64 period, u64 runtime); extern bool sched_rt_bandwidth_account(struct rt_rq *rt_rq); -diff --git a/kernel/signal.c b/kernel/signal.c -index d140672185a48..aebe0d5b20060 100644 ---- a/kernel/signal.c -+++ b/kernel/signal.c -@@ -2298,13 +2298,13 @@ static int ptrace_stop(int exit_code, int why, unsigned long message, +diff -rupN linux-6.1.2.orig/kernel/signal.c linux-6.1.2/kernel/signal.c +--- linux-6.1.2.orig/kernel/signal.c 2022-12-31 16:12:08.006569613 -0500 ++++ linux-6.1.2/kernel/signal.c 2022-12-31 16:12:36.290153295 -0500 +@@ -2298,13 +2298,13 @@ static int ptrace_stop(int exit_code, in /* * Don't want to allow preemption here, because * sys_ptrace() needs this task to be inactive. @@ -6543,10 +6403,9 @@ index d140672185a48..aebe0d5b20060 100644 schedule(); cgroup_leave_frozen(true); -diff --git a/kernel/softirq.c b/kernel/softirq.c -index c8a6913c067d9..ab1fe34326bab 100644 ---- a/kernel/softirq.c -+++ b/kernel/softirq.c +diff -rupN linux-6.1.2.orig/kernel/softirq.c linux-6.1.2/kernel/softirq.c +--- linux-6.1.2.orig/kernel/softirq.c 2022-12-31 16:12:08.006569613 -0500 ++++ linux-6.1.2/kernel/softirq.c 2022-12-31 16:12:36.290153295 -0500 @@ -637,6 +637,24 @@ static inline void tick_irq_exit(void) #endif } @@ -6588,7 +6447,7 @@ index c8a6913c067d9..ab1fe34326bab 100644 tick_irq_exit(); } -@@ -976,12 +999,70 @@ static struct smp_hotplug_thread softirq_threads = { +@@ -976,12 +999,70 @@ static struct smp_hotplug_thread softirq .thread_comm = "ksoftirqd/%u", }; @@ -6660,11 +6519,10 @@ index c8a6913c067d9..ab1fe34326bab 100644 return 0; } early_initcall(spawn_ksoftirqd); -diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c -index 3ae661ab62603..0a56c61710eac 100644 ---- a/kernel/time/hrtimer.c -+++ b/kernel/time/hrtimer.c -@@ -1805,7 +1805,7 @@ void hrtimer_interrupt(struct clock_event_device *dev) +diff -rupN linux-6.1.2.orig/kernel/time/hrtimer.c linux-6.1.2/kernel/time/hrtimer.c +--- linux-6.1.2.orig/kernel/time/hrtimer.c 2022-12-31 16:12:08.018569433 -0500 ++++ linux-6.1.2/kernel/time/hrtimer.c 2022-12-31 16:12:36.290153295 -0500 +@@ -1805,7 +1805,7 @@ retry: if (!ktime_before(now, cpu_base->softirq_expires_next)) { cpu_base->softirq_expires_next = KTIME_MAX; cpu_base->softirq_activated = 1; @@ -6682,11 +6540,10 @@ index 3ae661ab62603..0a56c61710eac 100644 } __hrtimer_run_queues(cpu_base, now, flags, HRTIMER_ACTIVE_HARD); -diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c -index b0e3c9205946f..133e4160ed54b 100644 ---- a/kernel/time/tick-sched.c -+++ b/kernel/time/tick-sched.c -@@ -779,7 +779,7 @@ static void tick_nohz_restart(struct tick_sched *ts, ktime_t now) +diff -rupN linux-6.1.2.orig/kernel/time/tick-sched.c linux-6.1.2/kernel/time/tick-sched.c +--- linux-6.1.2.orig/kernel/time/tick-sched.c 2022-12-31 16:12:08.022569373 -0500 ++++ linux-6.1.2/kernel/time/tick-sched.c 2022-12-31 16:12:36.290153295 -0500 +@@ -779,7 +779,7 @@ static void tick_nohz_restart(struct tic static inline bool local_timer_softirq_pending(void) { @@ -6695,10 +6552,9 @@ index b0e3c9205946f..133e4160ed54b 100644 } static ktime_t tick_nohz_next_event(struct tick_sched *ts, int cpu) -diff --git a/kernel/time/timer.c b/kernel/time/timer.c -index 717fcb9fb14aa..e6219da89933d 100644 ---- a/kernel/time/timer.c -+++ b/kernel/time/timer.c +diff -rupN linux-6.1.2.orig/kernel/time/timer.c linux-6.1.2/kernel/time/timer.c +--- linux-6.1.2.orig/kernel/time/timer.c 2022-12-31 16:12:08.022569373 -0500 ++++ linux-6.1.2/kernel/time/timer.c 2022-12-31 16:12:36.294153237 -0500 @@ -1822,7 +1822,7 @@ static void run_local_timers(void) if (time_before(jiffies, base->next_expiry)) return; @@ -6708,11 +6564,10 @@ index 717fcb9fb14aa..e6219da89933d 100644 } /* -diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c -index a7fe0e115272e..a0a603784045a 100644 ---- a/kernel/trace/trace.c -+++ b/kernel/trace/trace.c -@@ -2640,11 +2640,19 @@ unsigned int tracing_gen_ctx_irq_test(unsigned int irqs_status) +diff -rupN linux-6.1.2.orig/kernel/trace/trace.c linux-6.1.2/kernel/trace/trace.c +--- linux-6.1.2.orig/kernel/trace/trace.c 2022-12-31 16:12:08.022569373 -0500 ++++ linux-6.1.2/kernel/trace/trace.c 2022-12-31 16:12:36.294153237 -0500 +@@ -2649,11 +2649,19 @@ unsigned int tracing_gen_ctx_irq_test(un if (softirq_count() >> (SOFTIRQ_SHIFT + 1)) trace_flags |= TRACE_FLAG_BH_OFF; @@ -6734,7 +6589,7 @@ index a7fe0e115272e..a0a603784045a 100644 (min_t(unsigned int, migration_disable_value(), 0xf)) << 4; } -@@ -4230,15 +4238,17 @@ unsigned long trace_total_entries(struct trace_array *tr) +@@ -4239,15 +4247,17 @@ unsigned long trace_total_entries(struct static void print_lat_help_header(struct seq_file *m) { @@ -6761,7 +6616,7 @@ index a7fe0e115272e..a0a603784045a 100644 } static void print_event_info(struct array_buffer *buf, struct seq_file *m) -@@ -4272,14 +4282,16 @@ static void print_func_help_header_irq(struct array_buffer *buf, struct seq_file +@@ -4281,14 +4291,16 @@ static void print_func_help_header_irq(s print_event_info(buf, m); @@ -6786,11 +6641,10 @@ index a7fe0e115272e..a0a603784045a 100644 } void -diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c -index 0356cae0cf74e..585380a3db753 100644 ---- a/kernel/trace/trace_events.c -+++ b/kernel/trace/trace_events.c -@@ -193,6 +193,7 @@ static int trace_define_common_fields(void) +diff -rupN linux-6.1.2.orig/kernel/trace/trace_events.c linux-6.1.2/kernel/trace/trace_events.c +--- linux-6.1.2.orig/kernel/trace/trace_events.c 2022-12-31 16:12:08.022569373 -0500 ++++ linux-6.1.2/kernel/trace/trace_events.c 2022-12-31 16:12:36.294153237 -0500 +@@ -193,6 +193,7 @@ static int trace_define_common_fields(vo /* Holds both preempt_count and migrate_disable */ __common_field(unsigned char, preempt_count); __common_field(int, pid); @@ -6798,11 +6652,10 @@ index 0356cae0cf74e..585380a3db753 100644 return ret; } -diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c -index 67f47ea27921d..de58eaaf1ac7a 100644 ---- a/kernel/trace/trace_output.c -+++ b/kernel/trace/trace_output.c -@@ -442,6 +442,7 @@ int trace_print_lat_fmt(struct trace_seq *s, struct trace_entry *entry) +diff -rupN linux-6.1.2.orig/kernel/trace/trace_output.c linux-6.1.2/kernel/trace/trace_output.c +--- linux-6.1.2.orig/kernel/trace/trace_output.c 2022-12-31 16:12:08.026569314 -0500 ++++ linux-6.1.2/kernel/trace/trace_output.c 2022-12-31 16:12:36.294153237 -0500 +@@ -442,6 +442,7 @@ int trace_print_lat_fmt(struct trace_seq { char hardsoft_irq; char need_resched; @@ -6810,7 +6663,7 @@ index 67f47ea27921d..de58eaaf1ac7a 100644 char irqs_off; int hardirq; int softirq; -@@ -462,20 +463,27 @@ int trace_print_lat_fmt(struct trace_seq *s, struct trace_entry *entry) +@@ -462,20 +463,27 @@ int trace_print_lat_fmt(struct trace_seq switch (entry->flags & (TRACE_FLAG_NEED_RESCHED | TRACE_FLAG_PREEMPT_RESCHED)) { @@ -6838,7 +6691,7 @@ index 67f47ea27921d..de58eaaf1ac7a 100644 hardsoft_irq = (nmi && hardirq) ? 'Z' : nmi ? 'z' : -@@ -484,14 +492,20 @@ int trace_print_lat_fmt(struct trace_seq *s, struct trace_entry *entry) +@@ -484,14 +492,20 @@ int trace_print_lat_fmt(struct trace_seq softirq ? 's' : '.' ; @@ -6861,11 +6714,10 @@ index 67f47ea27921d..de58eaaf1ac7a 100644 if (entry->preempt_count & 0xf0) trace_seq_printf(s, "%x", entry->preempt_count >> 4); else -diff --git a/kernel/watchdog.c b/kernel/watchdog.c -index 8e61f21e7e33e..41596c415111b 100644 ---- a/kernel/watchdog.c -+++ b/kernel/watchdog.c -@@ -424,6 +424,8 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer) +diff -rupN linux-6.1.2.orig/kernel/watchdog.c linux-6.1.2/kernel/watchdog.c +--- linux-6.1.2.orig/kernel/watchdog.c 2022-12-31 16:12:08.006569613 -0500 ++++ linux-6.1.2/kernel/watchdog.c 2022-12-31 16:12:36.294153237 -0500 +@@ -424,6 +424,8 @@ static enum hrtimer_restart watchdog_tim /* Start period for the next softlockup warning. */ update_report_ts(); @@ -6874,7 +6726,7 @@ index 8e61f21e7e33e..41596c415111b 100644 pr_emerg("BUG: soft lockup - CPU#%d stuck for %us! [%s:%d]\n", smp_processor_id(), duration, current->comm, task_pid_nr(current)); -@@ -442,6 +444,8 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer) +@@ -442,6 +444,8 @@ static enum hrtimer_restart watchdog_tim add_taint(TAINT_SOFTLOCKUP, LOCKDEP_STILL_OK); if (softlockup_panic) panic("softlockup: hung tasks"); @@ -6883,11 +6735,10 @@ index 8e61f21e7e33e..41596c415111b 100644 } return HRTIMER_RESTART; -diff --git a/kernel/watchdog_hld.c b/kernel/watchdog_hld.c -index 247bf0b1582ca..701f35f0e2d44 100644 ---- a/kernel/watchdog_hld.c -+++ b/kernel/watchdog_hld.c -@@ -135,6 +135,8 @@ static void watchdog_overflow_callback(struct perf_event *event, +diff -rupN linux-6.1.2.orig/kernel/watchdog_hld.c linux-6.1.2/kernel/watchdog_hld.c +--- linux-6.1.2.orig/kernel/watchdog_hld.c 2022-12-31 16:12:08.006569613 -0500 ++++ linux-6.1.2/kernel/watchdog_hld.c 2022-12-31 16:12:36.294153237 -0500 +@@ -135,6 +135,8 @@ static void watchdog_overflow_callback(s if (__this_cpu_read(hard_watchdog_warn) == true) return; @@ -6896,7 +6747,7 @@ index 247bf0b1582ca..701f35f0e2d44 100644 pr_emerg("Watchdog detected hard LOCKUP on cpu %d\n", this_cpu); print_modules(); -@@ -155,6 +157,8 @@ static void watchdog_overflow_callback(struct perf_event *event, +@@ -155,6 +157,8 @@ static void watchdog_overflow_callback(s if (hardlockup_panic) nmi_panic(regs, "Hard LOCKUP"); @@ -6905,18 +6756,15 @@ index 247bf0b1582ca..701f35f0e2d44 100644 __this_cpu_write(hard_watchdog_warn, true); return; } -diff --git a/localversion-rt b/localversion-rt -new file mode 100644 -index 0000000000000..0efe7ba1930e1 ---- /dev/null -+++ b/localversion-rt +diff -rupN linux-6.1.2.orig/localversion-rt linux-6.1.2/localversion-rt +--- linux-6.1.2.orig/localversion-rt 1969-12-31 19:00:00.000000000 -0500 ++++ linux-6.1.2/localversion-rt 2022-12-31 16:12:36.294153237 -0500 @@ -0,0 +1 @@ +-rt5 -diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c -index e1bb41a443c43..296d0145932f4 100644 ---- a/net/8021q/vlan_dev.c -+++ b/net/8021q/vlan_dev.c -@@ -712,13 +712,13 @@ static void vlan_dev_get_stats64(struct net_device *dev, +diff -rupN linux-6.1.2.orig/net/8021q/vlan_dev.c linux-6.1.2/net/8021q/vlan_dev.c +--- linux-6.1.2.orig/net/8021q/vlan_dev.c 2022-12-31 16:12:08.050568954 -0500 ++++ linux-6.1.2/net/8021q/vlan_dev.c 2022-12-31 16:12:36.294153237 -0500 +@@ -712,13 +712,13 @@ static void vlan_dev_get_stats64(struct p = per_cpu_ptr(vlan_dev_priv(dev)->vlan_pcpu_stats, i); do { @@ -6932,11 +6780,10 @@ index e1bb41a443c43..296d0145932f4 100644 stats->rx_packets += rxpackets; stats->rx_bytes += rxbytes; -diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c -index db4f2641d1cd1..7e2a9fb5786c9 100644 ---- a/net/bridge/br_multicast.c -+++ b/net/bridge/br_multicast.c -@@ -4899,9 +4899,9 @@ void br_multicast_get_stats(const struct net_bridge *br, +diff -rupN linux-6.1.2.orig/net/bridge/br_multicast.c linux-6.1.2/net/bridge/br_multicast.c +--- linux-6.1.2.orig/net/bridge/br_multicast.c 2022-12-31 16:12:08.058568833 -0500 ++++ linux-6.1.2/net/bridge/br_multicast.c 2022-12-31 16:12:36.294153237 -0500 +@@ -4899,9 +4899,9 @@ void br_multicast_get_stats(const struct unsigned int start; do { @@ -6948,11 +6795,10 @@ index db4f2641d1cd1..7e2a9fb5786c9 100644 mcast_stats_add_dir(tdst.igmp_v1queries, temp.igmp_v1queries); mcast_stats_add_dir(tdst.igmp_v2queries, temp.igmp_v2queries); -diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c -index 9ffd40b8270c1..bc75fa1e4666a 100644 ---- a/net/bridge/br_vlan.c -+++ b/net/bridge/br_vlan.c -@@ -1389,12 +1389,12 @@ void br_vlan_get_stats(const struct net_bridge_vlan *v, +diff -rupN linux-6.1.2.orig/net/bridge/br_vlan.c linux-6.1.2/net/bridge/br_vlan.c +--- linux-6.1.2.orig/net/bridge/br_vlan.c 2022-12-31 16:12:08.058568833 -0500 ++++ linux-6.1.2/net/bridge/br_vlan.c 2022-12-31 16:12:36.294153237 -0500 +@@ -1389,12 +1389,12 @@ void br_vlan_get_stats(const struct net_ cpu_stats = per_cpu_ptr(v->stats, i); do { @@ -6967,11 +6813,10 @@ index 9ffd40b8270c1..bc75fa1e4666a 100644 u64_stats_add(&stats->rx_packets, rxpackets); u64_stats_add(&stats->rx_bytes, rxbytes); -diff --git a/net/core/dev.c b/net/core/dev.c -index 3be256051e99b..097233895eb8a 100644 ---- a/net/core/dev.c -+++ b/net/core/dev.c -@@ -4582,15 +4582,6 @@ static void rps_trigger_softirq(void *data) +diff -rupN linux-6.1.2.orig/net/core/dev.c linux-6.1.2/net/core/dev.c +--- linux-6.1.2.orig/net/core/dev.c 2022-12-31 16:12:08.062568774 -0500 ++++ linux-6.1.2/net/core/dev.c 2022-12-31 16:12:36.294153237 -0500 +@@ -4582,15 +4582,6 @@ static void rps_trigger_softirq(void *da #endif /* CONFIG_RPS */ @@ -6987,7 +6832,7 @@ index 3be256051e99b..097233895eb8a 100644 /* * Check if this softnet_data structure is another cpu one * If yes, queue it to our IPI list and return 1 -@@ -6648,6 +6639,30 @@ static void skb_defer_free_flush(struct softnet_data *sd) +@@ -6648,6 +6639,30 @@ static void skb_defer_free_flush(struct } } @@ -7018,7 +6863,7 @@ index 3be256051e99b..097233895eb8a 100644 static __latent_entropy void net_rx_action(struct softirq_action *h) { struct softnet_data *sd = this_cpu_ptr(&softnet_data); -@@ -10477,12 +10492,12 @@ void dev_fetch_sw_netstats(struct rtnl_link_stats64 *s, +@@ -10469,12 +10484,12 @@ void dev_fetch_sw_netstats(struct rtnl_l stats = per_cpu_ptr(netstats, cpu); do { @@ -7033,7 +6878,7 @@ index 3be256051e99b..097233895eb8a 100644 s->rx_packets += rx_packets; s->rx_bytes += rx_bytes; -@@ -11397,7 +11412,11 @@ static int __init net_dev_init(void) +@@ -11389,7 +11404,11 @@ static int __init net_dev_init(void) INIT_CSD(&sd->csd, rps_trigger_softirq, sd); sd->cpu = i; #endif @@ -7045,11 +6890,10 @@ index 3be256051e99b..097233895eb8a 100644 spin_lock_init(&sd->defer_lock); init_gro_hash(&sd->backlog); -diff --git a/net/core/devlink.c b/net/core/devlink.c -index 89baa7c0938b9..0a16ad45520eb 100644 ---- a/net/core/devlink.c -+++ b/net/core/devlink.c -@@ -8304,10 +8304,10 @@ static void devlink_trap_stats_read(struct devlink_stats __percpu *trap_stats, +diff -rupN linux-6.1.2.orig/net/core/devlink.c linux-6.1.2/net/core/devlink.c +--- linux-6.1.2.orig/net/core/devlink.c 2022-12-31 16:12:08.062568774 -0500 ++++ linux-6.1.2/net/core/devlink.c 2022-12-31 16:12:36.298153179 -0500 +@@ -8307,10 +8307,10 @@ static void devlink_trap_stats_read(stru cpu_stats = per_cpu_ptr(trap_stats, i); do { @@ -7062,11 +6906,10 @@ index 89baa7c0938b9..0a16ad45520eb 100644 u64_stats_add(&stats->rx_packets, rx_packets); u64_stats_add(&stats->rx_bytes, rx_bytes); -diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c -index f084a4a6b7ab2..11aa6e8a30981 100644 ---- a/net/core/drop_monitor.c -+++ b/net/core/drop_monitor.c -@@ -1432,9 +1432,9 @@ static void net_dm_stats_read(struct net_dm_stats *stats) +diff -rupN linux-6.1.2.orig/net/core/drop_monitor.c linux-6.1.2/net/core/drop_monitor.c +--- linux-6.1.2.orig/net/core/drop_monitor.c 2022-12-31 16:12:08.062568774 -0500 ++++ linux-6.1.2/net/core/drop_monitor.c 2022-12-31 16:12:36.298153179 -0500 +@@ -1432,9 +1432,9 @@ static void net_dm_stats_read(struct net u64 dropped; do { @@ -7078,7 +6921,7 @@ index f084a4a6b7ab2..11aa6e8a30981 100644 u64_stats_add(&stats->dropped, dropped); } -@@ -1476,9 +1476,9 @@ static void net_dm_hw_stats_read(struct net_dm_stats *stats) +@@ -1476,9 +1476,9 @@ static void net_dm_hw_stats_read(struct u64 dropped; do { @@ -7090,11 +6933,10 @@ index f084a4a6b7ab2..11aa6e8a30981 100644 u64_stats_add(&stats->dropped, dropped); } -diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c -index c8d137ef5980e..b71ccaec09914 100644 ---- a/net/core/gen_stats.c -+++ b/net/core/gen_stats.c -@@ -135,10 +135,10 @@ static void gnet_stats_add_basic_cpu(struct gnet_stats_basic_sync *bstats, +diff -rupN linux-6.1.2.orig/net/core/gen_stats.c linux-6.1.2/net/core/gen_stats.c +--- linux-6.1.2.orig/net/core/gen_stats.c 2022-12-31 16:12:08.062568774 -0500 ++++ linux-6.1.2/net/core/gen_stats.c 2022-12-31 16:12:36.298153179 -0500 +@@ -135,10 +135,10 @@ static void gnet_stats_add_basic_cpu(str u64 bytes, packets; do { @@ -7107,7 +6949,7 @@ index c8d137ef5980e..b71ccaec09914 100644 t_bytes += bytes; t_packets += packets; -@@ -162,10 +162,10 @@ void gnet_stats_add_basic(struct gnet_stats_basic_sync *bstats, +@@ -162,10 +162,10 @@ void gnet_stats_add_basic(struct gnet_st } do { if (running) @@ -7120,7 +6962,7 @@ index c8d137ef5980e..b71ccaec09914 100644 _bstats_update(bstats, bytes, packets); } -@@ -187,10 +187,10 @@ static void gnet_stats_read_basic(u64 *ret_bytes, u64 *ret_packets, +@@ -187,10 +187,10 @@ static void gnet_stats_read_basic(u64 *r u64 bytes, packets; do { @@ -7133,7 +6975,7 @@ index c8d137ef5980e..b71ccaec09914 100644 t_bytes += bytes; t_packets += packets; -@@ -201,10 +201,10 @@ static void gnet_stats_read_basic(u64 *ret_bytes, u64 *ret_packets, +@@ -201,10 +201,10 @@ static void gnet_stats_read_basic(u64 *r } do { if (running) @@ -7146,11 +6988,10 @@ index c8d137ef5980e..b71ccaec09914 100644 } static int -diff --git a/net/core/skbuff.c b/net/core/skbuff.c -index 88fa40571d0c7..2c3e1557c9000 100644 ---- a/net/core/skbuff.c -+++ b/net/core/skbuff.c -@@ -6660,6 +6660,11 @@ nodefer: __kfree_skb(skb); +diff -rupN linux-6.1.2.orig/net/core/skbuff.c linux-6.1.2/net/core/skbuff.c +--- linux-6.1.2.orig/net/core/skbuff.c 2022-12-31 16:12:08.062568774 -0500 ++++ linux-6.1.2/net/core/skbuff.c 2022-12-31 16:12:36.298153179 -0500 +@@ -6663,6 +6663,11 @@ nodefer: __kfree_skb(skb); /* Make sure to trigger NET_RX_SOFTIRQ on the remote CPU * if we are unlucky enough (this seems very unlikely). */ @@ -7163,11 +7004,10 @@ index 88fa40571d0c7..2c3e1557c9000 100644 +#endif + } } -diff --git a/net/dsa/slave.c b/net/dsa/slave.c -index a9fde48cffd43..83e419afa89e8 100644 ---- a/net/dsa/slave.c -+++ b/net/dsa/slave.c -@@ -976,12 +976,12 @@ static void dsa_slave_get_ethtool_stats(struct net_device *dev, +diff -rupN linux-6.1.2.orig/net/dsa/slave.c linux-6.1.2/net/dsa/slave.c +--- linux-6.1.2.orig/net/dsa/slave.c 2022-12-31 16:12:08.066568714 -0500 ++++ linux-6.1.2/net/dsa/slave.c 2022-12-31 16:12:36.298153179 -0500 +@@ -976,12 +976,12 @@ static void dsa_slave_get_ethtool_stats( s = per_cpu_ptr(dev->tstats, i); do { @@ -7182,11 +7022,10 @@ index a9fde48cffd43..83e419afa89e8 100644 data[0] += tx_packets; data[1] += tx_bytes; data[2] += rx_packets; -diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c -index 0da6794113308..643a7597bc5be 100644 ---- a/net/ipv4/af_inet.c -+++ b/net/ipv4/af_inet.c -@@ -1699,9 +1699,9 @@ u64 snmp_get_cpu_field64(void __percpu *mib, int cpu, int offt, +diff -rupN linux-6.1.2.orig/net/ipv4/af_inet.c linux-6.1.2/net/ipv4/af_inet.c +--- linux-6.1.2.orig/net/ipv4/af_inet.c 2022-12-31 16:12:08.070568654 -0500 ++++ linux-6.1.2/net/ipv4/af_inet.c 2022-12-31 16:12:36.298153179 -0500 +@@ -1699,9 +1699,9 @@ u64 snmp_get_cpu_field64(void __percpu * bhptr = per_cpu_ptr(mib, cpu); syncp = (struct u64_stats_sync *)(bhptr + syncp_offset); do { @@ -7198,11 +7037,10 @@ index 0da6794113308..643a7597bc5be 100644 return v; } -diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c -index 8370726ae7bf1..487f8e98deaa0 100644 ---- a/net/ipv6/seg6_local.c -+++ b/net/ipv6/seg6_local.c -@@ -1644,13 +1644,13 @@ static int put_nla_counters(struct sk_buff *skb, struct seg6_local_lwt *slwt) +diff -rupN linux-6.1.2.orig/net/ipv6/seg6_local.c linux-6.1.2/net/ipv6/seg6_local.c +--- linux-6.1.2.orig/net/ipv6/seg6_local.c 2022-12-31 16:12:08.078568534 -0500 ++++ linux-6.1.2/net/ipv6/seg6_local.c 2022-12-31 16:12:36.298153179 -0500 +@@ -1644,13 +1644,13 @@ static int put_nla_counters(struct sk_bu pcounters = per_cpu_ptr(slwt->pcpu_counters, i); do { @@ -7218,11 +7056,10 @@ index 8370726ae7bf1..487f8e98deaa0 100644 counters.packets += packets; counters.bytes += bytes; -diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c -index cebfd148bb406..1e922f95a98d3 100644 ---- a/net/mac80211/sta_info.c -+++ b/net/mac80211/sta_info.c -@@ -2396,9 +2396,9 @@ static inline u64 sta_get_tidstats_msdu(struct ieee80211_sta_rx_stats *rxstats, +diff -rupN linux-6.1.2.orig/net/mac80211/sta_info.c linux-6.1.2/net/mac80211/sta_info.c +--- linux-6.1.2.orig/net/mac80211/sta_info.c 2022-12-31 16:12:08.082568474 -0500 ++++ linux-6.1.2/net/mac80211/sta_info.c 2022-12-31 16:12:36.298153179 -0500 +@@ -2396,9 +2396,9 @@ static inline u64 sta_get_tidstats_msdu( u64 value; do { @@ -7234,7 +7071,7 @@ index cebfd148bb406..1e922f95a98d3 100644 return value; } -@@ -2464,9 +2464,9 @@ static inline u64 sta_get_stats_bytes(struct ieee80211_sta_rx_stats *rxstats) +@@ -2464,9 +2464,9 @@ static inline u64 sta_get_stats_bytes(st u64 value; do { @@ -7246,11 +7083,10 @@ index cebfd148bb406..1e922f95a98d3 100644 return value; } -diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c -index b52afe316dc41..35b5f806fdda1 100644 ---- a/net/mpls/af_mpls.c -+++ b/net/mpls/af_mpls.c -@@ -1079,9 +1079,9 @@ static void mpls_get_stats(struct mpls_dev *mdev, +diff -rupN linux-6.1.2.orig/net/mpls/af_mpls.c linux-6.1.2/net/mpls/af_mpls.c +--- linux-6.1.2.orig/net/mpls/af_mpls.c 2022-12-31 16:12:08.082568474 -0500 ++++ linux-6.1.2/net/mpls/af_mpls.c 2022-12-31 16:12:36.298153179 -0500 +@@ -1079,9 +1079,9 @@ static void mpls_get_stats(struct mpls_d p = per_cpu_ptr(mdev->stats, i); do { @@ -7262,31 +7098,29 @@ index b52afe316dc41..35b5f806fdda1 100644 stats->rx_packets += local.rx_packets; stats->rx_bytes += local.rx_bytes; -diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c -index 988222fff9f02..4d62059a60215 100644 ---- a/net/netfilter/ipvs/ip_vs_ctl.c -+++ b/net/netfilter/ipvs/ip_vs_ctl.c -@@ -2296,13 +2296,13 @@ static int ip_vs_stats_percpu_show(struct seq_file *seq, void *v) +diff -rupN linux-6.1.2.orig/net/netfilter/ipvs/ip_vs_ctl.c linux-6.1.2/net/netfilter/ipvs/ip_vs_ctl.c +--- linux-6.1.2.orig/net/netfilter/ipvs/ip_vs_ctl.c 2022-12-31 16:12:08.086568414 -0500 ++++ linux-6.1.2/net/netfilter/ipvs/ip_vs_ctl.c 2022-12-31 16:14:26.932659173 -0500 +@@ -2296,13 +2296,13 @@ static int ip_vs_stats_percpu_show(struc u64 conns, inpkts, outpkts, inbytes, outbytes; do { - start = u64_stats_fetch_begin_irq(&u->syncp); + start = u64_stats_fetch_begin(&u->syncp); - conns = u->cnt.conns; - inpkts = u->cnt.inpkts; - outpkts = u->cnt.outpkts; - inbytes = u->cnt.inbytes; - outbytes = u->cnt.outbytes; + conns = u64_stats_read(&u->cnt.conns); + inpkts = u64_stats_read(&u->cnt.inpkts); + outpkts = u64_stats_read(&u->cnt.outpkts); + inbytes = u64_stats_read(&u->cnt.inbytes); + outbytes = u64_stats_read(&u->cnt.outbytes); - } while (u64_stats_fetch_retry_irq(&u->syncp, start)); + } while (u64_stats_fetch_retry(&u->syncp, start)); seq_printf(seq, "%3X %8LX %8LX %8LX %16LX %16LX\n", i, (u64)conns, (u64)inpkts, -diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c -index 7a09421f19e15..6def1e17e69d2 100644 ---- a/net/netfilter/nf_tables_api.c -+++ b/net/netfilter/nf_tables_api.c -@@ -1534,10 +1534,10 @@ static int nft_dump_stats(struct sk_buff *skb, struct nft_stats __percpu *stats) +diff -rupN linux-6.1.2.orig/net/netfilter/nf_tables_api.c linux-6.1.2/net/netfilter/nf_tables_api.c +--- linux-6.1.2.orig/net/netfilter/nf_tables_api.c 2022-12-31 16:12:08.090568355 -0500 ++++ linux-6.1.2/net/netfilter/nf_tables_api.c 2022-12-31 16:12:36.298153179 -0500 +@@ -1534,10 +1534,10 @@ static int nft_dump_stats(struct sk_buff for_each_possible_cpu(cpu) { cpu_stats = per_cpu_ptr(stats, cpu); do { @@ -7299,11 +7133,10 @@ index 7a09421f19e15..6def1e17e69d2 100644 total.pkts += pkts; total.bytes += bytes; } -diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c -index 8b84869eb2ac7..861dfb8daf4a4 100644 ---- a/net/openvswitch/datapath.c -+++ b/net/openvswitch/datapath.c -@@ -716,9 +716,9 @@ static void get_dp_stats(const struct datapath *dp, struct ovs_dp_stats *stats, +diff -rupN linux-6.1.2.orig/net/openvswitch/datapath.c linux-6.1.2/net/openvswitch/datapath.c +--- linux-6.1.2.orig/net/openvswitch/datapath.c 2022-12-31 16:12:08.094568294 -0500 ++++ linux-6.1.2/net/openvswitch/datapath.c 2022-12-31 16:12:36.302153122 -0500 +@@ -716,9 +716,9 @@ static void get_dp_stats(const struct da percpu_stats = per_cpu_ptr(dp->stats_percpu, i); do { @@ -7315,11 +7148,10 @@ index 8b84869eb2ac7..861dfb8daf4a4 100644 stats->n_hit += local_stats.n_hit; stats->n_missed += local_stats.n_missed; -diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c -index d4a2db0b22998..0a0e4c283f02e 100644 ---- a/net/openvswitch/flow_table.c -+++ b/net/openvswitch/flow_table.c -@@ -205,9 +205,9 @@ static void tbl_mask_array_reset_counters(struct mask_array *ma) +diff -rupN linux-6.1.2.orig/net/openvswitch/flow_table.c linux-6.1.2/net/openvswitch/flow_table.c +--- linux-6.1.2.orig/net/openvswitch/flow_table.c 2022-12-31 16:12:08.094568294 -0500 ++++ linux-6.1.2/net/openvswitch/flow_table.c 2022-12-31 16:12:36.302153122 -0500 +@@ -205,9 +205,9 @@ static void tbl_mask_array_reset_counter stats = per_cpu_ptr(ma->masks_usage_stats, cpu); do { @@ -7331,7 +7163,7 @@ index d4a2db0b22998..0a0e4c283f02e 100644 ma->masks_usage_zero_cntr[i] += counter; } -@@ -1136,10 +1136,9 @@ void ovs_flow_masks_rebalance(struct flow_table *table) +@@ -1136,10 +1136,9 @@ void ovs_flow_masks_rebalance(struct flo stats = per_cpu_ptr(ma->masks_usage_stats, cpu); do {