]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.18-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 18 Jul 2022 15:50:58 +0000 (17:50 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 18 Jul 2022 15:50:58 +0000 (17:50 +0200)
added patches:
acpi-cppc-fix-enabling-cppc-on-amd-systems-with-shared-memory.patch
power-supply-core-fix-boundary-conditions-in-interpolation.patch
s390-ap-fix-error-handling-in-__verify_queue_reservations.patch
serial-8250-fix-pm-usage_count-for-console-handover.patch
serial-8250-fix-return-error-code-in-serial8250_request_std_resource.patch
serial-mvebu-uart-correctly-report-configured-baudrate-value.patch
serial-pl011-upstat_autorts-requires-.throttle-unthrottle.patch
serial-stm32-clear-prev-values-before-setting-rts-delays.patch
vt-fix-memory-overlapping-when-deleting-chars-in-the-buffer.patch
x86-pat-fix-x86_has_pat_wp.patch

12 files changed:
queue-5.18/acpi-cppc-fix-enabling-cppc-on-amd-systems-with-shared-memory.patch [new file with mode: 0644]
queue-5.18/acpi-video-fix-acpi_video_handles_brightness_key_pre.patch
queue-5.18/power-supply-core-fix-boundary-conditions-in-interpolation.patch [new file with mode: 0644]
queue-5.18/s390-ap-fix-error-handling-in-__verify_queue_reservations.patch [new file with mode: 0644]
queue-5.18/serial-8250-fix-pm-usage_count-for-console-handover.patch [new file with mode: 0644]
queue-5.18/serial-8250-fix-return-error-code-in-serial8250_request_std_resource.patch [new file with mode: 0644]
queue-5.18/serial-mvebu-uart-correctly-report-configured-baudrate-value.patch [new file with mode: 0644]
queue-5.18/serial-pl011-upstat_autorts-requires-.throttle-unthrottle.patch [new file with mode: 0644]
queue-5.18/serial-stm32-clear-prev-values-before-setting-rts-delays.patch [new file with mode: 0644]
queue-5.18/series
queue-5.18/vt-fix-memory-overlapping-when-deleting-chars-in-the-buffer.patch [new file with mode: 0644]
queue-5.18/x86-pat-fix-x86_has_pat_wp.patch [new file with mode: 0644]

diff --git a/queue-5.18/acpi-cppc-fix-enabling-cppc-on-amd-systems-with-shared-memory.patch b/queue-5.18/acpi-cppc-fix-enabling-cppc-on-amd-systems-with-shared-memory.patch
new file mode 100644 (file)
index 0000000..d0b8b12
--- /dev/null
@@ -0,0 +1,49 @@
+From fbd74d16890b9f5d08ea69b5282b123c894f8860 Mon Sep 17 00:00:00 2001
+From: Mario Limonciello <mario.limonciello@amd.com>
+Date: Wed, 13 Jul 2022 12:53:46 -0500
+Subject: ACPI: CPPC: Fix enabling CPPC on AMD systems with shared memory
+
+From: Mario Limonciello <mario.limonciello@amd.com>
+
+commit fbd74d16890b9f5d08ea69b5282b123c894f8860 upstream.
+
+When commit 72f2ecb7ece7 ("ACPI: bus: Set CPPC _OSC bits for all
+and when CPPC_LIB is supported") was introduced, we found collateral
+damage that a number of AMD systems that supported CPPC but
+didn't advertise support in _OSC stopped having a functional
+amd-pstate driver. The _OSC was only enforced on Intel systems at that
+time.
+
+This was fixed for the MSR based designs by commit 8b356e536e69f
+("ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC is supported")
+but some shared memory based designs also support CPPC but haven't
+advertised support in the _OSC.  Add support for those designs as well by
+hardcoding the list of systems.
+
+Fixes: 72f2ecb7ece7 ("ACPI: bus: Set CPPC _OSC bits for all and when CPPC_LIB is supported")
+Fixes: 8b356e536e69f ("ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC is supported")
+Link: https://lore.kernel.org/all/3559249.JlDtxWtqDm@natalenko.name/
+Cc: 5.18+ <stable@vger.kernel.org> # 5.18+
+Reported-and-tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
+Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kernel/acpi/cppc.c |    6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/arch/x86/kernel/acpi/cppc.c
++++ b/arch/x86/kernel/acpi/cppc.c
+@@ -16,6 +16,12 @@ bool cpc_supported_by_cpu(void)
+       switch (boot_cpu_data.x86_vendor) {
+       case X86_VENDOR_AMD:
+       case X86_VENDOR_HYGON:
++              if (boot_cpu_data.x86 == 0x19 && ((boot_cpu_data.x86_model <= 0x0f) ||
++                  (boot_cpu_data.x86_model >= 0x20 && boot_cpu_data.x86_model <= 0x2f)))
++                      return true;
++              else if (boot_cpu_data.x86 == 0x17 &&
++                       boot_cpu_data.x86_model >= 0x70 && boot_cpu_data.x86_model <= 0x7f)
++                      return true;
+               return boot_cpu_has(X86_FEATURE_CPPC);
+       }
+       return false;
index af10cd08891dbe91ae4a734327eab19e357e9784..cebd5b3b70d56036d66f5a7498a9798820b4485a 100644 (file)
@@ -41,14 +41,12 @@ Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
 Link: https://lore.kernel.org/r/20220713211101.85547-2-hdegoede@redhat.com
 Signed-off-by: Sasha Levin <sashal@kernel.org>
 ---
- drivers/acpi/acpi_video.c | 11 +++++++----
+ drivers/acpi/acpi_video.c |   11 +++++++----
  1 file changed, 7 insertions(+), 4 deletions(-)
 
-diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
-index e4ea42b83b51..3bd0de69aa11 100644
 --- a/drivers/acpi/acpi_video.c
 +++ b/drivers/acpi/acpi_video.c
-@@ -73,7 +73,7 @@ module_param(device_id_scheme, bool, 0444);
+@@ -73,7 +73,7 @@ module_param(device_id_scheme, bool, 044
  static int only_lcd = -1;
  module_param(only_lcd, int, 0444);
  
@@ -57,7 +55,7 @@ index e4ea42b83b51..3bd0de69aa11 100644
  static int register_count;
  static DEFINE_MUTEX(register_count_mutex);
  static DEFINE_MUTEX(video_list_lock);
-@@ -1224,7 +1224,7 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
+@@ -1224,7 +1224,7 @@ acpi_video_bus_get_one_device(struct acp
        acpi_video_device_find_cap(data);
  
        if (data->cap._BCM && data->cap._BCL)
@@ -66,7 +64,7 @@ index e4ea42b83b51..3bd0de69aa11 100644
  
        mutex_lock(&video->device_list_lock);
        list_add_tail(&data->entry, &video->video_device_list);
-@@ -1693,6 +1693,9 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
+@@ -1693,6 +1693,9 @@ static void acpi_video_device_notify(acp
                break;
        }
  
@@ -85,7 +83,7 @@ index e4ea42b83b51..3bd0de69aa11 100644
        }
        mutex_unlock(&register_count_mutex);
  }
-@@ -2276,7 +2279,7 @@ void acpi_video_unregister_backlight(void)
+@@ -2276,7 +2279,7 @@ void acpi_video_unregister_backlight(voi
  
  bool acpi_video_handles_brightness_key_presses(void)
  {
@@ -94,6 +92,3 @@ index e4ea42b83b51..3bd0de69aa11 100644
               (report_key_events & REPORT_BRIGHTNESS_KEY_EVENTS);
  }
  EXPORT_SYMBOL(acpi_video_handles_brightness_key_presses);
--- 
-2.35.1
-
diff --git a/queue-5.18/power-supply-core-fix-boundary-conditions-in-interpolation.patch b/queue-5.18/power-supply-core-fix-boundary-conditions-in-interpolation.patch
new file mode 100644 (file)
index 0000000..0f1dfc5
--- /dev/null
@@ -0,0 +1,81 @@
+From 093d27bb6f2d1963f927ef59c9a2d37059175426 Mon Sep 17 00:00:00 2001
+From: Dorian Rudolph <mail@dorianrudolph.com>
+Date: Sat, 14 May 2022 17:23:40 +0200
+Subject: power: supply: core: Fix boundary conditions in interpolation
+
+From: Dorian Rudolph <mail@dorianrudolph.com>
+
+commit 093d27bb6f2d1963f927ef59c9a2d37059175426 upstream.
+
+The functions power_supply_temp2resist_simple and power_supply_ocv2cap_simple
+handle boundary conditions incorrectly.
+The change was introduced in a4585ba2050f460f749bbaf2b67bd56c41e30283
+("power: supply: core: Use library interpolation").
+There are two issues: First, the lines "high = i - 1" and "high = i" in ocv2cap
+have the wrong order compared to temp2resist. As a consequence, ocv2cap
+sets high=-1 if ocv>table[0].ocv, which causes an out-of-bounds read.
+Second, the logic of temp2resist is also not correct.
+Consider the case table[] = {{20, 100}, {10, 80}, {0, 60}}.
+For temp=5, we expect a resistance of 70% by interpolation.
+However, temp2resist sets high=low=2 and returns 60.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Dorian Rudolph <mail@dorianrudolph.com>
+Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
+Fixes: a4585ba2050f ("power: supply: core: Use library interpolation")
+Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/power/supply/power_supply_core.c |   24 ++++++++++++------------
+ 1 file changed, 12 insertions(+), 12 deletions(-)
+
+--- a/drivers/power/supply/power_supply_core.c
++++ b/drivers/power/supply/power_supply_core.c
+@@ -846,17 +846,17 @@ int power_supply_temp2resist_simple(stru
+ {
+       int i, high, low;
+-      /* Break loop at table_len - 1 because that is the highest index */
+-      for (i = 0; i < table_len - 1; i++)
++      for (i = 0; i < table_len; i++)
+               if (temp > table[i].temp)
+                       break;
+       /* The library function will deal with high == low */
+-      if ((i == 0) || (i == (table_len - 1)))
+-              high = i;
++      if (i == 0)
++              high = low = i;
++      else if (i == table_len)
++              high = low = i - 1;
+       else
+-              high = i - 1;
+-      low = i;
++              high = (low = i) - 1;
+       return fixp_linear_interpolate(table[low].temp,
+                                      table[low].resistance,
+@@ -958,17 +958,17 @@ int power_supply_ocv2cap_simple(struct p
+ {
+       int i, high, low;
+-      /* Break loop at table_len - 1 because that is the highest index */
+-      for (i = 0; i < table_len - 1; i++)
++      for (i = 0; i < table_len; i++)
+               if (ocv > table[i].ocv)
+                       break;
+       /* The library function will deal with high == low */
+-      if ((i == 0) || (i == (table_len - 1)))
+-              high = i - 1;
++      if (i == 0)
++              high = low = i;
++      else if (i == table_len)
++              high = low = i - 1;
+       else
+-              high = i; /* i.e. i == 0 */
+-      low = i;
++              high = (low = i) - 1;
+       return fixp_linear_interpolate(table[low].ocv,
+                                      table[low].capacity,
diff --git a/queue-5.18/s390-ap-fix-error-handling-in-__verify_queue_reservations.patch b/queue-5.18/s390-ap-fix-error-handling-in-__verify_queue_reservations.patch
new file mode 100644 (file)
index 0000000..978395e
--- /dev/null
@@ -0,0 +1,38 @@
+From 2f23256c0ea20627c91ea2d468cda945f68c3395 Mon Sep 17 00:00:00 2001
+From: Tony Krowiak <akrowiak@linux.ibm.com>
+Date: Wed, 6 Jul 2022 17:43:29 -0400
+Subject: s390/ap: fix error handling in __verify_queue_reservations()
+
+From: Tony Krowiak <akrowiak@linux.ibm.com>
+
+commit 2f23256c0ea20627c91ea2d468cda945f68c3395 upstream.
+
+The AP bus's __verify_queue_reservations function increments the ref count
+for the device driver passed in as a parameter, but fails to decrement it
+before returning control to the caller. This will prevents any subsequent
+removal of the module.
+
+Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
+Reported-by: Tony Krowiak <akrowiak@linux.ibm.com>
+Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>
+Fixes: 4f8206b88286 ("s390/ap: driver callback to indicate resource in use")
+Link: https://lore.kernel.org/r/20220706222619.602094-1-akrowiak@linux.ibm.com
+Cc: stable@vger.kernel.org
+[agordeev@linux.ibm.com fixed description, added Fixes and Link]
+Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/s390/crypto/ap_bus.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/s390/crypto/ap_bus.c
++++ b/drivers/s390/crypto/ap_bus.c
+@@ -1410,7 +1410,7 @@ static int __verify_queue_reservations(s
+       if (ap_drv->in_use) {
+               rc = ap_drv->in_use(ap_perms.apm, newaqm);
+               if (rc)
+-                      return -EBUSY;
++                      rc = -EBUSY;
+       }
+       /* release the driver's module */
diff --git a/queue-5.18/serial-8250-fix-pm-usage_count-for-console-handover.patch b/queue-5.18/serial-8250-fix-pm-usage_count-for-console-handover.patch
new file mode 100644 (file)
index 0000000..30298f0
--- /dev/null
@@ -0,0 +1,105 @@
+From f9b11229b79c0fb2100b5bb4628a101b1d37fbf6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>
+Date: Wed, 29 Jun 2022 12:48:41 +0300
+Subject: serial: 8250: Fix PM usage_count for console handover
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+
+commit f9b11229b79c0fb2100b5bb4628a101b1d37fbf6 upstream.
+
+When console is enabled, univ8250_console_setup() calls
+serial8250_console_setup() before .dev is set to uart_port. Therefore,
+it will not call pm_runtime_get_sync(). Later, when the actual driver
+is going to take over univ8250_console_exit() is called. As .dev is
+already set, serial8250_console_exit() makes pm_runtime_put_sync() call
+with usage count being zero triggering PM usage count warning
+(extra debug for univ8250_console_setup(), univ8250_console_exit(), and
+serial8250_register_ports()):
+
+[    0.068987] univ8250_console_setup ttyS0 nodev
+[    0.499670] printk: console [ttyS0] enabled
+[    0.717955] printk: console [ttyS0] printing thread started
+[    1.960163] serial8250_register_ports assigned dev for ttyS0
+[    1.976830] printk: console [ttyS0] disabled
+[    1.976888] printk: console [ttyS0] printing thread stopped
+[    1.977073] univ8250_console_exit ttyS0 usage:0
+[    1.977075] serial8250 serial8250: Runtime PM usage count underflow!
+[    1.977429] dw-apb-uart.6: ttyS0 at MMIO 0x4010006000 (irq = 33, base_baud = 115200) is a 16550A
+[    1.977812] univ8250_console_setup ttyS0 usage:2
+[    1.978167] printk: console [ttyS0] printing thread started
+[    1.978203] printk: console [ttyS0] enabled
+
+To fix the issue, call pm_runtime_get_sync() in
+serial8250_register_ports() as soon as .dev is set for an uart_port
+if it has console enabled.
+
+This problem became apparent only recently because 82586a721595 ("PM:
+runtime: Avoid device usage count underflows") added the warning
+printout. I confirmed this problem also occurs with v5.18 (w/o the
+warning printout, obviously).
+
+Fixes: bedb404e91bb ("serial: 8250_port: Don't use power management for kernel console")
+Cc: stable <stable@kernel.org>
+Tested-by: Tony Lindgren <tony@atomide.com>
+Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Reviewed-by: Tony Lindgren <tony@atomide.com>
+Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Link: https://lore.kernel.org/r/b4f428e9-491f-daf2-2232-819928dc276e@linux.intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/tty/serial/8250/8250_core.c |    4 ++++
+ drivers/tty/serial/serial_core.c    |    5 -----
+ include/linux/serial_core.h         |    5 +++++
+ 3 files changed, 9 insertions(+), 5 deletions(-)
+
+--- a/drivers/tty/serial/8250/8250_core.c
++++ b/drivers/tty/serial/8250/8250_core.c
+@@ -23,6 +23,7 @@
+ #include <linux/sysrq.h>
+ #include <linux/delay.h>
+ #include <linux/platform_device.h>
++#include <linux/pm_runtime.h>
+ #include <linux/tty.h>
+ #include <linux/ratelimit.h>
+ #include <linux/tty_flip.h>
+@@ -560,6 +561,9 @@ serial8250_register_ports(struct uart_dr
+               up->port.dev = dev;
++              if (uart_console_enabled(&up->port))
++                      pm_runtime_get_sync(up->port.dev);
++
+               serial8250_apply_quirks(up);
+               uart_add_one_port(drv, &up->port);
+       }
+--- a/drivers/tty/serial/serial_core.c
++++ b/drivers/tty/serial/serial_core.c
+@@ -1904,11 +1904,6 @@ static int uart_proc_show(struct seq_fil
+ }
+ #endif
+-static inline bool uart_console_enabled(struct uart_port *port)
+-{
+-      return uart_console(port) && (port->cons->flags & CON_ENABLED);
+-}
+-
+ static void uart_port_spin_lock_init(struct uart_port *port)
+ {
+       spin_lock_init(&port->lock);
+--- a/include/linux/serial_core.h
++++ b/include/linux/serial_core.h
+@@ -388,6 +388,11 @@ static const bool earlycon_acpi_spcr_ena
+ static inline int setup_earlycon(char *buf) { return 0; }
+ #endif
++static inline bool uart_console_enabled(struct uart_port *port)
++{
++      return uart_console(port) && (port->cons->flags & CON_ENABLED);
++}
++
+ struct uart_port *uart_get_console(struct uart_port *ports, int nr,
+                                  struct console *c);
+ int uart_parse_earlycon(char *p, unsigned char *iotype, resource_size_t *addr,
diff --git a/queue-5.18/serial-8250-fix-return-error-code-in-serial8250_request_std_resource.patch b/queue-5.18/serial-8250-fix-return-error-code-in-serial8250_request_std_resource.patch
new file mode 100644 (file)
index 0000000..ea4024e
--- /dev/null
@@ -0,0 +1,39 @@
+From 6e690d54cfa802f939cefbd2fa2c91bd0b8bd1b6 Mon Sep 17 00:00:00 2001
+From: Yi Yang <yiyang13@huawei.com>
+Date: Tue, 28 Jun 2022 16:35:15 +0800
+Subject: serial: 8250: fix return error code in serial8250_request_std_resource()
+
+From: Yi Yang <yiyang13@huawei.com>
+
+commit 6e690d54cfa802f939cefbd2fa2c91bd0b8bd1b6 upstream.
+
+If port->mapbase = NULL in serial8250_request_std_resource() , it need
+return a error code instead of 0. If uart_set_info() fail to request new
+regions by serial8250_request_std_resource() but the return value of
+serial8250_request_std_resource() is 0, The system incorrectly considers
+that the resource application is successful and does not attempt to
+restore the old setting. A null pointer reference is triggered when the
+port resource is later invoked.
+
+Signed-off-by: Yi Yang <yiyang13@huawei.com>
+Cc: stable <stable@kernel.org>
+Link: https://lore.kernel.org/r/20220628083515.64138-1-yiyang13@huawei.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/tty/serial/8250/8250_port.c |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/drivers/tty/serial/8250/8250_port.c
++++ b/drivers/tty/serial/8250/8250_port.c
+@@ -2971,8 +2971,10 @@ static int serial8250_request_std_resour
+       case UPIO_MEM32BE:
+       case UPIO_MEM16:
+       case UPIO_MEM:
+-              if (!port->mapbase)
++              if (!port->mapbase) {
++                      ret = -EINVAL;
+                       break;
++              }
+               if (!request_mem_region(port->mapbase, size, "serial")) {
+                       ret = -EBUSY;
diff --git a/queue-5.18/serial-mvebu-uart-correctly-report-configured-baudrate-value.patch b/queue-5.18/serial-mvebu-uart-correctly-report-configured-baudrate-value.patch
new file mode 100644 (file)
index 0000000..3b541ba
--- /dev/null
@@ -0,0 +1,94 @@
+From 4f532c1e25319e42996ec18a1f473fd50c8e575d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
+Date: Tue, 28 Jun 2022 12:09:22 +0200
+Subject: serial: mvebu-uart: correctly report configured baudrate value
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Pali Rohár <pali@kernel.org>
+
+commit 4f532c1e25319e42996ec18a1f473fd50c8e575d upstream.
+
+Functions tty_termios_encode_baud_rate() and uart_update_timeout() should
+be called with the baudrate value which was set to hardware. Linux then
+report exact values via ioctl(TCGETS2) to userspace.
+
+Change mvebu_uart_baud_rate_set() function to return baudrate value which
+was set to hardware and propagate this value to above mentioned functions.
+
+With this change userspace would see precise value in termios c_ospeed
+field.
+
+Fixes: 68a0db1d7da2 ("serial: mvebu-uart: add function to change baudrate")
+Cc: stable <stable@kernel.org>
+Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Signed-off-by: Pali Rohár <pali@kernel.org>
+Link: https://lore.kernel.org/r/20220628100922.10717-1-pali@kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/tty/serial/mvebu-uart.c |   25 +++++++++++++------------
+ 1 file changed, 13 insertions(+), 12 deletions(-)
+
+--- a/drivers/tty/serial/mvebu-uart.c
++++ b/drivers/tty/serial/mvebu-uart.c
+@@ -470,14 +470,14 @@ static void mvebu_uart_shutdown(struct u
+       }
+ }
+-static int mvebu_uart_baud_rate_set(struct uart_port *port, unsigned int baud)
++static unsigned int mvebu_uart_baud_rate_set(struct uart_port *port, unsigned int baud)
+ {
+       unsigned int d_divisor, m_divisor;
+       unsigned long flags;
+       u32 brdv, osamp;
+       if (!port->uartclk)
+-              return -EOPNOTSUPP;
++              return 0;
+       /*
+        * The baudrate is derived from the UART clock thanks to divisors:
+@@ -548,7 +548,7 @@ static int mvebu_uart_baud_rate_set(stru
+                       (m_divisor << 16) | (m_divisor << 24);
+       writel(osamp, port->membase + UART_OSAMP);
+-      return 0;
++      return DIV_ROUND_CLOSEST(port->uartclk, d_divisor * m_divisor);
+ }
+ static void mvebu_uart_set_termios(struct uart_port *port,
+@@ -587,15 +587,11 @@ static void mvebu_uart_set_termios(struc
+       max_baud = port->uartclk / 80;
+       baud = uart_get_baud_rate(port, termios, old, min_baud, max_baud);
+-      if (mvebu_uart_baud_rate_set(port, baud)) {
+-              /* No clock available, baudrate cannot be changed */
+-              if (old)
+-                      baud = uart_get_baud_rate(port, old, NULL,
+-                                                min_baud, max_baud);
+-      } else {
+-              tty_termios_encode_baud_rate(termios, baud, baud);
+-              uart_update_timeout(port, termios->c_cflag, baud);
+-      }
++      baud = mvebu_uart_baud_rate_set(port, baud);
++
++      /* In case baudrate cannot be changed, report previous old value */
++      if (baud == 0 && old)
++              baud = tty_termios_baud_rate(old);
+       /* Only the following flag changes are supported */
+       if (old) {
+@@ -606,6 +602,11 @@ static void mvebu_uart_set_termios(struc
+               termios->c_cflag |= CS8;
+       }
++      if (baud != 0) {
++              tty_termios_encode_baud_rate(termios, baud, baud);
++              uart_update_timeout(port, termios->c_cflag, baud);
++      }
++
+       spin_unlock_irqrestore(&port->lock, flags);
+ }
diff --git a/queue-5.18/serial-pl011-upstat_autorts-requires-.throttle-unthrottle.patch b/queue-5.18/serial-pl011-upstat_autorts-requires-.throttle-unthrottle.patch
new file mode 100644 (file)
index 0000000..c757a40
--- /dev/null
@@ -0,0 +1,83 @@
+From 211565b100993c90b53bf40851eacaefc830cfe0 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>
+Date: Tue, 14 Jun 2022 10:56:37 +0300
+Subject: serial: pl011: UPSTAT_AUTORTS requires .throttle/unthrottle
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+
+commit 211565b100993c90b53bf40851eacaefc830cfe0 upstream.
+
+The driver must provide throttle and unthrottle in uart_ops when it
+sets UPSTAT_AUTORTS. Add them using existing stop_rx &
+enable_interrupts functions.
+
+Fixes: 2a76fa283098 (serial: pl011: Adopt generic flag to store auto RTS status)
+Cc: stable <stable@kernel.org>
+Cc: Lukas Wunner <lukas@wunner.de>
+Reported-by: Nuno Gonçalves <nunojpg@gmail.com>
+Tested-by: Nuno Gonçalves <nunojpg@gmail.com>
+Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Link: https://lore.kernel.org/r/20220614075637.8558-1-ilpo.jarvinen@linux.intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/tty/serial/amba-pl011.c |   23 +++++++++++++++++++++--
+ 1 file changed, 21 insertions(+), 2 deletions(-)
+
+--- a/drivers/tty/serial/amba-pl011.c
++++ b/drivers/tty/serial/amba-pl011.c
+@@ -1339,6 +1339,15 @@ static void pl011_stop_rx(struct uart_po
+       pl011_dma_rx_stop(uap);
+ }
++static void pl011_throttle_rx(struct uart_port *port)
++{
++      unsigned long flags;
++
++      spin_lock_irqsave(&port->lock, flags);
++      pl011_stop_rx(port);
++      spin_unlock_irqrestore(&port->lock, flags);
++}
++
+ static void pl011_enable_ms(struct uart_port *port)
+ {
+       struct uart_amba_port *uap =
+@@ -1760,9 +1769,10 @@ static int pl011_allocate_irq(struct uar
+  */
+ static void pl011_enable_interrupts(struct uart_amba_port *uap)
+ {
++      unsigned long flags;
+       unsigned int i;
+-      spin_lock_irq(&uap->port.lock);
++      spin_lock_irqsave(&uap->port.lock, flags);
+       /* Clear out any spuriously appearing RX interrupts */
+       pl011_write(UART011_RTIS | UART011_RXIS, uap, REG_ICR);
+@@ -1784,7 +1794,14 @@ static void pl011_enable_interrupts(stru
+       if (!pl011_dma_rx_running(uap))
+               uap->im |= UART011_RXIM;
+       pl011_write(uap->im, uap, REG_IMSC);
+-      spin_unlock_irq(&uap->port.lock);
++      spin_unlock_irqrestore(&uap->port.lock, flags);
++}
++
++static void pl011_unthrottle_rx(struct uart_port *port)
++{
++      struct uart_amba_port *uap = container_of(port, struct uart_amba_port, port);
++
++      pl011_enable_interrupts(uap);
+ }
+ static int pl011_startup(struct uart_port *port)
+@@ -2211,6 +2228,8 @@ static const struct uart_ops amba_pl011_
+       .stop_tx        = pl011_stop_tx,
+       .start_tx       = pl011_start_tx,
+       .stop_rx        = pl011_stop_rx,
++      .throttle       = pl011_throttle_rx,
++      .unthrottle     = pl011_unthrottle_rx,
+       .enable_ms      = pl011_enable_ms,
+       .break_ctl      = pl011_break_ctl,
+       .startup        = pl011_startup,
diff --git a/queue-5.18/serial-stm32-clear-prev-values-before-setting-rts-delays.patch b/queue-5.18/serial-stm32-clear-prev-values-before-setting-rts-delays.patch
new file mode 100644 (file)
index 0000000..a361ec1
--- /dev/null
@@ -0,0 +1,37 @@
+From 5c5f44e36217de5ead789ff25da71c31c2331c96 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>
+Date: Mon, 27 Jun 2022 18:07:52 +0300
+Subject: serial: stm32: Clear prev values before setting RTS delays
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+
+commit 5c5f44e36217de5ead789ff25da71c31c2331c96 upstream.
+
+The code lacks clearing of previous DEAT/DEDT values. Thus, changing
+values on the fly results in garbage delays tending towards the maximum
+value as more and more bits are ORed together. (Leaving RS485 mode
+would have cleared the old values though).
+
+Fixes: 1bcda09d2910 ("serial: stm32: add support for RS485 hardware control mode")
+Cc: stable <stable@kernel.org>
+Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Link: https://lore.kernel.org/r/20220627150753.34510-1-ilpo.jarvinen@linux.intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/tty/serial/stm32-usart.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/tty/serial/stm32-usart.c
++++ b/drivers/tty/serial/stm32-usart.c
+@@ -71,6 +71,8 @@ static void stm32_usart_config_reg_rs485
+       *cr3 |= USART_CR3_DEM;
+       over8 = *cr1 & USART_CR1_OVER8;
++      *cr1 &= ~(USART_CR1_DEDT_MASK | USART_CR1_DEAT_MASK);
++
+       if (over8)
+               rs485_deat_dedt = delay_ADE * baud * 8;
+       else
index 1e39445c259175599070cf2b475ea33110b8ba02..30a75697f97c7ca4917280797aec4fb77a403cce 100644 (file)
@@ -218,3 +218,14 @@ nvme-use-struct-group-for-generic-command-dwords.patch
 wireguard-selftests-set-fake-real-time-in-init.patch
 wireguard-selftests-always-call-kernel-makefile.patch
 signal-handling-don-t-use-bug_on-for-debugging.patch
+acpi-video-fix-acpi_video_handles_brightness_key_pre.patch
+vt-fix-memory-overlapping-when-deleting-chars-in-the-buffer.patch
+s390-ap-fix-error-handling-in-__verify_queue_reservations.patch
+acpi-cppc-fix-enabling-cppc-on-amd-systems-with-shared-memory.patch
+serial-8250-fix-return-error-code-in-serial8250_request_std_resource.patch
+power-supply-core-fix-boundary-conditions-in-interpolation.patch
+serial-stm32-clear-prev-values-before-setting-rts-delays.patch
+serial-pl011-upstat_autorts-requires-.throttle-unthrottle.patch
+serial-8250-fix-pm-usage_count-for-console-handover.patch
+serial-mvebu-uart-correctly-report-configured-baudrate-value.patch
+x86-pat-fix-x86_has_pat_wp.patch
diff --git a/queue-5.18/vt-fix-memory-overlapping-when-deleting-chars-in-the-buffer.patch b/queue-5.18/vt-fix-memory-overlapping-when-deleting-chars-in-the-buffer.patch
new file mode 100644 (file)
index 0000000..970465e
--- /dev/null
@@ -0,0 +1,38 @@
+From 39cdb68c64d84e71a4a717000b6e5de208ee60cc Mon Sep 17 00:00:00 2001
+From: Yangxi Xiang <xyangxi5@gmail.com>
+Date: Tue, 28 Jun 2022 17:33:22 +0800
+Subject: vt: fix memory overlapping when deleting chars in the buffer
+
+From: Yangxi Xiang <xyangxi5@gmail.com>
+
+commit 39cdb68c64d84e71a4a717000b6e5de208ee60cc upstream.
+
+A memory overlapping copy occurs when deleting a long line. This memory
+overlapping copy can cause data corruption when scr_memcpyw is optimized
+to memcpy because memcpy does not ensure its behavior if the destination
+buffer overlaps with the source buffer. The line buffer is not always
+broken, because the memcpy utilizes the hardware acceleration, whose
+result is not deterministic.
+
+Fix this problem by using replacing the scr_memcpyw with scr_memmovew.
+
+Fixes: 81732c3b2fed ("tty vt: Fix line garbage in virtual console on command line edition")
+Cc: stable <stable@kernel.org>
+Signed-off-by: Yangxi Xiang <xyangxi5@gmail.com>
+Link: https://lore.kernel.org/r/20220628093322.5688-1-xyangxi5@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/tty/vt/vt.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/tty/vt/vt.c
++++ b/drivers/tty/vt/vt.c
+@@ -855,7 +855,7 @@ static void delete_char(struct vc_data *
+       unsigned short *p = (unsigned short *) vc->vc_pos;
+       vc_uniscr_delete(vc, nr);
+-      scr_memcpyw(p, p + nr, (vc->vc_cols - vc->state.x - nr) * 2);
++      scr_memmovew(p, p + nr, (vc->vc_cols - vc->state.x - nr) * 2);
+       scr_memsetw(p + vc->vc_cols - vc->state.x - nr, vc->vc_video_erase_char,
+                       nr * 2);
+       vc->vc_need_wrap = 0;
diff --git a/queue-5.18/x86-pat-fix-x86_has_pat_wp.patch b/queue-5.18/x86-pat-fix-x86_has_pat_wp.patch
new file mode 100644 (file)
index 0000000..17af280
--- /dev/null
@@ -0,0 +1,63 @@
+From 230ec83d4299b30c51a1c133b4f2a669972cc08a Mon Sep 17 00:00:00 2001
+From: Juergen Gross <jgross@suse.com>
+Date: Fri, 8 Jul 2022 15:14:56 +0200
+Subject: x86/pat: Fix x86_has_pat_wp()
+
+From: Juergen Gross <jgross@suse.com>
+
+commit 230ec83d4299b30c51a1c133b4f2a669972cc08a upstream.
+
+x86_has_pat_wp() is using a wrong test, as it relies on the normal
+PAT configuration used by the kernel. In case the PAT MSR has been
+setup by another entity (e.g. Xen hypervisor) it might return false
+even if the PAT configuration is allowing WP mappings. This due to the
+fact that when running as Xen PV guest the PAT MSR is setup by the
+hypervisor and cannot be changed by the guest. This results in the WP
+related entry to be at a different position when running as Xen PV
+guest compared to the bare metal or fully virtualized case.
+
+The correct way to test for WP support is:
+
+1. Get the PTE protection bits needed to select WP mode by reading
+   __cachemode2pte_tbl[_PAGE_CACHE_MODE_WP] (depending on the PAT MSR
+   setting this might return protection bits for a stronger mode, e.g.
+   UC-)
+2. Translate those bits back into the real cache mode selected by those
+   PTE bits by reading __pte2cachemode_tbl[__pte2cm_idx(prot)]
+3. Test for the cache mode to be _PAGE_CACHE_MODE_WP
+
+Fixes: f88a68facd9a ("x86/mm: Extend early_memremap() support with additional attrs")
+Signed-off-by: Juergen Gross <jgross@suse.com>
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Cc: <stable@vger.kernel.org> # 4.14
+Link: https://lore.kernel.org/r/20220503132207.17234-1-jgross@suse.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/mm/init.c |   14 ++++++++++++--
+ 1 file changed, 12 insertions(+), 2 deletions(-)
+
+--- a/arch/x86/mm/init.c
++++ b/arch/x86/mm/init.c
+@@ -77,10 +77,20 @@ static uint8_t __pte2cachemode_tbl[8] =
+       [__pte2cm_idx(_PAGE_PWT | _PAGE_PCD | _PAGE_PAT)] = _PAGE_CACHE_MODE_UC,
+ };
+-/* Check that the write-protect PAT entry is set for write-protect */
++/*
++ * Check that the write-protect PAT entry is set for write-protect.
++ * To do this without making assumptions how PAT has been set up (Xen has
++ * another layout than the kernel), translate the _PAGE_CACHE_MODE_WP cache
++ * mode via the __cachemode2pte_tbl[] into protection bits (those protection
++ * bits will select a cache mode of WP or better), and then translate the
++ * protection bits back into the cache mode using __pte2cm_idx() and the
++ * __pte2cachemode_tbl[] array. This will return the really used cache mode.
++ */
+ bool x86_has_pat_wp(void)
+ {
+-      return __pte2cachemode_tbl[_PAGE_CACHE_MODE_WP] == _PAGE_CACHE_MODE_WP;
++      uint16_t prot = __cachemode2pte_tbl[_PAGE_CACHE_MODE_WP];
++
++      return __pte2cachemode_tbl[__pte2cm_idx(prot)] == _PAGE_CACHE_MODE_WP;
+ }
+ enum page_cache_mode pgprot2cachemode(pgprot_t pgprot)