Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Lu Baolu
On 1/25/22 8:57 AM, Robin Murphy wrote: On 2022-01-24 07:11, Lu Baolu wrote: Add a domain specific callback set, domain_ops, for vendor iommu driver to provide domain specific operations. Move domain-specific callbacks from iommu_ops to the domain_ops and hook them when a domain is allocated.

Re: [PATCH v4 2/7] mm: page_isolation: move has_unmovable_pages() to mm/page_isolation.c

2022-01-24 Thread Oscar Salvador
On 2022-01-19 20:06, Zi Yan wrote: From: Zi Yan has_unmovable_pages() is only used in mm/page_isolation.c. Move it from mm/page_alloc.c and make it static. Signed-off-by: Zi Yan Reviewed-by: Oscar Salvador -- Oscar Salvador SUSE Labs ___ iommu

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Lu Baolu
On 1/25/22 1:55 AM, Jason Gunthorpe wrote: On Mon, Jan 24, 2022 at 03:11:02PM +0800, Lu Baolu wrote: - int (*enable_nesting)(struct iommu_domain *domain); Lu, there is an implementation in the Intel driver here, is it usable at all? It's useless and I have cleaned it up in this

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Lu Baolu
On 1/24/22 5:58 PM, Tian, Kevin wrote: From: Lu Baolu Sent: Monday, January 24, 2022 3:11 PM +/** + * struct domain_ops - per-domain ops + * @attach_dev: attach an iommu domain to a device + * @detach_dev: detach an iommu domain from a device What is the criteria about whether an op should be

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Lu Baolu
On 1/25/22 1:24 AM, Jason Gunthorpe wrote: On Mon, Jan 24, 2022 at 01:37:21AM -0800, Christoph Hellwig wrote: On Mon, Jan 24, 2022 at 03:11:02PM +0800, Lu Baolu wrote: Add a domain specific callback set, domain_ops, for vendor iommu driver to provide domain specific operations. Move

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Lu Baolu
On 1/24/22 5:37 PM, Christoph Hellwig wrote: On Mon, Jan 24, 2022 at 03:11:02PM +0800, Lu Baolu wrote: Add a domain specific callback set, domain_ops, for vendor iommu driver to provide domain specific operations. Move domain-specific callbacks from iommu_ops to the domain_ops and hook them

Re: [PATCH 6/7] iommu: Use right way to retrieve iommu_ops

2022-01-24 Thread Lu Baolu
On 1/25/22 8:20 AM, Robin Murphy wrote: On 2022-01-24 07:11, Lu Baolu wrote: The common iommu_ops is hooked to both device and domain. When a helper has both device and domain pointer, the way to get the iommu_ops looks messy in iommu core. This sorts out the way to get iommu_ops. The device

Re: [PATCH 6/7] iommu: Use right way to retrieve iommu_ops

2022-01-24 Thread Lu Baolu
On 1/25/22 1:36 AM, Jason Gunthorpe wrote: On Mon, Jan 24, 2022 at 03:11:01PM +0800, Lu Baolu wrote: The common iommu_ops is hooked to both device and domain. When a helper has both device and domain pointer, the way to get the iommu_ops looks messy in iommu core. This sorts out the way to get

Re: [PATCH 6/7] iommu: Use right way to retrieve iommu_ops

2022-01-24 Thread Lu Baolu
On 1/24/22 5:48 PM, Tian, Kevin wrote: From: Lu Baolu Sent: Monday, January 24, 2022 3:11 PM diff --git a/include/linux/iommu.h b/include/linux/iommu.h index aa5486243892..111b3e9c79bb 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -385,6 +385,14 @@ static inline void

Re: [PATCH 6/7] iommu: Use right way to retrieve iommu_ops

2022-01-24 Thread Lu Baolu
On 1/24/22 5:32 PM, Christoph Hellwig wrote: On Mon, Jan 24, 2022 at 03:11:01PM +0800, Lu Baolu wrote: The common iommu_ops is hooked to both device and domain. When a helper has both device and domain pointer, the way to get the iommu_ops looks messy in iommu core. This sorts out the way to

Re: [PATCH 5/7] drm/nouveau/device: Get right pgsize_bitmap of iommu_domain

2022-01-24 Thread Lu Baolu
On 1/24/22 5:29 PM, Christoph Hellwig wrote: On Mon, Jan 24, 2022 at 03:11:00PM +0800, Lu Baolu wrote: The supported page sizes of an iommu_domain are saved in the pgsize_bitmap field. Retrieve the value from the right place. Signed-off-by: Lu Baolu Reviewed-by: Robin Murphy Link:

RE: [PATCH 0/7] iommu cleanup and refactoring

2022-01-24 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Tuesday, January 25, 2022 1:44 AM > > On Mon, Jan 24, 2022 at 09:46:26AM +, Tian, Kevin wrote: > > > From: Lu Baolu > > > Sent: Monday, January 24, 2022 3:11 PM > > > > > > Hi, > > > > > > The guest pasid and aux-domain related code are dead code in current >

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Robin Murphy
On 2022-01-24 07:11, Lu Baolu wrote: Add a domain specific callback set, domain_ops, for vendor iommu driver to provide domain specific operations. Move domain-specific callbacks from iommu_ops to the domain_ops and hook them when a domain is allocated. I think it would make a lot of sense for

Re: [PATCH 6/7] iommu: Use right way to retrieve iommu_ops

2022-01-24 Thread Robin Murphy
On 2022-01-24 07:11, Lu Baolu wrote: The common iommu_ops is hooked to both device and domain. When a helper has both device and domain pointer, the way to get the iommu_ops looks messy in iommu core. This sorts out the way to get iommu_ops. The device related helpers go through device pointer,

Re: [PATCH v2 05/11] iommu/sva: Assign a PASID to mm on PASID allocation and free it on mm exit

2022-01-24 Thread Thomas Gleixner
On Mon, Jan 24 2022 at 12:52, Fenghua Yu wrote: > On Mon, Jan 24, 2022 at 09:36:00PM +0100, Thomas Gleixner wrote: >> On Mon, Jan 24 2022 at 21:21, Thomas Gleixner wrote: > Ah. This patch should remove ioasid_get(). So I will change this patch > as follows: > > 1. Remove ioasid_get() because it's

Re: [PATCH v2 05/11] iommu/sva: Assign a PASID to mm on PASID allocation and free it on mm exit

2022-01-24 Thread Fenghua Yu
Hi, Thomas, On Mon, Jan 24, 2022 at 09:36:00PM +0100, Thomas Gleixner wrote: > On Mon, Jan 24 2022 at 21:21, Thomas Gleixner wrote: > > > > Hrm. This is odd. > > > >> +/* Associate a PASID with an mm_struct: */ > >> +static inline void mm_pasid_get(struct mm_struct *mm, u32 pasid) > >> +{ > >> +

Re: [PATCH v2 05/11] iommu/sva: Assign a PASID to mm on PASID allocation and free it on mm exit

2022-01-24 Thread Thomas Gleixner
On Mon, Jan 24 2022 at 21:21, Thomas Gleixner wrote: > > Hrm. This is odd. > >> +/* Associate a PASID with an mm_struct: */ >> +static inline void mm_pasid_get(struct mm_struct *mm, u32 pasid) >> +{ >> +mm->pasid = pasid; >> +} > > This does not get anything. It sets the allocated PASID in the

Re: [PATCH v2 05/11] iommu/sva: Assign a PASID to mm on PASID allocation and free it on mm exit

2022-01-24 Thread Fenghua Yu
Hi, Thomas, On Mon, Jan 24, 2022 at 09:21:24PM +0100, Thomas Gleixner wrote: > On Fri, Dec 17 2021 at 22:01, Fenghua Yu wrote: > > diff --git a/drivers/iommu/iommu-sva-lib.c b/drivers/iommu/iommu-sva-lib.c > > index bd41405d34e9..ee2294e02716 100644 > > --- a/drivers/iommu/iommu-sva-lib.c > > +++

Re: [PATCH v2 05/11] iommu/sva: Assign a PASID to mm on PASID allocation and free it on mm exit

2022-01-24 Thread Thomas Gleixner
On Fri, Dec 17 2021 at 22:01, Fenghua Yu wrote: > diff --git a/drivers/iommu/iommu-sva-lib.c b/drivers/iommu/iommu-sva-lib.c > index bd41405d34e9..ee2294e02716 100644 > --- a/drivers/iommu/iommu-sva-lib.c > +++ b/drivers/iommu/iommu-sva-lib.c > @@ -18,8 +18,7 @@ static

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Jason Gunthorpe via iommu
On Mon, Jan 24, 2022 at 03:11:02PM +0800, Lu Baolu wrote: > - int (*enable_nesting)(struct iommu_domain *domain); Perhaps for another series, but enable_nesting looks like dead code too, AFAICT. Or at the very least I can't figure how out VFIO_TYPE1_NESTING_IOMMU is supposed to work, or find

Re: [PATCH 0/7] iommu cleanup and refactoring

2022-01-24 Thread Jason Gunthorpe via iommu
On Mon, Jan 24, 2022 at 09:46:26AM +, Tian, Kevin wrote: > > From: Lu Baolu > > Sent: Monday, January 24, 2022 3:11 PM > > > > Hi, > > > > The guest pasid and aux-domain related code are dead code in current > > iommu subtree. As we have reached a consensus that all these features > >

Re: [PATCH 6/7] iommu: Use right way to retrieve iommu_ops

2022-01-24 Thread Jason Gunthorpe via iommu
On Mon, Jan 24, 2022 at 03:11:01PM +0800, Lu Baolu wrote: > The common iommu_ops is hooked to both device and domain. When a helper > has both device and domain pointer, the way to get the iommu_ops looks > messy in iommu core. This sorts out the way to get iommu_ops. The device > related helpers

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Jason Gunthorpe via iommu
On Mon, Jan 24, 2022 at 01:37:21AM -0800, Christoph Hellwig wrote: > On Mon, Jan 24, 2022 at 03:11:02PM +0800, Lu Baolu wrote: > > Add a domain specific callback set, domain_ops, for vendor iommu driver > > to provide domain specific operations. Move domain-specific callbacks > > from iommu_ops to

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Jason Gunthorpe via iommu
On Mon, Jan 24, 2022 at 09:58:18AM +, Tian, Kevin wrote: > > From: Lu Baolu > > Sent: Monday, January 24, 2022 3:11 PM > > +/** > > + * struct domain_ops - per-domain ops > > + * @attach_dev: attach an iommu domain to a device > > + * @detach_dev: detach an iommu domain from a device > >

Re: [PATCH v4 3/7] mm: page_isolation: check specified range for unmovable pages

2022-01-24 Thread Zi Yan via iommu
On 24 Jan 2022, at 4:55, Oscar Salvador wrote: > On 2022-01-19 20:06, Zi Yan wrote: >> From: Zi Yan >> >> Enable set_migratetype_isolate() to check specified sub-range for >> unmovable pages during isolation. Page isolation is done >> at max(MAX_ORDER_NR_PAEGS, pageblock_nr_pages) granularity,

Re: [PATCH v4 1/7] mm: page_alloc: avoid merging non-fallbackable pageblocks with others.

2022-01-24 Thread Mel Gorman
On Mon, Jan 24, 2022 at 11:12:07AM -0500, Zi Yan wrote: > On 24 Jan 2022, at 9:02, Mel Gorman wrote: > > > On Wed, Jan 19, 2022 at 02:06:17PM -0500, Zi Yan wrote: > >> From: Zi Yan > >> > >> This is done in addition to MIGRATE_ISOLATE pageblock merge avoidance. > >> It prepares for the upcoming

[PATCH 3/3] swiotlb: Simplify array allocation

2022-01-24 Thread Robin Murphy
Prefer kcalloc() to kzalloc(array_size()) for allocating an array. Signed-off-by: Robin Murphy --- kernel/dma/swiotlb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index f56d6504903c..44c49c3616fe 100644 ---

[PATCH 1/3] swiotlb: Simplify debugfs setup

2022-01-24 Thread Robin Murphy
Debugfs functions are already stubbed out for !CONFIG_DEBUG_FS, so we can remove most of the #ifdefs, just keeping one to manually optimise away the initcall when it would do nothing. We can also simplify the code itself by factoring out the directory creation and realising that the global

[PATCH 2/3] swiotlb: Tidy up includes

2022-01-24 Thread Robin Murphy
SWIOTLB's includes have become a great big mess. Restore some order by consolidating the random different blocks, sorting alphabetically, and purging some clearly unnecessary entries - linux/io.h is now included unconditionally, so need not be duplicated in the restricted DMA pool case; similarly,

[PATCH 0/3] Some minor SWIOTLB cleanups

2022-01-24 Thread Robin Murphy
Hi all, Here's a little collection of cleanup patches for some annoyances that have built up while looking at SWIOTLB code recently. Cheers, Robin. Robin Murphy (3): swiotlb: Simplify debugfs setup swiotlb: Tidy up includes swiotlb: Simplify array allocation kernel/dma/swiotlb.c | 74

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Jason Gunthorpe via iommu
On Mon, Jan 24, 2022 at 10:16:07AM +, Jean-Philippe Brucker wrote: > On Mon, Jan 24, 2022 at 09:58:18AM +, Tian, Kevin wrote: > > > From: Lu Baolu > > > Sent: Monday, January 24, 2022 3:11 PM > > > +/** > > > + * struct domain_ops - per-domain ops > > > + * @attach_dev: attach an iommu

Re: [PATCH v4 1/7] mm: page_alloc: avoid merging non-fallbackable pageblocks with others.

2022-01-24 Thread Zi Yan via iommu
On 24 Jan 2022, at 9:02, Mel Gorman wrote: > On Wed, Jan 19, 2022 at 02:06:17PM -0500, Zi Yan wrote: >> From: Zi Yan >> >> This is done in addition to MIGRATE_ISOLATE pageblock merge avoidance. >> It prepares for the upcoming removal of the MAX_ORDER-1 alignment >> requirement for CMA and

Re: [PATCH v4 3/7] mm: page_isolation: check specified range for unmovable pages

2022-01-24 Thread Oscar Salvador
On 2022-01-19 20:06, Zi Yan wrote: From: Zi Yan Enable set_migratetype_isolate() to check specified sub-range for unmovable pages during isolation. Page isolation is done at max(MAX_ORDER_NR_PAEGS, pageblock_nr_pages) granularity, but not all pages within that granularity are intended to be

Re: [PATCH v4 1/7] mm: page_alloc: avoid merging non-fallbackable pageblocks with others.

2022-01-24 Thread Mel Gorman
On Wed, Jan 19, 2022 at 02:06:17PM -0500, Zi Yan wrote: > From: Zi Yan > > This is done in addition to MIGRATE_ISOLATE pageblock merge avoidance. > It prepares for the upcoming removal of the MAX_ORDER-1 alignment > requirement for CMA and alloc_contig_range(). > > MIGRARTE_HIGHATOMIC should

[PATCH v3 0/8] Add support for HiSilicon PCIe Tune and Trace device

2022-01-24 Thread Yicong Yang via iommu
HiSilicon PCIe tune and trace device (PTT) is a PCIe Root Complex integrated Endpoint (RCiEP) device, providing the capability to dynamically monitor and tune the PCIe traffic (tune), and trace the TLP headers (trace). PTT tune is designed for monitoring and adjusting PCIe link parameters. We

[PATCH v3 1/8] hwtracing: Add trace function support for HiSilicon PCIe Tune and Trace device

2022-01-24 Thread Yicong Yang via iommu
HiSilicon PCIe tune and trace device(PTT) is a PCIe Root Complex integrated Endpoint(RCiEP) device, providing the capability to dynamically monitor and tune the PCIe traffic, and trace the TLP headers. Add the driver for the device to enable the trace function. This patch adds basic function of

[PATCH v3 2/8] hisi_ptt: Register PMU device for PTT trace

2022-01-24 Thread Yicong Yang via iommu
Register PMU device of PTT trace, then users can use trace through perf command. The driver makes use of perf AUX trace and support following events to configure the trace: - filter: select Root port or Endpoint to trace - type: select the type of traced TLP headers - direction: select the

[PATCH v3 5/8] perf tool: Add support for HiSilicon PCIe Tune and Trace device driver

2022-01-24 Thread Yicong Yang via iommu
From: Qi Liu 'perf record' and 'perf report --dump-raw-trace' supported in this patch. Example usage: Output will contain raw PTT data and its textual representation, such as: 0 0 0x5810 [0x30]: PERF_RECORD_AUXTRACE size: 0x40 offset: 0 ref: 0xa5d50c725 idx: 0 tid: -1 cpu: 0 . . ...

[PATCH v3 3/8] hisi_ptt: Add support for dynamically updating the filter list

2022-01-24 Thread Yicong Yang via iommu
The PCIe devices supported by the PTT trace can be removed/rescanned by hotplug or through sysfs. Add support for dynamically updating the available filter list by registering a PCI bus notifier block. Then user can always get latest information about available tracing filters and driver can

[PATCH v3 4/8] hisi_ptt: Add tune function support for HiSilicon PCIe Tune and Trace device

2022-01-24 Thread Yicong Yang via iommu
Add tune function for the HiSilicon Tune and Trace device. The interface of tune is exposed through sysfs attributes of PTT PMU device. Signed-off-by: Yicong Yang --- drivers/hwtracing/ptt/hisi_ptt.c | 154 +++ drivers/hwtracing/ptt/hisi_ptt.h | 19 2 files

[PATCH v3 7/8] MAINTAINERS: Add maintainer for HiSilicon PTT driver

2022-01-24 Thread Yicong Yang via iommu
Add maintainer for driver and documentation of HiSilicon PTT device. Signed-off-by: Yicong Yang --- MAINTAINERS | 7 +++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index ea3e6c914384..237c618a74d5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8689,6 +8689,13 @@

[PATCH v3 8/8] iommu/arm-smmu-v3: Make default domain type of HiSilicon PTT device to identity

2022-01-24 Thread Yicong Yang via iommu
The DMA of HiSilicon PTT device can only work with identical mapping. So add a quirk for the device to force the domain passthrough. Signed-off-by: Yicong Yang --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 16 1 file changed, 16 insertions(+) diff --git

[PATCH v3 6/8] docs: Add HiSilicon PTT device driver documentation

2022-01-24 Thread Yicong Yang via iommu
Document the introduction and usage of HiSilicon PTT device driver. Signed-off-by: Yicong Yang --- Documentation/trace/hisi-ptt.rst | 304 +++ 1 file changed, 304 insertions(+) create mode 100644 Documentation/trace/hisi-ptt.rst diff --git

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Jean-Philippe Brucker
On Mon, Jan 24, 2022 at 09:58:18AM +, Tian, Kevin wrote: > > From: Lu Baolu > > Sent: Monday, January 24, 2022 3:11 PM > > +/** > > + * struct domain_ops - per-domain ops > > + * @attach_dev: attach an iommu domain to a device > > + * @detach_dev: detach an iommu domain from a device > >

RE: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Tian, Kevin
> From: Lu Baolu > Sent: Monday, January 24, 2022 3:11 PM > +/** > + * struct domain_ops - per-domain ops > + * @attach_dev: attach an iommu domain to a device > + * @detach_dev: detach an iommu domain from a device What is the criteria about whether an op should be iommu_ops or domain_ops when

RE: [PATCH 6/7] iommu: Use right way to retrieve iommu_ops

2022-01-24 Thread Tian, Kevin
> From: Lu Baolu > Sent: Monday, January 24, 2022 3:11 PM > diff --git a/include/linux/iommu.h b/include/linux/iommu.h > index aa5486243892..111b3e9c79bb 100644 > --- a/include/linux/iommu.h > +++ b/include/linux/iommu.h > @@ -385,6 +385,14 @@ static inline void iommu_iotlb_gather_init(struct >

RE: [PATCH 0/7] iommu cleanup and refactoring

2022-01-24 Thread Tian, Kevin
> From: Lu Baolu > Sent: Monday, January 24, 2022 3:11 PM > > Hi, > > The guest pasid and aux-domain related code are dead code in current > iommu subtree. As we have reached a consensus that all these features > should be based on the new iommufd framework (which is under active >

Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Christoph Hellwig
On Mon, Jan 24, 2022 at 03:11:02PM +0800, Lu Baolu wrote: > Add a domain specific callback set, domain_ops, for vendor iommu driver > to provide domain specific operations. Move domain-specific callbacks > from iommu_ops to the domain_ops and hook them when a domain is allocated. Ah, that's what

Re: [PATCH 6/7] iommu: Use right way to retrieve iommu_ops

2022-01-24 Thread Christoph Hellwig
On Mon, Jan 24, 2022 at 03:11:01PM +0800, Lu Baolu wrote: > The common iommu_ops is hooked to both device and domain. When a helper > has both device and domain pointer, the way to get the iommu_ops looks > messy in iommu core. This sorts out the way to get iommu_ops. The device > related helpers

Re: [PATCH 5/7] drm/nouveau/device: Get right pgsize_bitmap of iommu_domain

2022-01-24 Thread Christoph Hellwig
On Mon, Jan 24, 2022 at 03:11:00PM +0800, Lu Baolu wrote: > The supported page sizes of an iommu_domain are saved in the pgsize_bitmap > field. Retrieve the value from the right place. > > Signed-off-by: Lu Baolu > Reviewed-by: Robin Murphy > Link: >

Re: [PATCH 4/7] iommu: Remove aux-domain related interfaces and iommu_ops

2022-01-24 Thread Christoph Hellwig
Looks good, Reviewed-by: Christoph Hellwig ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH 3/7] iommu/vt-d: Remove aux-domain related callbacks

2022-01-24 Thread Christoph Hellwig
Looks good, Reviewed-by: Christoph Hellwig ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH 2/7] iommu: Remove guest pasid related interfaces and definitions

2022-01-24 Thread Christoph Hellwig
Looks good, Reviewed-by: Christoph Hellwig ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH 1/7] iommu/vt-d: Remove guest pasid related callbacks

2022-01-24 Thread Christoph Hellwig
Looks good, Reviewed-by: Christoph Hellwig ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu