[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZAttk17mCqgCU1nK@nvidia.com>
Date: Fri, 10 Mar 2023 13:49:07 -0400
From: Jason Gunthorpe <jgg@...dia.com>
To: Baolu Lu <baolu.lu@...ux.intel.com>
Cc: Yi Liu <yi.l.liu@...el.com>, joro@...tes.org,
alex.williamson@...hat.com, kevin.tian@...el.com,
robin.murphy@....com, cohuck@...hat.com, eric.auger@...hat.com,
nicolinc@...dia.com, kvm@...r.kernel.org, mjrosato@...ux.ibm.com,
chao.p.peng@...ux.intel.com, yi.y.sun@...ux.intel.com,
peterx@...hat.com, jasowang@...hat.com,
shameerali.kolothum.thodi@...wei.com, lulu@...hat.com,
suravee.suthikulpanit@....com, iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH 04/12] iommufd: Pass parent hwpt and user_data to
iommufd_hw_pagetable_alloc()
On Fri, Mar 10, 2023 at 10:10:56AM +0800, Baolu Lu wrote:
> > @@ -54,14 +58,20 @@ int iommufd_hw_pagetable_enforce_cc(struct iommufd_hw_pagetable *hwpt)
> > */
> > struct iommufd_hw_pagetable *
> > iommufd_hw_pagetable_alloc(struct iommufd_ctx *ictx, struct iommufd_ioas *ioas,
> > - struct iommufd_device *idev, bool immediate_attach)
> > + struct iommufd_device *idev,
> > + struct iommufd_hw_pagetable *parent,
> > + void *user_data, bool immediate_attach)
> > {
> > const struct iommu_ops *ops = dev_iommu_ops(idev->dev);
> > + struct iommu_domain *parent_domain = NULL;
> > struct iommufd_hw_pagetable *hwpt;
> > int rc;
> > lockdep_assert_held(&ioas->mutex);
> > + if (parent && !ops->domain_alloc_user)
> > + return ERR_PTR(-EOPNOTSUPP);
>
> My understanding here is that we are checking whether domain_alloc_user
> is required. It seems that as long as the caller inputs a valid
> user_data or parent, domain_alloc_user is required. If so,
>
> if ((user_data || parent) && !ops->domain_alloc_user)
> return ERR_PTR(-EOPNOTSUPP);
Yes
Jason
Powered by blists - more mailing lists