Re: [RFC PATCH v1 2/9] pinctrl: devicetree: Delete usage of driver_deferred_probe_check_state()

2022-06-06 Thread Andy Shevchenko
On Sat, Jun 04, 2022 at 08:41:01PM -0700, Saravana Kannan wrote: > On Mon, May 30, 2022 at 2:22 AM Geert Uytterhoeven > wrote: > > On Thu, May 26, 2022 at 10:16 AM Saravana Kannan > > wrote: > > > Now that fw_devlink=on by default and fw_devlink supports > > > "pinctrl-[0-8]" property, the

Re: [PATCH 5/6] scsi: remove stale BusLogic driver

2022-06-06 Thread Maciej W. Rozycki
On Mon, 6 Jun 2022, Arnd Bergmann wrote: > This was in turn fixed in commit 56f396146af2 ("scsi: BusLogic: Fix > 64-bit system enumeration error for Buslogic"), 8 years later. > > The fact that this was found at all is an indication that there are > users, and it seems that Maciej, Matt and

[PATCH v9 4/8] perf tool: arm: Refactor event list iteration in auxtrace_record__init()

2022-06-06 Thread Yicong Yang via iommu
From: Qi Liu Add find_pmu_for_event() and use to simplify logic in auxtrace_record_init(). find_pmu_for_event() will be reused in subsequent patches. Reviewed-by: Jonathan Cameron Signed-off-by: Qi Liu Signed-off-by: Yicong Yang --- tools/perf/arch/arm/util/auxtrace.c | 53

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

2022-06-06 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 v9 8/8] MAINTAINERS: Add maintainer for HiSilicon PTT driver

2022-06-06 Thread Yicong Yang via iommu
Add maintainer for driver and documentation of HiSilicon PTT device. Signed-off-by: Yicong Yang Reviewed-by: Jonathan Cameron --- MAINTAINERS | 7 +++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index a6d3bd9d2a8d..5893fde0cc82 100644 --- a/MAINTAINERS +++

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

2022-06-06 Thread Yicong Yang via iommu
The DMA operations of HiSilicon PTT device can only work properly with identical mappings. So add a quirk for the device to force the domain as passthrough. Acked-by: Will Deacon Signed-off-by: Yicong Yang Reviewed-by: John Garry --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 21

[PATCH v9 7/8] docs: trace: Add HiSilicon PTT device driver documentation

2022-06-06 Thread Yicong Yang via iommu
Document the introduction and usage of HiSilicon PTT device driver. Signed-off-by: Yicong Yang Reviewed-by: Jonathan Cameron --- Documentation/trace/hisi-ptt.rst | 307 +++ Documentation/trace/index.rst| 1 + 2 files changed, 308 insertions(+) create mode

[PATCH v9 6/8] perf tool: Add support for parsing HiSilicon PCIe Trace packet

2022-06-06 Thread Yicong Yang via iommu
From: Qi Liu Add support for using 'perf report --dump-raw-trace' to parse PTT packet. 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 v9 3/8] hwtracing: hisi_ptt: Add tune function support for HiSilicon PCIe Tune and Trace device

2022-06-06 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. Reviewed-by: Jonathan Cameron Reviewed-by: John Garry Signed-off-by: Yicong Yang --- drivers/hwtracing/ptt/hisi_ptt.c | 136 +++

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

2022-06-06 Thread Yicong Yang via iommu
From: Qi Liu HiSilicon PCIe tune and trace device (PTT) could dynamically tune the PCIe link's events, and trace the TLP headers). This patch add support for PTT device in perf tool, so users could use 'perf record' to get TLP headers trace data. Signed-off-by: Qi Liu Signed-off-by: Yicong

[PATCH v9 2/8] hwtracing: hisi_ptt: Add trace function support for HiSilicon PCIe Tune and Trace device

2022-06-06 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. Register PMU device of PTT trace,

Re: [PATCH V2 2/6] iommu: iova: properly handle 0 as a valid IOVA address

2022-06-06 Thread Robin Murphy
On 2022-06-02 16:58, Marek Szyprowski wrote: Hi Robin, On 23.05.2022 19:30, Robin Murphy wrote: On 2022-05-11 13:15, Ajay Kumar wrote: From: Marek Szyprowski Zero is a valid DMA and IOVA address on many architectures, so adjust the IOVA management code to properly handle it. A new value

Re: [GIT PULL] dma-mapping fixes for 5.19

