return -EIO;
}
-static inline void mte_assign_mem_tag_range(void *addr, size_t size)
-{
-}
-
#endif /* CONFIG_ARM64_MTE */
+ #ifdef CONFIG_KASAN_HW_TAGS
+ /* Whether the MTE asynchronous mode is enabled. */
+ DECLARE_STATIC_KEY_FALSE(mte_async_mode);
+
+ static inline bool system_uses_mte_async_mode(void)
+ {
+ return static_branch_unlikely(&mte_async_mode);
+ }
+
+ void mte_check_tfsr_el1(void);
+
+ static inline void mte_check_tfsr_entry(void)
+ {
+ mte_check_tfsr_el1();
+ }
+
+ static inline void mte_check_tfsr_exit(void)
+ {
+ /*
+ * The asynchronous faults are sync'ed automatically with
+ * TFSR_EL1 on kernel entry but for exit an explicit dsb()
+ * is required.
+ */
+ dsb(nsh);
+ isb();
+
+ mte_check_tfsr_el1();
+ }
+ #else
+ static inline bool system_uses_mte_async_mode(void)
+ {
+ return false;
+ }
+ static inline void mte_check_tfsr_el1(void)
+ {
+ }
+ static inline void mte_check_tfsr_entry(void)
+ {
+ }
+ static inline void mte_check_tfsr_exit(void)
+ {
+ }
+ #endif /* CONFIG_KASAN_HW_TAGS */
+
#endif /* __ASSEMBLY__ */
#endif /* __ASM_MTE_H */