summaryrefslogtreecommitdiff
path: root/include/linux/iova.h
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2017-08-10 17:14:59 +0300
committerJoerg Roedel <jroedel@suse.de>2017-08-15 19:23:51 +0300
commitfb418dab8a4f01dde0c025d15145c589ec02796b (patch)
treea3248e1152ca546661147605d2480528a8775af6 /include/linux/iova.h
parent1928210107edd4fa786199fef6b875d3af3bef88 (diff)
downloadlinux-fb418dab8a4f01dde0c025d15145c589ec02796b.tar.xz
iommu/iova: Add flush counters to Flush-Queue implementation
There are two counters: * fq_flush_start_cnt - Increased when a TLB flush is started. * fq_flush_finish_cnt - Increased when a TLB flush is finished. The fq_flush_start_cnt is assigned to every Flush-Queue entry on its creation. When freeing entries from the Flush-Queue, the value in the entry is compared to the fq_flush_finish_cnt. The entry can only be freed when its value is less than the value of fq_flush_finish_cnt. The reason for these counters it to take advantage of IOMMU TLB flushes that happened on other CPUs. These already flushed the TLB for Flush-Queue entries on other CPUs so that they can already be freed without flushing the TLB again. This makes it less likely that the Flush-Queue is full and saves IOMMU TLB flushes. Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'include/linux/iova.h')
-rw-r--r--include/linux/iova.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/iova.h b/include/linux/iova.h
index 1ae85248ec50..985b8008999e 100644
--- a/include/linux/iova.h
+++ b/include/linux/iova.h
@@ -14,6 +14,7 @@
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/rbtree.h>
+#include <linux/atomic.h>
#include <linux/dma-mapping.h>
/* iova structure */
@@ -52,6 +53,7 @@ struct iova_fq_entry {
unsigned long iova_pfn;
unsigned long pages;
unsigned long data;
+ u64 counter; /* Flush counter when this entrie was added */
};
/* Per-CPU Flush Queue structure */
@@ -77,6 +79,12 @@ struct iova_domain {
iova entry */
struct iova_fq __percpu *fq; /* Flush Queue */
+
+ atomic64_t fq_flush_start_cnt; /* Number of TLB flushes that
+ have been started */
+
+ atomic64_t fq_flush_finish_cnt; /* Number of TLB flushes that
+ have been finished */
};
static inline unsigned long iova_size(struct iova *iova)