RE: [PATCH RFC v2 03/11] iommu/sva: Add iommu_domain type for SVA

2022-04-06 Thread Tian, Kevin
> From: Robin Murphy > Sent: Wednesday, April 6, 2022 8:32 PM > > On 2022-04-06 06:58, Tian, Kevin wrote: > >> From: Jason Gunthorpe > >> Sent: Wednesday, April 6, 2022 9:24 AM > >> > >> On Wed, Apr 06, 2022 at 01:00:13AM +, Tian, Kevin wrote: > >> > Because domains wrap more than just

Re: [PATCH RFC v2 03/11] iommu/sva: Add iommu_domain type for SVA

2022-04-06 Thread Jason Gunthorpe via iommu
On Wed, Apr 06, 2022 at 02:37:40PM +0100, Robin Murphy wrote: > On 2022-04-06 14:06, Jason Gunthorpe wrote: > > On Wed, Apr 06, 2022 at 01:32:07PM +0100, Robin Murphy wrote: > > > a particular IOMMU instance, and potentially allocate separate domains for > > > separate devices to represent the

Re: [PATCH RFC v2 03/11] iommu/sva: Add iommu_domain type for SVA

2022-04-06 Thread Robin Murphy
On 2022-04-06 14:06, Jason Gunthorpe wrote: On Wed, Apr 06, 2022 at 01:32:07PM +0100, Robin Murphy wrote: a particular IOMMU instance, and potentially allocate separate domains for separate devices to represent the same address space, much like vfio_iommu_type1_attach_group() does. I think

Re: [PATCH RFC v2 03/11] iommu/sva: Add iommu_domain type for SVA

2022-04-06 Thread Jason Gunthorpe via iommu
On Wed, Apr 06, 2022 at 01:32:07PM +0100, Robin Murphy wrote: > a particular IOMMU instance, and potentially allocate separate domains for > separate devices to represent the same address space, much like > vfio_iommu_type1_attach_group() does. I think this VFIO code also needs some more work, it

Re: [PATCH RFC v2 03/11] iommu/sva: Add iommu_domain type for SVA

2022-04-06 Thread Robin Murphy
On 2022-04-06 06:58, Tian, Kevin wrote: From: Jason Gunthorpe Sent: Wednesday, April 6, 2022 9:24 AM On Wed, Apr 06, 2022 at 01:00:13AM +, Tian, Kevin wrote: Because domains wrap more than just the IOPTE format, they have additional data related to the IOMMU HW block itself. Imagine a

RE: [PATCH RFC v2 03/11] iommu/sva: Add iommu_domain type for SVA

2022-04-05 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Wednesday, April 6, 2022 9:24 AM > > On Wed, Apr 06, 2022 at 01:00:13AM +, Tian, Kevin wrote: > > > > Because domains wrap more than just the IOPTE format, they have > > > additional data related to the IOMMU HW block itself. Imagine a SOC > > > with two

Re: [PATCH RFC v2 03/11] iommu/sva: Add iommu_domain type for SVA

2022-04-05 Thread Jason Gunthorpe via iommu
On Wed, Apr 06, 2022 at 01:00:13AM +, Tian, Kevin wrote: > > Because domains wrap more than just the IOPTE format, they have > > additional data related to the IOMMU HW block itself. Imagine a SOC > > with two IOMMU HW blocks that can both process the CPU IOPTE format, > > but have different

RE: [PATCH RFC v2 03/11] iommu/sva: Add iommu_domain type for SVA

2022-04-05 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Sunday, April 3, 2022 7:32 AM > > On Sat, Apr 02, 2022 at 08:43:16AM +, Tian, Kevin wrote: > > > > This assumes any domain is interchangeable with any device, which is > > > not the iommu model. We need a domain op to check if a device is > > > compatiable

Re: [PATCH RFC v2 03/11] iommu/sva: Add iommu_domain type for SVA

2022-04-04 Thread Lu Baolu
Hi Jason and Kevin, On 2022/4/3 7:32, Jason Gunthorpe wrote: On Sat, Apr 02, 2022 at 08:43:16AM +, Tian, Kevin wrote: This assumes any domain is interchangeable with any device, which is not the iommu model. We need a domain op to check if a device is compatiable with the domain for vfio

Re: [PATCH RFC v2 03/11] iommu/sva: Add iommu_domain type for SVA

2022-04-02 Thread Jason Gunthorpe via iommu
On Sat, Apr 02, 2022 at 08:43:16AM +, Tian, Kevin wrote: > > This assumes any domain is interchangeable with any device, which is > > not the iommu model. We need a domain op to check if a device is > > compatiable with the domain for vfio an iommufd, this should do the > > same. > > This

RE: [PATCH RFC v2 03/11] iommu/sva: Add iommu_domain type for SVA

2022-04-02 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Thursday, March 31, 2022 3:02 AM > > On Tue, Mar 29, 2022 at 01:37:52PM +0800, Lu Baolu wrote: > > @@ -95,6 +101,7 @@ struct iommu_domain { > > void *handler_token; > > struct iommu_domain_geometry geometry; > > struct iommu_dma_cookie *iova_cookie; >

Re: [PATCH RFC v2 03/11] iommu/sva: Add iommu_domain type for SVA

2022-03-30 Thread Jason Gunthorpe via iommu
On Tue, Mar 29, 2022 at 01:37:52PM +0800, Lu Baolu wrote: > @@ -95,6 +101,7 @@ struct iommu_domain { > void *handler_token; > struct iommu_domain_geometry geometry; > struct iommu_dma_cookie *iova_cookie; > + struct iommu_sva_cookie *sva_cookie; Cookie is still the wrong

Re: [PATCH RFC v2 03/11] iommu/sva: Add iommu_domain type for SVA

2022-03-29 Thread Lu Baolu
On 2022/3/30 5:38, Jacob Pan wrote: +static struct iommu_domain * +iommu_sva_alloc_domain(struct device *dev, struct mm_struct *mm) +{ + struct bus_type *bus = dev->bus; + struct iommu_sva_cookie *cookie; + struct iommu_domain *domain; + void *curr; + + if (!bus ||

Re: [PATCH RFC v2 03/11] iommu/sva: Add iommu_domain type for SVA

2022-03-29 Thread Jacob Pan
Hi BaoLu, On Tue, 29 Mar 2022 13:37:52 +0800, Lu Baolu wrote: > Add a new iommu domain type IOMMU_DOMAIN_SVA to represent an I/O page > table which is shared from CPU host VA. Add some helpers to get and > put an SVA domain and implement SVA domain life cycle management. > > Signed-off-by: Lu

[PATCH RFC v2 03/11] iommu/sva: Add iommu_domain type for SVA

2022-03-28 Thread Lu Baolu
Add a new iommu domain type IOMMU_DOMAIN_SVA to represent an I/O page table which is shared from CPU host VA. Add some helpers to get and put an SVA domain and implement SVA domain life cycle management. Signed-off-by: Lu Baolu --- include/linux/iommu.h | 7 +++