2022-06-06 Thread pr-tracker-bot
The pull request you sent on Mon, 6 Jun 2022 08:38:45 +0200: > git://git.infradead.org/users/hch/dma-mapping.git > tags/dma-mapping-5.19-2022-06-06 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/e71e60cd74df9386c3f684c54888f2367050b831 Thank you! -- Deet-doot-dot,

[PATCH v8 01/11] iommu: Add max_pasids field in struct iommu_device

2022-06-06 Thread Lu Baolu
Use this field to keep the number of supported PASIDs that an IOMMU hardware is able to support. This is a generic attribute of an IOMMU and lifting it into the per-IOMMU device structure makes it possible to allocate a PASID for device without calls into the IOMMU drivers. Any iommu driver which

[PATCH v8 00/11] iommu: SVA and IOPF refactoring

2022-06-06 Thread Lu Baolu
Hi folks, The former part of this series refactors the IOMMU SVA code by assigning an SVA type of iommu_domain to a shared virtual address and replacing sva_bind/unbind iommu ops with set/block_dev_pasid domain ops. The latter part changes the existing I/O page fault handling framework from only

[PATCH v8 02/11] iommu: Add max_pasids field in struct dev_iommu

2022-06-06 Thread Lu Baolu
Use this field to save the number of PASIDs that a device is able to consume. It is a generic attribute of a device and lifting it into the per-device dev_iommu struct could help to avoid the boilerplate code in various IOMMU drivers. Signed-off-by: Lu Baolu --- include/linux/iommu.h | 2 ++

[PATCH v8 03/11] iommu: Remove SVM_FLAG_SUPERVISOR_MODE support

2022-06-06 Thread Lu Baolu
The current kernel DMA with PASID support is based on the SVA with a flag SVM_FLAG_SUPERVISOR_MODE. The IOMMU driver binds the kernel memory address space to a PASID of the device. The device driver programs the device with kernel virtual address (KVA) for DMA access. There have been security and

[PATCH v8 04/11] iommu: Add sva iommu_domain support

2022-06-06 Thread Lu Baolu
The sva iommu_domain represents a hardware pagetable that the IOMMU hardware could use for SVA translation. This adds some infrastructure to support SVA domain in the iommu common layer. It includes: - Extend the iommu_domain to support a new IOMMU_DOMAIN_SVA domain type. The IOMMU drivers that

[PATCH v8 05/11] iommu/vt-d: Add SVA domain support

2022-06-06 Thread Lu Baolu
Add support for SVA domain allocation and provide an SVA-specific iommu_domain_ops. Signed-off-by: Lu Baolu --- include/linux/intel-iommu.h | 5 drivers/iommu/intel/iommu.c | 2 ++ drivers/iommu/intel/svm.c | 49 + 3 files changed, 56 insertions(+)

Re: [PATCH 1/5] iommu: Return -EMEDIUMTYPE for incompatible domain and device/group

2022-06-06 Thread Baolu Lu
On 2022/6/6 14:19, Nicolin Chen wrote: +/** + * iommu_attach_group - Attach an IOMMU group to an IOMMU domain + * @domain: IOMMU domain to attach + * @dev: IOMMU group that will be attached Nit: @group: ... + * + * Returns 0 on success and error code on failure + * + * Specifically,

[PATCH v8 08/11] iommu: Remove SVA related callbacks from iommu ops

2022-06-06 Thread Lu Baolu
These ops'es have been replaced with the dev_attach/detach_pasid domain ops'es. There's no need for them anymore. Remove them to avoid dead code. Signed-off-by: Lu Baolu Reviewed-by: Jean-Philippe Brucker Reviewed-by: Kevin Tian --- include/linux/intel-iommu.h | 3 --

[PATCH v8 09/11] iommu: Prepare IOMMU domain for IOPF

2022-06-06 Thread Lu Baolu
This adds some mechanisms around the iommu_domain so that the I/O page fault handling framework could route a page fault to the domain and call the fault handler from it. Add pointers to the page fault handler and its private data in struct iommu_domain. The fault handler will be called with the

[PATCH v8 07/11] iommu/sva: Refactoring iommu_sva_bind/unbind_device()

2022-06-06 Thread Lu Baolu
The existing iommu SVA interfaces are implemented by calling the SVA specific iommu ops provided by the IOMMU drivers. There's no need for any SVA specific ops in iommu_ops vector anymore as we can achieve this through the generic attach/detach_dev_pasid domain ops. This refactors the IOMMU SVA

[PATCH v8 11/11] iommu: Rename iommu-sva-lib.{c,h}

2022-06-06 Thread Lu Baolu
Rename iommu-sva-lib.c[h] to iommu-sva.c[h] as it contains all code for SVA implementation in iommu core. Signed-off-by: Lu Baolu Reviewed-by: Jean-Philippe Brucker --- drivers/iommu/{iommu-sva-lib.h => iommu-sva.h} | 6 +++--- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 2 +-

[PATCH v8 06/11] arm-smmu-v3/sva: Add SVA domain support

2022-06-06 Thread Lu Baolu
Add support for SVA domain allocation and provide an SVA-specific iommu_domain_ops. Signed-off-by: Lu Baolu Reviewed-by: Jean-Philippe Brucker --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 6 ++ .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 69 +++

[PATCH v8 10/11] iommu: Per-domain I/O page fault handling

2022-06-06 Thread Lu Baolu
Tweak the I/O page fault handling framework to route the page faults to the domain and call the page fault handler retrieved from the domain. This makes the I/O page fault handling framework possible to serve more usage scenarios as long as they have an IOMMU domain and install a page fault

Re: [PATCH 1/5] iommu: Return -EMEDIUMTYPE for incompatible domain and device/group

2022-06-06 Thread Nicolin Chen via iommu
On Tue, Jun 07, 2022 at 11:23:27AM +0800, Baolu Lu wrote: > External email: Use caution opening links or attachments > > > On 2022/6/6 14:19, Nicolin Chen wrote: > > +/** > > + * iommu_attach_group - Attach an IOMMU group to an IOMMU domain > > + * @domain: IOMMU domain to attach > > + * @dev:

[PATCH 0/6] phase out CONFIG_VIRT_TO_BUS

2022-06-06 Thread Arnd Bergmann
From: Arnd Bergmann The virt_to_bus/bus_to_virt interface has been deprecated for decades. After Jakub Kicinski put a lot of work into cleaning out the network drivers using them, there are only a couple of other drivers left, which can all be removed or otherwise cleaned up, to remove the old

[PATCH 1/5] iommu: Return -EMEDIUMTYPE for incompatible domain and device/group

2022-06-06 Thread Nicolin Chen via iommu
Cases like VFIO wish to attach a device to an existing domain that was not allocated specifically from the device. This raises a condition where the IOMMU driver can fail the domain attach because the domain and device are incompatible with each other. This is a soft failure that can be resolved

[PATCH 0/5] Simplify vfio_iommu_type1 attach/detach routine

2022-06-06 Thread Nicolin Chen via iommu
This is a preparatory series for IOMMUFD v2 patches. It enforces error code -EMEDIUMTYPE in iommu_attach_device() and iommu_attach_group() when an IOMMU domain and a device/group are incompatible. It also moves the domain->ops check into __iommu_attach_device(). These allow VFIO iommu code to

[PATCH 2/5] iommu: Ensure device has the same iommu_ops as the domain

2022-06-06 Thread Nicolin Chen via iommu
The core code should not call an iommu driver op with a struct device parameter unless it knows that the dev_iommu_priv_get() for that struct device was setup by the same driver. Otherwise in a mixed driver system the iommu_priv could be casted to the wrong type. Store the iommu_ops pointer in

[PATCH 3/5] vfio/iommu_type1: Prefer to reuse domains vs match enforced cache coherency

2022-06-06 Thread Nicolin Chen via iommu
From: Jason Gunthorpe The KVM mechanism for controlling wbinvd is only triggered during kvm_vfio_group_add(), meaning it is a one-shot test done once the devices are setup. So, there is no value in trying to push a device that could do enforced cache coherency to a dedicated domain vs re-using

[PATCH 4/5] vfio/iommu_type1: Clean up update_dirty_scope in detach_group()

2022-06-06 Thread Nicolin Chen via iommu
All devices in emulated_iommu_groups have pinned_page_dirty_scope set, so the update_dirty_scope in the first list_for_each_entry is always false. Clean it up, and move the "if update_dirty_scope" part from the detach_group_done routine to the domain_list part. Rename the "detach_group_done" goto

[PATCH 5/5] vfio/iommu_type1: Simplify group attachment

2022-06-06 Thread Nicolin Chen via iommu
Un-inline the domain specific logic from the attach/detach_group ops into two paired functions vfio_iommu_alloc_attach_domain() and vfio_iommu_detach_destroy_domain() that strictly deal with creating and destroying struct vfio_domains. Add the logic to check for EMEDIUMTYPE return code of

[GIT PULL] dma-mapping fixes for 5.19

2022-06-06 Thread Christoph Hellwig
[I really wanted to send these before -rc1, but the fact that today is a public holiday here really confused me and messed up my schedule] The following changes since commit 4a37f3dd9a83186cb88d44808ab35b78375082c9: dma-direct: don't over-decrypt memory (2022-05-23 15:25:40 +0200) are

[PATCH 1/6] vme: remove ca91cx42 Universe-II support

2022-06-06 Thread Arnd Bergmann
From: Arnd Bergmann This is one of four remaining drivers using the ancient virt_to_bus() interface instead of the dma-mapping interface, making it incompatible with most modern machines. As nobody has cleaned this up, there is a high chance that this driver has no actual users. The chip was

[PATCH 2/6] vme: move back to staging

2022-06-06 Thread Arnd Bergmann
From: Arnd Bergmann The VME subsystem graduated from staging into a top-level subsystem in 2012, with commit db3b9e990e75 ("Staging: VME: move VME drivers out of staging") stating: The VME device drivers have not moved out yet due to some API questions they are still working through,

[PATCH 3/6] media: sta2x11: remove VIRT_TO_BUS dependency

2022-06-06 Thread Arnd Bergmann
From: Arnd Bergmann This driver does not use the virt_to_bus() function, though it depends on x86 specific fixups in the swiotlb code, which was last rewritten in commit e380a0394c36 ("x86/PCI: sta2x11: use default DMA address translation"). It is possible that the driver still fails to build

[PATCH 4/6] scsi: dpt_i2o: drop stale VIRT_TO_BUS dependency

2022-06-06 Thread Arnd Bergmann
From: Arnd Bergmann The dpt_i2o driver was fixed to stop using virt_to_bus() in 2008 but it a stale reference in a broken error handling code path that could never work. Fix it up to build without VIRT_TO_BUS and remove the Kconfig dependency. The alternative to this would be to just remove

[PATCH 6/6] arch/*/: remove CONFIG_VIRT_TO_BUS

