| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2006, Intel Corporation. |
|---|
| 3 | 4 | * |
|---|
| 4 | | - * This file is released under the GPLv2. |
|---|
| 5 | | - * |
|---|
| 6 | 5 | * Copyright (C) 2006-2008 Intel Corporation |
|---|
| 7 | 6 | * Author: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> |
|---|
| 8 | | - * |
|---|
| 9 | 7 | */ |
|---|
| 10 | 8 | |
|---|
| 11 | 9 | #ifndef _IOVA_H_ |
|---|
| .. | .. |
|---|
| 74 | 72 | struct rb_node *cached32_node; /* Save last 32-bit alloced node */ |
|---|
| 75 | 73 | unsigned long granule; /* pfn granularity for this domain */ |
|---|
| 76 | 74 | unsigned long start_pfn; /* Lower limit for this domain */ |
|---|
| 77 | | - unsigned long end_pfn; /* Upper limit for this domain */ |
|---|
| 78 | 75 | unsigned long dma_32bit_pfn; |
|---|
| 76 | + unsigned long max32_alloc_size; /* Size of last failed allocation */ |
|---|
| 77 | + struct iova_fq __percpu *fq; /* Flush Queue */ |
|---|
| 78 | + |
|---|
| 79 | + atomic64_t fq_flush_start_cnt; /* Number of TLB flushes that |
|---|
| 80 | + have been started */ |
|---|
| 81 | + |
|---|
| 82 | + atomic64_t fq_flush_finish_cnt; /* Number of TLB flushes that |
|---|
| 83 | + have been finished */ |
|---|
| 84 | + |
|---|
| 79 | 85 | struct iova anchor; /* rbtree lookup anchor */ |
|---|
| 80 | 86 | struct iova_rcache rcaches[IOVA_RANGE_CACHE_MAX_SIZE]; /* IOVA range caches */ |
|---|
| 81 | 87 | |
|---|
| .. | .. |
|---|
| 84 | 90 | |
|---|
| 85 | 91 | iova_entry_dtor entry_dtor; /* IOMMU driver specific destructor for |
|---|
| 86 | 92 | iova entry */ |
|---|
| 87 | | - |
|---|
| 88 | | - struct iova_fq __percpu *fq; /* Flush Queue */ |
|---|
| 89 | | - |
|---|
| 90 | | - atomic64_t fq_flush_start_cnt; /* Number of TLB flushes that |
|---|
| 91 | | - have been started */ |
|---|
| 92 | | - |
|---|
| 93 | | - atomic64_t fq_flush_finish_cnt; /* Number of TLB flushes that |
|---|
| 94 | | - have been finished */ |
|---|
| 95 | 93 | |
|---|
| 96 | 94 | struct timer_list fq_timer; /* Timer to regularily empty the |
|---|
| 97 | 95 | flush-queues */ |
|---|
| .. | .. |
|---|
| 135 | 133 | return iova >> iova_shift(iovad); |
|---|
| 136 | 134 | } |
|---|
| 137 | 135 | |
|---|
| 138 | | -#if IS_ENABLED(CONFIG_IOMMU_IOVA) |
|---|
| 136 | +#if IS_REACHABLE(CONFIG_IOMMU_IOVA) |
|---|
| 139 | 137 | int iova_cache_get(void); |
|---|
| 140 | 138 | void iova_cache_put(void); |
|---|
| 141 | 139 | |
|---|
| .. | .. |
|---|
| 166 | 164 | struct iova *split_and_remove_iova(struct iova_domain *iovad, |
|---|
| 167 | 165 | struct iova *iova, unsigned long pfn_lo, unsigned long pfn_hi); |
|---|
| 168 | 166 | void free_cpu_cached_iovas(unsigned int cpu, struct iova_domain *iovad); |
|---|
| 167 | +void free_global_cached_iovas(struct iova_domain *iovad); |
|---|
| 169 | 168 | #else |
|---|
| 170 | 169 | static inline int iova_cache_get(void) |
|---|
| 171 | 170 | { |
|---|
| .. | .. |
|---|
| 273 | 272 | struct iova_domain *iovad) |
|---|
| 274 | 273 | { |
|---|
| 275 | 274 | } |
|---|
| 275 | + |
|---|
| 276 | +static inline void free_global_cached_iovas(struct iova_domain *iovad) |
|---|
| 277 | +{ |
|---|
| 278 | +} |
|---|
| 279 | + |
|---|
| 276 | 280 | #endif |
|---|
| 277 | 281 | |
|---|
| 278 | 282 | #endif |
|---|