Re: [RFC PATCH v2 08/10] vfio/type1: Add domain at(de)taching group helpers

2018-09-25 Thread Lu Baolu
Hi, On 09/26/2018 01:55 AM, Jean-Philippe Brucker wrote: On 19/09/2018 00:26, Tian, Kevin wrote: If the core actually calls it, we can implement detach_dev :) The problem is that the core never calls detach_dev when default_domain is present (affects any IOMMU driver that relies on

Re: [RFC PATCH v2 08/10] vfio/type1: Add domain at(de)taching group helpers

2018-09-25 Thread Jean-Philippe Brucker
On 19/09/2018 00:26, Tian, Kevin wrote: >> If the core actually calls it, we can implement detach_dev :) The >> problem is that the core never calls detach_dev when default_domain is >> present (affects any IOMMU driver that relies on default_domain, >> including AMD), and even in case 4) the

Re: [RFC PATCH v2 08/10] vfio/type1: Add domain at(de)taching group helpers

2018-09-18 Thread Lu Baolu
Hi, On 09/19/2018 07:26 AM, Tian, Kevin wrote: From: Jean-Philippe Brucker [mailto:jean-philippe.bruc...@arm.com] Sent: Tuesday, September 18, 2018 11:52 PM On 15/09/2018 03:36, Tian, Kevin wrote: 4) Userspace opens another mdev. -> iommu.c calls domain->ops->attach_dev(domain2, dev)

RE: [RFC PATCH v2 08/10] vfio/type1: Add domain at(de)taching group helpers

2018-09-18 Thread Tian, Kevin
> From: Jean-Philippe Brucker [mailto:jean-philippe.bruc...@arm.com] > Sent: Tuesday, September 18, 2018 11:52 PM > > On 15/09/2018 03:36, Tian, Kevin wrote: > >> 4) Userspace opens another mdev. > >> -> iommu.c calls domain->ops->attach_dev(domain2, dev) > > > > another mdev in same VFIO

Re: [RFC PATCH v2 08/10] vfio/type1: Add domain at(de)taching group helpers

2018-09-18 Thread Jean-Philippe Brucker
On 15/09/2018 03:36, Tian, Kevin wrote: >> 4) Userspace opens another mdev. >> -> iommu.c calls domain->ops->attach_dev(domain2, dev) > > another mdev in same VFIO container or different? I assume the > latter since you mentioned a new domain2. I was thinking a different VFIO container actually.

RE: [RFC PATCH v2 08/10] vfio/type1: Add domain at(de)taching group helpers

2018-09-14 Thread Tian, Kevin
> From: Jean-Philippe Brucker > Sent: Friday, September 14, 2018 10:46 PM > > On 13/09/2018 01:35, Tian, Kevin wrote: > >>> Let's consider it from the API point of view. > >>> > >>> We have iommu_a(de)ttach_device() APIs to attach or detach a domain > >>> to/from a device. We should avoid

Re: [RFC PATCH v2 08/10] vfio/type1: Add domain at(de)taching group helpers

2018-09-14 Thread Jean-Philippe Brucker
On 13/09/2018 01:35, Tian, Kevin wrote: >>> Let's consider it from the API point of view. >>> >>> We have iommu_a(de)ttach_device() APIs to attach or detach a domain >>> to/from a device. We should avoid applying a limitation of "these are >>> only for single domain case, for multiple domains, use

RE: [RFC PATCH v2 08/10] vfio/type1: Add domain at(de)taching group helpers

2018-09-12 Thread Tian, Kevin
> From: Jean-Philippe Brucker [mailto:jean-philippe.bruc...@arm.com] > Sent: Thursday, September 13, 2018 1:54 AM > > On 12/09/2018 06:02, Lu Baolu wrote: > > Hi, > > > > On 09/11/2018 12:23 AM, Jean-Philippe Brucker wrote: > >> On 30/08/2018 05:09, Lu Baolu wrote: > >>> +static int

Re: [RFC PATCH v2 08/10] vfio/type1: Add domain at(de)taching group helpers

2018-09-12 Thread Jean-Philippe Brucker
On 12/09/2018 06:02, Lu Baolu wrote: > Hi, > > On 09/11/2018 12:23 AM, Jean-Philippe Brucker wrote: >> On 30/08/2018 05:09, Lu Baolu wrote: >>> +static int vfio_detach_aux_domain(struct device *dev, void *data) >>> +{ >>> + struct iommu_domain *domain = data; >>> + >>> +

Re: [RFC PATCH v2 08/10] vfio/type1: Add domain at(de)taching group helpers

2018-09-11 Thread Lu Baolu
Hi, On 09/11/2018 12:23 AM, Jean-Philippe Brucker wrote: On 30/08/2018 05:09, Lu Baolu wrote: +static int vfio_detach_aux_domain(struct device *dev, void *data) +{ + struct iommu_domain *domain = data; + + vfio_mdev_set_aux_domain(dev, NULL); + iommu_detach_device(domain,

Re: [RFC PATCH v2 08/10] vfio/type1: Add domain at(de)taching group helpers

2018-09-10 Thread Jean-Philippe Brucker
On 30/08/2018 05:09, Lu Baolu wrote: > +static int vfio_detach_aux_domain(struct device *dev, void *data) > +{ > + struct iommu_domain *domain = data; > + > + vfio_mdev_set_aux_domain(dev, NULL); > + iommu_detach_device(domain, dev->parent); I think that's only going to work for vt-d,