From: Sasha Levin Date: Mon, 29 Apr 2024 01:53:54 +0000 (-0400) Subject: Fixes for 5.15 X-Git-Tag: v6.1.89~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=371843373482560a16ad164422ffe074e1fceeab;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.15 Signed-off-by: Sasha Levin --- diff --git a/queue-5.15/drm-print-add-drm_dbg_driver-to-improve-namespace-sy.patch b/queue-5.15/drm-print-add-drm_dbg_driver-to-improve-namespace-sy.patch new file mode 100644 index 00000000000..fcbbff150e1 --- /dev/null +++ b/queue-5.15/drm-print-add-drm_dbg_driver-to-improve-namespace-sy.patch @@ -0,0 +1,54 @@ +From 0a4299b6fe869b7bcd00f80bba792f35d6d0560d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 11 Sep 2022 23:28:49 -0600 +Subject: drm-print: add drm_dbg_driver to improve namespace symmetry + +From: Jim Cromie + +[ Upstream commit 95a77b6331c2d2313aa843fa77ec91cd092ab0e4 ] + +drm_print defines all of these: + drm_dbg_{core,kms,prime,atomic,vbl,lease,_dp,_drmres} + +but not drm_dbg_driver itself, since it was the original drm_dbg. + +To improve namespace symmetry, change the drm_dbg defn to +drm_dbg_driver, and redef grandfathered name to symmetric one. + +This will help with nouveau, which uses its own stack of macros to +construct calls to dev_info, dev_dbg, etc, for which adaptation means +drm_dbg_##driver constructs. + +Signed-off-by: Jim Cromie +Link: https://lore.kernel.org/r/20220912052852.1123868-7-jim.cromie@gmail.com +Signed-off-by: Greg Kroah-Hartman +Stable-dep-of: a60ccade88f9 ("drm/vmwgfx: Fix crtc's atomic check conditional") +Signed-off-by: Sasha Levin +--- + include/drm/drm_print.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h +index 15a089a87c225..f7ece14b10227 100644 +--- a/include/drm/drm_print.h ++++ b/include/drm/drm_print.h +@@ -444,7 +444,7 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category, + + #define drm_dbg_core(drm, fmt, ...) \ + drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_CORE, fmt, ##__VA_ARGS__) +-#define drm_dbg(drm, fmt, ...) \ ++#define drm_dbg_driver(drm, fmt, ...) \ + drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DRIVER, fmt, ##__VA_ARGS__) + #define drm_dbg_kms(drm, fmt, ...) \ + drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_KMS, fmt, ##__VA_ARGS__) +@@ -463,6 +463,7 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category, + #define drm_dbg_drmres(drm, fmt, ...) \ + drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DRMRES, fmt, ##__VA_ARGS__) + ++#define drm_dbg(drm, fmt, ...) drm_dbg_driver(drm, fmt, ##__VA_ARGS__) + + /* + * printk based logging +-- +2.43.0 + diff --git a/queue-5.15/drm-vmwgfx-fix-crtc-s-atomic-check-conditional.patch b/queue-5.15/drm-vmwgfx-fix-crtc-s-atomic-check-conditional.patch new file mode 100644 index 00000000000..274ab1259bc --- /dev/null +++ b/queue-5.15/drm-vmwgfx-fix-crtc-s-atomic-check-conditional.patch @@ -0,0 +1,63 @@ +From d8eb1ccd25a13cf4a991fb53e515a59d9728e747 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 11 Apr 2024 22:55:10 -0400 +Subject: drm/vmwgfx: Fix crtc's atomic check conditional + +From: Zack Rusin + +[ Upstream commit a60ccade88f926e871a57176e86a34bbf0db0098 ] + +The conditional was supposed to prevent enabling of a crtc state +without a set primary plane. Accidently it also prevented disabling +crtc state with a set primary plane. Neither is correct. + +Fix the conditional and just driver-warn when a crtc state has been +enabled without a primary plane which will help debug broken userspace. + +Fixes IGT's kms_atomic_interruptible and kms_atomic_transition tests. + +Signed-off-by: Zack Rusin +Fixes: 06ec41909e31 ("drm/vmwgfx: Add and connect CRTC helper functions") +Cc: Broadcom internal kernel review list +Cc: dri-devel@lists.freedesktop.org +Cc: # v4.12+ +Reviewed-by: Ian Forbes +Reviewed-by: Martin Krastev +Link: https://patchwork.freedesktop.org/patch/msgid/20240412025511.78553-5-zack.rusin@broadcom.com +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +index 01d5a01af2594..e2a52b5de1733 100644 +--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c ++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +@@ -537,6 +537,7 @@ int vmw_du_cursor_plane_atomic_check(struct drm_plane *plane, + int vmw_du_crtc_atomic_check(struct drm_crtc *crtc, + struct drm_atomic_state *state) + { ++ struct vmw_private *vmw = vmw_priv(crtc->dev); + struct drm_crtc_state *new_state = drm_atomic_get_new_crtc_state(state, + crtc); + struct vmw_display_unit *du = vmw_crtc_to_du(new_state->crtc); +@@ -544,9 +545,13 @@ int vmw_du_crtc_atomic_check(struct drm_crtc *crtc, + bool has_primary = new_state->plane_mask & + drm_plane_mask(crtc->primary); + +- /* We always want to have an active plane with an active CRTC */ +- if (has_primary != new_state->enable) +- return -EINVAL; ++ /* ++ * This is fine in general, but broken userspace might expect ++ * some actual rendering so give a clue as why it's blank. ++ */ ++ if (new_state->enable && !has_primary) ++ drm_dbg_driver(&vmw->drm, ++ "CRTC without a primary plane will be blank.\n"); + + + if (new_state->connector_mask != connector_mask && +-- +2.43.0 + diff --git a/queue-5.15/serial-core-provide-port-lock-wrappers.patch b/queue-5.15/serial-core-provide-port-lock-wrappers.patch new file mode 100644 index 00000000000..47b3051d3a4 --- /dev/null +++ b/queue-5.15/serial-core-provide-port-lock-wrappers.patch @@ -0,0 +1,136 @@ +From fe71719243fe4eca6903ebc3567f89aaae8647c1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 Sep 2023 20:43:18 +0206 +Subject: serial: core: Provide port lock wrappers +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Thomas Gleixner + +[ Upstream commit b0af4bcb49464c221ad5f95d40f2b1b252ceedcc ] + +When a serial port is used for kernel console output, then all +modifications to the UART registers which are done from other contexts, +e.g. getty, termios, are interference points for the kernel console. + +So far this has been ignored and the printk output is based on the +principle of hope. The rework of the console infrastructure which aims to +support threaded and atomic consoles, requires to mark sections which +modify the UART registers as unsafe. This allows the atomic write function +to make informed decisions and eventually to restore operational state. It +also allows to prevent the regular UART code from modifying UART registers +while printk output is in progress. + +All modifications of UART registers are guarded by the UART port lock, +which provides an obvious synchronization point with the console +infrastructure. + +Provide wrapper functions for spin_[un]lock*(port->lock) invocations so +that the console mechanics can be applied later on at a single place and +does not require to copy the same logic all over the drivers. + +Signed-off-by: Thomas Gleixner +Reviewed-by: Ilpo Järvinen +Signed-off-by: John Ogness +Link: https://lore.kernel.org/r/20230914183831.587273-2-john.ogness@linutronix.de +Signed-off-by: Greg Kroah-Hartman +Stable-dep-of: 54c4ec5f8c47 ("serial: mxs-auart: add spinlock around changing cts state") +Signed-off-by: Sasha Levin +--- + include/linux/serial_core.h | 79 +++++++++++++++++++++++++++++++++++++ + 1 file changed, 79 insertions(+) + +diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h +index d5b6b1550d596..5bddafd9dfda5 100644 +--- a/include/linux/serial_core.h ++++ b/include/linux/serial_core.h +@@ -260,6 +260,85 @@ struct uart_port { + void *private_data; /* generic platform data pointer */ + }; + ++/** ++ * uart_port_lock - Lock the UART port ++ * @up: Pointer to UART port structure ++ */ ++static inline void uart_port_lock(struct uart_port *up) ++{ ++ spin_lock(&up->lock); ++} ++ ++/** ++ * uart_port_lock_irq - Lock the UART port and disable interrupts ++ * @up: Pointer to UART port structure ++ */ ++static inline void uart_port_lock_irq(struct uart_port *up) ++{ ++ spin_lock_irq(&up->lock); ++} ++ ++/** ++ * uart_port_lock_irqsave - Lock the UART port, save and disable interrupts ++ * @up: Pointer to UART port structure ++ * @flags: Pointer to interrupt flags storage ++ */ ++static inline void uart_port_lock_irqsave(struct uart_port *up, unsigned long *flags) ++{ ++ spin_lock_irqsave(&up->lock, *flags); ++} ++ ++/** ++ * uart_port_trylock - Try to lock the UART port ++ * @up: Pointer to UART port structure ++ * ++ * Returns: True if lock was acquired, false otherwise ++ */ ++static inline bool uart_port_trylock(struct uart_port *up) ++{ ++ return spin_trylock(&up->lock); ++} ++ ++/** ++ * uart_port_trylock_irqsave - Try to lock the UART port, save and disable interrupts ++ * @up: Pointer to UART port structure ++ * @flags: Pointer to interrupt flags storage ++ * ++ * Returns: True if lock was acquired, false otherwise ++ */ ++static inline bool uart_port_trylock_irqsave(struct uart_port *up, unsigned long *flags) ++{ ++ return spin_trylock_irqsave(&up->lock, *flags); ++} ++ ++/** ++ * uart_port_unlock - Unlock the UART port ++ * @up: Pointer to UART port structure ++ */ ++static inline void uart_port_unlock(struct uart_port *up) ++{ ++ spin_unlock(&up->lock); ++} ++ ++/** ++ * uart_port_unlock_irq - Unlock the UART port and re-enable interrupts ++ * @up: Pointer to UART port structure ++ */ ++static inline void uart_port_unlock_irq(struct uart_port *up) ++{ ++ spin_unlock_irq(&up->lock); ++} ++ ++/** ++ * uart_port_lock_irqrestore - Unlock the UART port, restore interrupts ++ * @up: Pointer to UART port structure ++ * @flags: The saved interrupt flags for restore ++ */ ++static inline void uart_port_unlock_irqrestore(struct uart_port *up, unsigned long flags) ++{ ++ spin_unlock_irqrestore(&up->lock, flags); ++} ++ + static inline int serial_port_in(struct uart_port *up, int offset) + { + return up->serial_in(up, offset); +-- +2.43.0 + diff --git a/queue-5.15/serial-mxs-auart-add-spinlock-around-changing-cts-st.patch b/queue-5.15/serial-mxs-auart-add-spinlock-around-changing-cts-st.patch new file mode 100644 index 00000000000..508324424b0 --- /dev/null +++ b/queue-5.15/serial-mxs-auart-add-spinlock-around-changing-cts-st.patch @@ -0,0 +1,67 @@ +From 1a487266774f43c674a3bff3caf1976cac1e6066 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 20 Mar 2024 12:15:36 +0000 +Subject: serial: mxs-auart: add spinlock around changing cts state + +From: Emil Kronborg + +[ Upstream commit 54c4ec5f8c471b7c1137a1f769648549c423c026 ] + +The uart_handle_cts_change() function in serial_core expects the caller +to hold uport->lock. For example, I have seen the below kernel splat, +when the Bluetooth driver is loaded on an i.MX28 board. + + [ 85.119255] ------------[ cut here ]------------ + [ 85.124413] WARNING: CPU: 0 PID: 27 at /drivers/tty/serial/serial_core.c:3453 uart_handle_cts_change+0xb4/0xec + [ 85.134694] Modules linked in: hci_uart bluetooth ecdh_generic ecc wlcore_sdio configfs + [ 85.143314] CPU: 0 PID: 27 Comm: kworker/u3:0 Not tainted 6.6.3-00021-gd62a2f068f92 #1 + [ 85.151396] Hardware name: Freescale MXS (Device Tree) + [ 85.156679] Workqueue: hci0 hci_power_on [bluetooth] + (...) + [ 85.191765] uart_handle_cts_change from mxs_auart_irq_handle+0x380/0x3f4 + [ 85.198787] mxs_auart_irq_handle from __handle_irq_event_percpu+0x88/0x210 + (...) + +Cc: stable@vger.kernel.org +Fixes: 4d90bb147ef6 ("serial: core: Document and assert lock requirements for irq helpers") +Reviewed-by: Frank Li +Signed-off-by: Emil Kronborg +Link: https://lore.kernel.org/r/20240320121530.11348-1-emil.kronborg@protonmail.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/tty/serial/mxs-auart.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c +index ac45f3386e974..dfedd3f1130e4 100644 +--- a/drivers/tty/serial/mxs-auart.c ++++ b/drivers/tty/serial/mxs-auart.c +@@ -1094,11 +1094,13 @@ static void mxs_auart_set_ldisc(struct uart_port *port, + + static irqreturn_t mxs_auart_irq_handle(int irq, void *context) + { +- u32 istat; ++ u32 istat, stat; + struct mxs_auart_port *s = context; + u32 mctrl_temp = s->mctrl_prev; +- u32 stat = mxs_read(s, REG_STAT); + ++ uart_port_lock(&s->port); ++ ++ stat = mxs_read(s, REG_STAT); + istat = mxs_read(s, REG_INTR); + + /* ack irq */ +@@ -1134,6 +1136,8 @@ static irqreturn_t mxs_auart_irq_handle(int irq, void *context) + istat &= ~AUART_INTR_TXIS; + } + ++ uart_port_unlock(&s->port); ++ + return IRQ_HANDLED; + } + +-- +2.43.0 + diff --git a/queue-5.15/series b/queue-5.15/series index 78f2bfc7030..beea18bd859 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -41,3 +41,7 @@ i40e-report-mfs-in-decimal-base-instead-of-hex.patch iavf-fix-tc-config-comparison-with-existing-adapter-.patch net-ethernet-ti-am65-cpts-fix-ptpv1-message-type-on-.patch af_unix-suppress-false-positive-lockdep-splat-for-sp.patch +serial-core-provide-port-lock-wrappers.patch +serial-mxs-auart-add-spinlock-around-changing-cts-st.patch +drm-print-add-drm_dbg_driver-to-improve-namespace-sy.patch +drm-vmwgfx-fix-crtc-s-atomic-check-conditional.patch