Re: [PATCH v7 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-07-05 Thread Christoph Hellwig
On Tue, Jul 05, 2022 at 12:16:45PM -0600, Logan Gunthorpe wrote: > The current version does it through a char device, but that requires > creating a simple_fs and anon_inode for teardown on driver removal, plus > a bunch of hooks through the driver that exposes it (NVMe, in this case) > to set this

Re: [PATCH v1 03/16] dt-bindings: power: mediatek: Refine multiple level power domain nodes

2022-07-05 Thread Tinghan Shen via iommu
On Tue, 2022-07-05 at 14:57 -0600, Rob Herring wrote: > On Mon, Jul 04, 2022 at 06:00:15PM +0800, Tinghan Shen wrote: > > Extract duplicated properties and support more levels of power > > domain nodes. > > > > This change fix following error when do dtbs_check, > > arch/arm64/boot/dts/mediate

Re: [PATCH v1 01/16] dt-bindings: iommu: mediatek: Increase max interrupt number

2022-07-05 Thread Tinghan Shen via iommu
On Tue, 2022-07-05 at 14:49 -0600, Rob Herring wrote: > On Mon, Jul 04, 2022 at 06:00:13PM +0800, Tinghan Shen wrote: > > mt8195 infra iommu has max 5 interrupts. > > > > Signed-off-by: Tinghan Shen > > --- > > .../devicetree/bindings/iommu/mediatek,iommu.yaml| 12 +++- > > 1 file ch

Re: [PATCH v1 16/16] arm64: dts: mt8195: Add display node for vdosys0

2022-07-05 Thread Tinghan Shen via iommu
On Mon, 2022-07-04 at 14:39 +0200, Krzysztof Kozlowski wrote: > On 04/07/2022 12:00, Tinghan Shen wrote: > > From: "Jason-JH.Lin" > > > > Add display node for vdosys0 of mt8195. > > > > Signed-off-by: Jason-JH.Lin > > Signed-off-by: Tinghan Shen > > --- > > arch/arm64/boot/dts/mediatek/mt8195

Re: [PATCH v1 02/16] dt-bindings: memory: mediatek: Update condition for mt8195 smi node

2022-07-05 Thread Tinghan Shen via iommu
On Mon, 2022-07-04 at 14:36 +0200, Krzysztof Kozlowski wrote: > On 04/07/2022 12:00, Tinghan Shen wrote: > > The max clock items for the dts node with compatible > > 'mediatek,mt8195-smi-sub-common' should be 3. > > > > However, the dtbs_check of such node will get following message, > > arch/arm6

Re: [PATCH v1 16/16] arm64: dts: mt8195: Add display node for vdosys0

2022-07-05 Thread Tinghan Shen via iommu
On Mon, 2022-07-04 at 12:44 +0200, AngeloGioacchino Del Regno wrote: > Il 04/07/22 12:00, Tinghan Shen ha scritto: > > From: "Jason-JH.Lin" > > > > Add display node for vdosys0 of mt8195. > > > > Signed-off-by: Jason-JH.Lin > > Signed-off-by: Tinghan Shen > > --- > > arch/arm64/boot/dts/medi

Re: [PATCH v1 04/16] arm64: dts: mt8195: Disable watchdog external reset signal

2022-07-05 Thread Tinghan Shen via iommu
On Mon, 2022-07-04 at 12:30 +0200, AngeloGioacchino Del Regno wrote: > Il 04/07/22 12:00, Tinghan Shen ha scritto: > > Disable external output reset signal in first round of watchdog reset > > to reserve wdt reset reason for debugging watchdog issue. > > If my understanding of the commit decriptio

Re: [PATCH v1 02/16] dt-bindings: memory: mediatek: Update condition for mt8195 smi node

2022-07-05 Thread Tinghan Shen via iommu
On Mon, 2022-07-04 at 12:25 +0200, AngeloGioacchino Del Regno wrote: > Il 04/07/22 12:00, Tinghan Shen ha scritto: > > The max clock items for the dts node with compatible > > 'mediatek,mt8195-smi-sub-common' should be 3. > > > > However, the dtbs_check of such node will get following message, > >

[PATCH v4 11/11] iommu/vt-d: Convert global spinlock into per domain lock

2022-07-05 Thread Lu Baolu
Using a global device_domain_lock spinlock to protect per-domain device tracking lists is an inefficient way, especially considering this lock is also needed in the hot paths. This optimizes the locking mechanism by converting the global lock to per domain lock. On the other hand, as the device tr

[PATCH v4 10/11] iommu/vt-d: Use device_domain_lock accurately

2022-07-05 Thread Lu Baolu
The device_domain_lock is used to protect the device tracking list of a domain. Remove unnecessary spin_lock/unlock()'s and move the necessary ones around the list access. Signed-off-by: Lu Baolu Reviewed-by: Kevin Tian --- drivers/iommu/intel/iommu.c | 57 +

[PATCH v4 09/11] iommu/vt-d: Fold __dmar_remove_one_dev_info() into its caller

2022-07-05 Thread Lu Baolu
Fold __dmar_remove_one_dev_info() into dmar_remove_one_dev_info() which is its only caller. Make the spin lock critical range only cover the device list change code and remove some unnecessary checks. Signed-off-by: Lu Baolu Reviewed-by: Kevin Tian --- drivers/iommu/intel/iommu.c | 31 +++--

[PATCH v4 07/11] iommu/vt-d: Acquiring lock in pasid manipulation helpers

2022-07-05 Thread Lu Baolu
The iommu->lock is used to protect the per-IOMMU pasid directory table and pasid table. Move the spinlock acquisition/release into the helpers to make the code self-contained. Signed-off-by: Lu Baolu Reviewed-by: Kevin Tian --- drivers/iommu/intel/iommu.c | 2 - drivers/iommu/intel/pasid.c |

[PATCH v4 08/11] iommu/vt-d: Check device list of domain in domain free path

2022-07-05 Thread Lu Baolu
When the IOMMU domain is about to be freed, it should not be set on any device. Instead of silently dealing with some bug cases, it's better to trigger a warning to report and fix any potential bugs at the first time. Signed-off-by: Lu Baolu Reviewed-by: Jason Gunthorpe Reviewed-by: Kevin Tian

[PATCH v4 06/11] iommu/vt-d: Acquiring lock in domain ID allocation helpers

2022-07-05 Thread Lu Baolu
The iommu->lock is used to protect the per-IOMMU domain ID resource. Moving the lock into the ID alloc/free helpers makes the code more compact. At the same time, the device_domain_lock is irrelevant to the domain ID resource, remove its assertion as well. Signed-off-by: Lu Baolu Reviewed-by: Kev

[PATCH v4 05/11] iommu/vt-d: Replace spin_lock_irqsave() with spin_lock()

2022-07-05 Thread Lu Baolu
The iommu->lock is used to protect changes in root/context/pasid tables and domain ID allocation. There's no use case to change these resources in any interrupt context. Therefore, it is unnecessary to disable the interrupts when the spinlock is held. The same thing happens on the device_domain_loc

[PATCH v4 04/11] iommu/vt-d: Unnecessary spinlock for root table alloc and free

2022-07-05 Thread Lu Baolu
The IOMMU root table is allocated and freed in the IOMMU initialization code in static boot or hot-remove paths. There's no need for a spinlock. Signed-off-by: Lu Baolu Reviewed-by: Kevin Tian --- drivers/iommu/intel/iommu.c | 18 +- 1 file changed, 5 insertions(+), 13 deletions

[PATCH v4 02/11] iommu/vt-d: Remove clearing translation data in disable_dmar_iommu()

2022-07-05 Thread Lu Baolu
The disable_dmar_iommu() is called when IOMMU initialization fails or the IOMMU is hot-removed from the system. In both cases, there is no need to clear the IOMMU translation data structures for devices. On the initialization path, the device probing only happens after the IOMMU is initialized suc

[PATCH v4 03/11] iommu/vt-d: Use pci_get_domain_bus_and_slot() in pgtable_walk()

2022-07-05 Thread Lu Baolu
Use pci_get_domain_bus_and_slot() instead of searching the global list to retrieve the pci device pointer. This also removes the global device_domain_list as there isn't any consumer anymore. Signed-off-by: Lu Baolu Reviewed-by: Jason Gunthorpe Reviewed-by: Kevin Tian --- drivers/iommu/intel/i

[PATCH v4 00/11] iommu/vt-d: Optimize the use of locks

2022-07-05 Thread Lu Baolu
Hi folks, This series tries to optimize the uses of two locks in the Intel IOMMU driver: - The intel_iommu::lock is used to protect the IOMMU resources shared by devices. They include the IOMMU root and context tables, the pasid tables and the domain IDs. - The global device_domain_lock is us

[PATCH v4 01/11] iommu/vt-d: debugfs: Remove device_domain_lock usage

2022-07-05 Thread Lu Baolu
The domain_translation_struct debugfs node is used to dump the DMAR page tables for the PCI devices. It potentially races with setting domains to devices. The existing code uses the global spinlock device_domain_lock to avoid the races. This removes the use of device_domain_lock outside of iommu.c

[linux-next:master] BUILD REGRESSION 2a2aa3f05338270aecbe2492fda910d6c17e0102

2022-07-05 Thread kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master branch HEAD: 2a2aa3f05338270aecbe2492fda910d6c17e0102 Add linux-next specific files for 20220705 Error/Warning reports: https://lore.kernel.org/linux-doc/202207051821.3f0erisl-...@intel.com Error/Warning

Re: [PATCH v1 03/16] dt-bindings: power: mediatek: Refine multiple level power domain nodes

2022-07-05 Thread Rob Herring
On Mon, Jul 04, 2022 at 06:00:15PM +0800, Tinghan Shen wrote: > Extract duplicated properties and support more levels of power > domain nodes. > > This change fix following error when do dtbs_check, > arch/arm64/boot/dts/mediatek/mt8195-evb.dtb: power-controller: > power-domain@15:power-domai

Re: [PATCH v1 01/16] dt-bindings: iommu: mediatek: Increase max interrupt number

2022-07-05 Thread Rob Herring
On Mon, Jul 04, 2022 at 06:00:13PM +0800, Tinghan Shen wrote: > mt8195 infra iommu has max 5 interrupts. > > Signed-off-by: Tinghan Shen > --- > .../devicetree/bindings/iommu/mediatek,iommu.yaml| 12 +++- > 1 file changed, 11 insertions(+), 1 deletion(-) > > diff --git a/Documentati

Re: [PATCH v7] dt-bindings: reserved-memory: Document iommu-addresses

2022-07-05 Thread Rob Herring
On Tue, 05 Jul 2022 15:06:52 +0200, Thierry Reding wrote: > From: Thierry Reding > > This adds the "iommu-addresses" property to reserved-memory nodes, which > allow describing the interaction of memory regions with IOMMUs. Two use- > cases are supported: > > 1. Static mappings can be describe

Re: [PATCH v2] ACPI: VIOT: Fix ACS setup

2022-07-05 Thread Rafael J. Wysocki
On Thu, Jun 30, 2022 at 11:59 AM Jean-Philippe Brucker wrote: > > On Thu, Jun 30, 2022 at 11:40:59AM +0200, Eric Auger wrote: > > Currently acpi_viot_init() gets called after the pci > > device has been scanned and pci_enable_acs() has been called. > > So pci_request_acs() fails to be taken into a

Re: [PATCH v7 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-07-05 Thread Logan Gunthorpe
On 2022-07-05 11:42, Greg Kroah-Hartman wrote: > On Tue, Jul 05, 2022 at 11:32:23AM -0600, Logan Gunthorpe wrote: >> >> >> On 2022-07-05 11:21, Greg Kroah-Hartman wrote: >>> On Tue, Jul 05, 2022 at 06:50:39PM +0200, Christoph Hellwig wrote: [note for the newcomers, this is about allowing mm

Re: [PATCH v7 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-07-05 Thread Greg Kroah-Hartman
On Tue, Jul 05, 2022 at 11:32:23AM -0600, Logan Gunthorpe wrote: > > > On 2022-07-05 11:21, Greg Kroah-Hartman wrote: > > On Tue, Jul 05, 2022 at 06:50:39PM +0200, Christoph Hellwig wrote: > >> [note for the newcomers, this is about allowing mmap()ing the PCIe > >> P2P memory from the generic PCI

Re: [PATCH v7 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-07-05 Thread Logan Gunthorpe
On 2022-07-05 11:21, Greg Kroah-Hartman wrote: > On Tue, Jul 05, 2022 at 06:50:39PM +0200, Christoph Hellwig wrote: >> [note for the newcomers, this is about allowing mmap()ing the PCIe >> P2P memory from the generic PCI P2P code through sysfs, and more >> importantly how to revoke it on device

Re: [PATCH v7 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-07-05 Thread Greg Kroah-Hartman
On Tue, Jul 05, 2022 at 06:50:39PM +0200, Christoph Hellwig wrote: > [note for the newcomers, this is about allowing mmap()ing the PCIe > P2P memory from the generic PCI P2P code through sysfs, and more > importantly how to revoke it on device removal] We allow mmap on PCIe config space today, rig

Re: [PATCH v7 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-07-05 Thread Christoph Hellwig
[note for the newcomers, this is about allowing mmap()ing the PCIe P2P memory from the generic PCI P2P code through sysfs, and more importantly how to revoke it on device removal] On Tue, Jul 05, 2022 at 10:44:49AM -0600, Logan Gunthorpe wrote: > We might be able to. I'm not sure. I'll have to fig

Re: [PATCH v7 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-07-05 Thread Logan Gunthorpe
On 2022-07-05 10:43, Christoph Hellwig wrote: > On Tue, Jul 05, 2022 at 10:41:52AM -0600, Logan Gunthorpe wrote: >> Using sysfs means we don't need all the messy callbacks from the nvme >> driver, which is a plus. But I'm not sure how we'd get or unmap the >> mapping of a sysfs file or avoid the

Re: [PATCH v7 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-07-05 Thread Christoph Hellwig
On Tue, Jul 05, 2022 at 10:41:52AM -0600, Logan Gunthorpe wrote: > Using sysfs means we don't need all the messy callbacks from the nvme > driver, which is a plus. But I'm not sure how we'd get or unmap the > mapping of a sysfs file or avoid the anonymous inode. Seems with the > existing PCI resour

Re: [PATCH v7 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-07-05 Thread Logan Gunthorpe
On 2022-07-05 10:12, Christoph Hellwig wrote: > On Tue, Jul 05, 2022 at 10:51:02AM -0300, Jason Gunthorpe wrote: >>> In fact I'm not even sure this should be a character device, it seems >>> to fit it way better with the PCI sysfs hierchacy, just like how we >>> map MMIO resources, which these a

Re: [PATCH v7 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-07-05 Thread Christoph Hellwig
On Tue, Jul 05, 2022 at 01:29:59PM -0300, Jason Gunthorpe wrote: > > Making the entire area given by the device to the p2p allocator available > > to user space seems sensible to me. That is what the current series does, > > and what a sysfs interface would do as well. > > That makes openning the

Re: [PATCH v7 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-07-05 Thread Jason Gunthorpe
On Tue, Jul 05, 2022 at 06:12:40PM +0200, Christoph Hellwig wrote: > On Tue, Jul 05, 2022 at 10:51:02AM -0300, Jason Gunthorpe wrote: > > > In fact I'm not even sure this should be a character device, it seems > > > to fit it way better with the PCI sysfs hierchacy, just like how we > > > map MMIO

Re: [PATCH v7 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-07-05 Thread Christoph Hellwig
On Tue, Jul 05, 2022 at 10:51:02AM -0300, Jason Gunthorpe wrote: > > In fact I'm not even sure this should be a character device, it seems > > to fit it way better with the PCI sysfs hierchacy, just like how we > > map MMIO resources, which these are anyway. And once it is on sysfs > > we do have

Re: [PATCH v3 1/8] irqchip/mips-gic: Only register IPI domain when SMP is enabled

2022-07-05 Thread Serge Semin
Hi Samuel On Fri, Jul 01, 2022 at 03:00:49PM -0500, Samuel Holland wrote: > The MIPS GIC irqchip driver may be selected in a uniprocessor > configuration, but it unconditionally registers an IPI domain. > > Limit the part of the driver dealing with IPIs to only be compiled when > GENERIC_IRQ_IPI

Re: [PATCH v7 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-07-05 Thread Jason Gunthorpe
On Tue, Jul 05, 2022 at 09:51:08AM +0200, Christoph Hellwig wrote: > But what also really matters here: I don't want every user that > wants to be able to mmap a character device to do all this work. > The layering is simply wrong, it needs some character device > based helpers, not be open code

[PATCH v7] dt-bindings: reserved-memory: Document iommu-addresses

2022-07-05 Thread Thierry Reding
From: Thierry Reding This adds the "iommu-addresses" property to reserved-memory nodes, which allow describing the interaction of memory regions with IOMMUs. Two use- cases are supported: 1. Static mappings can be described by pairing the "iommu-addresses" property with a "reg" property.

[PATCH v6 5/5] iommu/tegra-smmu: Support managed domains

2022-07-05 Thread Thierry Reding
From: Navneet Kumar Allow creating identity and DMA API compatible IOMMU domains. When creating a DMA API compatible domain, make sure to also create the required cookie. Signed-off-by: Navneet Kumar Signed-off-by: Thierry Reding --- Changes in v5: - remove DMA cookie initialization that's now

[PATCH v6 4/5] iommu/tegra-smmu: Add support for reserved regions

2022-07-05 Thread Thierry Reding
From: Thierry Reding The Tegra DRM driver currently uses the IOMMU API explicitly. This means that it has fine-grained control over when exactly the translation through the IOMMU is enabled. This currently happens after the driver probes, so the driver is in a DMA quiesced state when the IOMMU tr

[PATCH v6 2/5] iommu: Implement of_iommu_get_resv_regions()

2022-07-05 Thread Thierry Reding
From: Thierry Reding This is an implementation that IOMMU drivers can use to obtain reserved memory regions from a device tree node. It uses the reserved-memory DT bindings to find the regions associated with a given device. If these regions are marked accordingly, identity mappings will be creat

[PATCH v6 3/5] iommu: dma: Use of_iommu_get_resv_regions()

2022-07-05 Thread Thierry Reding
From: Thierry Reding For device tree nodes, use the standard of_iommu_get_resv_regions() implementation to obtain the reserved memory regions associated with a device. Cc: Rob Herring Cc: Frank Rowand Cc: devicet...@vger.kernel.org Signed-off-by: Thierry Reding --- drivers/iommu/dma-iommu.c

[PATCH v6 1/5] dt-bindings: reserved-memory: Document iommu-addresses

2022-07-05 Thread Thierry Reding
From: Thierry Reding This adds the "iommu-addresses" property to reserved-memory nodes, which allow describing the interaction of memory regions with IOMMUs. Two use- cases are supported: 1. Static mappings can be described by pairing the "iommu-addresses" property with a "reg" property.

[PATCH v6 0/5] iommu: Support mappings/reservations in reserved-memory regions

2022-07-05 Thread Thierry Reding
From: Thierry Reding Hi, This version has several fixes over the previous v5, which can be found here: https://lore.kernel.org/all/20220512190052.1152377-1-thierry.red...@gmail.com/ An example is included in the DT bindings, but here is an extract of what I've used to test this: res

Re: [PATCH kernel] powerpc/iommu: Add simple iommu_ops to report capabilities

2022-07-05 Thread Jason Gunthorpe via iommu
On Tue, Jul 05, 2022 at 04:22:35PM +1000, Alexey Kardashevskiy wrote: > I have not looked into the domains for ages, what is missing here? With this > on top of 5.19-rc1 VFIO works again on my POWER9 box. Thanks, Does this solve all the problems or just coherency? It seems like it should solve ev

Re: [PATCH kernel] powerpc/iommu: Add simple iommu_ops to report capabilities

2022-07-05 Thread Robin Murphy
On 2022-07-05 07:22, Alexey Kardashevskiy wrote: Historically PPC64 managed to avoid using iommu_ops. The VFIO driver uses a SPAPR TCE sub-driver and all iommu_ops uses were kept in the Type1 VFIO driver. Recent development though has added a coherency capability check to the generic part of VFIO

Re: [PATCH v2 3/9] net: mdio: Delete usage of driver_deferred_probe_check_state()

2022-07-05 Thread Geert Uytterhoeven
Hi Saravana, On Wed, Jun 1, 2022 at 2:44 PM Saravana Kannan wrote: > Now that fw_devlink=on by default and fw_devlink supports interrupt > properties, the execution will never get to the point where > driver_deferred_probe_check_state() is called before the supplier has > probed successfully or b

Re: [PATCH v2 03/14] iommu: Move bus setup to IOMMU device registration

2022-07-05 Thread Robin Murphy
On 2022-07-05 05:51, Baolu Lu wrote: Hi Robin, On 2022/4/30 02:06, Robin Murphy wrote: On 29/04/2022 9:50 am, Robin Murphy wrote: On 2022-04-29 07:57, Baolu Lu wrote: Hi Robin, On 2022/4/28 21:18, Robin Murphy wrote: Move the bus setup to iommu_device_register(). This should allow bus_iommu

Re: [PATCH v2 1/9] PM: domains: Delete usage of driver_deferred_probe_check_state()

2022-07-05 Thread Saravana Kannan via iommu
On Fri, Jul 1, 2022 at 12:13 PM Saravana Kannan wrote: > > On Fri, Jul 1, 2022 at 8:08 AM Sudeep Holla wrote: > > > > Hi, Saravana, > > > > On Fri, Jul 01, 2022 at 01:26:12AM -0700, Saravana Kannan wrote: > > > > [...] > > > > > Can you check if this hack helps? If so, then I can think about > >

Re: [PATCH v7 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-07-05 Thread Christoph Hellwig
On Wed, Jun 29, 2022 at 02:59:06PM -0300, Jason Gunthorpe wrote: > I've tried in the past, this is not a good idea. There is no way to > handle failures when a VMA is dup'd and if you rely on private_data > you almost certainly have to alloc here. > > Then there is the issue of making the locking