]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 6.6
authorSasha Levin <sashal@kernel.org>
Wed, 26 Jun 2024 19:04:36 +0000 (15:04 -0400)
committerSasha Levin <sashal@kernel.org>
Thu, 27 Jun 2024 14:01:19 +0000 (10:01 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-6.6/iio-pressure-bmp280-fix-bmp580-temperature-reading.patch [new file with mode: 0644]
queue-6.6/iio-pressure-fix-some-word-spelling-errors.patch [new file with mode: 0644]
queue-6.6/series [new file with mode: 0644]
queue-6.6/usb-typec-ucsi-ack-also-failed-get-error-commands.patch [new file with mode: 0644]
queue-6.6/usb-typec-ucsi-never-send-a-lone-connector-change-ac.patch [new file with mode: 0644]
queue-6.6/x86-mm-numa-use-numa_no_node-when-calling-memblock_s.patch [new file with mode: 0644]

diff --git a/queue-6.6/iio-pressure-bmp280-fix-bmp580-temperature-reading.patch b/queue-6.6/iio-pressure-bmp280-fix-bmp580-temperature-reading.patch
new file mode 100644 (file)
index 0000000..72367ae
--- /dev/null
@@ -0,0 +1,48 @@
+From 2eff3512837f988cd739cac6072e7b3064c879d9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 25 Apr 2024 01:22:49 -0500
+Subject: iio: pressure: bmp280: Fix BMP580 temperature reading
+
+From: Adam Rizkalla <ajarizzo@gmail.com>
+
+[ Upstream commit 0f0f6306617cb4b6231fc9d4ec68ab9a56dba7c0 ]
+
+Fix overflow issue when storing BMP580 temperature reading and
+properly preserve sign of 24-bit data.
+
+Signed-off-by: Adam Rizkalla <ajarizzo@gmail.com>
+Tested-By: Vasileios Amoiridis <vassilisamir@gmail.com>
+Acked-by: Angel Iglesias <ang.iglesiasg@gmail.com>
+Link: https://lore.kernel.org/r/Zin2udkXRD0+GrML@adam-asahi.lan
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/iio/pressure/bmp280-core.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
+index 4c493db7db965..a65630d5742f0 100644
+--- a/drivers/iio/pressure/bmp280-core.c
++++ b/drivers/iio/pressure/bmp280-core.c
+@@ -1385,12 +1385,12 @@ static int bmp580_read_temp(struct bmp280_data *data, int *val, int *val2)
+       /*
+        * Temperature is returned in Celsius degrees in fractional
+-       * form down 2^16. We rescale by x1000 to return milli Celsius
+-       * to respect IIO ABI.
++       * form down 2^16. We rescale by x1000 to return millidegrees
++       * Celsius to respect IIO ABI.
+        */
+-      *val = raw_temp * 1000;
+-      *val2 = 16;
+-      return IIO_VAL_FRACTIONAL_LOG2;
++      raw_temp = sign_extend32(raw_temp, 23);
++      *val = ((s64)raw_temp * 1000) / (1 << 16);
++      return IIO_VAL_INT;
+ }
+ static int bmp580_read_press(struct bmp280_data *data, int *val, int *val2)
+-- 
+2.43.0
+
diff --git a/queue-6.6/iio-pressure-fix-some-word-spelling-errors.patch b/queue-6.6/iio-pressure-fix-some-word-spelling-errors.patch
new file mode 100644 (file)
index 0000000..7443879
--- /dev/null
@@ -0,0 +1,72 @@
+From 9a46d3fef619eae3d98a1bbfc1d0cd29b6d9c6fc Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 21 Oct 2023 15:09:03 +0800
+Subject: iio: pressure: fix some word spelling errors
+
+From: Li peiyu <579lpy@gmail.com>
+
+[ Upstream commit a2d43f44628fe4fa9c17f0e09548cb385e772f7e ]
+
+They are appear to be spelling mistakes,
+drivers/iio/pressure/bmp280.h:413        endianess->endianness
+drivers/iio/pressure/bmp280-core.c:923   dregrees->degrees
+drivers/iio/pressure/bmp280-core.c:1388  reescale->rescale
+drivers/iio/pressure/bmp280-core.c:1415  reescale->rescale
+
+Signed-off-by: Li peiyu <579lpy@gmail.com>
+Link: https://lore.kernel.org/r/20231021070903.6051-1-579lpy@gmail.com
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Stable-dep-of: 0f0f6306617c ("iio: pressure: bmp280: Fix BMP580 temperature reading")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/iio/pressure/bmp280-core.c | 6 +++---
+ drivers/iio/pressure/bmp280.h      | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
+index a2ef1373a274e..4c493db7db965 100644
+--- a/drivers/iio/pressure/bmp280-core.c
++++ b/drivers/iio/pressure/bmp280-core.c
+@@ -920,7 +920,7 @@ static int bmp380_cmd(struct bmp280_data *data, u8 cmd)
+ }
+ /*
+- * Returns temperature in Celsius dregrees, resolution is 0.01º C. Output value of
++ * Returns temperature in Celsius degrees, resolution is 0.01º C. Output value of
+  * "5123" equals 51.2º C. t_fine carries fine temperature as global value.
+  *
+  * Taken from datasheet, Section Appendix 9, "Compensation formula" and repo
+@@ -1385,7 +1385,7 @@ static int bmp580_read_temp(struct bmp280_data *data, int *val, int *val2)
+       /*
+        * Temperature is returned in Celsius degrees in fractional
+-       * form down 2^16. We reescale by x1000 to return milli Celsius
++       * form down 2^16. We rescale by x1000 to return milli Celsius
+        * to respect IIO ABI.
+        */
+       *val = raw_temp * 1000;
+@@ -1412,7 +1412,7 @@ static int bmp580_read_press(struct bmp280_data *data, int *val, int *val2)
+       }
+       /*
+        * Pressure is returned in Pascals in fractional form down 2^16.
+-       * We reescale /1000 to convert to kilopascal to respect IIO ABI.
++       * We rescale /1000 to convert to kilopascal to respect IIO ABI.
+        */
+       *val = raw_press;
+       *val2 = 64000; /* 2^6 * 1000 */
+diff --git a/drivers/iio/pressure/bmp280.h b/drivers/iio/pressure/bmp280.h
+index 5c0563ce75725..9d9f4ce2baa6e 100644
+--- a/drivers/iio/pressure/bmp280.h
++++ b/drivers/iio/pressure/bmp280.h
+@@ -410,7 +410,7 @@ struct bmp280_data {
+               __le16 bmp280_cal_buf[BMP280_CONTIGUOUS_CALIB_REGS / 2];
+               __be16 bmp180_cal_buf[BMP180_REG_CALIB_COUNT / 2];
+               u8 bmp380_cal_buf[BMP380_CALIB_REG_COUNT];
+-              /* Miscellaneous, endianess-aware data buffers */
++              /* Miscellaneous, endianness-aware data buffers */
+               __le16 le16;
+               __be16 be16;
+       } __aligned(IIO_DMA_MINALIGN);
+-- 
+2.43.0
+
diff --git a/queue-6.6/series b/queue-6.6/series
new file mode 100644 (file)
index 0000000..81691d1
--- /dev/null
@@ -0,0 +1,5 @@
+iio-pressure-fix-some-word-spelling-errors.patch
+iio-pressure-bmp280-fix-bmp580-temperature-reading.patch
+usb-typec-ucsi-never-send-a-lone-connector-change-ac.patch
+usb-typec-ucsi-ack-also-failed-get-error-commands.patch
+x86-mm-numa-use-numa_no_node-when-calling-memblock_s.patch
diff --git a/queue-6.6/usb-typec-ucsi-ack-also-failed-get-error-commands.patch b/queue-6.6/usb-typec-ucsi-ack-also-failed-get-error-commands.patch
new file mode 100644 (file)
index 0000000..c0cc4f7
--- /dev/null
@@ -0,0 +1,48 @@
+From 257efd98e94c6a4f011036b4b69b0aa42c99310a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 31 May 2024 13:46:52 +0300
+Subject: usb: typec: ucsi: Ack also failed Get Error commands
+
+From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
+
+[ Upstream commit 8bdf8a42bca4f47646fd105a387ab6926948c7f1 ]
+
+It is possible that also the GET_ERROR command fails. If
+that happens, the command completion still needs to be
+acknowledged. Otherwise the interface will be stuck until
+it's reset.
+
+Reported-by: Ammy Yi <ammy.yi@intel.com>
+Fixes: bdc62f2bae8f ("usb: typec: ucsi: Simplified registration and I/O API")
+Cc: stable@vger.kernel.org
+Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
+Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Link: https://lore.kernel.org/r/20240531104653.1303519-1-heikki.krogerus@linux.intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/usb/typec/ucsi/ucsi.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
+index 9b0ad06db6dab..f6fb5575d4f0a 100644
+--- a/drivers/usb/typec/ucsi/ucsi.c
++++ b/drivers/usb/typec/ucsi/ucsi.c
+@@ -153,8 +153,13 @@ static int ucsi_exec_command(struct ucsi *ucsi, u64 cmd)
+       }
+       if (cci & UCSI_CCI_ERROR) {
+-              if (cmd == UCSI_GET_ERROR_STATUS)
++              if (cmd == UCSI_GET_ERROR_STATUS) {
++                      ret = ucsi_acknowledge(ucsi, false);
++                      if (ret)
++                              return ret;
++
+                       return -EIO;
++              }
+               return ucsi_read_error(ucsi);
+       }
+-- 
+2.43.0
+
diff --git a/queue-6.6/usb-typec-ucsi-never-send-a-lone-connector-change-ac.patch b/queue-6.6/usb-typec-ucsi-never-send-a-lone-connector-change-ac.patch
new file mode 100644 (file)
index 0000000..cf4389c
--- /dev/null
@@ -0,0 +1,159 @@
+From b80a9b64862291b70d9071bc467e3f933a3c75db Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 27 Mar 2024 23:45:53 +0100
+Subject: usb: typec: ucsi: Never send a lone connector change ack
+
+From: Christian A. Ehrhardt <lk@c--e.de>
+
+[ Upstream commit de52aca4d9d56c3b2f00b638d457075914b1a227 ]
+
+Some PPM implementation do not like UCSI_ACK_CONNECTOR_CHANGE
+without UCSI_ACK_COMMAND_COMPLETE. Moreover, doing this is racy
+as it requires sending two UCSI_ACK_CC_CI commands in a row and
+the second one will be started with UCSI_CCI_ACK_COMPLETE already
+set in CCI.
+
+Bundle the UCSI_ACK_CONNECTOR_CHANGE with the UCSI_ACK_COMMAND_COMPLETE
+for the UCSI_GET_CONNECTOR_STATUS command that is sent while
+handling a connector change event.
+
+Signed-off-by: Christian A. Ehrhardt <lk@c--e.de>
+Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
+Tested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Link: https://lore.kernel.org/r/20240327224554.1772525-3-lk@c--e.de
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Stable-dep-of: 8bdf8a42bca4 ("usb: typec: ucsi: Ack also failed Get Error commands")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/usb/typec/ucsi/ucsi.c | 48 +++++++++++++++--------------------
+ 1 file changed, 21 insertions(+), 27 deletions(-)
+
+diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
+index 7f575b9b3debe..9b0ad06db6dab 100644
+--- a/drivers/usb/typec/ucsi/ucsi.c
++++ b/drivers/usb/typec/ucsi/ucsi.c
+@@ -49,22 +49,16 @@ static int ucsi_read_message_in(struct ucsi *ucsi, void *buf,
+       return ucsi->ops->read(ucsi, UCSI_MESSAGE_IN, buf, buf_size);
+ }
+-static int ucsi_acknowledge_command(struct ucsi *ucsi)
++static int ucsi_acknowledge(struct ucsi *ucsi, bool conn_ack)
+ {
+       u64 ctrl;
+       ctrl = UCSI_ACK_CC_CI;
+       ctrl |= UCSI_ACK_COMMAND_COMPLETE;
+-
+-      return ucsi->ops->sync_write(ucsi, UCSI_CONTROL, &ctrl, sizeof(ctrl));
+-}
+-
+-static int ucsi_acknowledge_connector_change(struct ucsi *ucsi)
+-{
+-      u64 ctrl;
+-
+-      ctrl = UCSI_ACK_CC_CI;
+-      ctrl |= UCSI_ACK_CONNECTOR_CHANGE;
++      if (conn_ack) {
++              clear_bit(EVENT_PENDING, &ucsi->flags);
++              ctrl |= UCSI_ACK_CONNECTOR_CHANGE;
++      }
+       return ucsi->ops->sync_write(ucsi, UCSI_CONTROL, &ctrl, sizeof(ctrl));
+ }
+@@ -77,7 +71,7 @@ static int ucsi_read_error(struct ucsi *ucsi)
+       int ret;
+       /* Acknowledge the command that failed */
+-      ret = ucsi_acknowledge_command(ucsi);
++      ret = ucsi_acknowledge(ucsi, false);
+       if (ret)
+               return ret;
+@@ -89,7 +83,7 @@ static int ucsi_read_error(struct ucsi *ucsi)
+       if (ret)
+               return ret;
+-      ret = ucsi_acknowledge_command(ucsi);
++      ret = ucsi_acknowledge(ucsi, false);
+       if (ret)
+               return ret;
+@@ -152,7 +146,7 @@ static int ucsi_exec_command(struct ucsi *ucsi, u64 cmd)
+               return -EIO;
+       if (cci & UCSI_CCI_NOT_SUPPORTED) {
+-              if (ucsi_acknowledge_command(ucsi) < 0)
++              if (ucsi_acknowledge(ucsi, false) < 0)
+                       dev_err(ucsi->dev,
+                               "ACK of unsupported command failed\n");
+               return -EOPNOTSUPP;
+@@ -165,15 +159,15 @@ static int ucsi_exec_command(struct ucsi *ucsi, u64 cmd)
+       }
+       if (cmd == UCSI_CANCEL && cci & UCSI_CCI_CANCEL_COMPLETE) {
+-              ret = ucsi_acknowledge_command(ucsi);
++              ret = ucsi_acknowledge(ucsi, false);
+               return ret ? ret : -EBUSY;
+       }
+       return UCSI_CCI_LENGTH(cci);
+ }
+-int ucsi_send_command(struct ucsi *ucsi, u64 command,
+-                    void *data, size_t size)
++static int ucsi_send_command_common(struct ucsi *ucsi, u64 command,
++                                  void *data, size_t size, bool conn_ack)
+ {
+       u8 length;
+       int ret;
+@@ -192,7 +186,7 @@ int ucsi_send_command(struct ucsi *ucsi, u64 command,
+                       goto out;
+       }
+-      ret = ucsi_acknowledge_command(ucsi);
++      ret = ucsi_acknowledge(ucsi, conn_ack);
+       if (ret)
+               goto out;
+@@ -201,6 +195,12 @@ int ucsi_send_command(struct ucsi *ucsi, u64 command,
+       mutex_unlock(&ucsi->ppm_lock);
+       return ret;
+ }
++
++int ucsi_send_command(struct ucsi *ucsi, u64 command,
++                    void *data, size_t size)
++{
++      return ucsi_send_command_common(ucsi, command, data, size, false);
++}
+ EXPORT_SYMBOL_GPL(ucsi_send_command);
+ /* -------------------------------------------------------------------------- */
+@@ -886,7 +886,9 @@ static void ucsi_handle_connector_change(struct work_struct *work)
+       mutex_lock(&con->lock);
+       command = UCSI_GET_CONNECTOR_STATUS | UCSI_CONNECTOR_NUMBER(con->num);
+-      ret = ucsi_send_command(ucsi, command, &con->status, sizeof(con->status));
++
++      ret = ucsi_send_command_common(ucsi, command, &con->status,
++                                     sizeof(con->status), true);
+       if (ret < 0) {
+               dev_err(ucsi->dev, "%s: GET_CONNECTOR_STATUS failed (%d)\n",
+                       __func__, ret);
+@@ -938,14 +940,6 @@ static void ucsi_handle_connector_change(struct work_struct *work)
+       if (con->status.change & UCSI_CONSTAT_CAM_CHANGE)
+               ucsi_partner_task(con, ucsi_check_altmodes, 1, 0);
+-      mutex_lock(&ucsi->ppm_lock);
+-      clear_bit(EVENT_PENDING, &con->ucsi->flags);
+-      ret = ucsi_acknowledge_connector_change(ucsi);
+-      mutex_unlock(&ucsi->ppm_lock);
+-
+-      if (ret)
+-              dev_err(ucsi->dev, "%s: ACK failed (%d)", __func__, ret);
+-
+ out_unlock:
+       mutex_unlock(&con->lock);
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.6/x86-mm-numa-use-numa_no_node-when-calling-memblock_s.patch b/queue-6.6/x86-mm-numa-use-numa_no_node-when-calling-memblock_s.patch
new file mode 100644 (file)
index 0000000..d9195d7
--- /dev/null
@@ -0,0 +1,58 @@
+From 8609cf4207a564022badd8310756e2ee384323b5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 29 May 2024 09:42:05 +0200
+Subject: x86/mm/numa: Use NUMA_NO_NODE when calling memblock_set_node()
+
+From: Jan Beulich <jbeulich@suse.com>
+
+[ Upstream commit 3ac36aa7307363b7247ccb6f6a804e11496b2b36 ]
+
+memblock_set_node() warns about using MAX_NUMNODES, see
+
+  e0eec24e2e19 ("memblock: make memblock_set_node() also warn about use of MAX_NUMNODES")
+
+for details.
+
+Reported-by: Narasimhan V <Narasimhan.V@amd.com>
+Signed-off-by: Jan Beulich <jbeulich@suse.com>
+Cc: stable@vger.kernel.org
+[bp: commit message]
+Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
+Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
+Tested-by: Paul E. McKenney <paulmck@kernel.org>
+Link: https://lore.kernel.org/r/20240603141005.23261-1-bp@kernel.org
+Link: https://lore.kernel.org/r/abadb736-a239-49e4-ab42-ace7acdd4278@suse.com
+Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/x86/mm/numa.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
+index c7fa5396c0f05..c281326baa144 100644
+--- a/arch/x86/mm/numa.c
++++ b/arch/x86/mm/numa.c
+@@ -523,7 +523,7 @@ static void __init numa_clear_kernel_node_hotplug(void)
+       for_each_reserved_mem_region(mb_region) {
+               int nid = memblock_get_region_node(mb_region);
+-              if (nid != MAX_NUMNODES)
++              if (nid != NUMA_NO_NODE)
+                       node_set(nid, reserved_nodemask);
+       }
+@@ -643,9 +643,9 @@ static int __init numa_init(int (*init_func)(void))
+       nodes_clear(node_online_map);
+       memset(&numa_meminfo, 0, sizeof(numa_meminfo));
+       WARN_ON(memblock_set_node(0, ULLONG_MAX, &memblock.memory,
+-                                MAX_NUMNODES));
++                                NUMA_NO_NODE));
+       WARN_ON(memblock_set_node(0, ULLONG_MAX, &memblock.reserved,
+-                                MAX_NUMNODES));
++                                NUMA_NO_NODE));
+       /* In case that parsing SRAT failed. */
+       WARN_ON(memblock_clear_hotplug(0, ULLONG_MAX));
+       numa_reset_distance();
+-- 
+2.43.0
+