Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-26 Thread Jean-Philippe Brucker
On Mon, Jan 24, 2022 at 12:33:02PM -0400, Jason Gunthorpe wrote: > On Mon, Jan 24, 2022 at 10:16:07AM +, Jean-Philippe Brucker wrote: > > On Mon, Jan 24, 2022 at 09:58:18AM +, Tian, Kevin wrote: > > > > From: Lu Baolu > > > > Sent: Monday, January 24, 2022 3:11 PM > > > > +/** > > > > + *

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-25 Thread Jason Gunthorpe via iommu
On Tue, Jan 25, 2022 at 02:23:52PM +, Robin Murphy wrote: > On 2022-01-25 06:27, Lu Baolu wrote: > Where it's just about which operations are valid for which domains, it's > even simpler for the core interface wrappers to validate the domain type, > rather than forcing drivers to implement

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-25 Thread Robin Murphy
On 2022-01-25 06:27, Lu Baolu wrote: On 1/25/22 8:57 AM, Robin Murphy wrote: On 2022-01-24 07:11, Lu Baolu wrote: Add a domain specific callback set, domain_ops, for vendor iommu driver to provide domain specific operations. Move domain-specific callbacks from iommu_ops to the domain_ops and

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-25 Thread Jason Gunthorpe via iommu
On Tue, Jan 25, 2022 at 12:59:14PM +0800, Lu Baolu wrote: > On 1/24/22 5:58 PM, Tian, Kevin wrote: > > > From: Lu Baolu > > > Sent: Monday, January 24, 2022 3:11 PM > > > +/** > > > + * struct domain_ops - per-domain ops > > > + * @attach_dev: attach an iommu domain to a device > > > + *

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Lu Baolu
On 1/25/22 8:57 AM, Robin Murphy wrote: On 2022-01-24 07:11, Lu Baolu wrote: Add a domain specific callback set, domain_ops, for vendor iommu driver to provide domain specific operations. Move domain-specific callbacks from iommu_ops to the domain_ops and hook them when a domain is allocated.

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Lu Baolu
On 1/25/22 1:55 AM, Jason Gunthorpe wrote: On Mon, Jan 24, 2022 at 03:11:02PM +0800, Lu Baolu wrote: - int (*enable_nesting)(struct iommu_domain *domain); Lu, there is an implementation in the Intel driver here, is it usable at all? It's useless and I have cleaned it up in this

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Lu Baolu
On 1/24/22 5:58 PM, Tian, Kevin wrote: From: Lu Baolu 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

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Lu Baolu
On 1/25/22 1:24 AM, Jason Gunthorpe wrote: On Mon, Jan 24, 2022 at 01:37:21AM -0800, Christoph Hellwig wrote: On Mon, Jan 24, 2022 at 03:11:02PM +0800, Lu Baolu wrote: Add a domain specific callback set, domain_ops, for vendor iommu driver to provide domain specific operations. Move

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Lu Baolu
On 1/24/22 5:37 PM, Christoph Hellwig wrote: On Mon, Jan 24, 2022 at 03:11:02PM +0800, Lu Baolu wrote: Add a domain specific callback set, domain_ops, for vendor iommu driver to provide domain specific operations. Move domain-specific callbacks from iommu_ops to the domain_ops and hook them

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Robin Murphy
On 2022-01-24 07:11, Lu Baolu wrote: Add a domain specific callback set, domain_ops, for vendor iommu driver to provide domain specific operations. Move domain-specific callbacks from iommu_ops to the domain_ops and hook them when a domain is allocated. I think it would make a lot of sense for

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Jason Gunthorpe via iommu
On Mon, Jan 24, 2022 at 03:11:02PM +0800, Lu Baolu wrote: > - int (*enable_nesting)(struct iommu_domain *domain); Perhaps for another series, but enable_nesting looks like dead code too, AFAICT. Or at the very least I can't figure how out VFIO_TYPE1_NESTING_IOMMU is supposed to work, or find

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Jason Gunthorpe via iommu
On Mon, Jan 24, 2022 at 01:37:21AM -0800, Christoph Hellwig wrote: > On Mon, Jan 24, 2022 at 03:11:02PM +0800, Lu Baolu wrote: > > Add a domain specific callback set, domain_ops, for vendor iommu driver > > to provide domain specific operations. Move domain-specific callbacks > > from iommu_ops to

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Jason Gunthorpe via iommu
On Mon, Jan 24, 2022 at 09:58:18AM +, Tian, Kevin wrote: > > From: Lu Baolu > > 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 > >

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Jason Gunthorpe via iommu
On Mon, Jan 24, 2022 at 10:16:07AM +, Jean-Philippe Brucker wrote: > On Mon, Jan 24, 2022 at 09:58:18AM +, Tian, Kevin wrote: > > > From: Lu Baolu > > > Sent: Monday, January 24, 2022 3:11 PM > > > +/** > > > + * struct domain_ops - per-domain ops > > > + * @attach_dev: attach an iommu

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Jean-Philippe Brucker
On Mon, Jan 24, 2022 at 09:58:18AM +, Tian, Kevin wrote: > > From: Lu Baolu > > 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 > >

RE: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Tian, Kevin
> From: Lu Baolu > 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

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Christoph Hellwig
On Mon, Jan 24, 2022 at 03:11:02PM +0800, Lu Baolu wrote: > Add a domain specific callback set, domain_ops, for vendor iommu driver > to provide domain specific operations. Move domain-specific callbacks > from iommu_ops to the domain_ops and hook them when a domain is allocated. Ah, that's what