hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/include/linux/iova.h
....@@ -1,11 +1,9 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Copyright (c) 2006, Intel Corporation.
34 *
4
- * This file is released under the GPLv2.
5
- *
65 * Copyright (C) 2006-2008 Intel Corporation
76 * Author: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
8
- *
97 */
108
119 #ifndef _IOVA_H_
....@@ -74,8 +72,16 @@
7472 struct rb_node *cached32_node; /* Save last 32-bit alloced node */
7573 unsigned long granule; /* pfn granularity for this domain */
7674 unsigned long start_pfn; /* Lower limit for this domain */
77
- unsigned long end_pfn; /* Upper limit for this domain */
7875 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
+
7985 struct iova anchor; /* rbtree lookup anchor */
8086 struct iova_rcache rcaches[IOVA_RANGE_CACHE_MAX_SIZE]; /* IOVA range caches */
8187
....@@ -84,14 +90,6 @@
8490
8591 iova_entry_dtor entry_dtor; /* IOMMU driver specific destructor for
8692 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 */
9593
9694 struct timer_list fq_timer; /* Timer to regularily empty the
9795 flush-queues */
....@@ -135,7 +133,7 @@
135133 return iova >> iova_shift(iovad);
136134 }
137135
138
-#if IS_ENABLED(CONFIG_IOMMU_IOVA)
136
+#if IS_REACHABLE(CONFIG_IOMMU_IOVA)
139137 int iova_cache_get(void);
140138 void iova_cache_put(void);
141139
....@@ -166,6 +164,7 @@
166164 struct iova *split_and_remove_iova(struct iova_domain *iovad,
167165 struct iova *iova, unsigned long pfn_lo, unsigned long pfn_hi);
168166 void free_cpu_cached_iovas(unsigned int cpu, struct iova_domain *iovad);
167
+void free_global_cached_iovas(struct iova_domain *iovad);
169168 #else
170169 static inline int iova_cache_get(void)
171170 {
....@@ -273,6 +272,11 @@
273272 struct iova_domain *iovad)
274273 {
275274 }
275
+
276
+static inline void free_global_cached_iovas(struct iova_domain *iovad)
277
+{
278
+}
279
+
276280 #endif
277281
278282 #endif