]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Feb 2025 14:09:44 +0000 (15:09 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Feb 2025 14:09:44 +0000 (15:09 +0100)
added patches:
drm-tidss-clear-the-interrupt-status-for-interrupts-being-disabled.patch
drm-tidss-fix-issue-in-irq-handling-causing-irq-flood-issue.patch
drm-v3d-stop-active-perfmon-if-it-is-being-destroyed.patch

queue-5.15/drm-tidss-clear-the-interrupt-status-for-interrupts-being-disabled.patch [new file with mode: 0644]
queue-5.15/drm-tidss-fix-issue-in-irq-handling-causing-irq-flood-issue.patch [new file with mode: 0644]
queue-5.15/drm-v3d-stop-active-perfmon-if-it-is-being-destroyed.patch [new file with mode: 0644]
queue-5.15/series

diff --git a/queue-5.15/drm-tidss-clear-the-interrupt-status-for-interrupts-being-disabled.patch b/queue-5.15/drm-tidss-clear-the-interrupt-status-for-interrupts-being-disabled.patch
new file mode 100644 (file)
index 0000000..d8c0944
--- /dev/null
@@ -0,0 +1,72 @@
+From 361a2ebb5cad211732ec3c5d962de49b21895590 Mon Sep 17 00:00:00 2001
+From: Devarsh Thakkar <devarsht@ti.com>
+Date: Mon, 21 Oct 2024 17:07:49 +0300
+Subject: drm/tidss: Clear the interrupt status for interrupts being disabled
+
+From: Devarsh Thakkar <devarsht@ti.com>
+
+commit 361a2ebb5cad211732ec3c5d962de49b21895590 upstream.
+
+The driver does not touch the irqstatus register when it is disabling
+interrupts.  This might cause an interrupt to trigger for an interrupt
+that was just disabled.
+
+To fix the issue, clear the irqstatus registers right after disabling
+the interrupts.
+
+Fixes: 32a1795f57ee ("drm/tidss: New driver for TI Keystone platform Display SubSystem")
+Cc: stable@vger.kernel.org
+Reported-by: Jonathan Cormier <jcormier@criticallink.com>
+Closes: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1394222/am625-issue-about-tidss-rcu_preempt-self-detected-stall-on-cpu/5424479#5424479
+Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
+[Tomi: mostly rewrote the patch]
+Reviewed-by: Jonathan Cormier <jcormier@criticallink.com>
+Tested-by: Jonathan Cormier <jcormier@criticallink.com>
+Reviewed-by: Aradhya Bhatia <aradhya.bhatia@linux.dev>
+Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20241021-tidss-irq-fix-v1-5-82ddaec94e4a@ideasonboard.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/tidss/tidss_dispc.c |   10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+--- a/drivers/gpu/drm/tidss/tidss_dispc.c
++++ b/drivers/gpu/drm/tidss/tidss_dispc.c
+@@ -596,7 +596,7 @@ void dispc_k2g_set_irqenable(struct disp
+ {
+       dispc_irq_t old_mask = dispc_k2g_read_irqenable(dispc);
+-      /* clear the irqstatus for newly enabled irqs */
++      /* clear the irqstatus for irqs that will be enabled */
+       dispc_k2g_clear_irqstatus(dispc, (mask ^ old_mask) & mask);
+       dispc_k2g_vp_set_irqenable(dispc, 0, mask);
+@@ -604,6 +604,9 @@ void dispc_k2g_set_irqenable(struct disp
+       dispc_write(dispc, DISPC_IRQENABLE_SET, (1 << 0) | (1 << 7));
++      /* clear the irqstatus for irqs that were disabled */
++      dispc_k2g_clear_irqstatus(dispc, (mask ^ old_mask) & old_mask);
++
+       /* flush posted write */
+       dispc_k2g_read_irqenable(dispc);
+ }
+@@ -735,7 +738,7 @@ static void dispc_k3_set_irqenable(struc
+       old_mask = dispc_k3_read_irqenable(dispc);
+-      /* clear the irqstatus for newly enabled irqs */
++      /* clear the irqstatus for irqs that will be enabled */
+       dispc_k3_clear_irqstatus(dispc, (old_mask ^ mask) & mask);
+       for (i = 0; i < dispc->feat->num_vps; ++i) {
+@@ -760,6 +763,9 @@ static void dispc_k3_set_irqenable(struc
+       if (main_disable)
+               dispc_write(dispc, DISPC_IRQENABLE_CLR, main_disable);
++      /* clear the irqstatus for irqs that were disabled */
++      dispc_k3_clear_irqstatus(dispc, (old_mask ^ mask) & old_mask);
++
+       /* Flush posted writes */
+       dispc_read(dispc, DISPC_IRQENABLE_SET);
+ }
diff --git a/queue-5.15/drm-tidss-fix-issue-in-irq-handling-causing-irq-flood-issue.patch b/queue-5.15/drm-tidss-fix-issue-in-irq-handling-causing-irq-flood-issue.patch
new file mode 100644 (file)
index 0000000..49334d7
--- /dev/null
@@ -0,0 +1,83 @@
+From 44b6730ab53ef04944fbaf6da0e77397531517b7 Mon Sep 17 00:00:00 2001
+From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
+Date: Mon, 21 Oct 2024 17:07:45 +0300
+Subject: drm/tidss: Fix issue in irq handling causing irq-flood issue
+
+From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
+
+commit 44b6730ab53ef04944fbaf6da0e77397531517b7 upstream.
+
+It has been observed that sometimes DSS will trigger an interrupt and
+the top level interrupt (DISPC_IRQSTATUS) is not zero, but the VP and
+VID level interrupt-statuses are zero.
+
+As the top level irqstatus is supposed to tell whether we have VP/VID
+interrupts, the thinking of the driver authors was that this particular
+case could never happen. Thus the driver only clears the DISPC_IRQSTATUS
+bits which has corresponding interrupts in VP/VID status. So when this
+issue happens, the driver will not clear DISPC_IRQSTATUS, and we get an
+interrupt flood.
+
+It is unclear why the issue happens. It could be a race issue in the
+driver, but no such race has been found. It could also be an issue with
+the HW. However a similar case can be easily triggered by manually
+writing to DISPC_IRQSTATUS_RAW. This will forcibly set a bit in the
+DISPC_IRQSTATUS and trigger an interrupt, and as the driver never clears
+the bit, we get an interrupt flood.
+
+To fix the issue, always clear DISPC_IRQSTATUS. The concern with this
+solution is that if the top level irqstatus is the one that triggers the
+interrupt, always clearing DISPC_IRQSTATUS might leave some interrupts
+unhandled if VP/VID interrupt statuses have bits set. However, testing
+shows that if any of the irqstatuses is set (i.e. even if
+DISPC_IRQSTATUS == 0, but a VID irqstatus has a bit set), we will get an
+interrupt.
+
+Co-developed-by: Bin Liu <b-liu@ti.com>
+Signed-off-by: Bin Liu <b-liu@ti.com>
+Co-developed-by: Devarsh Thakkar <devarsht@ti.com>
+Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
+Co-developed-by: Jonathan Cormier <jcormier@criticallink.com>
+Signed-off-by: Jonathan Cormier <jcormier@criticallink.com>
+Fixes: 32a1795f57ee ("drm/tidss: New driver for TI Keystone platform Display SubSystem")
+Cc: stable@vger.kernel.org
+Tested-by: Jonathan Cormier <jcormier@criticallink.com>
+Reviewed-by: Aradhya Bhatia <aradhya.bhatia@linux.dev>
+Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20241021-tidss-irq-fix-v1-1-82ddaec94e4a@ideasonboard.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/tidss/tidss_dispc.c |   12 ++++--------
+ 1 file changed, 4 insertions(+), 8 deletions(-)
+
+--- a/drivers/gpu/drm/tidss/tidss_dispc.c
++++ b/drivers/gpu/drm/tidss/tidss_dispc.c
+@@ -676,24 +676,20 @@ static
+ void dispc_k3_clear_irqstatus(struct dispc_device *dispc, dispc_irq_t clearmask)
+ {
+       unsigned int i;
+-      u32 top_clear = 0;
+       for (i = 0; i < dispc->feat->num_vps; ++i) {
+-              if (clearmask & DSS_IRQ_VP_MASK(i)) {
++              if (clearmask & DSS_IRQ_VP_MASK(i))
+                       dispc_k3_vp_write_irqstatus(dispc, i, clearmask);
+-                      top_clear |= BIT(i);
+-              }
+       }
+       for (i = 0; i < dispc->feat->num_planes; ++i) {
+-              if (clearmask & DSS_IRQ_PLANE_MASK(i)) {
++              if (clearmask & DSS_IRQ_PLANE_MASK(i))
+                       dispc_k3_vid_write_irqstatus(dispc, i, clearmask);
+-                      top_clear |= BIT(4 + i);
+-              }
+       }
+       if (dispc->feat->subrev == DISPC_K2G)
+               return;
+-      dispc_write(dispc, DISPC_IRQSTATUS, top_clear);
++      /* always clear the top level irqstatus */
++      dispc_write(dispc, DISPC_IRQSTATUS, dispc_read(dispc, DISPC_IRQSTATUS));
+       /* Flush posted writes */
+       dispc_read(dispc, DISPC_IRQSTATUS);
diff --git a/queue-5.15/drm-v3d-stop-active-perfmon-if-it-is-being-destroyed.patch b/queue-5.15/drm-v3d-stop-active-perfmon-if-it-is-being-destroyed.patch
new file mode 100644 (file)
index 0000000..a6adb7a
--- /dev/null
@@ -0,0 +1,52 @@
+From 21f1435b1e6b012a07c42f36b206d2b66fc8f13b Mon Sep 17 00:00:00 2001
+From: Christian Gmeiner <cgmeiner@igalia.com>
+Date: Mon, 18 Nov 2024 23:19:47 +0100
+Subject: drm/v3d: Stop active perfmon if it is being destroyed
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Christian Gmeiner <cgmeiner@igalia.com>
+
+commit 21f1435b1e6b012a07c42f36b206d2b66fc8f13b upstream.
+
+If the active performance monitor (`v3d->active_perfmon`) is being
+destroyed, stop it first. Currently, the active perfmon is not
+stopped during destruction, leaving the `v3d->active_perfmon` pointer
+stale. This can lead to undefined behavior and instability.
+
+This patch ensures that the active perfmon is stopped before being
+destroyed, aligning with the behavior introduced in commit
+7d1fd3638ee3 ("drm/v3d: Stop the active perfmon before being destroyed").
+
+Cc: stable@vger.kernel.org # v5.15+
+Fixes: 26a4dc29b74a ("drm/v3d: Expose performance counters to userspace")
+Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
+Signed-off-by: MaĆ­ra Canal <mcanal@igalia.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20241118221948.1758130-1-christian.gmeiner@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/v3d/v3d_perfmon.c |    5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/drivers/gpu/drm/v3d/v3d_perfmon.c
++++ b/drivers/gpu/drm/v3d/v3d_perfmon.c
+@@ -175,6 +175,7 @@ int v3d_perfmon_destroy_ioctl(struct drm
+ {
+       struct v3d_file_priv *v3d_priv = file_priv->driver_priv;
+       struct drm_v3d_perfmon_destroy *req = data;
++      struct v3d_dev *v3d = v3d_priv->v3d;
+       struct v3d_perfmon *perfmon;
+       mutex_lock(&v3d_priv->perfmon.lock);
+@@ -184,6 +185,10 @@ int v3d_perfmon_destroy_ioctl(struct drm
+       if (!perfmon)
+               return -EINVAL;
++      /* If the active perfmon is being destroyed, stop it first */
++      if (perfmon == v3d->active_perfmon)
++              v3d_perfmon_stop(v3d, perfmon, false);
++
+       v3d_perfmon_put(perfmon);
+       return 0;
index cb7ac30a80dd24f682451b9d45ef427d31e92204..049ffec72b833e866f6bb2e49cba07e529ede5e2 100644 (file)
@@ -411,3 +411,6 @@ arp-use-rcu-protection-in-arp_xmit.patch
 openvswitch-use-rcu-protection-in-ovs_vport_cmd_fill.patch
 ndisc-extend-rcu-protection-in-ndisc_send_skb.patch
 ipv6-mcast-add-rcu-protection-to-mld_newpack.patch
+drm-tidss-fix-issue-in-irq-handling-causing-irq-flood-issue.patch
+drm-tidss-clear-the-interrupt-status-for-interrupts-being-disabled.patch
+drm-v3d-stop-active-perfmon-if-it-is-being-destroyed.patch