openwrt/target/linux/bcm27xx/patches-6.6/950-0710-drm-vc4-Free-all-stale-dlists-if-channel-is-disabled.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

87 lines
2.9 KiB
Diff

From 9c02b7cd40a89ba1339d32a46b6694276902b81a Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Thu, 26 Oct 2023 18:23:31 +0100
Subject: [PATCH 0710/1085] drm/vc4: Free all stale dlists if channel is
disabled
The code handling freeing stale dlists had 2 issues:
- it disabled the interrupt as soon as the first EOF interrupt
occurred, even if it didn't clear all stale allocations, thus
leading to stale entries
- It didn't free stale entries from disabled channels, so eg
"kmstest -c 0" could leave a stale alloc on channel 1 floating
around.
Keep the interrupt enabled whilst there are any outstanding
allocs, and discard those on disabled channels. This second
channel does require us to call vc4_hvs_stop_channel from
vc4_crtc_atomic_disable so that the channel actually gets stopped.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/gpu/drm/vc4/vc4_crtc.c | 2 ++
drivers/gpu/drm/vc4/vc4_hvs.c | 27 +++++++++++++++++++++++++--
2 files changed, 27 insertions(+), 2 deletions(-)
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -661,6 +661,8 @@ static void vc4_crtc_atomic_disable(stru
vc4_crtc_disable(crtc, encoder, state, old_vc4_state->assigned_channel);
+ vc4_hvs_atomic_disable(crtc, state);
+
/*
* Make sure we issue a vblank event after disabling the CRTC if
* someone was waiting it.
--- a/drivers/gpu/drm/vc4/vc4_hvs.c
+++ b/drivers/gpu/drm/vc4/vc4_hvs.c
@@ -700,7 +700,8 @@ static void vc4_hvs_schedule_dlist_sweep
if (!list_empty(&hvs->stale_dlist_entries))
queue_work(system_unbound_wq, &hvs->free_dlist_work);
- vc4_hvs_irq_clear_eof(hvs, channel);
+ if (list_empty(&hvs->stale_dlist_entries))
+ vc4_hvs_irq_clear_eof(hvs, channel);
spin_unlock_irqrestore(&hvs->mm_lock, flags);
}
@@ -715,6 +716,27 @@ static bool vc4_hvs_frcnt_lte(u8 cnt1, u
return (s8)((cnt1 << 2) - (cnt2 << 2)) <= 0;
}
+bool vc4_hvs_check_channel_active(struct vc4_hvs *hvs, unsigned int fifo)
+{
+ struct vc4_dev *vc4 = hvs->vc4;
+ struct drm_device *drm = &vc4->base;
+ bool enabled = false;
+ int idx;
+
+ WARN_ON_ONCE(vc4->gen > VC4_GEN_6);
+
+ if (!drm_dev_enter(drm, &idx))
+ return 0;
+
+ if (vc4->gen >= VC4_GEN_6)
+ enabled = HVS_READ(SCALER6_DISPX_CTRL0(fifo)) & SCALER6_DISPX_CTRL0_ENB;
+ else
+ enabled = HVS_READ(SCALER_DISPCTRLX(fifo)) & SCALER_DISPCTRLX_ENABLE;
+
+ drm_dev_exit(idx);
+ return enabled;
+}
+
/*
* Some atomic commits (legacy cursor updates, mostly) will not wait for
* the next vblank and will just return once the commit has been pushed
@@ -749,7 +771,8 @@ static void vc4_hvs_dlist_free_work(stru
u8 frcnt;
frcnt = vc4_hvs_get_fifo_frame_count(hvs, cur->channel);
- if (!vc4_hvs_frcnt_lte(cur->target_frame_count, frcnt))
+ if (vc4_hvs_check_channel_active(hvs, cur->channel) &&
+ !vc4_hvs_frcnt_lte(cur->target_frame_count, frcnt))
continue;
vc4_hvs_free_dlist_entry_locked(hvs, cur);