2022-06-06 Thread Arnd Bergmann
From: Arnd Bergmann All architecture-independent users of virt_to_bus() and bus_to_virt() have been fixed to use the dma mapping interfaces or have been removed now. This means the definitions on most architectures, and the CONFIG_VIRT_TO_BUS symbol are now obsolete and can be removed. The

Re: [PATCH 0/6] phase out CONFIG_VIRT_TO_BUS

2022-06-06 Thread Greg Kroah-Hartman
On Mon, Jun 06, 2022 at 10:41:03AM +0200, Arnd Bergmann wrote: > From: Arnd Bergmann > > The virt_to_bus/bus_to_virt interface has been deprecated for > decades. After Jakub Kicinski put a lot of work into cleaning out the > network drivers using them, there are only a couple of other drivers >

[PATCH v3 3/4] scsi: core: Cap shost max_sectors according to DMA optimum mapping limits

2022-06-06 Thread John Garry via iommu
Streaming DMA mappings may be considerably slower when mappings go through an IOMMU and the total mapping length is somewhat long. This is because the IOMMU IOVA code allocates and free an IOVA for each mapping, which may affect performance. For performance reasons set the request_queue

[PATCH v3 4/4] libata-scsi: Cap ata_device->max_sectors according to shost->max_sectors

2022-06-06 Thread John Garry via iommu
ATA devices (struct ata_device) have a max_sectors field which is configured internally in libata. This is then used to (re)configure the associated sdev request queue max_sectors value from how it is earlier set in __scsi_init_queue(). In __scsi_init_queue() the max_sectors value is set according

[PATCH v3 1/4] dma-mapping: Add dma_opt_mapping_size()

2022-06-06 Thread John Garry via iommu
Streaming DMA mapping involving an IOMMU may be much slower for larger total mapping size. This is because every IOMMU DMA mapping requires an IOVA to be allocated and freed. IOVA sizes above a certain limit are not cached, which can have a big impact on DMA mapping performance. Provide an API

[PATCH v3 0/4] DMA mapping changes for SCSI core

