public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] iommu: add domain->nested
@ 2021-06-16 14:38 Zhangfei Gao
  2021-06-16 14:44 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Zhangfei Gao @ 2021-06-16 14:38 UTC (permalink / raw)
  To: Christoph Hellwig, Joerg Roedel, Will Deacon, Auger Eric,
	jean-philippe
  Cc: iommu, kvm, Zhangfei Gao

Add domain->nested to decide whether domain is in nesting mode,
since attr DOMAIN_ATTR_NESTING is removed in the patches:
7876a83 iommu: remove iommu_domain_{get,set}_attr
7e14754 iommu: remove DOMAIN_ATTR_NESTING

Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
---

Nesting info is still required for vsva according to
https://patchwork.kernel.org/project/linux-arm-kernel/patch/20210301084257.945454-16-hch@lst.de/

 drivers/iommu/iommu.c | 8 +++++++-
 include/linux/iommu.h | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 808ab70..ba26ad0 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -2684,11 +2684,17 @@ core_initcall(iommu_init);
 
 int iommu_enable_nesting(struct iommu_domain *domain)
 {
+	int ret;
+
 	if (domain->type != IOMMU_DOMAIN_UNMANAGED)
 		return -EINVAL;
 	if (!domain->ops->enable_nesting)
 		return -EINVAL;
-	return domain->ops->enable_nesting(domain);
+	ret = domain->ops->enable_nesting(domain);
+	if (!ret)
+		domain->nested = 1;
+
+	return ret;
 }
 EXPORT_SYMBOL_GPL(iommu_enable_nesting);
 
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 32d4480..179f849 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -87,6 +87,7 @@ struct iommu_domain {
 	void *handler_token;
 	struct iommu_domain_geometry geometry;
 	void *iova_cookie;
+	int nested;
 };
 
 enum iommu_cap {
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-17  3:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-16 14:38 [RFC PATCH] iommu: add domain->nested Zhangfei Gao
2021-06-16 14:44 ` Christoph Hellwig
2021-06-17  3:13   ` Zhangfei Gao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox