Re: [PATCH v2 1/2] vfio/type1: Simplify bus_type determination

2022-06-24 Thread Alex Williamson
On Fri, 24 Jun 2022 16:12:55 +0100 Robin Murphy wrote: > On 2022-06-24 15:28, Alex Williamson wrote: > > On Fri, 24 Jun 2022 11:18:36 -0300 > > Jason Gunthorpe wrote: > > > >> On Fri, Jun 24, 2022 at 08:11:59AM -0600, Alex Williamson wrote: > >>> On Thu, 23 Jun 2022 22:50:30 -0300 > >>>

Re: [PATCH v2 1/2] vfio/type1: Simplify bus_type determination

2022-06-24 Thread Robin Murphy
On 2022-06-24 15:28, Alex Williamson wrote: On Fri, 24 Jun 2022 11:18:36 -0300 Jason Gunthorpe wrote: On Fri, Jun 24, 2022 at 08:11:59AM -0600, Alex Williamson wrote: On Thu, 23 Jun 2022 22:50:30 -0300 Jason Gunthorpe wrote: On Thu, Jun 23, 2022 at 05:00:44PM -0600, Alex Williamson

Re: [PATCH v2 1/2] vfio/type1: Simplify bus_type determination

2022-06-24 Thread Jason Gunthorpe via iommu
On Fri, Jun 24, 2022 at 08:28:31AM -0600, Alex Williamson wrote: > > > That's essentially what I'm suggesting, the vfio_group is passed as an > > > opaque pointer which type1 can use for a > > > vfio_group_for_each_vfio_device() type call. Thanks, > > > > I don't want to add a whole

Re: [PATCH v2 1/2] vfio/type1: Simplify bus_type determination

2022-06-24 Thread Alex Williamson
On Fri, 24 Jun 2022 11:18:36 -0300 Jason Gunthorpe wrote: > On Fri, Jun 24, 2022 at 08:11:59AM -0600, Alex Williamson wrote: > > On Thu, 23 Jun 2022 22:50:30 -0300 > > Jason Gunthorpe wrote: > > > > > On Thu, Jun 23, 2022 at 05:00:44PM -0600, Alex Williamson wrote: > > > > > > > > >>

Re: [PATCH v2 1/2] vfio/type1: Simplify bus_type determination

