OSDN Git Service

Merge "ARM: dts: msm: remove CARVEOUT ION for msm8996 ivi multi-gvm vplatform"
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / include / linux / io-pgtable-fast.h
1 /* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
2  *
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.
6  *
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.
11  */
12
13 #ifndef __LINUX_IO_PGTABLE_FAST_H
14 #define __LINUX_IO_PGTABLE_FAST_H
15
16 #include <linux/notifier.h>
17
18 typedef u64 av8l_fast_iopte;
19
20 #define iopte_pmd_offset(pmds, base, iova) (pmds + ((iova - base) >> 12))
21
22 int av8l_fast_map_public(av8l_fast_iopte *ptep, phys_addr_t paddr, size_t size,
23                          int prot);
24 void av8l_fast_unmap_public(av8l_fast_iopte *ptep, size_t size);
25
26 /* events for notifiers passed to av8l_register_notify */
27 #define MAPPED_OVER_STALE_TLB 1
28
29
30 #ifdef CONFIG_IOMMU_IO_PGTABLE_FAST_PROVE_TLB
31 /*
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.
36  */
37 #define AV8L_FAST_PTE_UNMAPPED_NEED_TLBI 0xa
38
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);
42
43 #else  /* !CONFIG_IOMMU_IO_PGTABLE_FAST_PROVE_TLB */
44
45 #define AV8L_FAST_PTE_UNMAPPED_NEED_TLBI 0
46
47 static inline void av8l_fast_clear_stale_ptes(av8l_fast_iopte *puds,
48                                               u64 base,
49                                               u64 start,
50                                               u64 end,
51                                               bool skip_sync)
52 {
53 }
54
55 static inline void av8l_register_notify(struct notifier_block *nb)
56 {
57 }
58
59 #endif  /* CONFIG_IOMMU_IO_PGTABLE_FAST_PROVE_TLB */
60
61 #endif /* __LINUX_IO_PGTABLE_FAST_H */