Re: [RFC 13/20] iommu: Extend iommu_at[de]tach_device() for multiple devices group

2021-10-26 Thread David Gibson
On Mon, Oct 25, 2021 at 08:36:02PM -0300, Jason Gunthorpe wrote: > On Tue, Oct 26, 2021 at 12:16:43AM +1100, David Gibson wrote: > > If you attach devices A and B (both in group X) to IOAS 1, then detach > > device A, what happens? Do you detach both devices? Or do you have a > > counter so you

Re: [RFC 13/20] iommu: Extend iommu_at[de]tach_device() for multiple devices group

2021-10-25 Thread Jason Gunthorpe via iommu
On Tue, Oct 26, 2021 at 12:16:43AM +1100, David Gibson wrote: > If you attach devices A and B (both in group X) to IOAS 1, then detach > device A, what happens? Do you detach both devices? Or do you have a > counter so you have to detach as many time as you attached? I would refcount it since

Re: [RFC 13/20] iommu: Extend iommu_at[de]tach_device() for multiple devices group

2021-10-25 Thread David Gibson
On Mon, Oct 25, 2021 at 09:14:10AM -0300, Jason Gunthorpe wrote: > On Mon, Oct 25, 2021 at 04:14:56PM +1100, David Gibson wrote: > > On Mon, Oct 18, 2021 at 01:32:38PM -0300, Jason Gunthorpe wrote: > > > On Mon, Oct 18, 2021 at 02:57:12PM +1100, David Gibson wrote: > > > > > > > The first user

Re: [RFC 13/20] iommu: Extend iommu_at[de]tach_device() for multiple devices group

2021-10-25 Thread Jason Gunthorpe via iommu
On Mon, Oct 25, 2021 at 04:14:56PM +1100, David Gibson wrote: > On Mon, Oct 18, 2021 at 01:32:38PM -0300, Jason Gunthorpe wrote: > > On Mon, Oct 18, 2021 at 02:57:12PM +1100, David Gibson wrote: > > > > > The first user might read this. Subsequent users are likely to just > > > copy paste

Re: [RFC 13/20] iommu: Extend iommu_at[de]tach_device() for multiple devices group

2021-10-24 Thread David Gibson
On Mon, Oct 18, 2021 at 01:32:38PM -0300, Jason Gunthorpe wrote: > On Mon, Oct 18, 2021 at 02:57:12PM +1100, David Gibson wrote: > > > The first user might read this. Subsequent users are likely to just > > copy paste examples from earlier things without fully understanding > > them. In general

Re: [RFC 13/20] iommu: Extend iommu_at[de]tach_device() for multiple devices group

2021-10-18 Thread Jason Gunthorpe via iommu
On Mon, Oct 18, 2021 at 02:57:12PM +1100, David Gibson wrote: > The first user might read this. Subsequent users are likely to just > copy paste examples from earlier things without fully understanding > them. In general documenting restrictions somewhere is never as > effective as making those

Re: [RFC 13/20] iommu: Extend iommu_at[de]tach_device() for multiple devices group

2021-10-17 Thread David Gibson
On Thu, Oct 14, 2021 at 07:06:07AM +, Tian, Kevin wrote: > > From: David Gibson > > Sent: Thursday, October 14, 2021 1:24 PM > > > > On Sun, Sep 19, 2021 at 02:38:41PM +0800, Liu Yi L wrote: > > > From: Lu Baolu > > > > > > These two helpers could be used when 1) the iommu group is

RE: [RFC 13/20] iommu: Extend iommu_at[de]tach_device() for multiple devices group

2021-10-14 Thread Tian, Kevin
> From: David Gibson > Sent: Thursday, October 14, 2021 1:24 PM > > On Sun, Sep 19, 2021 at 02:38:41PM +0800, Liu Yi L wrote: > > From: Lu Baolu > > > > These two helpers could be used when 1) the iommu group is singleton, > > or 2) the upper layer has put the iommu group into the secure state

Re: [RFC 13/20] iommu: Extend iommu_at[de]tach_device() for multiple devices group

2021-10-14 Thread David Gibson
On Sun, Sep 19, 2021 at 02:38:41PM +0800, Liu Yi L wrote: > From: Lu Baolu > > These two helpers could be used when 1) the iommu group is singleton, > or 2) the upper layer has put the iommu group into the secure state by > calling iommu_device_init_user_dma(). > > As we want the iommufd design

[RFC 13/20] iommu: Extend iommu_at[de]tach_device() for multiple devices group

2021-09-19 Thread Liu Yi L
From: Lu Baolu These two helpers could be used when 1) the iommu group is singleton, or 2) the upper layer has put the iommu group into the secure state by calling iommu_device_init_user_dma(). As we want the iommufd design to be a device-centric model, we want to remove any group knowledge in