@@ -5,6 +5,7 @@
#include <linux/iommu.h>
#include <uapi/linux/iommufd.h>
+#include "../iommu-priv.h"
#include "iommufd_private.h"
void iommufd_hw_pagetable_destroy(struct iommufd_object *obj)
@@ -55,6 +56,7 @@ struct iommufd_hw_pagetable *
iommufd_hw_pagetable_alloc(struct iommufd_ctx *ictx, struct iommufd_ioas *ioas,
struct iommufd_device *idev, bool immediate_attach)
{
+ const struct iommu_ops *ops = dev_iommu_ops(idev->dev);
struct iommufd_hw_pagetable *hwpt;
int rc;
@@ -69,7 +71,10 @@ iommufd_hw_pagetable_alloc(struct iommufd_ctx *ictx, struct iommufd_ioas *ioas,
refcount_inc(&ioas->obj.users);
hwpt->ioas = ioas;
- hwpt->domain = iommu_domain_alloc(idev->dev->bus);
+ if (ops->domain_alloc_user)
+ hwpt->domain = ops->domain_alloc_user(idev->dev, NULL, NULL);
+ else
+ hwpt->domain = iommu_domain_alloc(idev->dev->bus);
if (!hwpt->domain) {
rc = -ENOMEM;
goto out_abort;