1 /* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
13 #ifndef __LINUX_IO_PGTABLE_FAST_H
14 #define __LINUX_IO_PGTABLE_FAST_H
16 #include <linux/notifier.h>
18 typedef u64 av8l_fast_iopte;
20 #define iopte_pmd_offset(pmds, base, iova) (pmds + ((iova - base) >> 12))
22 int av8l_fast_map_public(av8l_fast_iopte *ptep, phys_addr_t paddr, size_t size,
24 void av8l_fast_unmap_public(av8l_fast_iopte *ptep, size_t size);
26 /* events for notifiers passed to av8l_register_notify */
27 #define MAPPED_OVER_STALE_TLB 1
30 #ifdef CONFIG_IOMMU_IO_PGTABLE_FAST_PROVE_TLB
32 * Doesn't matter what we use as long as bit 0 is unset. The reason why we
33 * need a different value at all is that there are certain hardware
34 * platforms with erratum that require that a PTE actually be zero'd out
35 * and not just have its valid bit unset.
37 #define AV8L_FAST_PTE_UNMAPPED_NEED_TLBI 0xa
39 void av8l_fast_clear_stale_ptes(av8l_fast_iopte *puds, u64 base,
40 u64 start, u64 end, bool skip_sync);
41 void av8l_register_notify(struct notifier_block *nb);
43 #else /* !CONFIG_IOMMU_IO_PGTABLE_FAST_PROVE_TLB */
45 #define AV8L_FAST_PTE_UNMAPPED_NEED_TLBI 0
47 static inline void av8l_fast_clear_stale_ptes(av8l_fast_iopte *puds,
55 static inline void av8l_register_notify(struct notifier_block *nb)
59 #endif /* CONFIG_IOMMU_IO_PGTABLE_FAST_PROVE_TLB */
61 #endif /* __LINUX_IO_PGTABLE_FAST_H */