Commit 559a22ca authored by Christian Marangi's avatar Christian Marangi Committed by Zhang Changzhong
Browse files

mips: bmips: BCM6358: make sure CBR is correctly set

stable inclusion
from stable-v5.10.221
commit 36d771ce6028b886e18a4a8956a5d23688e4e13d
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IACS75
CVE: CVE-2024-40963

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=36d771ce6028b886e18a4a8956a5d23688e4e13d



--------------------------------

[ Upstream commit ce5cdd3b05216b704a704f466fb4c2dff3778caf ]

It was discovered that some device have CBR address set to 0 causing
kernel panic when arch_sync_dma_for_cpu_all is called.

This was notice in situation where the system is booted from TP1 and
BMIPS_GET_CBR() returns 0 instead of a valid address and
!!(read_c0_brcm_cmt_local() & (1 << 31)); not failing.

The current check whether RAC flush should be disabled or not are not
enough hence lets check if CBR is a valid address or not.

Fixes: ab327f8a ("mips: bmips: BCM6358: disable RAC flush for TP1")
Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
Acked-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
parent dc1965ad
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -110,7 +110,8 @@ static void bcm6358_quirks(void)
	 * RAC flush causes kernel panics on BCM6358 when booting from TP1
	 * because the bootloader is not initializing it properly.
	 */
	bmips_rac_flush_disable = !!(read_c0_brcm_cmt_local() & (1 << 31));
	bmips_rac_flush_disable = !!(read_c0_brcm_cmt_local() & (1 << 31)) ||
				  !!BMIPS_GET_CBR();
}

static void bcm6368_quirks(void)