[PATCH v2 00/14] iommu: Retire bus_set_iommu()

2022-04-28 Thread Robin Murphy
based on the AMD IOMMU patch now applied, plus v2 of my device_iommu_capable() series here: https://lore.kernel.org/linux-iommu/cover.1650878781.git.robin.mur...@arm.com/ Cheers, Robin. Robin Murphy (14): iommu/vt-d: Temporarily reject probing non-PCI devices iommu: Always register bus

Re: [PATCH 5/5] iommu/sun50i: Ensure the IOMMU can be used for DMA

2022-04-28 Thread Robin Murphy
On 2022-04-28 02:04, Samuel Holland wrote: So far, the driver has relied on arch/arm64/Kconfig to select IOMMU_DMA. Unsurprisingly, this does not work on RISC-V, so the driver must select IOMMU_DMA itself. No, IOMMU_DMA should only be selected by the architecture code that's also responsible f

Re: [PATCH 01/11] dt-bindings: iommu: arm,smmu-v3: make PRI IRQ optional

2022-04-28 Thread Robin Murphy
On 2022-04-28 07:56, Krzysztof Kozlowski wrote: On 27/04/2022 13:25, Andre Przywara wrote: The Page Request Interface (PRI) is an optional PCIe feature. As such, a SMMU would not need to handle it if the PCIe host bridge or the SMMU itself do not implement it. Also an SMMU could be connected to

Re: [PATCH 01/11] dt-bindings: iommu: arm,smmu-v3: make PRI IRQ optional

2022-04-27 Thread Robin Murphy
therwise AFAICS the last item should stay as "- const: cmdq-sync" to preserve the existing canonical order for the 4-item case. Otherwise, Reviewed-by: Robin Murphy Cheers, Robin. '#iommu-cells': const: 1 ___ iommu m

Re: [PATCH v6 1/2] PCI/ACPI: Support Microsoft's "DmaProperty"

2022-04-26 Thread Robin Murphy
On 2022-04-26 01:06, Rajat Jain via iommu wrote: The "DmaProperty" is supported and currently documented and used by Microsoft [link 1 below], to flag internal PCIe root ports that need DMA protection [link 2 below]. We have discussed with them and reached a common understanding that they shall c

[PATCH v4 3/4] thunderbolt: Make iommu_dma_protection more accurate

2022-04-25 Thread Robin Murphy
er that implies that firmware is playing the game overall, so we'll use that to assume that all Thunderbolt ports should be correctly marked and thus will end up fully protected. CC: Mario Limonciello Reviewed-by: Christoph Hellwig Acked-by: Mika Westerberg Signed-off-by: Robin Murphy ---

[PATCH v4 4/4] iommu/amd: Indicate whether DMA remap support is enabled

2022-04-25 Thread Robin Murphy
-by: Christoph Hellwig Signed-off-by: Mario Limonciello Signed-off-by: Robin Murphy --- v4: No change drivers/iommu/amd/amd_iommu_types.h | 4 drivers/iommu/amd/init.c| 3 +++ drivers/iommu/amd/iommu.c | 2 ++ 3 files changed, 9 insertions(+) diff --git a/drivers

[PATCH v4 2/4] iommu: Add capability for pre-boot DMA protection

2022-04-25 Thread Robin Murphy
protection Suggested-by: Christoph Hellwig Reviewed-by: Christoph Hellwig Reviewed-by: Lu Baolu Signed-off-by: Robin Murphy --- v4: No change drivers/iommu/intel/iommu.c | 2 ++ include/linux/iommu.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/iommu/intel/iommu.c

[PATCH v4 1/4] iommu: Introduce device_iommu_capable()

2022-04-25 Thread Robin Murphy
external users have been converted and we can reliably pass the device pointer through the internal driver interface too. Signed-off-by: Robin Murphy --- v4: Hold off changing the internal callback interface for now drivers/iommu/iommu.c | 23 +++ include/linux/iommu.h | 6

[PATCH v4 0/4] iommu, thunderbolt: Make iommu_dma_protection more accurate

2022-04-25 Thread Robin Murphy
DMA remap support is enabled Robin Murphy (3): iommu: Introduce device_iommu_capable() iommu: Add capability for pre-boot DMA protection thunderbolt: Make iommu_dma_protection more accurate drivers/iommu/amd/amd_iommu_types.h | 4 +++ drivers/iommu/amd/init.c| 3 ++ drivers

Re: [PATCH v2] iommu/mediatek: fix NULL pointer dereference when printing dev_name

2022-04-25 Thread Robin Murphy
On 2022-04-25 09:24, Miles Chen via iommu wrote: When larbdev is NULL (in the case I hit, the node is incorrectly set iommus = <&iommu NUM>), it will cause device_link_add() fail and kernel crashes when we try to print dev_name(larbdev). Fix it by adding a NULL pointer check before device_link_a

Re: [PATCH 02/13] iommu: Move bus setup to IOMMU device registration

2022-04-23 Thread Robin Murphy
On 2022-04-23 09:01, Lu Baolu wrote: Hi Robin, On 2022/4/19 15:20, Robin Murphy wrote: On 2022-04-19 00:37, Lu Baolu wrote: On 2022/4/19 6:09, Robin Murphy wrote: On 2022-04-16 01:04, Lu Baolu wrote: On 2022/4/14 20:42, Robin Murphy wrote: @@ -1883,27 +1900,12 @@ static int iommu_bus_init

