* [PATCH v2] iommu: Set owner token to SVA domain
@ 2023-12-08 1:53 Lu Baolu
2023-12-08 11:15 ` Robin Murphy
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Lu Baolu @ 2023-12-08 1:53 UTC (permalink / raw)
To: Joerg Roedel, Will Deacon, Robin Murphy, Jason Gunthorpe,
Kevin Tian
Cc: iommu, linux-kernel, Lu Baolu
Commit a9c362db3920 ("iommu: Validate that devices match domains") added
an owner token to the iommu_domain. This token is checked during domain
attachment to RID or PASID through the generic iommu interfaces.
The SVA domains are attached to PASIDs through those iommu interfaces.
Therefore, they require the owner token to be set during allocation.
Otherwise, they fail to attach.
Set the owner token for SVA domains.
Fixes: a9c362db3920 ("iommu: Validate that devices match domains")
Cc: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
drivers/iommu/iommu.c | 1 +
1 file changed, 1 insertion(+)
Change log:
v2:
- The user domain allocation path does the right thing. Hence no need
to fix anything.
v1:
- https://lore.kernel.org/linux-iommu/20231207021938.306738-1-baolu.lu@linux.intel.com/
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 0d25468d53a6..d0a28667479a 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -3617,6 +3617,7 @@ struct iommu_domain *iommu_sva_domain_alloc(struct device *dev,
domain->type = IOMMU_DOMAIN_SVA;
mmgrab(mm);
domain->mm = mm;
+ domain->owner = ops;
domain->iopf_handler = iommu_sva_handle_iopf;
domain->fault_data = mm;
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] iommu: Set owner token to SVA domain
2023-12-08 1:53 [PATCH v2] iommu: Set owner token to SVA domain Lu Baolu
@ 2023-12-08 11:15 ` Robin Murphy
2023-12-08 13:40 ` Jason Gunthorpe
2023-12-12 9:16 ` Joerg Roedel
2 siblings, 0 replies; 4+ messages in thread
From: Robin Murphy @ 2023-12-08 11:15 UTC (permalink / raw)
To: Lu Baolu, Joerg Roedel, Will Deacon, Jason Gunthorpe, Kevin Tian
Cc: iommu, linux-kernel
On 08/12/2023 1:53 am, Lu Baolu wrote:
> Commit a9c362db3920 ("iommu: Validate that devices match domains") added
> an owner token to the iommu_domain. This token is checked during domain
> attachment to RID or PASID through the generic iommu interfaces.
>
> The SVA domains are attached to PASIDs through those iommu interfaces.
> Therefore, they require the owner token to be set during allocation.
> Otherwise, they fail to attach.
>
> Set the owner token for SVA domains.
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
> Fixes: a9c362db3920 ("iommu: Validate that devices match domains")
> Cc: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
> ---
> drivers/iommu/iommu.c | 1 +
> 1 file changed, 1 insertion(+)
>
> Change log:
> v2:
> - The user domain allocation path does the right thing. Hence no need
> to fix anything.
> v1:
> - https://lore.kernel.org/linux-iommu/20231207021938.306738-1-baolu.lu@linux.intel.com/
>
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index 0d25468d53a6..d0a28667479a 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -3617,6 +3617,7 @@ struct iommu_domain *iommu_sva_domain_alloc(struct device *dev,
> domain->type = IOMMU_DOMAIN_SVA;
> mmgrab(mm);
> domain->mm = mm;
> + domain->owner = ops;
> domain->iopf_handler = iommu_sva_handle_iopf;
> domain->fault_data = mm;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] iommu: Set owner token to SVA domain
2023-12-08 1:53 [PATCH v2] iommu: Set owner token to SVA domain Lu Baolu
2023-12-08 11:15 ` Robin Murphy
@ 2023-12-08 13:40 ` Jason Gunthorpe
2023-12-12 9:16 ` Joerg Roedel
2 siblings, 0 replies; 4+ messages in thread
From: Jason Gunthorpe @ 2023-12-08 13:40 UTC (permalink / raw)
To: Lu Baolu
Cc: Joerg Roedel, Will Deacon, Robin Murphy, Kevin Tian, iommu,
linux-kernel
On Fri, Dec 08, 2023 at 09:53:14AM +0800, Lu Baolu wrote:
> Commit a9c362db3920 ("iommu: Validate that devices match domains") added
> an owner token to the iommu_domain. This token is checked during domain
> attachment to RID or PASID through the generic iommu interfaces.
>
> The SVA domains are attached to PASIDs through those iommu interfaces.
> Therefore, they require the owner token to be set during allocation.
> Otherwise, they fail to attach.
>
> Set the owner token for SVA domains.
>
> Fixes: a9c362db3920 ("iommu: Validate that devices match domains")
> Cc: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
> ---
> drivers/iommu/iommu.c | 1 +
> 1 file changed, 1 insertion(+)
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Jason
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] iommu: Set owner token to SVA domain
2023-12-08 1:53 [PATCH v2] iommu: Set owner token to SVA domain Lu Baolu
2023-12-08 11:15 ` Robin Murphy
2023-12-08 13:40 ` Jason Gunthorpe
@ 2023-12-12 9:16 ` Joerg Roedel
2 siblings, 0 replies; 4+ messages in thread
From: Joerg Roedel @ 2023-12-12 9:16 UTC (permalink / raw)
To: Lu Baolu
Cc: Will Deacon, Robin Murphy, Jason Gunthorpe, Kevin Tian, iommu,
linux-kernel
On Fri, Dec 08, 2023 at 09:53:14AM +0800, Lu Baolu wrote:
> drivers/iommu/iommu.c | 1 +
> 1 file changed, 1 insertion(+)
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-12-12 9:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-08 1:53 [PATCH v2] iommu: Set owner token to SVA domain Lu Baolu
2023-12-08 11:15 ` Robin Murphy
2023-12-08 13:40 ` Jason Gunthorpe
2023-12-12 9:16 ` Joerg Roedel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox