lkml.org 
[lkml]   [2023]   [Feb]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 06/17] iommufd/hw_pagetable: Use domain_alloc_user op for domain allocation
Date
This converts iommufd to use iommu_domain_alloc_user() for iommu_domain
creation.

Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
---
drivers/iommu/iommufd/hw_pagetable.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/iommufd/hw_pagetable.c b/drivers/iommu/iommufd/hw_pagetable.c
index 43d473989a06..08d963ee38c7 100644
--- a/drivers/iommu/iommufd/hw_pagetable.c
+++ b/drivers/iommu/iommufd/hw_pagetable.c
@@ -30,6 +30,7 @@ struct iommufd_hw_pagetable *
iommufd_hw_pagetable_alloc(struct iommufd_ctx *ictx, struct iommufd_ioas *ioas,
struct device *dev)
{
+ const struct iommu_ops *ops;
struct iommufd_hw_pagetable *hwpt;
int rc;

@@ -37,7 +38,13 @@ iommufd_hw_pagetable_alloc(struct iommufd_ctx *ictx, struct iommufd_ioas *ioas,
if (IS_ERR(hwpt))
return hwpt;

- hwpt->domain = iommu_domain_alloc(dev->bus);
+ ops = dev_iommu_ops(dev);
+ if (!ops || !ops->domain_alloc_user) {
+ rc = -EOPNOTSUPP;
+ goto out_abort;
+ }
+
+ hwpt->domain = ops->domain_alloc_user(dev, NULL, NULL);
if (!hwpt->domain) {
rc = -ENOMEM;
goto out_abort;
--
2.34.1
\
 
 \ /
  Last update: 2023-03-27 00:15    [W:0.294 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site