Re: [PATCH 9/9] iommu: Move flush queue data into iommu_dma_cookie

From: Robin Murphy
Date: Wed Nov 24 2021 - 13:00:32 EST


On 2021-11-24 17:25, John Garry wrote:
On 23/11/2021 14:10, Robin Murphy wrote:
ruct iommu_dma_msi_page {
      struct list_head    list;
@@ -41,7 +43,19 @@ struct iommu_dma_cookie {
      enum iommu_dma_cookie_type    type;
      union {
          /* Full allocator for IOMMU_DMA_IOVA_COOKIE */
-        struct iova_domain    iovad;
+        struct {
+            struct iova_domain    iovad;
+
+            struct iova_fq __percpu *fq;    /* Flush queue */
+            /* Number of TLB flushes that have been started */
+            atomic64_t        fq_flush_start_cnt;
+            /* Number of TLB flushes that have been finished */
+            atomic64_t        fq_flush_finish_cnt;
+            /* Timer to regularily empty the flush queues */
+            struct timer_list    fq_timer;
+            /* 1 when timer is active, 0 when not */
+            atomic_t        fq_timer_on;

I thought that putting all the FQ stuff in its own structure would be neater, but that's just personal preference.

But look, it is! ;)

The iova_domain is still a fundamental part of the flush queue built around it; the rest of the machinery can't stand in isolation. It's just an anonymous structure because I don't feel like needlessly cluttering up the code with "cookie->fq.fq" silliness.

Cheers,
Robin.