2022-06-24 Thread Jason Gunthorpe via iommu
On Fri, Jun 24, 2022 at 08:11:59AM -0600, Alex Williamson wrote: > On Thu, 23 Jun 2022 22:50:30 -0300 > Jason Gunthorpe wrote: > > > On Thu, Jun 23, 2022 at 05:00:44PM -0600, Alex Williamson wrote: > > > > > > >> +struct vfio_device *vfio_device_get_from_iommu(struct iommu_group > > > > >>

Re: [PATCH v2 1/2] vfio/type1: Simplify bus_type determination

2022-06-24 Thread Alex Williamson
On Thu, 23 Jun 2022 22:50:30 -0300 Jason Gunthorpe wrote: > On Thu, Jun 23, 2022 at 05:00:44PM -0600, Alex Williamson wrote: > > > > >> +struct vfio_device *vfio_device_get_from_iommu(struct iommu_group > > > >> *iommu_group) > > > >> +{ > > > >> + struct vfio_group *group = > > > >>

Re: [PATCH v2 1/2] vfio/type1: Simplify bus_type determination

2022-06-23 Thread Jason Gunthorpe via iommu
On Wed, Jun 22, 2022 at 01:04:11PM +0100, Robin Murphy wrote: > +struct vfio_device *vfio_device_get_from_iommu(struct iommu_group > *iommu_group) > +{ > + struct vfio_group *group = vfio_group_get_from_iommu(iommu_group); > + struct vfio_device *device; > + > +

Re: [PATCH v2 1/2] vfio/type1: Simplify bus_type determination

2022-06-23 Thread Jason Gunthorpe via iommu
On Thu, Jun 23, 2022 at 05:00:44PM -0600, Alex Williamson wrote: > > >> +struct vfio_device *vfio_device_get_from_iommu(struct iommu_group > > >> *iommu_group) > > >> +{ > > >> +struct vfio_group *group = > > >> vfio_group_get_from_iommu(iommu_group); > > >> +struct vfio_device

Re: [PATCH v2 1/2] vfio/type1: Simplify bus_type determination

2022-06-23 Thread Alex Williamson
On Thu, 23 Jun 2022 13:23:05 +0100 Robin Murphy wrote: > On 2022-06-22 23:17, Alex Williamson wrote: > > On Wed, 22 Jun 2022 13:04:11 +0100 > > Robin Murphy wrote: > > > >> Since IOMMU groups are mandatory for drivers to support, it stands to > >> reason that any device which has been

Re: [PATCH v2 1/2] vfio/type1: Simplify bus_type determination

2022-06-23 Thread Jason Gunthorpe via iommu
On Thu, Jun 23, 2022 at 01:23:05PM +0100, Robin Murphy wrote: > So yes, technically we could implement an iommu_group_capable() and an > iommu_group_domain_alloc(), which would still just internally resolve the > IOMMU ops and instance data from a member device to perform the driver-level > call,

Re: [PATCH v2 1/2] vfio/type1: Simplify bus_type determination

2022-06-23 Thread Alex Williamson
On Thu, 23 Jun 2022 08:46:45 + "Tian, Kevin" wrote: > > From: Alex Williamson > > Sent: Thursday, June 23, 2022 6:17 AM > > > > > > > > ret = -EIO; > > > - domain->domain = iommu_domain_alloc(bus); > > > + domain->domain = iommu_domain_alloc(iommu_api_dev->dev- > > >bus); > > > > It

Re: [PATCH v2 1/2] vfio/type1: Simplify bus_type determination

2022-06-23 Thread Robin Murphy
On 2022-06-22 23:17, Alex Williamson wrote: On Wed, 22 Jun 2022 13:04:11 +0100 Robin Murphy wrote: Since IOMMU groups are mandatory for drivers to support, it stands to reason that any device which has been successfully be added to a group s/be // Oops. must be on a bus supported by

RE: [PATCH v2 1/2] vfio/type1: Simplify bus_type determination

2022-06-23 Thread Tian, Kevin
> From: Alex Williamson > Sent: Thursday, June 23, 2022 6:17 AM > > > > > ret = -EIO; > > - domain->domain = iommu_domain_alloc(bus); > > + domain->domain = iommu_domain_alloc(iommu_api_dev->dev- > >bus); > > It makes sense to move away from a bus centric interface to iommu ops > and I

Re: [PATCH v2 1/2] vfio/type1: Simplify bus_type determination

2022-06-22 Thread kernel test robot
Hi Robin, I love your patch! Yet something to improve: [auto build test ERROR on v5.19-rc3] [also build test ERROR on linus/master next-20220622] [cannot apply to awilliam-vfio/next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to

Re: [PATCH v2 1/2] vfio/type1: Simplify bus_type determination

2022-06-22 Thread Baolu Lu
On 2022/6/22 20:04, Robin Murphy wrote: Since IOMMU groups are mandatory for drivers to support, it stands to reason that any device which has been successfully be added to a group must be on a bus supported by that IOMMU driver, and therefore a domain viable for any device in the group must be

Re: [PATCH v2 1/2] vfio/type1: Simplify bus_type determination

2022-06-22 Thread Alex Williamson
On Wed, 22 Jun 2022 13:04:11 +0100 Robin Murphy wrote: > Since IOMMU groups are mandatory for drivers to support, it stands to > reason that any device which has been successfully be added to a group s/be // > must be on a bus supported by that IOMMU driver, and therefore a domain > viable for

[PATCH v2 1/2] vfio/type1: Simplify bus_type determination

2022-06-22 Thread Robin Murphy
Since IOMMU groups are mandatory for drivers to support, it stands to reason that any device which has been successfully be added to a group must be on a bus supported by that IOMMU driver, and therefore a domain viable for any device in the group must be viable for all devices in the group. This