2022-06-06 Thread John Garry via iommu
As reported in [0], DMA mappings whose size exceeds the IOMMU IOVA caching limit may see a big performance hit. This series introduces a new DMA mapping API, dma_opt_mapping_size(), so that drivers may know this limit when performance is a factor in the mapping. Robin didn't like using

[PATCH v3 2/4] dma-iommu: Add iommu_dma_opt_mapping_size()

2022-06-06 Thread John Garry via iommu
Add the IOMMU callback for DMA mapping API dma_opt_mapping_size(), which allows the drivers to know the optimal mapping limit and thus limit the requested IOVA lengths. This value is based on the IOVA rcache range limit, as IOVAs allocated above this limit must always be newly allocated, which

Re: [PATCH 5/6] scsi: remove stale BusLogic driver

2022-06-06 Thread Arnd Bergmann
On Mon, Jun 6, 2022 at 12:40 PM Maciej W. Rozycki wrote: > > On Mon, 6 Jun 2022, Arnd Bergmann wrote: > > > This was in turn fixed in commit 56f396146af2 ("scsi: BusLogic: Fix > > 64-bit system enumeration error for Buslogic"), 8 years later. > > > > The fact that this was found at all is an

Re: [PATCH 2/5] iommu: Ensure device has the same iommu_ops as the domain

2022-06-06 Thread Robin Murphy
On 2022-06-06 07:19, Nicolin Chen wrote: The core code should not call an iommu driver op with a struct device parameter unless it knows that the dev_iommu_priv_get() for that struct device was setup by the same driver. Otherwise in a mixed driver system the iommu_priv could be casted to the

Re: [PATCH 0/6] phase out CONFIG_VIRT_TO_BUS

2022-06-06 Thread Arnd Bergmann
On Mon, Jun 6, 2022 at 11:25 AM Greg Kroah-Hartman wrote: > > I'll take patches 1 and 2 right now through my staging tree if that's > ok. Yes, that's perfect, as there are no actual interdependencies with the other drivers -- applying the last patch first would just hide the driver I'm removing

Re: [PATCH 5/6] scsi: remove stale BusLogic driver

2022-06-06 Thread Khalid Aziz
On 6/6/22 02:41, Arnd Bergmann wrote: From: Arnd Bergmann The BusLogic driver is the last remaining driver that relies on the deprecated bus_to_virt() function, which in turn only works on a few architectures, and is incompatible with both swiotlb and iommu support. Before commit 391e2f25601e

Re: [PATCH 2/5] iommu: Ensure device has the same iommu_ops as the domain

2022-06-06 Thread Nicolin Chen via iommu
Hi Robin, On Mon, Jun 06, 2022 at 03:33:42PM +0100, Robin Murphy wrote: > On 2022-06-06 07:19, Nicolin Chen wrote: > > The core code should not call an iommu driver op with a struct device > > parameter unless it knows that the dev_iommu_priv_get() for that struct > > device was setup by the same

Re: [PATCH 2/5] iommu: Ensure device has the same iommu_ops as the domain

2022-06-06 Thread Robin Murphy
On 2022-06-06 17:51, Nicolin Chen wrote: Hi Robin, On Mon, Jun 06, 2022 at 03:33:42PM +0100, Robin Murphy wrote: On 2022-06-06 07:19, Nicolin Chen wrote: The core code should not call an iommu driver op with a struct device parameter unless it knows that the dev_iommu_priv_get() for that

Re: [PATCH 2/5] iommu: Ensure device has the same iommu_ops as the domain

2022-06-06 Thread Nicolin Chen via iommu
On Mon, Jun 06, 2022 at 06:50:33PM +0100, Robin Murphy wrote: > External email: Use caution opening links or attachments > > > On 2022-06-06 17:51, Nicolin Chen wrote: > > Hi Robin, > > > > On Mon, Jun 06, 2022 at 03:33:42PM +0100, Robin Murphy wrote: > > > On 2022-06-06 07:19, Nicolin Chen

Re: [PATCH 2/5] iommu: Ensure device has the same iommu_ops as the domain

2022-06-06 Thread Jason Gunthorpe via iommu
On Mon, Jun 06, 2022 at 11:28:49AM -0700, Nicolin Chen wrote: > > Well, as before I'd prefer to make the code match the commit message - > > if I really need to spell it out, see below - since I can't imagine that > > we should ever have need to identify a set of iommu_domain_ops in > >