openwrt/target/linux/bcm27xx/patches-6.6/950-0837-drm-vc4-Flush-stale-dlist-entries-if-allocation-fail.patch
John Audia 9af0e94fa6 kernel: bump 6.6 to 6.6.64
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.64

Manually rebased:
	generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch
	bcm27xx/patches-6.6/950-0585-drm-vc4-Introduce-generation-number-enum.patch
	bcm27xx/patches-6.6/950-0610-drm-vc4-hvs-Support-BCM2712-HVS.patch
	bcm27xx/patches-6.6/950-0829-vc4-hvs-Add-support-for-D0-register-changes.patch

Removed upstreamed:
	bcm27xx/patches-6.6/950-0597-drm-vc4-hdmi-Avoid-hang-with-debug-registers-when-su.patch[1]
	bcm27xx/patches-6.6/950-0599-drm-vc4-Fix-dlist-debug-not-resetting-the-next-entry.patch[2]
	bcm27xx/patches-6.6/950-0600-drm-vc4-Remove-incorrect-limit-from-hvs_dlist-debugf.patch[3]
	bcm27xx/patches-6.6/950-0708-drm-vc4-Correct-logic-on-stopping-an-HVS-channel.patch[4]
	ramips/patches-6.6/002-01-v6.13-clk-ralink-mtmips-fix-clock-plan-for-Ralink-SoC-RT38.patch[5]
	ramips/patches-6.6/002-02-v6.13-clk-ralink-mtmips-fix-clocks-probe-order-in-oldest-r.patch[6]

All other patches automatically rebased.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.64&id=223ee2567a55e4f80315c768d2969e6a3b9fb23d
2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.64&id=8182b5ca19c6f173b6498d1c6d3e4b034b76bbde
3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.64&id=52c1716f65a558174e381360bd88f18dae4be85c
4. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.64&id=9728b508b01a5eeeac79ceb676364c674dd951ac
5. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.64&id=f85a1d06afbcc57ac44176db8f9d7a934979952c
6. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.64&id=fbb13732c6ffa9d58cedafabcd5ce8fd7ef8ae5a

Build system: x86/64
Build-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3
Run-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3

Co-authored-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Signed-off-by: John Audia <therealgraysky@proton.me>
Link: https://github.com/openwrt/openwrt/pull/17217
Signed-off-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit 5158e28769)
2024-12-15 01:43:39 +01:00

70 lines
2.5 KiB
Diff

From e33f46eba97edbaff7744bfd5c5a093cd2c567d3 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Wed, 17 Jan 2024 18:36:11 +0000
Subject: [PATCH 0837/1085] drm/vc4: Flush stale dlist entries if allocation
fails
This is largely for debug at present.
For reasons unknown we are not getting the end of frame interrupts
that should trigger a sweep of stale dlist entries.
On allocation failure clear out ALL stale entries, and retry the
allocation. Log the interrupt status so we have debug regarding
whether the HVS believes the interrupt is enabled.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/gpu/drm/vc4/vc4_hvs.c | 27 ++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
--- a/drivers/gpu/drm/vc4/vc4_hvs.c
+++ b/drivers/gpu/drm/vc4/vc4_hvs.c
@@ -696,6 +696,9 @@ static void vc4_hvs_irq_clear_eof(struct
hvs->eof_irq[channel].enabled = false;
}
+static void vc4_hvs_free_dlist_entry_locked(struct vc4_hvs *hvs,
+ struct vc4_hvs_dlist_allocation *alloc);
+
static struct vc4_hvs_dlist_allocation *
vc4_hvs_alloc_dlist_entry(struct vc4_hvs *hvs,
unsigned int channel,
@@ -704,6 +707,7 @@ vc4_hvs_alloc_dlist_entry(struct vc4_hvs
struct vc4_dev *vc4 = hvs->vc4;
struct drm_device *dev = &vc4->base;
struct vc4_hvs_dlist_allocation *alloc;
+ struct vc4_hvs_dlist_allocation *cur, *next;
unsigned long flags;
int ret;
@@ -721,9 +725,26 @@ vc4_hvs_alloc_dlist_entry(struct vc4_hvs
dlist_count);
spin_unlock_irqrestore(&hvs->mm_lock, flags);
if (ret) {
- drm_err(dev, "Failed to allocate DLIST entry. Requested size=%zu. ret=%d\n",
- dlist_count, ret);
- return ERR_PTR(ret);
+ drm_err(dev, "Failed to allocate DLIST entry. Requested size=%zu. ret=%d. DISPCTRL is %08x\n",
+ dlist_count, ret, HVS_READ(SCALER_DISPCTRL));
+
+ /* This should never happen as stale entries should get released
+ * as the frame counter interrupt triggers.
+ * However we've seen this fail for reasons currently unknown.
+ * Free all stale entries now so we should be able to complete
+ * this allocation.
+ */
+ spin_lock_irqsave(&hvs->mm_lock, flags);
+ list_for_each_entry_safe(cur, next, &hvs->stale_dlist_entries, node) {
+ vc4_hvs_free_dlist_entry_locked(hvs, cur);
+ }
+
+ ret = drm_mm_insert_node(&hvs->dlist_mm, &alloc->mm_node,
+ dlist_count);
+ spin_unlock_irqrestore(&hvs->mm_lock, flags);
+
+ if (ret)
+ return ERR_PTR(ret);
}
alloc->channel = channel;