All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] iommu: add domain->nested
@ 2021-06-16 14:38 ` Zhangfei Gao
  0 siblings, 0 replies; 6+ 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] 6+ messages in thread

* [RFC PATCH] iommu: add domain->nested
@ 2021-06-16 14:38 ` Zhangfei Gao
  0 siblings, 0 replies; 6+ 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: Zhangfei Gao, iommu, kvm

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

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

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

* Re: [RFC PATCH] iommu: add domain->nested
  2021-06-16 14:38 ` Zhangfei Gao
@ 2021-06-16 14:44   ` Christoph Hellwig
  -1 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2021-06-16 14:44 UTC (permalink / raw)
  To: Zhangfei Gao
  Cc: Christoph Hellwig, Joerg Roedel, Will Deacon, Auger Eric,
	jean-philippe, iommu, kvm

On Wed, Jun 16, 2021 at 10:38:02PM +0800, Zhangfei Gao wrote:
> +++ 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;

This should probably be a bool : 1;

Also this needs a user, so please just queue up a variant of this for
the code that eventually relies on this information.

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

* Re: [RFC PATCH] iommu: add domain->nested
@ 2021-06-16 14:44   ` Christoph Hellwig
  0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2021-06-16 14:44 UTC (permalink / raw)
  To: Zhangfei Gao; +Cc: jean-philippe, kvm, iommu, Will Deacon, Christoph Hellwig

On Wed, Jun 16, 2021 at 10:38:02PM +0800, Zhangfei Gao wrote:
> +++ 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;

This should probably be a bool : 1;

Also this needs a user, so please just queue up a variant of this for
the code that eventually relies on this information.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

* Re: [RFC PATCH] iommu: add domain->nested
  2021-06-16 14:44   ` Christoph Hellwig
@ 2021-06-17  3:13     ` Zhangfei Gao
  -1 siblings, 0 replies; 6+ messages in thread
From: Zhangfei Gao @ 2021-06-17  3:13 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Joerg Roedel, Will Deacon, Auger Eric, jean-philippe, iommu, kvm



On 2021/6/16 下午10:44, Christoph Hellwig wrote:
> On Wed, Jun 16, 2021 at 10:38:02PM +0800, Zhangfei Gao wrote:
>> +++ 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;
> This should probably be a bool : 1;
>
> Also this needs a user, so please just queue up a variant of this for
> the code that eventually relies on this information.
Thanks Christoph

Got it, will do this.



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

* Re: [RFC PATCH] iommu: add domain->nested
@ 2021-06-17  3:13     ` Zhangfei Gao
  0 siblings, 0 replies; 6+ messages in thread
From: Zhangfei Gao @ 2021-06-17  3:13 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: jean-philippe, kvm, iommu, Will Deacon



On 2021/6/16 下午10:44, Christoph Hellwig wrote:
> On Wed, Jun 16, 2021 at 10:38:02PM +0800, Zhangfei Gao wrote:
>> +++ 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;
> This should probably be a bool : 1;
>
> Also this needs a user, so please just queue up a variant of this for
> the code that eventually relies on this information.
Thanks Christoph

Got it, will do this.


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

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

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

Thread overview: 6+ 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:38 ` Zhangfei Gao
2021-06-16 14:44 ` Christoph Hellwig
2021-06-16 14:44   ` Christoph Hellwig
2021-06-17  3:13   ` Zhangfei Gao
2021-06-17  3:13     ` Zhangfei Gao

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.