misc: sram: Only map reserved areas in Tegra SYSRAM
authorMikko Perttunen <mperttunen@nvidia.com>
Thu, 15 Jul 2021 10:34:23 +0000 (13:34 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Aug 2021 12:27:46 +0000 (14:27 +0200)
commitfec29bf04994b478a43a7e60e6dd5ac1f7cb53ae
tree5e74dc1e960079173434cda7e7332ee3882b4f42
parent72674e86b6fe2f656c93564635b675bcdf012844
misc: sram: Only map reserved areas in Tegra SYSRAM

On Tegra186 and later, a portion of the SYSRAM may be reserved for use
by TZ. Non-TZ memory accesses to this portion, including speculative
accesses, trigger SErrors that bring down the system. This does also
happen in practice occasionally (due to speculative accesses).

To fix the issue, add a flag to the SRAM driver to only map the
device tree-specified reserved areas depending on a flag set
based on the compatibility string. This would not affect non-Tegra
systems that rely on the entire thing being memory mapped.

If 64K pages are being used, we cannot exactly map the 4K regions
that are placed in SYSRAM - ioremap code instead aligns to closest
64K pages. However, since in practice the non-accessible memory area
is 64K aligned, these mappings do not overlap with the non-accessible
memory area and things work out.

Reviewed-by: Mian Yousaf Kaukab <ykaukab@suse.de>
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Link: https://lore.kernel.org/r/20210715103423.1811101-1-mperttunen@nvidia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/sram.c
drivers/misc/sram.h