diff options
author | Emil Renner Berthing <kernel@esmil.dk> | 2022-07-06 13:26:09 +0300 |
---|---|---|
committer | Samin Guo <samin.guo@starfivetech.com> | 2023-06-26 13:38:36 +0300 |
commit | 8ef9414156a3c95b8a20e2533a73a2b26ea21acc (patch) | |
tree | 81814665012e610f6562812f6ff02a9549bb40f1 /include/soc | |
parent | 9e15de20af9f14c50a7f27cc7ca098189e6767a5 (diff) | |
download | linux-8ef9414156a3c95b8a20e2533a73a2b26ea21acc.tar.xz |
soc: sifive: ccache: Add non-coherent DMA handling
Add functions to flush the caches and handle non-coherent DMA.
Signed-off-by: Emil Renner Berthing <kernel@esmil.dk>
Diffstat (limited to 'include/soc')
-rw-r--r-- | include/soc/sifive/sifive_l2_cache.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/soc/sifive/sifive_l2_cache.h b/include/soc/sifive/sifive_l2_cache.h index 04dcac10b5cd..93b033debf62 100644 --- a/include/soc/sifive/sifive_l2_cache.h +++ b/include/soc/sifive/sifive_l2_cache.h @@ -7,12 +7,33 @@ #ifndef __SOC_SIFIVE_L2_CACHE_H #define __SOC_SIFIVE_L2_CACHE_H +#include <linux/io.h> +#include <linux/jump_label.h> + extern int register_sifive_l2_error_notifier(struct notifier_block *nb); extern int unregister_sifive_l2_error_notifier(struct notifier_block *nb); #define SIFIVE_L2_ERR_TYPE_CE 0 #define SIFIVE_L2_ERR_TYPE_UE 1 +DECLARE_STATIC_KEY_FALSE(sifive_l2_handle_noncoherent_key); + +static inline bool sifive_l2_handle_noncoherent(void) +{ +#ifdef CONFIG_SIFIVE_L2 + return static_branch_unlikely(&sifive_l2_handle_noncoherent_key); +#else + return false; +#endif +} + +void sifive_l2_flush_range(phys_addr_t start, size_t len); +void *sifive_l2_set_uncached(void *addr, size_t size); +static inline void sifive_l2_clear_uncached(void *addr, size_t size) +{ + memunmap(addr); +} + #ifdef CONFIG_SIFIVE_L2_FLUSH void sifive_l2_flush64_range(unsigned long start, unsigned long len); #endif |