From a300b135c37bfee521282ccecb3bee4a8311f3c0 Mon Sep 17 00:00:00 2001 From: Jarried Lin Date: Wed, 4 Mar 2026 13:06:14 +0800 Subject: [PATCH] soc/mediatek/mt8196: Call mtk_mmu_disable_l2c_sram via boot state The commit 7072f42c08f7 ("soc/mediatek/mt8196: Move WATCHDOG_TOMBSTONE from SRAM to SRAM_L2C") move WATCHDOG_TOMBSTONE from SRAM to SRAM_L2C causes elog_handle_watchdog_tombstone (BS_POST_DEVICE, BS_ON_ENTRY) to be invoked after mtk_mmu_disable_l2c_sram. As a result, the watchdog event magic value in WATCHDOG_TOMBSTONE is cleared before it can be processed, which is incorrect behavior. So we refactor the mtk_mmu_disable_l2c_sram to be called as a boot state entry (BS_POST_DEVICE, BS_ON_EXIT) instead of directly from soc_init. This ensures that mtk_mmu_disable_l2c_sram will be executed after elog_handle_watchdog_tombstone. BUG=b:481854714 TEST=watchdog event added to eventlog on WDT timeout (triggered via echo > /dev/watchdog) TEST=cbmem logs preserved on WDT timeout Change-Id: I69ef567ab73f2f7006bb249cb577f377d4720909 Signed-off-by: Jarried Lin Reviewed-on: https://review.coreboot.org/c/coreboot/+/91539 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Yidi Lin Reviewed-by: Yu-Ping Wu --- src/soc/mediatek/mt8196/soc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/soc/mediatek/mt8196/soc.c b/src/soc/mediatek/mt8196/soc.c index c739998383..1e228c8a54 100644 --- a/src/soc/mediatek/mt8196/soc.c +++ b/src/soc/mediatek/mt8196/soc.c @@ -70,10 +70,15 @@ static void fsp_init(void *arg) BOOT_STATE_INIT_ENTRY(BS_DEV_INIT, BS_ON_ENTRY, fsp_init, NULL); -static void soc_init(struct device *dev) +static void mmu_disable_l2c_sram(void *unused) { mtk_mmu_disable_l2c_sram(); +} +BOOT_STATE_INIT_ENTRY(BS_POST_DEVICE, BS_ON_EXIT, mmu_disable_l2c_sram, NULL); + +static void soc_init(struct device *dev) +{ if (dpm_init()) printk(BIOS_ERR, "dpm init failed, DVFS may not work\n"); if (spm_init())