mirror of
https://github.com/torvalds/linux.git
synced 2024-11-14 16:12:02 +00:00
fec29bf049
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>
65 lines
1.2 KiB
C
65 lines
1.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Defines for the SRAM driver
|
|
*/
|
|
#ifndef __SRAM_H
|
|
#define __SRAM_H
|
|
|
|
struct sram_config {
|
|
int (*init)(void);
|
|
bool map_only_reserved;
|
|
};
|
|
|
|
struct sram_partition {
|
|
void __iomem *base;
|
|
|
|
struct gen_pool *pool;
|
|
struct bin_attribute battr;
|
|
struct mutex lock;
|
|
struct list_head list;
|
|
};
|
|
|
|
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;
|
|
|
|
struct sram_partition *partition;
|
|
u32 partitions;
|
|
};
|
|
|
|
struct sram_reserve {
|
|
struct list_head list;
|
|
u32 start;
|
|
u32 size;
|
|
struct resource res;
|
|
bool export;
|
|
bool pool;
|
|
bool protect_exec;
|
|
const char *label;
|
|
};
|
|
|
|
#ifdef CONFIG_SRAM_EXEC
|
|
int sram_check_protect_exec(struct sram_dev *sram, struct sram_reserve *block,
|
|
struct sram_partition *part);
|
|
int sram_add_protect_exec(struct sram_partition *part);
|
|
#else
|
|
static inline int sram_check_protect_exec(struct sram_dev *sram,
|
|
struct sram_reserve *block,
|
|
struct sram_partition *part)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
|
|
static inline int sram_add_protect_exec(struct sram_partition *part)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
#endif /* CONFIG_SRAM_EXEC */
|
|
#endif /* __SRAM_H */
|