blob: ab5a1dc6753e281c71274cac7ca0a094bb440fe8 [file] [log] [blame]
Mitchel Humpherys86a560e2015-09-30 14:23:58 -07001/* Copyright (c) 2016, 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
Mitchel Humpherys5c704e02015-12-21 15:06:34 -080016#include <linux/notifier.h>
17
Mitchel Humpherys86a560e2015-09-30 14:23:58 -070018typedef u64 av8l_fast_iopte;
19
20#define iopte_pmd_offset(pmds, iova) (pmds + (iova >> 12))
21
22int av8l_fast_map_public(av8l_fast_iopte *ptep, phys_addr_t paddr, size_t size,
23 int prot);
24void av8l_fast_unmap_public(av8l_fast_iopte *ptep, size_t size);
25
Mitchel Humpherys5c704e02015-12-21 15:06:34 -080026/* 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
39void av8l_fast_clear_stale_ptes(av8l_fast_iopte *puds, bool skip_sync);
40void av8l_register_notify(struct notifier_block *nb);
41
42#else /* !CONFIG_IOMMU_IO_PGTABLE_FAST_PROVE_TLB */
43
44#define AV8L_FAST_PTE_UNMAPPED_NEED_TLBI 0
45
46static inline void av8l_fast_clear_stale_ptes(av8l_fast_iopte *puds,
47 bool skip_sync)
48{
49}
50
51static inline void av8l_register_notify(struct notifier_block *nb)
52{
53}
54
55#endif /* CONFIG_IOMMU_IO_PGTABLE_FAST_PROVE_TLB */
56
Mitchel Humpherys86a560e2015-09-30 14:23:58 -070057#endif /* __LINUX_IO_PGTABLE_FAST_H */