mirror of
https://github.com/openwrt/openwrt.git
synced 2026-06-17 12:40:16 +04:00
8f638f9366
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.12.91 Remove upstreamed patches: - airoha/patches-6.12/017-v6.13-net-airoha-Implement-BQL-support.patch[1] - airoha/patches-6.12/138-v7.1-net-airoha-Add-missing-RX_CPU_IDX-configuration-in-a.patch[2] - airoha/patches-6.12/149-v7.1-net-airoha-Move-ndesc-initialization-at-end-of-airoh.patch[3] - generic/backport-6.12/940-v7.1-net-dsa-realtek-rtl8365mb-fix-mode-mask-calculation.patch[5] Manually rebased patches: - airoha/patches-6.12/048-01-v6.15-net-airoha-Move-airoha_eth-driver-in-a-dedicated-fol.patch[1] - ath79/patches-6.12/800-leds-add-reset-controller-based-driver.patch[4] - bcm27xx/patches-6.12/950-0122-bcmgenet-Better-coalescing-parameter-defaults.patch[6] We also backported four patches to fix perf tool regression: - generic/backport-6.12/216-01-revert-perf-cgroup-update-metric-leader-in-evlist__e.patch - generic/backport-6.12/216-02-revert-perf-tool_pmu-fix-aggregation-on-duration_tim.patch - generic/backport-6.12/216-03-revert-perf-python-add-parse_events-function.patch - generic/backport-6.12/216-04-revert-perf-tool_pmu-factor-tool-events-into-their-o.patch All other patches are automatically refreshed. [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.91&id=ca24fcac1daaa5e8a667981d81986a3eb4b9fb04 [2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.91&id=f00037a99bc2332ef59dc85298b98b20af165904 [3] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.91&id=d36be272adda7f313e39dd118086955d993bf6a7 [4] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.91&id=07d3611389ba7d78b80ea360a42ce32ab2521fbc [5] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.91&id=3354d6c62fd4baa7b32cbd80cc5a8aa3f2bd0656 [6] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.91&id=b84351dcc359667bc952131c1424b692ec83dce2 Signed-off-by: Shiji Yang <yangshiji66@outlook.com> Link: https://github.com/openwrt/openwrt/pull/23444 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
141 lines
5.5 KiB
Diff
141 lines
5.5 KiB
Diff
From 850bf1a716c51db46a7e2ff4bf7e2968c22ab4bf Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Ma=C3=ADra=20Canal?= <mcanal@igalia.com>
|
|
Date: Tue, 11 Mar 2025 15:13:48 -0300
|
|
Subject: [PATCH] drm/v3d: Use V3D_SMS registers for power on/off and reset on
|
|
V3D 7.x
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
In addition to the standard reset controller, V3D 7.x requires configuring
|
|
the V3D_SMS registers for proper power on/off and reset. Add the new
|
|
registers to `v3d_regs.h` and ensure they are properly configured during
|
|
device probing, removal, and reset.
|
|
|
|
This change fixes GPU reset issues on the Raspberry Pi 5 (BCM2712).
|
|
Without exposing these registers, a GPU reset causes the GPU to hang,
|
|
stopping any further job execution and freezing the desktop GUI. The same
|
|
issue occurs when unloading and loading the v3d driver.
|
|
|
|
Link: https://github.com/raspberrypi/linux/issues/6660
|
|
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
|
|
Signed-off-by: Maíra Canal <mcanal@igalia.com>
|
|
---
|
|
drivers/gpu/drm/v3d/v3d_drv.c | 2 ++
|
|
drivers/gpu/drm/v3d/v3d_drv.h | 11 +++++++++++
|
|
drivers/gpu/drm/v3d/v3d_gem.c | 17 +++++++++++++++++
|
|
drivers/gpu/drm/v3d/v3d_regs.h | 26 ++++++++++++++++++++++++++
|
|
4 files changed, 56 insertions(+)
|
|
|
|
--- a/drivers/gpu/drm/v3d/v3d_drv.c
|
|
+++ b/drivers/gpu/drm/v3d/v3d_drv.c
|
|
@@ -495,6 +495,8 @@ static void v3d_platform_drm_remove(stru
|
|
dma_free_wc(v3d->drm.dev, 4096, v3d->mmu_scratch,
|
|
v3d->mmu_scratch_paddr);
|
|
|
|
+ v3d_power_off_sms(v3d);
|
|
+
|
|
clk_disable_unprepare(v3d->clk);
|
|
}
|
|
|
|
--- a/drivers/gpu/drm/v3d/v3d_drv.h
|
|
+++ b/drivers/gpu/drm/v3d/v3d_drv.h
|
|
@@ -126,6 +126,7 @@ struct v3d_dev {
|
|
void __iomem *core_regs[3];
|
|
void __iomem *bridge_regs;
|
|
void __iomem *gca_regs;
|
|
+ void __iomem *sms_regs;
|
|
struct clk *clk;
|
|
struct delayed_work clk_down_work;
|
|
unsigned long clk_up_rate, clk_down_rate;
|
|
@@ -282,6 +283,15 @@ to_v3d_fence(struct dma_fence *fence)
|
|
#define V3D_GCA_READ(offset) readl(v3d->gca_regs + offset)
|
|
#define V3D_GCA_WRITE(offset, val) writel(val, v3d->gca_regs + offset)
|
|
|
|
+#define V3D_SMS_IDLE 0x0
|
|
+#define V3D_SMS_ISOLATING_FOR_RESET 0xa
|
|
+#define V3D_SMS_RESETTING 0xb
|
|
+#define V3D_SMS_ISOLATING_FOR_POWER_OFF 0xc
|
|
+#define V3D_SMS_POWER_OFF_STATE 0xd
|
|
+
|
|
+#define V3D_SMS_READ(offset) readl(v3d->sms_regs + (offset))
|
|
+#define V3D_SMS_WRITE(offset, val) writel(val, v3d->sms_regs + (offset))
|
|
+
|
|
#define V3D_CORE_READ(core, offset) readl(v3d->core_regs[core] + offset)
|
|
#define V3D_CORE_WRITE(core, offset, val) writel(val, v3d->core_regs[core] + offset)
|
|
|
|
@@ -560,6 +570,7 @@ struct dma_fence *v3d_fence_create(struc
|
|
/* v3d_gem.c */
|
|
int v3d_gem_init(struct drm_device *dev);
|
|
void v3d_gem_destroy(struct drm_device *dev);
|
|
+void v3d_reset_sms(struct v3d_dev *v3d);
|
|
void v3d_reset(struct v3d_dev *v3d);
|
|
void v3d_invalidate_caches(struct v3d_dev *v3d);
|
|
void v3d_clean_caches(struct v3d_dev *v3d);
|
|
--- a/drivers/gpu/drm/v3d/v3d_gem.c
|
|
+++ b/drivers/gpu/drm/v3d/v3d_gem.c
|
|
@@ -106,6 +106,22 @@ v3d_reset_v3d(struct v3d_dev *v3d)
|
|
}
|
|
|
|
void
|
|
+v3d_reset_sms(struct v3d_dev *v3d)
|
|
+{
|
|
+ if (v3d->ver < V3D_GEN_71)
|
|
+ return;
|
|
+
|
|
+ V3D_SMS_WRITE(V3D_SMS_REE_CS, V3D_SET_FIELD(0x4, V3D_SMS_STATE));
|
|
+
|
|
+ if (wait_for(!(V3D_GET_FIELD(V3D_SMS_READ(V3D_SMS_REE_CS),
|
|
+ V3D_SMS_STATE) == V3D_SMS_ISOLATING_FOR_RESET) &&
|
|
+ !(V3D_GET_FIELD(V3D_SMS_READ(V3D_SMS_REE_CS),
|
|
+ V3D_SMS_STATE) == V3D_SMS_RESETTING), 100)) {
|
|
+ DRM_ERROR("Failed to wait for SMS reset\n");
|
|
+ }
|
|
+}
|
|
+
|
|
+void
|
|
v3d_reset(struct v3d_dev *v3d)
|
|
{
|
|
struct drm_device *dev = &v3d->drm;
|
|
@@ -122,6 +138,7 @@ v3d_reset(struct v3d_dev *v3d)
|
|
v3d_irq_disable(v3d);
|
|
|
|
v3d_idle_gca(v3d);
|
|
+ v3d_reset_sms(v3d);
|
|
v3d_reset_v3d(v3d);
|
|
|
|
v3d_mmu_set_page_table(v3d);
|
|
--- a/drivers/gpu/drm/v3d/v3d_regs.h
|
|
+++ b/drivers/gpu/drm/v3d/v3d_regs.h
|
|
@@ -515,4 +515,30 @@
|
|
# define V3D_ERR_VPAERGS BIT(1)
|
|
# define V3D_ERR_VPAEABB BIT(0)
|
|
|
|
+#define V3D_SMS_REE_CS 0x00000
|
|
+#define V3D_SMS_TEE_CS 0x00400
|
|
+# define V3D_SMS_INTERRUPT BIT(31)
|
|
+# define V3D_SMS_POWER_OFF BIT(30)
|
|
+# define V3D_SMS_CLEAR_POWER_OFF BIT(29)
|
|
+# define V3D_SMS_LOCK BIT(28)
|
|
+# define V3D_SMS_CLEAR_LOCK BIT(27)
|
|
+# define V3D_SMS_SVP_MODE_EXIT BIT(26)
|
|
+# define V3D_SMS_CLEAR_SVP_MODE_EXIT BIT(25)
|
|
+# define V3D_SMS_SVP_MODE_ENTER BIT(24)
|
|
+# define V3D_SMS_CLEAR_SVP_MODE_ENTER BIT(23)
|
|
+# define V3D_SMS_THEIR_MODE_EXIT BIT(22)
|
|
+# define V3D_SMS_THEIR_MODE_ENTER BIT(21)
|
|
+# define V3D_SMS_OUR_MODE_EXIT BIT(20)
|
|
+# define V3D_SMS_CLEAR_OUR_MODE_EXIT BIT(19)
|
|
+# define V3D_SMS_SEQ_PC_MASK V3D_MASK(16, 10)
|
|
+# define V3D_SMS_SEQ_PC_SHIFT 10
|
|
+# define V3D_SMS_HUBCORE_STATUS_MASK V3D_MASK(9, 8)
|
|
+# define V3D_SMS_HUBCORE_STATUS_SHIFT 8
|
|
+# define V3D_SMS_NEW_MODE_MASK V3D_MASK(7, 6)
|
|
+# define V3D_SMS_NEW_MODE_SHIFT 6
|
|
+# define V3D_SMS_OLD_MODE_MASK V3D_MASK(5, 4)
|
|
+# define V3D_SMS_OLD_MODE_SHIFT 4
|
|
+# define V3D_SMS_STATE_MASK V3D_MASK(3, 0)
|
|
+# define V3D_SMS_STATE_SHIFT 0
|
|
+
|
|
#endif /* V3D_REGS_H */
|