]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
MIPS: ralink: mt7621: do memory detection on KSEG1
authorChuanhong Guo <gch981213@gmail.com>
Fri, 11 Feb 2022 00:13:44 +0000 (08:13 +0800)
committerPaolo Pisati <paolo.pisati@canonical.com>
Wed, 9 Mar 2022 14:17:55 +0000 (15:17 +0100)
commitf423cff65ad9ab2be4ca894d4ca674e8593991e5
tree78a19dcf2ee11789918ec484e484ae0dc25b6a39
parent7a0ab7d9f2ce713e79cb2df204863b4d5730564f
MIPS: ralink: mt7621: do memory detection on KSEG1

BugLink: https://bugs.launchpad.net/bugs/1964361
[ Upstream commit cc19db8b312a6c75645645f5cc1b45166b109006 ]

It's reported that current memory detection code occasionally detects
larger memory under some bootloaders.
Current memory detection code tests whether address space wraps around
on KSEG0, which is unreliable because it's cached.

Rewrite memory size detection to perform the same test on KSEG1 instead.
While at it, this patch also does the following two things:
1. use a fixed pattern instead of a random function pointer as the magic
   value.
2. add an additional memory write and a second comparison as part of the
   test to prevent possible smaller memory detection result due to
   leftover values in memory.

Fixes: 139c949f7f0a MIPS: ("ralink: mt7621: add memory detection support")
Reported-by: Rui Salvaterra <rsalvaterra@gmail.com>
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
Tested-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Tested-by: Rui Salvaterra <rsalvaterra@gmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
arch/mips/ralink/mt7621.c