Re: [PATCH] Documentation: x86: rework IOMMU documentation

2022-04-22 Thread Robin Murphy
On 2022-04-22 21:06, Alex Deucher wrote: Add preliminary documentation for AMD IOMMU and combine with the existing Intel IOMMU documentation and clean up and modernize some of the existing documentation to align with the current state of the kernel. FWIW, Reviewed-by: Robin Murphy Signed

Re: [PATCH v4] Documentation: x86: rework IOMMU documentation

2022-04-22 Thread Robin Murphy
On 2022-04-22 18:54, Alex Deucher wrote: [...] +Intel Specific Notes + + +Graphics Problems? +^^ + +If you encounter issues with graphics devices, you can try adding +option intel_iommu=igfx_off to turn off the integrated graphics engine. +If this fixes anythin

Re: [PATCH 02/13] iommu: Move bus setup to IOMMU device registration

2022-04-22 Thread Robin Murphy
On 2022-04-22 19:37, Krishna Reddy wrote: Good effort to isolate bus config from smmu drivers. Reviewed-By: Krishna Reddy Thanks! I have an orthogonal question here. Can the following code handle the case, where different buses have different type of SMMU instances(like one bus has SMMUv2 a

[PATCH] iommu: Use dev_iommu_ops() for probe_finalize

2022-04-22 Thread Robin Murphy
The ->probe_finalize hook only runs after ->probe_device succeeds, so we can move that over to the new dev_iommu_ops() as well. Signed-off-by: Robin Murphy --- Another cheeky little one which doesn't need to wait... drivers/iommu/iommu.c | 3 ++- 1 file changed, 2 insertions(+),

Re: [PATCH 03/25] dma-direct: take dma-ranges/offsets into account in resource mapping

2022-04-21 Thread Robin Murphy
On 2022-04-21 18:35, Serge Semin wrote: On Thu, Apr 21, 2022 at 04:45:36PM +0200, Christoph Hellwig wrote: On Wed, Apr 20, 2022 at 11:55:38AM +0300, Serge Semin wrote: On Wed, Apr 20, 2022 at 10:47:46AM +0200, Christoph Hellwig wrote: I can't really comment on the dma-ranges exlcusion for P2P

Re: [PATCH 12/13] iommu/virtio: Clean up bus_set_iommu()

2022-04-21 Thread Robin Murphy
On 2022-04-21 18:12, Jean-Philippe Brucker wrote: On Thu, Apr 14, 2022 at 01:42:41PM +0100, Robin Murphy wrote: Stop calling bus_set_iommu() since it's now unnecessary, and simplify the probe failure path accordingly. Signed-off-by: Robin Murphy --- drivers/iommu/virtio-iommu.c

Re: [PATCH v10 0/9] ACPI/IORT: Support for IORT RMR node

2022-04-21 Thread Robin Murphy
On 2022-04-21 15:43, Shameerali Kolothum Thodi wrote: -Original Message- From: Steven Price [mailto:steven.pr...@arm.com] Sent: 21 April 2022 13:59 To: Shameerali Kolothum Thodi ; linux-arm-ker...@lists.infradead.org; linux-a...@vger.kernel.org; iommu@lists.linux-foundation.org Cc: Lin

Re: [PATCH 0/3] More ARM DMA ops cleanup

2022-04-21 Thread Robin Murphy
On 2022-04-21 15:13, Christoph Hellwig wrote: On Thu, Apr 21, 2022 at 12:36:56PM +0100, Robin Murphy wrote: Hi all, Thanks to Christoph's latest series, I'm reminded that, if we're going to give the ARM DMA ops some cleanup this cycle, it's as good a time as any to dust o

Re: [Patch v2] iommu: arm-smmu: disable large page mappings for Nvidia arm-smmu

2022-04-21 Thread Robin Murphy
Tegra234 devices. This is recommended fix from Tegra hardware design team. Acked-by: Robin Murphy Co-developed-by: Pritesh Raithatha Signed-off-by: Pritesh Raithatha Signed-off-by: Ashish Mhetre --- Changes in v2: - Using init_context() to override pgsize_bitmap instead of new function

[PATCH 2/3] ARM/dma-mapping: Consolidate IOMMU ops callbacks

2022-04-21 Thread Robin Murphy
Merge the coherent and non-coherent callbacks down to a single implementation each, relying on the generic dev->dma_coherent flag at the points where the difference matters. Signed-off-by: Robin Murphy --- arch/arm/mm/dma-mapping.c | 240 +- 1 file chan

[PATCH 1/3] ARM/dma-mapping: Drop .dma_supported for IOMMU ops

2022-04-21 Thread Robin Murphy
When an IOMMU is present, we trust that it should be capable of remapping any physical memory, and since the device masks represent the input (virtual) addresses to the IOMMU it makes no sense to validate them against physical PFNs anyway. Signed-off-by: Robin Murphy --- arch/arm/mm/dma

[PATCH 3/3] ARM/dma-mapping: Merge IOMMU ops

2022-04-21 Thread Robin Murphy
The dma_sync_* operations are now the only difference between the coherent and non-coherent IOMMU ops. Some minor tweaks to make those safe for coherent devices with minimal overhead, and we can condense down to a single set of DMA ops. Signed-off-by: Robin Murphy --- arch/arm/mm/dma-mapping.c

[PATCH 0/3] More ARM DMA ops cleanup

2022-04-21 Thread Robin Murphy
ssume matches the patches posted at [1]. Cheers, Robin. [1] https://lore.kernel.org/linux-arm-kernel/20220421074204.1284072-1-...@lst.de/ Robin Murphy (3): ARM/dma-mapping: Drop .dma_supported for IOMMU ops ARM/dma-mapping: Consolidate IOMMU ops callbacks ARM/dma-mapping: Merge IOMMU ops

Re: [PATCH 04/13] iommu/arm-smmu: Clean up bus_set_iommu()

2022-04-20 Thread Robin Murphy
On 2022-04-19 15:40, Will Deacon wrote: On Thu, Apr 14, 2022 at 01:42:33PM +0100, Robin Murphy wrote: Stop calling bus_set_iommu() since it's now unnecessary. With device probes now replayed for every IOMMU instance registration, the whole sorry ordering workaround for legacy DT bindings

Re: [PATCH] drm/msm: Revert "drm/msm: Stop using iommu_present()"

2022-04-19 Thread Robin Murphy
On 2022-04-19 22:08, Dmitry Baryshkov wrote: On 20/04/2022 00:04, Robin Murphy wrote: On 2022-04-19 14:04, Dmitry Baryshkov wrote: This reverts commit e2a88eabb02410267519b838fb9b79f5206769be. The commit in question makes msm_use_mmu() check whether the DRM 'component master'

Re: [Freedreno] [PATCH] drm/msm: Revert "drm/msm: Stop using iommu_present()"

2022-04-19 Thread Robin Murphy
On 2022-04-19 22:08, Dmitry Baryshkov wrote: On 20/04/2022 00:04, Robin Murphy wrote: On 2022-04-19 14:04, Dmitry Baryshkov wrote: This reverts commit e2a88eabb02410267519b838fb9b79f5206769be. The commit in question makes msm_use_mmu() check whether the DRM 'component master'

Re: [PATCH] iommu/arm-smmu-v3: Fix size calculation in arm_smmu_mm_invalidate_range()

2022-04-19 Thread Robin Murphy
match resulted in an incorrect calculation for size so it failed to be page-size aligned. Further, it caused a dead loop at "while (iova < end)" check in __arm_smmu_tlb_inv_range function. This patch fixes the issue by doing the calculation correctly. Reviewed-by: Robin Murphy Fixes:

Re: [PATCH] drm/msm: Revert "drm/msm: Stop using iommu_present()"

2022-04-19 Thread Robin Murphy
On 2022-04-19 14:04, Dmitry Baryshkov wrote: This reverts commit e2a88eabb02410267519b838fb9b79f5206769be. The commit in question makes msm_use_mmu() check whether the DRM 'component master' device is translated by the IOMMU. At this moment it is the 'mdss' device. However on platforms using the

Re: [Freedreno] [PATCH] drm/msm: Revert "drm/msm: Stop using iommu_present()"

2022-04-19 Thread Robin Murphy
On 2022-04-19 14:04, Dmitry Baryshkov wrote: This reverts commit e2a88eabb02410267519b838fb9b79f5206769be. The commit in question makes msm_use_mmu() check whether the DRM 'component master' device is translated by the IOMMU. At this moment it is the 'mdss' device. However on platforms using the

Re: [Patch v1] iommu: arm-smmu: disable large page mappings for Nvidia arm-smmu

2022-04-19 Thread Robin Murphy
On 2022-04-17 10:04, Ashish Mhetre wrote: Tegra194 and Tegra234 SoCs have the erratum that causes walk cache entries to not be invalidated correctly. The problem is that the walk cache index generated for IOVA is not same across translation and invalidation requests. This is leading to page fault

Re: [PATCH] iommu/arm-smmu-v3: Align size in __arm_smmu_tlb_inv_range

2022-04-19 Thread Robin Murphy
On 2022-04-19 21:05, Nicolin Chen wrote: On Tue, Apr 19, 2022 at 05:02:33PM -0300, Jason Gunthorpe wrote: diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c index d816759a6bcf..e280568bb513 100644 +++ b/drivers/iommu/arm/arm-smmu-v3/a

Re: [PATCH 02/13] iommu: Move bus setup to IOMMU device registration

2022-04-19 Thread Robin Murphy
On 2022-04-19 00:37, Lu Baolu wrote: On 2022/4/19 6:09, Robin Murphy wrote: On 2022-04-16 01:04, Lu Baolu wrote: On 2022/4/14 20:42, Robin Murphy wrote: @@ -1883,27 +1900,12 @@ static int iommu_bus_init(struct bus_type *bus)    */   int bus_set_iommu(struct bus_type *bus, const struct

Re: [PATCH 02/13] iommu: Move bus setup to IOMMU device registration

2022-04-18 Thread Robin Murphy
On 2022-04-16 01:04, Lu Baolu wrote: On 2022/4/14 20:42, Robin Murphy wrote: @@ -1883,27 +1900,12 @@ static int iommu_bus_init(struct bus_type *bus)    */   int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops)   { -    int err; - -    if (ops == NULL) { -    bus->iommu_

[PATCH 13/13] iommu: Clean up bus_set_iommu()

2022-04-14 Thread Robin Murphy
Clean up the remaining trivial bus_set_iommu() callsites along with the implementation. Now drivers only have to know and care about iommu_device instances, phew! Signed-off-by: Robin Murphy --- drivers/iommu/arm/arm-smmu/qcom_iommu.c | 4 drivers/iommu/fsl_pamu_domain.c | 4

[PATCH 12/13] iommu/virtio: Clean up bus_set_iommu()

2022-04-14 Thread Robin Murphy
Stop calling bus_set_iommu() since it's now unnecessary, and simplify the probe failure path accordingly. Signed-off-by: Robin Murphy --- drivers/iommu/virtio-iommu.c | 24 1 file changed, 24 deletions(-) diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/v

[PATCH 11/13] iommu/tegra-smmu: Clean up bus_set_iommu()

2022-04-14 Thread Robin Murphy
Stop calling bus_set_iommu() since it's now unnecessary, and simplify the probe failure path accordingly. Signed-off-by: Robin Murphy --- drivers/iommu/tegra-smmu.c | 29 ++--- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/drivers/iommu/tegra-smm

[PATCH 10/13] iommu/omap: Clean up bus_set_iommu()

2022-04-14 Thread Robin Murphy
Stop calling bus_set_iommu() since it's now unnecessary, and simplify the init failure path accordingly. Signed-off-by: Robin Murphy --- drivers/iommu/omap-iommu.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index d9cf282

[PATCH 09/13] iommu/mtk: Clean up bus_set_iommu()

2022-04-14 Thread Robin Murphy
Stop calling bus_set_iommu() since it's now unnecessary, and simplify the probe failure paths accordingly. Signed-off-by: Robin Murphy --- drivers/iommu/mtk_iommu.c| 13 + drivers/iommu/mtk_iommu_v1.c | 13 + 2 files changed, 2 insertions(+), 24 deletions(-)

[PATCH 08/13] iommu/ipmmu-vmsa: Clean up bus_set_iommu()

2022-04-14 Thread Robin Murphy
Stop calling bus_set_iommu() since it's now unnecessary. This also leaves the custom initcall effectively doing nothing but register the driver, which no longer needs to happen early either, so convert it to builtin_platform_driver(). Signed-off-by: Robin Murphy --- drivers/iommu/ipmmu-v

[PATCH 07/13] iommu/exynos: Clean up bus_set_iommu()

2022-04-14 Thread Robin Murphy
Stop calling bus_set_iommu() since it's now unnecessary, and simplify the init failure path accordingly. Signed-off-by: Robin Murphy --- drivers/iommu/exynos-iommu.c | 9 - 1 file changed, 9 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c

[PATCH 06/13] iommu/dart: Clean up bus_set_iommu()

2022-04-14 Thread Robin Murphy
Stop calling bus_set_iommu() since it's now unnecessary, and simplify the probe failure path accordingly. Signed-off-by: Robin Murphy --- drivers/iommu/apple-dart.c | 30 +- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/drivers/iommu/apple-dar

[PATCH 05/13] iommu/arm-smmu-v3: Clean up bus_set_iommu()

2022-04-14 Thread Robin Murphy
Stop calling bus_set_iommu() since it's now unnecessary, and simplify the probe failure path accordingly. Signed-off-by: Robin Murphy --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 53 + 1 file changed, 2 insertions(+), 51 deletions(-) diff --git a/drivers/iommu/ar

[PATCH 03/13] iommu/amd: Clean up bus_set_iommu()

2022-04-14 Thread Robin Murphy
Stop calling bus_set_iommu() since it's now unnecessary, and garbage-collect the last remnants of amd_iommu_init_api(). Signed-off-by: Robin Murphy --- drivers/iommu/amd/amd_iommu.h | 1 - drivers/iommu/amd/init.c | 9 + drivers/iommu/amd/iommu.c | 21 ---

[PATCH 04/13] iommu/arm-smmu: Clean up bus_set_iommu()

2022-04-14 Thread Robin Murphy
Stop calling bus_set_iommu() since it's now unnecessary. With device probes now replayed for every IOMMU instance registration, the whole sorry ordering workaround for legacy DT bindings goes too, hooray! Signed-off-by: Robin Murphy --- drivers/iommu/arm/arm-smmu/arm-smmu.c

[PATCH 02/13] iommu: Move bus setup to IOMMU device registration

2022-04-14 Thread Robin Murphy
merely preserving the well-established existing behaviour. This could be improved in future - probably combined with equivalent cleanup for iommu_device_unregister() - but that isn't a priority right now. Signed-off-by: Robin Murphy --- drivers/iommu/iommu.c

[PATCH 01/13] iommu: Always register bus notifiers

2022-04-14 Thread Robin Murphy
not break the notifier call chain, so there should be no harm in proactively registering all our bus notifiers at init time. Signed-off-by: Robin Murphy --- drivers/iommu/iommu.c | 49 --- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/driv

[PATCH 00/13] iommu: Retire bus_set_iommu()

2022-04-14 Thread Robin Murphy
etty much good to go now (I'll send a slightly-tweaked final version once the iommu/core branch is open). Thanks, Robin. Robin Murphy (13): iommu: Always register bus notifiers iommu: Move bus setup to IOMMU device registration iommu/amd: Clean up bus_set_iommu() iommu/arm-smmu: Clean u

Re: [PATCH] iommu/arm-smmu-v3: Align size in __arm_smmu_tlb_inv_range

2022-04-14 Thread Robin Murphy
On 2022-04-13 21:19, Nicolin Chen wrote: Hi Robin, On Wed, Apr 13, 2022 at 02:40:31PM +0100, Robin Murphy wrote: On 2022-04-13 05:17, Nicolin Chen wrote: To calculate num_pages, the size should be aligned with "page size", determined by the tg value. Otherwise, its following &q

Re: [PATCH] iommu/arm-smmu-v3: Align size in __arm_smmu_tlb_inv_range

2022-04-13 Thread Robin Murphy
On 2022-04-13 05:17, Nicolin Chen wrote: To calculate num_pages, the size should be aligned with "page size", determined by the tg value. Otherwise, its following "while (iova < end)" might become an infinite loop if unaligned size is slightly greater than 1 << tg. Hmm, how does a non-page-alig

Re: [PATCH] dma-direct: avoid redundant memory sync for swiotlb

2022-04-13 Thread Robin Murphy
On 2022-04-13 05:59, Christoph Hellwig wrote: On Wed, Apr 13, 2022 at 09:02:02AM +0800, Chao Gao wrote: dma_direct_sync_single_for_cpu() also calls arch_sync_dma_for_cpu_all() and arch_dma_mark_clean() in some cases. if SWIOTLB does sync internally, should these two functions be called by SWIOTL

Re: [PATCH] dma-direct: avoid redundant memory sync for swiotlb

2022-04-12 Thread Robin Murphy
On 12/04/2022 12:38 pm, Chao Gao wrote: When we looked into FIO performance with swiotlb enabled in VM, we found swiotlb_bounce() is always called one more time than expected for each DMA read request. It turns out that the bounce buffer is copied to original DMA buffer twice after the completio

[PATCH v2] drm: tegra: Include DMA API header where used

2022-04-11 Thread Robin Murphy
Even though the IOVA API never actually needed it, iova.h is still carrying an include of dma-mapping.h, now solely for the sake of not breaking tegra-drm. Fix that properly. Signed-off-by: Robin Murphy --- v2: Apparently nvdec.c needs one now too. drivers/gpu/drm/tegra/dc.c| 1 + drivers

[PATCH v2] drm: tegra: Include DMA API header where used

2022-04-11 Thread Robin Murphy
Even though the IOVA API never actually needed it, iova.h is still carrying an include of dma-mapping.h, now solely for the sake of not breaking tegra-drm. Fix that properly. Signed-off-by: Robin Murphy --- v2: Apparently nvdec.c needs one now too. drivers/gpu/drm/tegra/dc.c| 1 + drivers

[PATCH v2] drm/tegra: Stop using iommu_present()

2022-04-11 Thread Robin Murphy
ce or not. Signed-off-by: Robin Murphy --- v2: Fix logic for older SoCs and clarify. drivers/gpu/drm/tegra/drm.c | 28 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 9464f522e257..4f2bdab

[PATCH v2] drm/tegra: Stop using iommu_present()

2022-04-11 Thread Robin Murphy
ce or not. Signed-off-by: Robin Murphy --- v2: Fix logic for older SoCs and clarify. drivers/gpu/drm/tegra/drm.c | 28 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 9464f522e257..4f2bdab

[PATCH v2] habanalabs: Stop using iommu_present()

2022-04-11 Thread Robin Murphy
Even if an IOMMU might be present for some PCI segment in the system, that doesn't necessarily mean it provides translation for the device we care about. Replace iommu_present() with a more appropriate check. Signed-off-by: Robin Murphy --- v2: Rebase on habanalabs-next drivers

Re: [PATCH] habanalabs: Stop using iommu_present()

2022-04-11 Thread Robin Murphy
On 2022-04-10 11:59, Oded Gabbay wrote: On Tue, Apr 5, 2022 at 4:46 PM Robin Murphy wrote: Even if an IOMMU might be present for some PCI segment in the system, that doesn't necessarily mean it provides translation for the device we care about. Replace iommu_present() with a more approp

Re: [PATCH] drm/tegra: Stop using iommu_present()

2022-04-08 Thread Robin Murphy
On 2022-04-07 18:51, Dmitry Osipenko wrote: On 4/6/22 21:06, Robin Murphy wrote: On 2022-04-06 15:32, Dmitry Osipenko wrote: On 4/5/22 17:19, Robin Murphy wrote: Remove the pointless check. host1x_drm_wants_iommu() cannot return true unless an IOMMU exists for the host1x platform device

Re: [PATCH] drm/tegra: Stop using iommu_present()

2022-04-08 Thread Robin Murphy
On 2022-04-07 18:51, Dmitry Osipenko wrote: On 4/6/22 21:06, Robin Murphy wrote: On 2022-04-06 15:32, Dmitry Osipenko wrote: On 4/5/22 17:19, Robin Murphy wrote: Remove the pointless check. host1x_drm_wants_iommu() cannot return true unless an IOMMU exists for the host1x platform device

Re: [PATCH v2 0/4] Make the iommu driver no-snoop block feature consistent

2022-04-08 Thread Robin Murphy
On 2022-04-08 14:35, Jason Gunthorpe wrote: On Fri, Apr 08, 2022 at 02:11:10PM +0100, Robin Murphy wrote: However, this creates an oddball situation where the vfio_device and it's struct device could become unplugged from the system while the domain that the struct device spawned continu

Re: [PATCH v2 4/4] vfio: Require that devices support DMA cache coherence

2022-04-08 Thread Robin Murphy
On 2022-04-08 13:22, Jason Gunthorpe wrote: On Fri, Apr 08, 2022 at 08:26:10AM +, Tian, Kevin wrote: From: Jason Gunthorpe Sent: Thursday, April 7, 2022 11:24 PM IOMMU_CACHE means that normal DMAs do not require any additional coherency mechanism and is the basic uAPI that VFIO exposes to

Re: [PATCH v2 0/4] Make the iommu driver no-snoop block feature consistent

2022-04-08 Thread Robin Murphy
On 2022-04-08 13:18, Jason Gunthorpe wrote: On Thu, Apr 07, 2022 at 08:27:05PM +0100, Robin Murphy wrote: On 2022-04-07 20:08, Jason Gunthorpe wrote: On Thu, Apr 07, 2022 at 07:02:03PM +0100, Robin Murphy wrote: On 2022-04-07 18:43, Jason Gunthorpe wrote: On Thu, Apr 07, 2022 at 06:03:37PM

Re: [PATCH v2 0/4] Make the iommu driver no-snoop block feature consistent

2022-04-08 Thread Robin Murphy
On 2022-04-08 10:08, Tian, Kevin wrote: From: Jason Gunthorpe Sent: Friday, April 8, 2022 3:08 AM On Thu, Apr 07, 2022 at 07:02:03PM +0100, Robin Murphy wrote: On 2022-04-07 18:43, Jason Gunthorpe wrote: On Thu, Apr 07, 2022 at 06:03:37PM +0100, Robin Murphy wrote: At a glance, this all

Re: [PATCH v2 0/4] Make the iommu driver no-snoop block feature consistent

2022-04-07 Thread Robin Murphy
On 2022-04-07 20:08, Jason Gunthorpe wrote: On Thu, Apr 07, 2022 at 07:02:03PM +0100, Robin Murphy wrote: On 2022-04-07 18:43, Jason Gunthorpe wrote: On Thu, Apr 07, 2022 at 06:03:37PM +0100, Robin Murphy wrote: At a glance, this all looks about the right shape to me now, thanks! Thanks

Re: [PATCH v2 0/4] Make the iommu driver no-snoop block feature consistent

2022-04-07 Thread Robin Murphy
On 2022-04-07 18:43, Jason Gunthorpe wrote: On Thu, Apr 07, 2022 at 06:03:37PM +0100, Robin Murphy wrote: At a glance, this all looks about the right shape to me now, thanks! Thanks! Ideally I'd hope patch #4 could go straight to device_iommu_capable() from my Thunderbolt series, but w

Re: [PATCH v2 0/4] Make the iommu driver no-snoop block feature consistent

2022-04-07 Thread Robin Murphy
his one too. For the series, Acked-by: Robin Murphy v1: https://lore.kernel.org/r/0-v1-ef02c60ddb76+12ca2-intel_no_snoop_...@nvidia.com Jason Gunthorpe (4): iommu: Introduce the domain op enforce_cache_coherency() vfio: Move the Intel no-snoop control off of IOMMU_CACHE iommu: Red

Re: [PATCH 1/5] iommu: Replace uses of IOMMU_CAP_CACHE_COHERENCY with dev_is_dma_coherent()

2022-04-07 Thread Robin Murphy
On 2022-04-07 14:59, Jason Gunthorpe wrote: On Thu, Apr 07, 2022 at 07:18:48AM +, Tian, Kevin wrote: From: Jason Gunthorpe Sent: Thursday, April 7, 2022 1:17 AM On Wed, Apr 06, 2022 at 06:10:31PM +0200, Christoph Hellwig wrote: On Wed, Apr 06, 2022 at 01:06:23PM -0300, Jason Gunthorpe wro

Re: [PATCH 1/5] iommu: Replace uses of IOMMU_CAP_CACHE_COHERENCY with dev_is_dma_coherent()

2022-04-07 Thread Robin Murphy
On 2022-04-07 14:59, Jason Gunthorpe wrote: On Thu, Apr 07, 2022 at 07:18:48AM +, Tian, Kevin wrote: From: Jason Gunthorpe Sent: Thursday, April 7, 2022 1:17 AM On Wed, Apr 06, 2022 at 06:10:31PM +0200, Christoph Hellwig wrote: On Wed, Apr 06, 2022 at 01:06:23PM -0300, Jason Gunthorpe wro

Re: [PATCH v9 06/11] ACPI/IORT: Add support to retrieve IORT RMR reserved regions

2022-04-07 Thread Robin Murphy
On 2022-04-07 14:28, Christoph Hellwig wrote: +static void iort_rmr_desc_check_overlap(struct acpi_iort_rmr_desc *desc, u32 count) Overly long line. void iommu_dma_put_resv_regions(struct device *dev, struct list_head *list) { + if (!is_of_node(dev_iommu_fwspec_get(dev)->iommu_fwno

Re: [PATCH v2 1/2] iommu/amd: Enable swiotlb in all cases

2022-04-07 Thread Robin Murphy
er changes a 32-bit device's default domain type to passthrough via sysfs, such that it starts needing regular dma-direct bouncing. Reviewed-by: Robin Murphy Fixes: 82612d66d51d ("iommu: Allow the dma-iommu api to use bounce buffers") Suggested-by: Christoph Hellwig Signed-of

Re: [PATCH v2 2/2] dma-iommu: Check that swiotlb is active before trying to use it

2022-04-07 Thread Robin Murphy
been allocated this is a problem that should be made apparent to the user. Reviewed-by: Robin Murphy Signed-off-by: Mario Limonciello --- v1->v2: * Move error message into the caller drivers/iommu/dma-iommu.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/iommu/dma

Re: [PATCH 3/4] iommu: remove the put_resv_regions method

2022-04-07 Thread Robin Murphy
On 2022-04-07 07:26, Christoph Hellwig wrote: All drivers that implement get_resv_regions just use generic_put_resv_regions to implement the put side. Remove the indirections and document the allocations constraints. Unfortunately we need to keep this one for now, as the belated IORT RMR supp

Re: [PATCH] RDMA/usnic: Refactor usnic_uiom_alloc_pd()

2022-04-06 Thread Robin Murphy
[1] https://lore.kernel.org/linux-iommu/f707b4248e1d33b6d2c7f1d7c94febb802cf9890.1649161199.git.robin.mur...@arm.com/ url: https://github.com/intel-lab-lkp/linux/commits/Robin-Murphy/RDMA-usnic-Refactor-usnic_uiom_alloc_pd/20220406-133657 base: https://git.kernel.org/pub/scm/linux/kerne

Re: [PATCH] drm/tegra: Stop using iommu_present()

2022-04-06 Thread Robin Murphy
On 2022-04-06 15:32, Dmitry Osipenko wrote: On 4/5/22 17:19, Robin Murphy wrote: Remove the pointless check. host1x_drm_wants_iommu() cannot return true unless an IOMMU exists for the host1x platform device, which at the moment means the iommu_present() test could never fail. Signed-off-by

Re: [PATCH] drm/tegra: Stop using iommu_present()

2022-04-06 Thread Robin Murphy
On 2022-04-06 15:32, Dmitry Osipenko wrote: On 4/5/22 17:19, Robin Murphy wrote: Remove the pointless check. host1x_drm_wants_iommu() cannot return true unless an IOMMU exists for the host1x platform device, which at the moment means the iommu_present() test could never fail. Signed-off-by

Re: [PATCH 1/5] iommu: Replace uses of IOMMU_CAP_CACHE_COHERENCY with dev_is_dma_coherent()

2022-04-06 Thread Robin Murphy
On 2022-04-06 15:14, Jason Gunthorpe wrote: On Wed, Apr 06, 2022 at 03:51:50PM +0200, Christoph Hellwig wrote: On Wed, Apr 06, 2022 at 09:07:30AM -0300, Jason Gunthorpe wrote: Didn't see it I'll move dev_is_dma_coherent to device.h along with device_iommu_mapped() and others then No. It it

Re: [PATCH 1/5] iommu: Replace uses of IOMMU_CAP_CACHE_COHERENCY with dev_is_dma_coherent()

2022-04-06 Thread Robin Murphy
On 2022-04-06 15:14, Jason Gunthorpe wrote: On Wed, Apr 06, 2022 at 03:51:50PM +0200, Christoph Hellwig wrote: On Wed, Apr 06, 2022 at 09:07:30AM -0300, Jason Gunthorpe wrote: Didn't see it I'll move dev_is_dma_coherent to device.h along with device_iommu_mapped() and others then No. It it

Re: [PATCH 1/5] iommu: Replace uses of IOMMU_CAP_CACHE_COHERENCY with dev_is_dma_coherent()

2022-04-06 Thread Robin Murphy
On 2022-04-05 17:16, Jason Gunthorpe wrote: vdpa and usnic are trying to test if IOMMU_CACHE is supported. The correct way to do this is via dev_is_dma_coherent() Not necessarily... Disregarding the complete disaster of PCIe No Snoop on Arm-Based systems, there's the more interesting effectiv

Re: [PATCH 1/5] iommu: Replace uses of IOMMU_CAP_CACHE_COHERENCY with dev_is_dma_coherent()

2022-04-06 Thread Robin Murphy
On 2022-04-05 17:16, Jason Gunthorpe wrote: vdpa and usnic are trying to test if IOMMU_CACHE is supported. The correct way to do this is via dev_is_dma_coherent() Not necessarily... Disregarding the complete disaster of PCIe No Snoop on Arm-Based systems, there's the more interesting effectiv

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 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 SOC

Re: [PATCH v9 01/23] clk: rk3568: Mark hclk_vo as critical

2022-04-06 Thread Robin Murphy
ed-by: Robin Murphy Signed-off-by: Sascha Hauer --- Notes: Changes since v8: - new patch drivers/clk/rockchip/clk-rk3568.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clk/rockchip/clk-rk3568.c b/drivers/clk/rockchip/clk-rk3568.c index 63dfbeeeb06d9..62694d95173ab 1

Re: [PATCH v3 1/4] iommu: Introduce device_iommu_capable()

2022-04-06 Thread Robin Murphy
On 2022-04-06 06:28, Christoph Hellwig wrote: On Tue, Apr 05, 2022 at 11:41:01AM +0100, Robin Murphy wrote: iommu_capable() only really works for systems where all IOMMU instances are completely homogeneous, and all devices are IOMMU-mapped. Implement the new variant which can give an accurate

[PATCH] RDMA/usnic: Refactor usnic_uiom_alloc_pd()

2022-04-05 Thread Robin Murphy
Rather than hard-coding pci_bus_type, pass the PF device through to usnic_uiom_alloc_pd() and retrieve its bus there. This prepares for iommu_domain_alloc() changing to take a device rather than a bus_type. Signed-off-by: Robin Murphy --- drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 3

[PATCH] drm/rockchip: Refactor IOMMU initialisation

2022-04-05 Thread Robin Murphy
somewhat of a logical cleanup, the main motivation is to prepare for a change in the iommu_domain_alloc() interface. Signed-off-by: Robin Murphy --- Lightly tested on RK3288. This does stand to collide with the in-flight VOP2 driver a little, if only that that will want an equivalent

[PATCH] drm/rockchip: Refactor IOMMU initialisation

2022-04-05 Thread Robin Murphy
somewhat of a logical cleanup, the main motivation is to prepare for a change in the iommu_domain_alloc() interface. Signed-off-by: Robin Murphy --- Lightly tested on RK3288. This does stand to collide with the in-flight VOP2 driver a little, if only that that will want an equivalent

[PATCH] drm/nouveau/tegra: Stop using iommu_present()

2022-04-05 Thread Robin Murphy
Even if some IOMMU has registered itself on the platform "bus", that doesn't necessarily mean it provides translation for the device we care about. Replace iommu_present() with a more appropriate check. Signed-off-by: Robin Murphy --- drivers/gpu/drm/nouveau/nvkm/engine/device/te

[PATCH] drm/nouveau/tegra: Stop using iommu_present()

2022-04-05 Thread Robin Murphy
Even if some IOMMU has registered itself on the platform "bus", that doesn't necessarily mean it provides translation for the device we care about. Replace iommu_present() with a more appropriate check. Signed-off-by: Robin Murphy --- drivers/gpu/drm/nouveau/nvkm/engine/device/te

[Nouveau] [PATCH] drm/nouveau/tegra: Stop using iommu_present()

2022-04-05 Thread Robin Murphy
Even if some IOMMU has registered itself on the platform "bus", that doesn't necessarily mean it provides translation for the device we care about. Replace iommu_present() with a more appropriate check. Signed-off-by: Robin Murphy --- drivers/gpu/drm/nouveau/nvkm/engine/device/te

[PATCH] drm/tegra: Stop using iommu_present()

2022-04-05 Thread Robin Murphy
Remove the pointless check. host1x_drm_wants_iommu() cannot return true unless an IOMMU exists for the host1x platform device, which at the moment means the iommu_present() test could never fail. Signed-off-by: Robin Murphy --- drivers/gpu/drm/tegra/drm.c | 2 +- 1 file changed, 1 insertion

[PATCH] drm/tegra: Stop using iommu_present()

2022-04-05 Thread Robin Murphy
Remove the pointless check. host1x_drm_wants_iommu() cannot return true unless an IOMMU exists for the host1x platform device, which at the moment means the iommu_present() test could never fail. Signed-off-by: Robin Murphy --- drivers/gpu/drm/tegra/drm.c | 2 +- 1 file changed, 1 insertion

[PATCH] drm/msm: Stop using iommu_present()

2022-04-05 Thread Robin Murphy
Even if some IOMMU has registered itself on the platform "bus", that doesn't necessarily mean it provides translation for the device we care about. Replace iommu_present() with a more appropriate check. Signed-off-by: Robin Murphy --- drivers/gpu/drm/msm/msm_drv.c | 2 +- 1

[PATCH] drm/msm: Stop using iommu_present()

2022-04-05 Thread Robin Murphy
Even if some IOMMU has registered itself on the platform "bus", that doesn't necessarily mean it provides translation for the device we care about. Replace iommu_present() with a more appropriate check. Signed-off-by: Robin Murphy --- drivers/gpu/drm/msm/msm_drv.c | 2 +- 1

[Freedreno] [PATCH] drm/msm: Stop using iommu_present()

2022-04-05 Thread Robin Murphy
Even if some IOMMU has registered itself on the platform "bus", that doesn't necessarily mean it provides translation for the device we care about. Replace iommu_present() with a more appropriate check. Signed-off-by: Robin Murphy --- drivers/gpu/drm/msm/msm_drv.c | 2 +- 1

[PATCH] drm/mediatek: Stop using iommu_present()

2022-04-05 Thread Robin Murphy
Remove the pointless check. If an IOMMU is providing transparent DMA API ops for any device(s) we care about, the DT code will have enforced the appropriate probe ordering already. Signed-off-by: Robin Murphy --- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 4 1 file changed, 4 deletions

[PATCH] drm/mediatek: Stop using iommu_present()

2022-04-05 Thread Robin Murphy
Remove the pointless check. If an IOMMU is providing transparent DMA API ops for any device(s) we care about, the DT code will have enforced the appropriate probe ordering already. Signed-off-by: Robin Murphy --- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 4 1 file changed, 4 deletions

[PATCH] drm/arm/malidp: Stop using iommu_present()

2022-04-05 Thread Robin Murphy
iommu_get_domain_for_dev() is already perfectly happy to return NULL if the given device has no IOMMU. Drop the unnecessary check. Signed-off-by: Robin Murphy --- drivers/gpu/drm/arm/malidp_planes.c | 14 +- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/gpu

[PATCH] drm/arm/malidp: Stop using iommu_present()

2022-04-05 Thread Robin Murphy
iommu_get_domain_for_dev() is already perfectly happy to return NULL if the given device has no IOMMU. Drop the unnecessary check. Signed-off-by: Robin Murphy --- drivers/gpu/drm/arm/malidp_planes.c | 14 +- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/gpu

<    1   2   3   4   5   6   7   8   9   10   >