]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 5.10
authorSasha Levin <sashal@kernel.org>
Mon, 12 Sep 2022 10:56:17 +0000 (06:56 -0400)
committerSasha Levin <sashal@kernel.org>
Mon, 12 Sep 2022 10:56:17 +0000 (06:56 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-5.10/hwmon-mr75203-enable-polling-for-all-vm-channels.patch [new file with mode: 0644]
queue-5.10/hwmon-mr75203-fix-multi-channel-voltage-reading.patch [new file with mode: 0644]
queue-5.10/hwmon-mr75203-fix-vm-sensor-allocation-when-intel-vm.patch [new file with mode: 0644]
queue-5.10/hwmon-mr75203-fix-voltage-equation-for-negative-sour.patch [new file with mode: 0644]
queue-5.10/hwmon-mr75203-update-pvt-v_num-and-vm_num-to-the-act.patch [new file with mode: 0644]
queue-5.10/iommu-amd-use-full-64-bit-value-in-build_completion_.patch [new file with mode: 0644]
queue-5.10/mips-loongson32-ls1c-fix-hang-during-startup.patch [new file with mode: 0644]
queue-5.10/series
queue-5.10/swiotlb-avoid-potential-left-shift-overflow.patch [new file with mode: 0644]

diff --git a/queue-5.10/hwmon-mr75203-enable-polling-for-all-vm-channels.patch b/queue-5.10/hwmon-mr75203-enable-polling-for-all-vm-channels.patch
new file mode 100644 (file)
index 0000000..3aae62b
--- /dev/null
@@ -0,0 +1,51 @@
+From f2d27e5ab5eec6ba5ff10efb119935b3c17d7e2a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 8 Sep 2022 15:24:34 +0000
+Subject: hwmon: (mr75203) enable polling for all VM channels
+
+From: Eliav Farber <farbere@amazon.com>
+
+[ Upstream commit e43212e0f55dc2d6b15d6c174cc0a64b25fab5e7 ]
+
+Configure ip-polling register to enable polling for all voltage monitor
+channels.
+This enables reading the voltage values for all inputs other than just
+input 0.
+
+Fixes: 9d823351a337 ("hwmon: Add hardware monitoring driver for Moortec MR75203 PVT controller")
+Signed-off-by: Eliav Farber <farbere@amazon.com>
+Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Link: https://lore.kernel.org/r/20220908152449.35457-7-farbere@amazon.com
+Signed-off-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/hwmon/mr75203.c | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff --git a/drivers/hwmon/mr75203.c b/drivers/hwmon/mr75203.c
+index 87a14713e1249..41e3d3b54baff 100644
+--- a/drivers/hwmon/mr75203.c
++++ b/drivers/hwmon/mr75203.c
+@@ -398,6 +398,19 @@ static int pvt_init(struct pvt_device *pvt)
+               if (ret)
+                       return ret;
++              val = (BIT(pvt->c_num) - 1) | VM_CH_INIT |
++                    IP_POLL << SDIF_ADDR_SFT | SDIF_WRN_W | SDIF_PROG;
++              ret = regmap_write(v_map, SDIF_W, val);
++              if (ret < 0)
++                      return ret;
++
++              ret = regmap_read_poll_timeout(v_map, SDIF_STAT,
++                                             val, !(val & SDIF_BUSY),
++                                             PVT_POLL_DELAY_US,
++                                             PVT_POLL_TIMEOUT_US);
++              if (ret)
++                      return ret;
++
+               val = CFG1_VOL_MEAS_MODE | CFG1_PARALLEL_OUT |
+                     CFG1_14_BIT | IP_CFG << SDIF_ADDR_SFT |
+                     SDIF_WRN_W | SDIF_PROG;
+-- 
+2.35.1
+
diff --git a/queue-5.10/hwmon-mr75203-fix-multi-channel-voltage-reading.patch b/queue-5.10/hwmon-mr75203-fix-multi-channel-voltage-reading.patch
new file mode 100644 (file)
index 0000000..71e4213
--- /dev/null
@@ -0,0 +1,136 @@
+From 0ae807064a69a791319d45caf1c87bba6b79cdff Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 8 Sep 2022 15:24:33 +0000
+Subject: hwmon: (mr75203) fix multi-channel voltage reading
+
+From: Eliav Farber <farbere@amazon.com>
+
+[ Upstream commit 91a9e063cdcfca8fe642b078d6fae4ce49187975 ]
+
+Fix voltage allocation and reading to support all channels in all VMs.
+Prior to this change allocation and reading were done only for the first
+channel in each VM.
+This change counts the total number of channels for allocation, and takes
+into account the channel offset when reading the sample data register.
+
+Fixes: 9d823351a337 ("hwmon: Add hardware monitoring driver for Moortec MR75203 PVT controller")
+Signed-off-by: Eliav Farber <farbere@amazon.com>
+Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Link: https://lore.kernel.org/r/20220908152449.35457-6-farbere@amazon.com
+Signed-off-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/hwmon/mr75203.c | 29 +++++++++++++++++------------
+ 1 file changed, 17 insertions(+), 12 deletions(-)
+
+diff --git a/drivers/hwmon/mr75203.c b/drivers/hwmon/mr75203.c
+index 8211d463495d0..87a14713e1249 100644
+--- a/drivers/hwmon/mr75203.c
++++ b/drivers/hwmon/mr75203.c
+@@ -68,8 +68,9 @@
+ /* VM Individual Macro Register */
+ #define VM_COM_REG_SIZE       0x200
+-#define VM_SDIF_DONE(n)       (VM_COM_REG_SIZE + 0x34 + 0x200 * (n))
+-#define VM_SDIF_DATA(n)       (VM_COM_REG_SIZE + 0x40 + 0x200 * (n))
++#define VM_SDIF_DONE(vm)      (VM_COM_REG_SIZE + 0x34 + 0x200 * (vm))
++#define VM_SDIF_DATA(vm, ch)  \
++      (VM_COM_REG_SIZE + 0x40 + 0x200 * (vm) + 0x4 * (ch))
+ /* SDA Slave Register */
+ #define IP_CTRL                       0x00
+@@ -115,6 +116,7 @@ struct pvt_device {
+       u32                     t_num;
+       u32                     p_num;
+       u32                     v_num;
++      u32                     c_num;
+       u32                     ip_freq;
+       u8                      *vm_idx;
+ };
+@@ -178,14 +180,15 @@ static int pvt_read_in(struct device *dev, u32 attr, int channel, long *val)
+ {
+       struct pvt_device *pvt = dev_get_drvdata(dev);
+       struct regmap *v_map = pvt->v_map;
++      u8 vm_idx, ch_idx;
+       u32 n, stat;
+-      u8 vm_idx;
+       int ret;
+-      if (channel >= pvt->v_num)
++      if (channel >= pvt->v_num * pvt->c_num)
+               return -EINVAL;
+-      vm_idx = pvt->vm_idx[channel];
++      vm_idx = pvt->vm_idx[channel / pvt->c_num];
++      ch_idx = channel % pvt->c_num;
+       switch (attr) {
+       case hwmon_in_input:
+@@ -196,7 +199,7 @@ static int pvt_read_in(struct device *dev, u32 attr, int channel, long *val)
+               if (ret)
+                       return ret;
+-              ret = regmap_read(v_map, VM_SDIF_DATA(vm_idx), &n);
++              ret = regmap_read(v_map, VM_SDIF_DATA(vm_idx, ch_idx), &n);
+               if(ret < 0)
+                       return ret;
+@@ -509,8 +512,8 @@ static int pvt_reset_control_deassert(struct device *dev, struct pvt_device *pvt
+ static int mr75203_probe(struct platform_device *pdev)
+ {
++      u32 ts_num, vm_num, pd_num, ch_num, val, index, i;
+       const struct hwmon_channel_info **pvt_info;
+-      u32 ts_num, vm_num, pd_num, val, index, i;
+       struct device *dev = &pdev->dev;
+       u32 *temp_config, *in_config;
+       struct device *hwmon_dev;
+@@ -551,9 +554,11 @@ static int mr75203_probe(struct platform_device *pdev)
+       ts_num = (val & TS_NUM_MSK) >> TS_NUM_SFT;
+       pd_num = (val & PD_NUM_MSK) >> PD_NUM_SFT;
+       vm_num = (val & VM_NUM_MSK) >> VM_NUM_SFT;
++      ch_num = (val & CH_NUM_MSK) >> CH_NUM_SFT;
+       pvt->t_num = ts_num;
+       pvt->p_num = pd_num;
+       pvt->v_num = vm_num;
++      pvt->c_num = ch_num;
+       val = 0;
+       if (ts_num)
+               val++;
+@@ -590,7 +595,7 @@ static int mr75203_probe(struct platform_device *pdev)
+       }
+       if (vm_num) {
+-              u32 num = vm_num;
++              u32 total_ch;
+               ret = pvt_get_regmap(pdev, "vm", pvt);
+               if (ret)
+@@ -614,20 +619,20 @@ static int mr75203_probe(struct platform_device *pdev)
+                       for (i = 0; i < vm_num; i++)
+                               if (pvt->vm_idx[i] >= vm_num ||
+                                   pvt->vm_idx[i] == 0xff) {
+-                                      num = i;
+                                       pvt->v_num = i;
+                                       vm_num = i;
+                                       break;
+                               }
+               }
+-              in_config = devm_kcalloc(dev, num + 1,
++              total_ch = ch_num * vm_num;
++              in_config = devm_kcalloc(dev, total_ch + 1,
+                                        sizeof(*in_config), GFP_KERNEL);
+               if (!in_config)
+                       return -ENOMEM;
+-              memset32(in_config, HWMON_I_INPUT, num);
+-              in_config[num] = 0;
++              memset32(in_config, HWMON_I_INPUT, total_ch);
++              in_config[total_ch] = 0;
+               pvt_in.config = in_config;
+               pvt_info[index++] = &pvt_in;
+-- 
+2.35.1
+
diff --git a/queue-5.10/hwmon-mr75203-fix-vm-sensor-allocation-when-intel-vm.patch b/queue-5.10/hwmon-mr75203-fix-vm-sensor-allocation-when-intel-vm.patch
new file mode 100644 (file)
index 0000000..cb29fe5
--- /dev/null
@@ -0,0 +1,71 @@
+From a901cb41ea741b4ef271b335d617a178727f1450 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 8 Sep 2022 15:24:30 +0000
+Subject: hwmon: (mr75203) fix VM sensor allocation when "intel,vm-map" not
+ defined
+
+From: Eliav Farber <farbere@amazon.com>
+
+[ Upstream commit 81114fc3d27bf5b06b2137d2fd2b63da656a8b90 ]
+
+Bug - in case "intel,vm-map" is missing in device-tree ,'num' is set
+to 0, and no voltage channel infos are allocated.
+
+The reason num is set to 0 when "intel,vm-map" is missing is to set the
+entire pvt->vm_idx[] with incremental channel numbers, but it didn't
+take into consideration that same num is used later in devm_kcalloc().
+
+If "intel,vm-map" does exist there is no need to set the unspecified
+channels with incremental numbers, because the unspecified channels
+can't be accessed in pvt_read_in() which is the only other place besides
+the probe functions that uses pvt->vm_idx[].
+
+This change fixes the bug by moving the incremental channel numbers
+setting to be done only if "intel,vm-map" property is defined (starting
+loop from 0), and removing 'num = 0'.
+
+Fixes: 9d823351a337 ("hwmon: Add hardware monitoring driver for Moortec MR75203 PVT controller")
+Signed-off-by: Eliav Farber <farbere@amazon.com>
+Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Link: https://lore.kernel.org/r/20220908152449.35457-3-farbere@amazon.com
+Signed-off-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/hwmon/mr75203.c | 14 ++++++--------
+ 1 file changed, 6 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/hwmon/mr75203.c b/drivers/hwmon/mr75203.c
+index 046523d47c29b..81ccb4c6fa5c0 100644
+--- a/drivers/hwmon/mr75203.c
++++ b/drivers/hwmon/mr75203.c
+@@ -594,7 +594,12 @@ static int mr75203_probe(struct platform_device *pdev)
+               ret = device_property_read_u8_array(dev, "intel,vm-map",
+                                                   pvt->vm_idx, vm_num);
+               if (ret) {
+-                      num = 0;
++                      /*
++                       * Incase intel,vm-map property is not defined, we
++                       * assume incremental channel numbers.
++                       */
++                      for (i = 0; i < vm_num; i++)
++                              pvt->vm_idx[i] = i;
+               } else {
+                       for (i = 0; i < vm_num; i++)
+                               if (pvt->vm_idx[i] >= vm_num ||
+@@ -604,13 +609,6 @@ static int mr75203_probe(struct platform_device *pdev)
+                               }
+               }
+-              /*
+-               * Incase intel,vm-map property is not defined, we assume
+-               * incremental channel numbers.
+-               */
+-              for (i = num; i < vm_num; i++)
+-                      pvt->vm_idx[i] = i;
+-
+               in_config = devm_kcalloc(dev, num + 1,
+                                        sizeof(*in_config), GFP_KERNEL);
+               if (!in_config)
+-- 
+2.35.1
+
diff --git a/queue-5.10/hwmon-mr75203-fix-voltage-equation-for-negative-sour.patch b/queue-5.10/hwmon-mr75203-fix-voltage-equation-for-negative-sour.patch
new file mode 100644 (file)
index 0000000..1948c4b
--- /dev/null
@@ -0,0 +1,70 @@
+From 46ac0df351bbc2ccb7bea4db6929f73fbef2c86b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 8 Sep 2022 15:24:32 +0000
+Subject: hwmon: (mr75203) fix voltage equation for negative source input
+
+From: Eliav Farber <farbere@amazon.com>
+
+[ Upstream commit 227a3a2fc31d8e4bb9c88d4804e19530af245b1b ]
+
+According to Moortec Embedded Voltage Monitor (MEVM) series 3 data
+sheet, the minimum input signal is -100mv and maximum input signal
+is +1000mv.
+
+The equation used to convert the digital word to voltage uses mixed
+types (*val signed and n unsigned), and on 64 bit machines also has
+different size, since sizeof(u32) = 4 and sizeof(long) = 8.
+
+So when measuring a negative input, n will be small enough, such that
+PVT_N_CONST * n < PVT_R_CONST, and the result of
+(PVT_N_CONST * n - PVT_R_CONST) will overflow to a very big positive
+32 bit number. Then when storing the result in *val it will be the same
+value just in 64 bit (instead of it representing a negative number which
+will what happen when sizeof(long) = 4).
+
+When -1023 <= (PVT_N_CONST * n - PVT_R_CONST) <= -1
+dividing the number by 1024 should result of in 0, but because ">> 10"
+is used, and the sign bit is used to fill the vacated bit positions, it
+results in -1 (0xf...fffff) which is wrong.
+
+This change fixes the sign problem and supports negative values by
+casting n to long and replacing the shift right with div operation.
+
+Fixes: 9d823351a337 ("hwmon: Add hardware monitoring driver for Moortec MR75203 PVT controller")
+Signed-off-by: Eliav Farber <farbere@amazon.com>
+Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Link: https://lore.kernel.org/r/20220908152449.35457-5-farbere@amazon.com
+Signed-off-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/hwmon/mr75203.c | 14 ++++++++++++--
+ 1 file changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/hwmon/mr75203.c b/drivers/hwmon/mr75203.c
+index 62df0c9498f38..8211d463495d0 100644
+--- a/drivers/hwmon/mr75203.c
++++ b/drivers/hwmon/mr75203.c
+@@ -201,8 +201,18 @@ static int pvt_read_in(struct device *dev, u32 attr, int channel, long *val)
+                       return ret;
+               n &= SAMPLE_DATA_MSK;
+-              /* Convert the N bitstream count into voltage */
+-              *val = (PVT_N_CONST * n - PVT_R_CONST) >> PVT_CONV_BITS;
++              /*
++               * Convert the N bitstream count into voltage.
++               * To support negative voltage calculation for 64bit machines
++               * n must be cast to long, since n and *val differ both in
++               * signedness and in size.
++               * Division is used instead of right shift, because for signed
++               * numbers, the sign bit is used to fill the vacated bit
++               * positions, and if the number is negative, 1 is used.
++               * BIT(x) may not be used instead of (1 << x) because it's
++               * unsigned.
++               */
++              *val = (PVT_N_CONST * (long)n - PVT_R_CONST) / (1 << PVT_CONV_BITS);
+               return 0;
+       default:
+-- 
+2.35.1
+
diff --git a/queue-5.10/hwmon-mr75203-update-pvt-v_num-and-vm_num-to-the-act.patch b/queue-5.10/hwmon-mr75203-update-pvt-v_num-and-vm_num-to-the-act.patch
new file mode 100644 (file)
index 0000000..f7fc4fb
--- /dev/null
@@ -0,0 +1,42 @@
+From bba6fbad3d9158a4fd6f1f49bacdf37197830223 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 8 Sep 2022 15:24:31 +0000
+Subject: hwmon: (mr75203) update pvt->v_num and vm_num to the actual number of
+ used sensors
+
+From: Eliav Farber <farbere@amazon.com>
+
+[ Upstream commit bb9195bd6664d94d71647631593e09f705ff5edd ]
+
+This issue is relevant when "intel,vm-map" is set in device-tree, and
+defines a lower number of VMs than actually supported.
+
+This change is needed for all places that use pvt->v_num or vm_num
+later on in the code.
+
+Fixes: 9d823351a337 ("hwmon: Add hardware monitoring driver for Moortec MR75203 PVT controller")
+Signed-off-by: Eliav Farber <farbere@amazon.com>
+Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Link: https://lore.kernel.org/r/20220908152449.35457-4-farbere@amazon.com
+Signed-off-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/hwmon/mr75203.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/hwmon/mr75203.c b/drivers/hwmon/mr75203.c
+index 81ccb4c6fa5c0..62df0c9498f38 100644
+--- a/drivers/hwmon/mr75203.c
++++ b/drivers/hwmon/mr75203.c
+@@ -605,6 +605,8 @@ static int mr75203_probe(struct platform_device *pdev)
+                               if (pvt->vm_idx[i] >= vm_num ||
+                                   pvt->vm_idx[i] == 0xff) {
+                                       num = i;
++                                      pvt->v_num = i;
++                                      vm_num = i;
+                                       break;
+                               }
+               }
+-- 
+2.35.1
+
diff --git a/queue-5.10/iommu-amd-use-full-64-bit-value-in-build_completion_.patch b/queue-5.10/iommu-amd-use-full-64-bit-value-in-build_completion_.patch
new file mode 100644 (file)
index 0000000..6f37c84
--- /dev/null
@@ -0,0 +1,39 @@
+From cacf3d2ff13b7e86aa26091343ac4b7c861b15cc Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 1 Aug 2022 19:22:29 +0000
+Subject: iommu/amd: use full 64-bit value in build_completion_wait()
+
+From: John Sperbeck <jsperbeck@google.com>
+
+[ Upstream commit 94a568ce32038d8ff9257004bb4632e60eb43a49 ]
+
+We started using a 64 bit completion value.  Unfortunately, we only
+stored the low 32-bits, so a very large completion value would never
+be matched in iommu_completion_wait().
+
+Fixes: c69d89aff393 ("iommu/amd: Use 4K page for completion wait write-back semaphore")
+Signed-off-by: John Sperbeck <jsperbeck@google.com>
+Link: https://lore.kernel.org/r/20220801192229.3358786-1-jsperbeck@google.com
+Signed-off-by: Joerg Roedel <jroedel@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/iommu/amd/iommu.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
+index 200cf5da5e0ad..f216a86d9c817 100644
+--- a/drivers/iommu/amd/iommu.c
++++ b/drivers/iommu/amd/iommu.c
+@@ -923,7 +923,8 @@ static void build_completion_wait(struct iommu_cmd *cmd,
+       memset(cmd, 0, sizeof(*cmd));
+       cmd->data[0] = lower_32_bits(paddr) | CMD_COMPL_WAIT_STORE_MASK;
+       cmd->data[1] = upper_32_bits(paddr);
+-      cmd->data[2] = data;
++      cmd->data[2] = lower_32_bits(data);
++      cmd->data[3] = upper_32_bits(data);
+       CMD_SET_TYPE(cmd, CMD_COMPL_WAIT);
+ }
+-- 
+2.35.1
+
diff --git a/queue-5.10/mips-loongson32-ls1c-fix-hang-during-startup.patch b/queue-5.10/mips-loongson32-ls1c-fix-hang-during-startup.patch
new file mode 100644 (file)
index 0000000..d27355a
--- /dev/null
@@ -0,0 +1,37 @@
+From 7a7e3fc355c3cd2291d6a1b4beb1f6cd8476f2aa Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 23 Aug 2022 19:17:25 +0800
+Subject: MIPS: loongson32: ls1c: Fix hang during startup
+
+From: Yang Ling <gnaygnil@gmail.com>
+
+[ Upstream commit 35508d2424097f9b6a1a17aac94f702767035616 ]
+
+The RTCCTRL reg of LS1C is obselete.
+Writing this reg will cause system hang.
+
+Fixes: 60219c563c9b6 ("MIPS: Add RTC support for Loongson1C board")
+Signed-off-by: Yang Ling <gnaygnil@gmail.com>
+Tested-by: Keguang Zhang <keguang.zhang@gmail.com>
+Acked-by: Keguang Zhang <keguang.zhang@gmail.com>
+Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/mips/loongson32/ls1c/board.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/arch/mips/loongson32/ls1c/board.c b/arch/mips/loongson32/ls1c/board.c
+index e9de6da0ce51f..9dcfe9de55b0a 100644
+--- a/arch/mips/loongson32/ls1c/board.c
++++ b/arch/mips/loongson32/ls1c/board.c
+@@ -15,7 +15,6 @@ static struct platform_device *ls1c_platform_devices[] __initdata = {
+ static int __init ls1c_platform_init(void)
+ {
+       ls1x_serial_set_uartclk(&ls1x_uart_pdev);
+-      ls1x_rtc_set_extclk(&ls1x_rtc_pdev);
+       return platform_add_devices(ls1c_platform_devices,
+                                  ARRAY_SIZE(ls1c_platform_devices));
+-- 
+2.35.1
+
index 50a6ab1e063dbb5f46e2d7231f2c57312705d5f2..5acb2e21dd620a3af0df116fa1a619d888677d91 100644 (file)
@@ -68,3 +68,11 @@ tcp-fix-early-etimedout-after-spurious-non-sack-rto.patch
 sch_sfb-also-store-skb-len-before-calling-child-enqu.patch
 asoc-mchp-spdiftx-remove-references-to-mchp_i2s_caps.patch
 asoc-mchp-spdiftx-fix-clang-wbitfield-constant-conversion.patch
+mips-loongson32-ls1c-fix-hang-during-startup.patch
+swiotlb-avoid-potential-left-shift-overflow.patch
+iommu-amd-use-full-64-bit-value-in-build_completion_.patch
+hwmon-mr75203-fix-vm-sensor-allocation-when-intel-vm.patch
+hwmon-mr75203-update-pvt-v_num-and-vm_num-to-the-act.patch
+hwmon-mr75203-fix-voltage-equation-for-negative-sour.patch
+hwmon-mr75203-fix-multi-channel-voltage-reading.patch
+hwmon-mr75203-enable-polling-for-all-vm-channels.patch
diff --git a/queue-5.10/swiotlb-avoid-potential-left-shift-overflow.patch b/queue-5.10/swiotlb-avoid-potential-left-shift-overflow.patch
new file mode 100644 (file)
index 0000000..5352949
--- /dev/null
@@ -0,0 +1,44 @@
+From 1304098a1f8233de85e89173e0e1738a21984a86 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 19 Aug 2022 16:45:37 +0800
+Subject: swiotlb: avoid potential left shift overflow
+
+From: Chao Gao <chao.gao@intel.com>
+
+[ Upstream commit 3f0461613ebcdc8c4073e235053d06d5aa58750f ]
+
+The second operand passed to slot_addr() is declared as int or unsigned int
+in all call sites. The left-shift to get the offset of a slot can overflow
+if swiotlb size is larger than 4G.
+
+Convert the macro to an inline function and declare the second argument as
+phys_addr_t to avoid the potential overflow.
+
+Fixes: 26a7e094783d ("swiotlb: refactor swiotlb_tbl_map_single")
+Signed-off-by: Chao Gao <chao.gao@intel.com>
+Reviewed-by: Dongli Zhang <dongli.zhang@oracle.com>
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/dma/swiotlb.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
+index 274587a57717f..4a9831d01f0ea 100644
+--- a/kernel/dma/swiotlb.c
++++ b/kernel/dma/swiotlb.c
+@@ -452,7 +452,10 @@ static void swiotlb_bounce(phys_addr_t orig_addr, phys_addr_t tlb_addr,
+       }
+ }
+-#define slot_addr(start, idx) ((start) + ((idx) << IO_TLB_SHIFT))
++static inline phys_addr_t slot_addr(phys_addr_t start, phys_addr_t idx)
++{
++      return start + (idx << IO_TLB_SHIFT);
++}
+ /*
+  * Return the offset into a iotlb slot required to keep the device happy.
+-- 
+2.35.1
+