diff options
author | Jason Gunthorpe <jgg@nvidia.com> | 2023-03-01 15:30:23 -0400 |
---|---|---|
committer | Jason Gunthorpe <jgg@nvidia.com> | 2023-03-06 10:51:57 -0400 |
commit | 339fbf3ae144263725ccb7694cd2366d5e0c6ebf (patch) | |
tree | e09e6620947c64bf7b7fa43278346ecc388ebd15 /drivers/iommu/iommufd/iommufd_private.h | |
parent | 7e7ec8a5692105450bbfde8c310af606e216add0 (diff) | |
download | linux-stable-339fbf3ae144263725ccb7694cd2366d5e0c6ebf.tar.gz linux-stable-339fbf3ae144263725ccb7694cd2366d5e0c6ebf.tar.bz2 linux-stable-339fbf3ae144263725ccb7694cd2366d5e0c6ebf.zip |
iommufd: Make iommufd_hw_pagetable_alloc() do iopt_table_add_domain()
The HWPT is always linked to an IOAS and once a HWPT exists its domain
should be fully mapped. This ended up being split up into device.c during
a two phase creation that was a bit confusing.
Move the iopt_table_add_domain() into iommufd_hw_pagetable_alloc() by
having it call back to device.c to complete the domain attach in the
required order.
Calling iommufd_hw_pagetable_alloc() with immediate_attach = false will
work on most drivers, but notably the SMMU drivers will fail because they
can't decide what kind of domain to create until they are attached. This
will be fixed when the domain_alloc function can take in a struct device.
Link: https://lore.kernel.org/r/6-v3-ae9c2975a131+2e1e8-iommufd_hwpt_jgg@nvidia.com
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/iommu/iommufd/iommufd_private.h')
-rw-r--r-- | drivers/iommu/iommufd/iommufd_private.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/iommu/iommufd/iommufd_private.h b/drivers/iommu/iommufd/iommufd_private.h index 84fe19a19546..331664e917b7 100644 --- a/drivers/iommu/iommufd/iommufd_private.h +++ b/drivers/iommu/iommufd/iommufd_private.h @@ -255,7 +255,11 @@ struct iommufd_hw_pagetable { struct iommufd_hw_pagetable * iommufd_hw_pagetable_alloc(struct iommufd_ctx *ictx, struct iommufd_ioas *ioas, - struct device *dev); + struct iommufd_device *idev, bool immediate_attach); +int iommufd_hw_pagetable_attach(struct iommufd_hw_pagetable *hwpt, + struct iommufd_device *idev); +void iommufd_hw_pagetable_detach(struct iommufd_hw_pagetable *hwpt, + struct iommufd_device *idev); void iommufd_hw_pagetable_destroy(struct iommufd_object *obj); /* |