[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR11MB5276D1C4EA66F5B30D08124A8C5F9@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Tue, 25 Jan 2022 00:58:04 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: Jason Gunthorpe <jgg@...dia.com>
CC: "Raj, Ashok" <ashok.raj@...el.com>,
David Airlie <airlied@...ux.ie>,
"Robin Murphy" <robin.murphy@....com>,
"Pan, Jacob jun" <jacob.jun.pan@...el.com>,
Christoph Hellwig <hch@...radead.org>,
Alex Williamson <alex.williamson@...hat.com>,
Thierry Reding <thierry.reding@...il.com>,
"Ben Skeggs" <bskeggs@...hat.com>, Daniel Vetter <daniel@...ll.ch>,
Jonathan Hunter <jonathanh@...dia.com>,
Will Deacon <will@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 7/7] iommu: Add iommu_domain::domain_ops
> From: Jason Gunthorpe via iommu
> Sent: Tuesday, January 25, 2022 1:18 AM
>
> On Mon, Jan 24, 2022 at 09:58:18AM +0000, Tian, Kevin wrote:
> > > From: Lu Baolu <baolu.lu@...ux.intel.com>
> > > Sent: Monday, January 24, 2022 3:11 PM
> > > +/**
> > > + * struct domain_ops - per-domain ops
> > > + * @attach_dev: attach an iommu domain to a device
> > > + * @detach_dev: detach an iommu domain from a device
> >
> > What is the criteria about whether an op should be iommu_ops or
> domain_ops
> > when it requires both domain and device pointers like above two (and
> future
> > PASID-based attach)?
> >
> > Other examples include:
> > @apply_resv_region
>
> For apply_resv_region the 'dev' argument is really selecting a device
> that is already attached to the domain, so it should be in the domain
> ops.
Looks this one can be just removed. No iommu driver implements today.
>
> > @is_attach_deferred
>
> Only two drivers implement this and neither use the domain
> argument. Remove the domain argument and keep it in the iommu_ops
>
Yes, especially when none of the two drivers actually uses domain.
Generally it makes sense to me by putting all attach related callbacks in
iommu_ops, since they are all for building connections between device
and domain while such connection is device specific (just like how a
vfio device is connected to iommufd).
This in concept also applies to @enable_nesting which you mentioned
in another thread. Nesting is a per-device configuration between multiple
domains attached by a same device.
Thanks
Kevin
Powered by blists - more mailing lists