]> git.baikalelectronics.ru Git - kernel.git/commit
MIPS: Fix incorrect mem=X@Y handling
authorMarcin Nowakowski <marcin.nowakowski@mips.com>
Thu, 1 Feb 2018 11:37:21 +0000 (12:37 +0100)
committerJames Hogan <jhogan@kernel.org>
Tue, 13 Feb 2018 13:14:41 +0000 (13:14 +0000)
commita4daf47f23b01fe3b0bc9fed04d0c6015819b9ca
tree1f233a0d6c6376606e16c807127b31e680dbe708
parent8a509def35f61b4b42f704429d48bc91b5b2b5c7
MIPS: Fix incorrect mem=X@Y handling

Commit 97fb0a23df5a ("MIPS: fix mem=X@Y commandline processing") added a
fix to ensure that the memory range between PHYS_OFFSET and low memory
address specified by mem= cmdline argument is not later processed by
free_all_bootmem.  This change was incorrect for systems where the
commandline specifies more than 1 mem argument, as it will cause all
memory between PHYS_OFFSET and each of the memory offsets to be marked
as reserved, which results in parts of the RAM marked as reserved
(Creator CI20's u-boot has a default commandline argument 'mem=256M@0x0
mem=768M@0x30000000').

Change the behaviour to ensure that only the range between PHYS_OFFSET
and the lowest start address of the memories is marked as protected.

This change also ensures that the range is marked protected even if it's
only defined through the devicetree and not only via commandline
arguments.

Reported-by: Mathieu Malaterre <mathieu.malaterre@gmail.com>
Signed-off-by: Marcin Nowakowski <marcin.nowakowski@mips.com>
Fixes: 97fb0a23df5a ("MIPS: fix mem=X@Y commandline processing")
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Cc: <stable@vger.kernel.org> # v4.11+
Tested-by: Mathieu Malaterre <malat@debian.org>
Patchwork: https://patchwork.linux-mips.org/patch/18562/
Signed-off-by: James Hogan <jhogan@kernel.org>
arch/mips/kernel/setup.c