[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b11d87e6-6665-7579-6334-f9e280dbf20b@gmail.com>
Date: Sat, 6 Mar 2021 20:13:53 -0800
From: Florian Fainelli <f.fainelli@...il.com>
To: Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Mike Rapoport <rppt@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Roman Gushchin <guro@...com>, linux-mips@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Kamal Dasu <kdasu.kdev@...il.com>,
Serge Semin <Sergey.Semin@...kalelectronics.ru>
Subject: Re: [PATCH v2] MIPS: kernel: Reserve exception base early to prevent
corruption
On 3/6/2021 12:29 AM, Thomas Bogendoerfer wrote:
> BMIPS is one of the few platforms that do change the exception base.
> After commit 2dcb39645441 ("memblock: do not start bottom-up allocations
> with kernel_end") we started seeing BMIPS boards fail to boot with the
> built-in FDT being corrupted.
>
> Before the cited commit, early allocations would be in the [kernel_end,
> RAM_END] range, but after commit they would be within [RAM_START +
> PAGE_SIZE, RAM_END].
>
> The custom exception base handler that is installed by
> bmips_ebase_setup() done for BMIPS5000 CPUs ends-up trampling on the
> memory region allocated by unflatten_and_copy_device_tree() thus
> corrupting the FDT used by the kernel.
>
> To fix this, we need to perform an early reservation of the custom
> exception space. So we reserve it already in cpu_probe() for the CPUs
> where this is fixed. For CPU with an ebase config register allocation
> of exception space will be done in trap_init().
>
> Huge thanks to Serget for analysing and proposing a solution to this
> issue.
I made a typo on Sergey's name in my original version here.
>
> Fixes: 2dcb39645441 ("memblock: do not start bottom-up allocations with kernel_end")
> Reported-by: Kamal Dasu <kdasu.kdev@...il.com>
> Debugged-by: Serge Semin <Sergey.Semin@...kalelectronics.ru>
> Signed-off-by: Thomas Bogendoerfer <tsbogend@...ha.franken.de>
Tested-by: Florian Fainelli <f.fainelli@...il.com>
Thanks!
--
Florian
Powered by blists - more mailing lists