Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-20 Thread Jason Gunthorpe
On Mon, Mar 20, 2023 at 11:11:51PM +0800, Yi Liu wrote: > > > On 2023/3/20 22:49, Jason Gunthorpe wrote: > > On Wed, Mar 15, 2023 at 02:03:09AM -0700, Nicolin Chen wrote: > > > Hi, > > > > > > On Wed, Mar 15, 2023 at 06:50:53AM +, Tian, Kevin wrote: > > > > > > > > So, this preparatory

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-20 Thread Yi Liu
On 2023/3/20 22:49, Jason Gunthorpe wrote: On Wed, Mar 15, 2023 at 02:03:09AM -0700, Nicolin Chen wrote: Hi, On Wed, Mar 15, 2023 at 06:50:53AM +, Tian, Kevin wrote: So, this preparatory series will add a pair of simple attach() and detach() APIs. Then the cdev series will add the

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-20 Thread Jason Gunthorpe
On Wed, Mar 15, 2023 at 02:03:09AM -0700, Nicolin Chen wrote: > Hi, > > On Wed, Mar 15, 2023 at 06:50:53AM +, Tian, Kevin wrote: > > > > So, this preparatory series will add a pair of simple attach() > > > and detach() APIs. Then the cdev series will add the locking > > > and the ioas_unpin

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-16 Thread Liu, Yi L
> From: Tian, Kevin > Sent: Thursday, March 16, 2023 1:49 PM > > > From: Nicolin Chen > > Sent: Thursday, March 16, 2023 1:44 PM > > > > On Thu, Mar 16, 2023 at 05:38:41AM +, Tian, Kevin wrote: > > > External email: Use caution opening links or attachments > > > > > > > > > > From: Nicolin

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-15 Thread Nicolin Chen
On Thu, Mar 16, 2023 at 05:49:20AM +, Tian, Kevin wrote: > External email: Use caution opening links or attachments > > > > From: Nicolin Chen > > Sent: Thursday, March 16, 2023 1:44 PM > > > > On Thu, Mar 16, 2023 at 05:38:41AM +, Tian, Kevin wrote: > > > External email: Use caution

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-15 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Thursday, March 16, 2023 1:44 PM > > On Thu, Mar 16, 2023 at 05:38:41AM +, Tian, Kevin wrote: > > External email: Use caution opening links or attachments > > > > > > > From: Nicolin Chen > > > Sent: Thursday, March 16, 2023 1:33 PM > > > > > > Hi Kevin, > > > >

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-15 Thread Nicolin Chen
On Thu, Mar 16, 2023 at 05:38:41AM +, Tian, Kevin wrote: > External email: Use caution opening links or attachments > > > > From: Nicolin Chen > > Sent: Thursday, March 16, 2023 1:33 PM > > > > Hi Kevin, > > > > I've fixed the other two commits. Here is the one that I am > > not sure about:

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-15 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Thursday, March 16, 2023 1:33 PM > > Hi Kevin, > > I've fixed the other two commits. Here is the one that I am > not sure about: > > On Thu, Mar 16, 2023 at 02:53:50AM +, Tian, Kevin wrote: > > > > [2] This adds iommufd_access_detach() in the cdev series: > >

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-15 Thread Nicolin Chen
Hi Kevin, I've fixed the other two commits. Here is the one that I am not sure about: On Thu, Mar 16, 2023 at 02:53:50AM +, Tian, Kevin wrote: > > [2] This adds iommufd_access_detach() in the cdev series: > > "iommufd/device: Add iommufd_access_detach() API" > > > >

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-15 Thread Nicolin Chen
On Thu, Mar 16, 2023 at 02:53:50AM +, Tian, Kevin wrote: > > Please check if they look okay, so that Yi can integrate them > > accordingly to the emulated/cdev series. > > this split looks reasonable to me. Go ahead. Thanks for the review! I will address those comments and renew those

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-15 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Wednesday, March 15, 2023 5:03 PM > > Hi, > > On Wed, Mar 15, 2023 at 06:50:53AM +, Tian, Kevin wrote: > > > > So, this preparatory series will add a pair of simple attach() > > > and detach() APIs. Then the cdev series will add the locking > > > and the

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-15 Thread Nicolin Chen
On Wed, Mar 15, 2023 at 12:18:01PM +, Liu, Yi L wrote: > > OK. Basically I followed what Jason suggested by having three > > APIs and combined Kevin's inputs about the difference between > > the attach/replace(). I also updated the replace changes, and > > rebased all nesting (infrastructure,

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-15 Thread Nicolin Chen
On Thu, Mar 16, 2023 at 12:17:11AM +, Tian, Kevin wrote: > > > > > > > > @@ -449,33 +450,18 @@ iommufd_access_create(struct > > > > iommufd_ctx > > > > > > > > refcount_inc(>obj.users); > > > > > > > > + mutex_init(>ioas_lock); > > > > > > > > access->ictx = ictx; > > > > > >

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-15 Thread Tian, Kevin
> From: Liu, Yi L > Sent: Wednesday, March 15, 2023 4:53 PM > > > From: Tian, Kevin > > Sent: Wednesday, March 15, 2023 2:52 PM > > > > > From: Nicolin Chen > > > Sent: Wednesday, March 15, 2023 2:22 PM > > > > > > On Wed, Mar 15, 2023 at 06:16:37AM +, Tian, Kevin wrote: > > > > External

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-15 Thread Liu, Yi L
> From: Nicolin Chen > Sent: Wednesday, March 15, 2023 5:03 PM > > Hi, > > On Wed, Mar 15, 2023 at 06:50:53AM +, Tian, Kevin wrote: > > > > So, this preparatory series will add a pair of simple attach() > > > and detach() APIs. Then the cdev series will add the locking > > > and the

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-15 Thread Nicolin Chen
Hi, On Wed, Mar 15, 2023 at 06:50:53AM +, Tian, Kevin wrote: > > So, this preparatory series will add a pair of simple attach() > > and detach() APIs. Then the cdev series will add the locking > > and the ioas_unpin stuff as a rework of the detach() API. > > I think they can be something

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-15 Thread Liu, Yi L
> From: Tian, Kevin > Sent: Wednesday, March 15, 2023 2:52 PM > > > From: Nicolin Chen > > Sent: Wednesday, March 15, 2023 2:22 PM > > > > On Wed, Mar 15, 2023 at 06:16:37AM +, Tian, Kevin wrote: > > > External email: Use caution opening links or attachments > > > > > > > > > > From: Nicolin

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-15 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Wednesday, March 15, 2023 2:22 PM > > On Wed, Mar 15, 2023 at 06:16:37AM +, Tian, Kevin wrote: > > External email: Use caution opening links or attachments > > > > > > > From: Nicolin Chen > > > Sent: Wednesday, March 15, 2023 2:51 AM > > > > > > On Fri, Mar 10,

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-15 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Wednesday, March 15, 2023 2:33 PM > > On Wed, Mar 15, 2023 at 06:15:23AM +, Tian, Kevin wrote: > > External email: Use caution opening links or attachments > > > > > > > From: Nicolin Chen > > > Sent: Wednesday, March 15, 2023 9:01 AM > > > > > > Hi Jason/Kevin,

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-15 Thread Nicolin Chen
On Wed, Mar 15, 2023 at 06:15:23AM +, Tian, Kevin wrote: > External email: Use caution opening links or attachments > > > > From: Nicolin Chen > > Sent: Wednesday, March 15, 2023 9:01 AM > > > > Hi Jason/Kevin, > > > > > > > > Perhaps we can have iommufd_access_attach/detach in this series

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-15 Thread Nicolin Chen
On Wed, Mar 15, 2023 at 06:16:37AM +, Tian, Kevin wrote: > External email: Use caution opening links or attachments > > > > From: Nicolin Chen > > Sent: Wednesday, March 15, 2023 2:51 AM > > > > On Fri, Mar 10, 2023 at 02:08:15AM +, Tian, Kevin wrote: > > > External email: Use caution

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-15 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Wednesday, March 15, 2023 2:51 AM > > On Fri, Mar 10, 2023 at 02:08:15AM +, Tian, Kevin wrote: > > External email: Use caution opening links or attachments > > > > > > > From: Liu, Yi L > > > Sent: Wednesday, March 8, 2023 9:14 PM > > > > > > @@ -449,33 +450,18

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-15 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Wednesday, March 15, 2023 9:01 AM > > Hi Jason/Kevin, > > > > > Perhaps we can have iommufd_access_attach/detach in this series > > along with a vfio_iommufd_emulated_detach_ioas, and the locking > > will come with another patch in replace series? > > I recall that

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-14 Thread Nicolin Chen
Hi Jason/Kevin, On Tue, Mar 14, 2023 at 01:20:52AM -0700, Nicolin Chen wrote: > On Fri, Mar 10, 2023 at 01:36:22PM -0400, Jason Gunthorpe wrote: > > On Wed, Mar 08, 2023 at 05:13:36AM -0800, Yi Liu wrote: > > > > > +int iommufd_access_set_ioas(struct iommufd_access *access, u32 ioas_id) > > > +{

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-14 Thread Nicolin Chen
On Fri, Mar 10, 2023 at 02:08:15AM +, Tian, Kevin wrote: > External email: Use caution opening links or attachments > > > > From: Liu, Yi L > > Sent: Wednesday, March 8, 2023 9:14 PM > > > > @@ -449,33 +450,18 @@ iommufd_access_create(struct iommufd_ctx *ictx, > > u32 ioas_id, > >

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-14 Thread Nicolin Chen
On Fri, Mar 10, 2023 at 01:36:22PM -0400, Jason Gunthorpe wrote: > On Wed, Mar 08, 2023 at 05:13:36AM -0800, Yi Liu wrote: > > > +int iommufd_access_set_ioas(struct iommufd_access *access, u32 ioas_id) > > +{ > > + struct iommufd_ioas *new_ioas = NULL, *cur_ioas; > > + struct iommufd_ctx

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-10 Thread Jason Gunthorpe
On Wed, Mar 08, 2023 at 05:13:36AM -0800, Yi Liu wrote: > +int iommufd_access_set_ioas(struct iommufd_access *access, u32 ioas_id) > +{ > + struct iommufd_ioas *new_ioas = NULL, *cur_ioas; > + struct iommufd_ctx *ictx = access->ictx; > + struct iommufd_object *obj; > + int rc = 0;

Re: [Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-09 Thread Tian, Kevin
> From: Liu, Yi L > Sent: Wednesday, March 8, 2023 9:14 PM > > @@ -449,33 +450,18 @@ iommufd_access_create(struct iommufd_ctx *ictx, > u32 ioas_id, > access->data = data; > access->ops = ops; > > - obj = iommufd_get_object(ictx, ioas_id, IOMMUFD_OBJ_IOAS); > - if

[Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

2023-03-08 Thread Yi Liu
From: Nicolin Chen There are needs to created iommufd_access prior to have an IOAS and set IOAS later. Like the vfio device cdev needs to have an iommufd object to represent the bond (iommufd_access) and IOAS replacement. This moves iommufd_access_create() call into