All of lore.kernel.org
 help / color / mirror / Atom feed
From: chenxiang <chenxiang66@hisilicon.com>
To: <robin.murphy@arm.com>, <will@kernel.org>, <joro@8bytes.org>
Cc: iommu@lists.linux-foundation.org, linuxarm@openeuler.org,
	linuxarm@huawei.com
Subject: [PATCH 1/4] iommu/iova: add a function to free all rcached iovas and export it
Date: Mon, 7 Jun 2021 10:42:59 +0800	[thread overview]
Message-ID: <1623033782-57907-2-git-send-email-chenxiang66@hisilicon.com> (raw)
In-Reply-To: <1623033782-57907-1-git-send-email-chenxiang66@hisilicon.com>

From: Xiang Chen <chenxiang66@hisilicon.com>

Add a function to free all rcached iovas including cpu rcache iovas and
global rcache iovas, and export it.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
---
 drivers/iommu/iova.c | 11 +++++++++++
 include/linux/iova.h |  5 +++++
 2 files changed, 16 insertions(+)

diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c
index b7ecd5b..f595867 100644
--- a/drivers/iommu/iova.c
+++ b/drivers/iommu/iova.c
@@ -1077,5 +1077,16 @@ static void free_global_cached_iovas(struct iova_domain *iovad)
 		spin_unlock_irqrestore(&rcache->lock, flags);
 	}
 }
+
+void free_rcache_cached_iovas(struct iova_domain *iovad)
+{
+	unsigned int cpu;
+
+	for_each_online_cpu(cpu)
+		free_cpu_cached_iovas(cpu, iovad);
+	free_global_cached_iovas(iovad);
+}
+EXPORT_SYMBOL_GPL(free_rcache_cached_iovas);
+
 MODULE_AUTHOR("Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>");
 MODULE_LICENSE("GPL");
diff --git a/include/linux/iova.h b/include/linux/iova.h
index 71d8a2d..7006d9f 100644
--- a/include/linux/iova.h
+++ b/include/linux/iova.h
@@ -157,6 +157,7 @@ int init_iova_flush_queue(struct iova_domain *iovad,
 			  iova_flush_cb flush_cb, iova_entry_dtor entry_dtor);
 struct iova *find_iova(struct iova_domain *iovad, unsigned long pfn);
 void put_iova_domain(struct iova_domain *iovad);
+void free_rcache_cached_iovas(struct iova_domain *iovad);
 #else
 static inline int iova_cache_get(void)
 {
@@ -233,6 +234,10 @@ static inline void put_iova_domain(struct iova_domain *iovad)
 {
 }
 
+static inline void free_rcache_cached_iovas(struct iova_domain *iovad)
+{
+}
+
 #endif
 
 #endif
-- 
2.8.1

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2021-06-07  2:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-07  2:42 [PATCH 0/4] Free cached iovas when rmmod the driver of the last device in group chenxiang
2021-06-07  2:42 ` chenxiang [this message]
2021-06-07  2:43 ` [PATCH 2/4] iommu/iova: use function free_rcache_cached_iovas() to free all rcached iovas chenxiang
2021-06-07  2:43 ` [PATCH 3/4] dma-iommu: add a interface to get iova_domain from iommu domain chenxiang
2021-06-07  2:43 ` [PATCH 4/4] iommu: free cached iovas when rmmod the driver of the last device in the group chenxiang
2021-06-07 11:23 ` [PATCH 0/4] Free cached iovas when rmmod the driver of the last device in group Robin Murphy
2021-06-08  7:50   ` [Linuxarm] " chenxiang (M)
2021-06-08 14:17     ` Robin Murphy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1623033782-57907-2-git-send-email-chenxiang66@hisilicon.com \
    --to=chenxiang66@hisilicon.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=linuxarm@huawei.com \
    --cc=linuxarm@openeuler.org \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.