summaryrefslogtreecommitdiffstats
path: root/drivers/misc/sram.h
diff options
context:
space:
mode:
authorMikko Perttunen <mperttunen@nvidia.com>2021-07-15 13:34:23 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-08-05 14:27:46 +0200
commitfec29bf04994b478a43a7e60e6dd5ac1f7cb53ae (patch)
tree5e74dc1e960079173434cda7e7332ee3882b4f42 /drivers/misc/sram.h
parent72674e86b6fe2f656c93564635b675bcdf012844 (diff)
downloadlinux-fec29bf04994b478a43a7e60e6dd5ac1f7cb53ae.tar.bz2
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>
Diffstat (limited to 'drivers/misc/sram.h')
-rw-r--r--drivers/misc/sram.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/misc/sram.h b/drivers/misc/sram.h
index 9c1d21ff7347..d2058d8c8f1d 100644
--- a/drivers/misc/sram.h
+++ b/drivers/misc/sram.h
@@ -5,6 +5,11 @@
#ifndef __SRAM_H
#define __SRAM_H
+struct sram_config {
+ int (*init)(void);
+ bool map_only_reserved;
+};
+
struct sram_partition {
void __iomem *base;
@@ -15,8 +20,11 @@ struct sram_partition {
};
struct sram_dev {
+ const struct sram_config *config;
+
struct device *dev;
void __iomem *virt_base;
+ bool no_memory_wc;
struct gen_pool *pool;
struct clk *clk;
@@ -29,6 +37,7 @@ struct sram_reserve {
struct list_head list;
u32 start;
u32 size;
+ struct resource res;
bool export;
bool pool;
bool protect_exec;