Re: [PATCH 2/4] iommu/mediatek: Add iotlb_sync_range() support

2020-10-23 Thread Robin Murphy
On 2020-10-23 06:57, chao hao wrote: On Wed, 2020-10-21 at 17:55 +0100, Robin Murphy wrote: On 2020-10-19 12:30, Chao Hao wrote: MTK_IOMMU driver writes one page entry and does tlb flush at a time currently. More optimal would be to aggregate the writes and flush BUS buffer in the end

Re: [PATCH v3 11/24] iommu/io-pgtable-arm-v7s: Quad lvl1 pgtable for MediaTek

2020-10-23 Thread Robin Murphy
On 2020-09-30 08:06, Yong Wu wrote: The standard input iova bits is 32. MediaTek quad the lvl1 pagetable (4 * lvl1). No change for lvl2 pagetable. Then the iova bits can reach 34bit. Signed-off-by: Yong Wu --- drivers/iommu/io-pgtable-arm-v7s.c | 13 ++--- drivers/iommu/mtk_iommu.c

Re: [PATCH v4 0/4] Add system mmu support for Armada-806

2020-10-23 Thread Robin Murphy
On 2020-10-23 13:19, Tomasz Nowicki wrote: Hi Denis, Sorry for late response, we had to check few things. Please see comments inline. On 10/6/20 3:16 PM, Denis Odintsov wrote: Hi, Am 15.07.2020 um 09:06 schrieb Tomasz Nowicki : The series is meant to support SMMU for AP806 and a

Re: [PATCH] dma-mapping: document dma_{alloc,free}_pages

2020-10-23 Thread Robin Murphy
On 2020-10-23 07:45, Christoph Hellwig wrote: Document the new dma_alloc_pages and dma_free_pages APIs, and fix up the documentation for dma_alloc_noncoherent and dma_free_noncoherent. Reported-by: Robin Murphy Signed-off-by: Christoph Hellwig --- Documentation/core-api/dma-api.rst | 49

Re: [PATCH 2/4] iommu/mediatek: Add iotlb_sync_range() support

2020-10-21 Thread Robin Murphy
On 2020-10-19 12:30, Chao Hao wrote: MTK_IOMMU driver writes one page entry and does tlb flush at a time currently. More optimal would be to aggregate the writes and flush BUS buffer in the end. That's exactly what iommu_iotlb_gather_add_page() is meant to achieve. Rather than jumping

Re: [PATCH v5 3/3] iommu/arm-smmu-qcom: Implement S2CR quirk

2020-10-19 Thread Robin Murphy
it all spelled out, so regardless, Acked-by: Robin Murphy Cheers, Robin. + + set_bit(qsmmu->bypass_cbndx, smmu->context_map); + + reg = FIELD_PREP(ARM_SMMU_CBAR_TYPE, CBAR_TYPE_S1_TRANS_S2_BYPASS); + arm_smmu_gr1_write(smmu, ARM_SMMU_GR1_CBAR(qsmmu->

Re: [PATCH v5 2/3] iommu/arm-smmu-qcom: Read back stream mappings

2020-10-19 Thread Robin Murphy
mappings during initialization and make the arm-smmu driver maintain the streams in bypass mode. Acked-by: Robin Murphy Signed-off-by: Bjorn Andersson --- Changes since v4: - Don't increment s2cr[i]->count, as this is not actually needed to survive probe deferral drivers/iommu/arm/arm-s

Re: [PATCH v4 3/3] iommu/arm-smmu-qcom: Implement S2CR quirk

2020-10-19 Thread Robin Murphy
On 2020-10-17 05:39, Bjorn Andersson wrote: The firmware found in some Qualcomm platforms intercepts writes to S2CR in order to replace bypass type streams with fault; and ignore S2CR updates of type fault. Detect this behavior and implement a custom write_s2cr function in order to trick the

Re: [PATCH v4 2/3] iommu/arm-smmu-qcom: Read back stream mappings

2020-10-19 Thread Robin Murphy
On 2020-10-17 05:39, Bjorn Andersson wrote: The Qualcomm boot loader configures stream mapping for the peripherals that it accesses and in particular it sets up the stream mapping for the display controller to be allowed to scan out a splash screen or EFI framebuffer. Read back the stream

Re: [PATCH v4 1/3] iommu/arm-smmu: Allow implementation specific write_s2cr

2020-10-19 Thread Robin Murphy
reasonable level of abstraction to me - we'll still have plenty of flexibility to adjust things in future if necessary. With that change, Reviewed-by: Robin Murphy + } else { + reg = FIELD_PREP(ARM_SMMU_S2CR_TYPE, s2cr->type) | + FIELD_PREP(A

Re: [PATCH v7 3/3] iommu/tegra-smmu: Add PCI support

2020-10-19 Thread Robin Murphy
On 2020-10-17 02:56, Nicolin Chen wrote: On Fri, Oct 16, 2020 at 03:10:26PM +0100, Robin Murphy wrote: On 2020-10-16 04:53, Nicolin Chen wrote: On Thu, Oct 15, 2020 at 10:55:52AM +0100, Robin Murphy wrote: On 2020-10-15 05:13, Nicolin Chen wrote: On Wed, Oct 14, 2020 at 06:42:36PM +0100

Re: [PATCH v7 3/3] iommu/tegra-smmu: Add PCI support

2020-10-16 Thread Robin Murphy
On 2020-10-16 04:53, Nicolin Chen wrote: On Thu, Oct 15, 2020 at 10:55:52AM +0100, Robin Murphy wrote: On 2020-10-15 05:13, Nicolin Chen wrote: On Wed, Oct 14, 2020 at 06:42:36PM +0100, Robin Murphy wrote: On 2020-10-09 17:19, Nicolin Chen wrote: This patch simply adds support for PCI

Re: [PATCH v7 3/3] iommu/tegra-smmu: Add PCI support

2020-10-15 Thread Robin Murphy
On 2020-10-15 05:13, Nicolin Chen wrote: On Wed, Oct 14, 2020 at 06:42:36PM +0100, Robin Murphy wrote: On 2020-10-09 17:19, Nicolin Chen wrote: This patch simply adds support for PCI devices. Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Signed-off-by: Nicolin Chen --- Changelog

Re: [PATCH v7 3/3] iommu/tegra-smmu: Add PCI support

2020-10-14 Thread Robin Murphy
On 2020-10-09 17:19, Nicolin Chen wrote: This patch simply adds support for PCI devices. Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Signed-off-by: Nicolin Chen --- Changelog v6->v7 * Renamed goto labels, suggested by Thierry. v5->v6 * Added Dmitry's Reviewed-by and

Re: [PATCH v3 6/8] iommu/arm-smmu: Add impl hook for inherit boot mappings

2020-10-13 Thread Robin Murphy
On 2020-10-12 08:31, Bjorn Andersson wrote: On Mon 21 Sep 23:08 CEST 2020, Will Deacon wrote: On Sat, Sep 12, 2020 at 10:25:59PM -0500, Bjorn Andersson wrote: On Fri 11 Sep 12:13 CDT 2020, Robin Murphy wrote: On 2020-09-04 16:55, Bjorn Andersson wrote: Add a new operation to allow platform

Re: [PATCH 2/3] drm/msm: add DRM_MSM_GEM_SYNC_CACHE for non-coherent cache maintenance

2020-10-13 Thread Robin Murphy
On 2020-10-07 07:25, Christoph Hellwig wrote: On Tue, Oct 06, 2020 at 09:19:32AM -0400, Jonathan Marek wrote: One example why drm/msm can't use DMA API is multiple page table support (that is landing in 5.10), which is something that definitely couldn't work with DMA API. Another one is being

Re: [PATCH v4 0/4] Add system mmu support for Armada-806

2020-10-13 Thread Robin Murphy
On 2020-10-06 16:16, Denis Odintsov wrote: Hi, Am 15.07.2020 um 09:06 schrieb Tomasz Nowicki : The series is meant to support SMMU for AP806 and a workaround for accessing ARM SMMU 64bit registers is the gist of it. For the record, AP-806 can't access SMMU registers with 64bit width. This

Re: [PATCH v2 1/4] dt-bindings: reserved-memory: Document "active" property

2020-09-25 Thread Robin Murphy
MA/IOMMU integration for Tegra SMMU if they have a bootloader that does initialize display to actively scan out during boot. I think Robin Murphy already suggested that we should simply create a dummy "identity" IOMMU domain by default for the DRM/VDE devices and then replace it with an ex

Re: [PATCH 1/2] iommu/iova: Flush CPU rcache for when a depot fills

2020-09-25 Thread Robin Murphy
On 2020-09-25 10:51, John Garry wrote: Leizhen reported some time ago that IOVA performance may degrade over time [0], but unfortunately his solution to fix this problem was not given attention. To summarize, the issue is that as time goes by, the CPU rcache and depot rcache continue to grow.

Re: [PATCH 08/18] dma-mapping: add a new dma_alloc_noncoherent API

2020-09-25 Thread Robin Murphy
On 2020-09-15 16:51, Christoph Hellwig wrote: [...] +These APIs allow to allocate pages in the kernel direct mapping that are +guaranteed to be DMA addressable. This means that unlike dma_alloc_coherent, +virt_to_page can be called on the resulting address, and the resulting Nit: if we

Re: [PATCH 02/13] iommu: amd: Prepare for generic IO page table framework

2020-09-24 Thread Robin Murphy
On 2020-09-23 11:14, Suravee Suthikulpanit wrote: Add initial hook up code to implement generic IO page table framework. Signed-off-by: Suravee Suthikulpanit --- drivers/iommu/amd/Kconfig | 1 + drivers/iommu/amd/Makefile | 2 +- drivers/iommu/amd/amd_iommu_types.h |

Re: IOVA allocation dependency between firmware buffer and remaining buffers

2020-09-24 Thread Robin Murphy
On 2020-09-24 11:47, Marek Szyprowski wrote: Hi Robin, On 24.09.2020 12:40, Robin Murphy wrote: On 2020-09-24 11:16, Thierry Reding wrote: On Thu, Sep 24, 2020 at 10:46:46AM +0200, Marek Szyprowski wrote: On 24.09.2020 10:28, Joerg Roedel wrote: On Wed, Sep 23, 2020 at 08:48:26AM +0200

Re: IOVA allocation dependency between firmware buffer and remaining buffers

2020-09-24 Thread Robin Murphy
On 2020-09-24 11:16, Thierry Reding wrote: On Thu, Sep 24, 2020 at 10:46:46AM +0200, Marek Szyprowski wrote: Hi Joerg, On 24.09.2020 10:28, Joerg Roedel wrote: On Wed, Sep 23, 2020 at 08:48:26AM +0200, Marek Szyprowski wrote: It allows to remap given buffer at the specific IOVA address,

Re: arm-smmu 5000000.iommu: Cannot accommodate DMA offset for IOMMU page tables

2020-09-24 Thread Robin Murphy
On 2020-09-24 10:25, Joerg Roedel wrote: Hi Robin, On Thu, Sep 24, 2020 at 10:08:46AM +0100, Robin Murphy wrote: This should be fixed by https://lore.kernel.org/linux-iommu/daedc9364a19dc07487e4d07b8768b1e5934abd4.1600700881.git.robin.mur...@arm.com/T/#u (already in linux-next). Thanks

Re: arm-smmu 5000000.iommu: Cannot accommodate DMA offset for IOMMU page tables

2020-09-24 Thread Robin Murphy
Hi Joerg, On 2020-09-24 10:03, Joerg Roedel wrote: Adding Will and Robin. This should be fixed by https://lore.kernel.org/linux-iommu/daedc9364a19dc07487e4d07b8768b1e5934abd4.1600700881.git.robin.mur...@arm.com/T/#u (already in linux-next). Thanks, Robin. On Mon, Sep 21, 2020 at

Re: [PATCH] iommu: of: skip iommu_device_list traversal in of_iommu_xlate()

2020-09-23 Thread Robin Murphy
On 2020-09-23 15:53, Charan Teja Reddy wrote: In of_iommu_xlate(), check if iommu device is enabled before traversing the iommu_device_list through iommu_ops_from_fwnode(). It is of no use in traversing the iommu_device_list only to return NO_IOMMU because of iommu device node is disabled.

Re: [PATCHv5 5/6] iommu: arm-smmu-impl: Use table to list QCOM implementations

2020-09-23 Thread Robin Murphy
On 2020-09-22 07:18, Sai Prakash Ranjan wrote: Use table and of_match_node() to match qcom implementation instead of multiple of_device_compatible() calls for each QCOM SMMU implementation. Signed-off-by: Sai Prakash Ranjan --- drivers/iommu/arm/arm-smmu/arm-smmu-impl.c | 12 1

Re: dma_alloc_coherent not allocating memory from CMA Reserved

2020-09-23 Thread Robin Murphy
On 2020-09-23 08:43, Sathyavathi M wrote: Hi All, I am trying to allocate coherent memory for 33 MB in kerenl driver. and for that i have reserved CMA of 1024 MB, but from dmesg, i can see that address reserved for cma is different and what i get with dma_alloc_coherent is different. My pc is

[PATCH v2 2/3] drm/panfrost: Support cache-coherent integrations

2020-09-22 Thread Robin Murphy
ppropriate cacheable outer-shareable attributes in order to generate the requisite snoop signals, and that CPU mappings don't create a mismatch by using a non-cacheable type either. Reviewed-by: Steven Price Tested-by: Neil Armstrong Signed-off-by: Robin Murphy --- drivers/gpu/drm/panfrost/panfros

[PATCH v2 3/3] arm64: dts: meson: Describe G12b GPU as coherent

2020-09-22 Thread Robin Murphy
snooping stale data from caches, which would account for at least some of the brokenness observed on this platform. Reviewed-by: Neil Armstrong Tested-by: Neil Armstrong Signed-off-by: Robin Murphy --- arch/arm64/boot/dts/amlogic/meson-g12b.dtsi | 4 1 file changed, 4 insertions(+) diff

[PATCH v2 1/3] iommu/io-pgtable-arm: Support coherency for Mali LPAE

2020-09-22 Thread Robin Murphy
accesses. As such, setting the TTBR_SHARE_OUTER bit does indeed get coherent pagetable walks working nicely for the coherent T620 in the Arm Juno SoC. Reviewed-by: Steven Price Tested-by: Neil Armstrong Signed-off-by: Robin Murphy --- drivers/iommu/io-pgtable-arm.c | 11 ++- 1 file changed

[PATCH v2 0/3] drm: panfrost: Coherency support

2020-09-22 Thread Robin Murphy
Hi all, Here's a quick v2 with the tags so far picked up and some inline commentary about the shareability domains for the pagetable code. Robin. Robin Murphy (3): iommu/io-pgtable-arm: Support coherency for Mali LPAE drm/panfrost: Support cache-coherent integrations arm64: dts: meson

Re: [PATCH v3 0/6] Convert the intel iommu driver to the dma-iommu api

2020-09-22 Thread Robin Murphy
On 2020-09-15 09:31, Tvrtko Ursulin wrote: On 15/09/2020 02:47, Lu Baolu wrote: Hi Tvrtko, On 9/14/20 4:04 PM, Tvrtko Ursulin wrote: Hi, On 12/09/2020 04:21, Lu Baolu wrote: Tom Murphy has almost done all the work. His latest patch series was posted here.

Re: [Intel-gfx] [PATCH v3 0/6] Convert the intel iommu driver to the dma-iommu api

2020-09-22 Thread Robin Murphy
On 2020-09-18 21:47, Logan Gunthorpe wrote: Hi Lu, On 2020-09-11 9:21 p.m., Lu Baolu wrote: Tom Murphy has almost done all the work. His latest patch series was posted here. https://lore.kernel.org/linux-iommu/20200903201839.7327-1-murph...@tcd.ie/ Thanks a lot! This series is a follow-up

Re: [PATCHv4 1/6] iommu/io-pgtable-arm: Add support to use system cache

2020-09-21 Thread Robin Murphy
On 2020-09-21 19:03, Will Deacon wrote: On Fri, Sep 11, 2020 at 07:57:18PM +0530, Sai Prakash Ranjan wrote: Add a quirk IO_PGTABLE_QUIRK_SYS_CACHE to override the attributes set in TCR for the page table walker when using system cache. I wonder if the panfrost folks can reuse this for the

Re: [PATCH 1/3] iommu/io-pgtable-arm: Support coherency for Mali LPAE

2020-09-21 Thread Robin Murphy
On 2020-09-21 18:57, Will Deacon wrote: On Wed, Sep 16, 2020 at 12:51:05AM +0100, Robin Murphy wrote: Midgard GPUs have ACE-Lite master interfaces which allows systems to integrate them in an I/O-coherent manner. It seems that from the GPU's viewpoint, the rest of the system is its outer

[PATCH] iommu/io-pgtable-arm: Clean up faulty sanity check

2020-09-21 Thread Robin Murphy
-by: Robin Murphy --- drivers/iommu/io-pgtable-arm.c | 5 - 1 file changed, 5 deletions(-) diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c index d77e881516a4..f87cbb822a3d 100644 --- a/drivers/iommu/io-pgtable-arm.c +++ b/drivers/iommu/io-pgtable-arm.c @@ -751,11

Re: arm-smmu 5000000.iommu: Cannot accommodate DMA offset for IOMMU page tables

2020-09-21 Thread Robin Murphy
On 2020-09-21 14:20, Naresh Kamboju wrote: [...] [2.256403] e1000e :01:00.0: Adding to iommu group 0 [2.261733] arm-smmu 500.iommu: Cannot accommodate DMA offset for IOMMU page tables Ah, I know what's going on there - the dma_range_map stuff has overlooked a subtlety, but

Re: [PATCH] iommu/arm-smmu-v3: Fix endianness annotations

2020-09-18 Thread Robin Murphy
:expected unsigned long long [usertype] *[assigned] strtab arm-smmu-v3.c:1424:39:got restricted __le64 [usertype] *l2ptr While harmless, they are incorrect and could hide actual errors during development. Fix them. Reviewed-by: Robin Murphy Signed-off-by: Jean-Philippe Brucker

Re: [PATCH v2 2/2] iommu/iova: Free global iova rcache on iova alloc failure

2020-09-18 Thread Robin Murphy
On 2020-08-20 13:49, vji...@codeaurora.org wrote: From: Vijayanand Jitta When ever an iova alloc request fails we free the iova ranges present in the percpu iova rcaches and then retry but the global iova rcache is not freed as a result we could still see iova alloc failure even after retry as

Re: [PATCH v2 1/2] iommu/iova: Retry from last rb tree node if iova search fails

2020-09-18 Thread Robin Murphy
his looks OK (IIRC it's basically what I originally suggested), so with the naming tweaked, Reviewed-by: Robin Murphy + +retry: do { - limit_pfn = min(limit_pfn, curr_iova->pfn_lo); - new_pfn = (limit_pfn - size) & align_mask; + high_pfn

Re: [PATCH] Handle init_iova_flush_queue failure in dma-iommu path

2020-09-18 Thread Robin Murphy
s good to me, but Robin should also have a look. Yup, seems reasonable, thanks Tom! Reviewed-by: Robin Murphy ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH 0/3] drm: panfrost: Coherency support

2020-09-17 Thread Robin Murphy
On 2020-09-16 18:46, Rob Herring wrote: On Wed, Sep 16, 2020 at 11:04 AM Alyssa Rosenzweig wrote: So I get a performance regression with the dma-coherent approach, even if it's clearly the cleaner. That's bizarre -- this should really be the faster of the two. Coherency may not be free.

[PATCH 3/3] arm64: dts: meson: Describe G12b GPU as coherent

2020-09-15 Thread Robin Murphy
snooping stale data from caches, which would account for at least some of the brokenness observed on this platform. Signed-off-by: Robin Murphy --- arch/arm64/boot/dts/amlogic/meson-g12b.dtsi | 4 1 file changed, 4 insertions(+) diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi b/arch

[PATCH 1/3] iommu/io-pgtable-arm: Support coherency for Mali LPAE

2020-09-15 Thread Robin Murphy
accesses. As such, setting the TTBR_SHARE_OUTER bit does indeed get coherent pagetable walks working nicely for the coherent T620 in the Arm Juno SoC. Reviewed-by: Steven Price Signed-off-by: Robin Murphy --- drivers/iommu/io-pgtable-arm.c | 5 - 1 file changed, 4 insertions(+), 1 deletion

[PATCH 2/3] drm/panfrost: Support cache-coherent integrations

2020-09-15 Thread Robin Murphy
ppropriate cacheable outer-shareable attributes in order to generate the requisite snoop signals, and that CPU mappings don't create a mismatch by using a non-cacheable type either. Signed-off-by: Robin Murphy --- drivers/gpu/drm/panfrost/panfrost_device.h | 1 + drivers/gpu/drm/panfrost/panfrost_dr

[PATCH 0/3] drm: panfrost: Coherency support

2020-09-15 Thread Robin Murphy
, provided Will's OK with that. Robin. Robin Murphy (3): iommu/io-pgtable-arm: Support coherency for Mali LPAE drm/panfrost: Support cache-coherent integrations arm64: dts: meson: Describe G12b GPU as coherent arch/arm64/boot/dts/amlogic/meson-g12b.dtsi | 4 drivers/gpu/drm/panfrost

Re: [PATCH v3 8/8] iommu/arm-smmu-qcom: Setup identity domain for boot mappings

2020-09-11 Thread Robin Murphy
On 2020-09-04 16:55, Bjorn Andersson wrote: With many Qualcomm platforms not having functional S2CR BYPASS a temporary IOMMU domain, without translation, needs to be allocated in order to allow these memory transactions. Unfortunately the boot loader uses the first few context banks, so rather

Re: [PATCH v3 6/8] iommu/arm-smmu: Add impl hook for inherit boot mappings

2020-09-11 Thread Robin Murphy
On 2020-09-04 16:55, Bjorn Andersson wrote: Add a new operation to allow platform implementations to inherit any stream mappings from the boot loader. Is there a reason we need an explicit step for this? The aim of the cfg_probe hook is that the SMMU software state should all be set up by

Re: [PATCHv4 6/6] iommu: arm-smmu-impl: Remove unwanted extra blank lines

2020-09-11 Thread Robin Murphy
On 2020-09-11 17:21, Sai Prakash Ranjan wrote: On 2020-09-11 21:37, Will Deacon wrote: On Fri, Sep 11, 2020 at 05:03:06PM +0100, Robin Murphy wrote: BTW am I supposed to have received 3 copies of everything? Because I did... Yeah, this seems to be happening for all of Sai's emails

Re: [PATCH 3/3] dma-mapping: introduce DMA range map, supplanting dma_pfn_offset

2020-09-11 Thread Robin Murphy
+*/ Apparently this one *does* want updating to use the MBUS interconnect bindings - as does the cedrus instance below - so no complaint there :) Other than those few trivial nitpicks, I think I've stared at this patch enough times now that even if there are any bugs left I'm not goi

Re: [PATCHv4 6/6] iommu: arm-smmu-impl: Remove unwanted extra blank lines

2020-09-11 Thread Robin Murphy
On 2020-09-11 15:28, Sai Prakash Ranjan wrote: There are few places in arm-smmu-impl where there are extra blank lines, remove them FWIW those were deliberate - sometimes I like a bit of subtle space to visually delineate distinct groups of definitions. I suppose it won't be to everyone's

Re: [PATCH 2/3] ARM/keystone: move the DMA offset handling under ifdef CONFIG_ARM_LPAE

2020-09-11 Thread Robin Murphy
On 2020-09-11 12:15, Russell King - ARM Linux admin wrote: On Thu, Sep 10, 2020 at 07:40:37AM +0200, Christoph Hellwig wrote: The DMA offset notifier can only be used if PHYS_OFFSET is at least KEYSTONE_HIGH_PHYS_START, which can't be represented by a 32-bit phys_addr_t. Currently the code

Re: [PATCH 2/3] ARM/keystone: move the DMA offset handling under ifdef CONFIG_ARM_LPAE

2020-09-11 Thread Robin Murphy
g to worry about in this series. Reviewed-by: Robin Murphy Signed-off-by: Christoph Hellwig --- arch/arm/mach-keystone/keystone.c | 4 1 file changed, 4 insertions(+) diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach-keystone/keystone.c index 638808c4e12247..dcd031ba84c

Re: [PATCH 1/3] ARM/dma-mapping: move various helpers from dma-mapping.h to dma-direct.h

2020-09-10 Thread Robin Murphy
be, Reviewed-by: Robin Murphy However I do wonder how much of this could be cleaned up further... Signed-off-by: Christoph Hellwig --- arch/arm/common/dmabounce.c| 2 +- arch/arm/include/asm/dma-direct.h | 70 ++ arch/arm/include/asm/dma-mapping.h | 70

Re: [trivial PATCH] treewide: Convert switch/case fallthrough; to break;

2020-09-10 Thread Robin Murphy
On 2020-09-09 21:06, Joe Perches wrote: fallthrough to a separate case/default label break; isn't very readable. Convert pseudo-keyword fallthrough; statements to a simple break; when the next label is case or default and the only statement in the next label block is break; Found using: $

Re: [PATCH 12/12] dma-mapping: move the dma_declare_coherent_memory documentation

2020-09-10 Thread Robin Murphy
), so meh. Reviewed-by: Robin Murphy Signed-off-by: Christoph Hellwig --- Documentation/core-api/dma-api.rst | 24 kernel/dma/coherent.c | 17 + 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/Documentation/core-api/dma

Re: [PATCH 11/12] dma-mapping: move dma_common_{mmap, get_sgtable} out of mapping.c

2020-09-10 Thread Robin Murphy
On 2020-09-08 17:47, Christoph Hellwig wrote: Add a new file that contains helpera for misc DMA ops, which is only The Latin plural of the singular "helperum", I guess? :P built when CONFIG_DMA_OPS is set. Reviewed-by: Robin Murphy Signed-off-by: Christoph Hellwig ---

Re: [PATCH 10/12] dma-direct: rename and cleanup __phys_to_dma

2020-09-10 Thread Robin Murphy
. Reviewed-by: Robin Murphy Signed-off-by: Christoph Hellwig --- arch/arm/include/asm/dma-direct.h | 2 +- arch/mips/bmips/dma.c | 2 +- arch/mips/cavium-octeon/dma-octeon.c | 2 +- arch/mips/include/asm/dma-direct.h | 2 +- arch/mips/loongson2ef/fuloong-2e

Re: [PATCH 09/12] dma-direct: remove __dma_to_phys

2020-09-10 Thread Robin Murphy
realising that it all does just come back to __sme_clr(), which is indeed a no-op for everyone other than AMD, any simplification of this mess is indeed welcome :) Unless I've massively misunderstood how SME is supposed to work, Reviewed-by: Robin Murphy Signed-off-by: Christoph Hellwig --- arch/a

Re: [PATCH 08/12] dma-direct: use phys_to_dma_direct in dma_direct_alloc

2020-09-10 Thread Robin Murphy
On 2020-09-08 17:47, Christoph Hellwig wrote: Replace the currently open code copy. Reviewed-by: Robin Murphy Signed-off-by: Christoph Hellwig --- kernel/dma/direct.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c index

Re: [PATCH 07/12] dma-direct: lift gfp_t manipulation out of__dma_direct_alloc_pages

2020-09-10 Thread Robin Murphy
On 2020-09-08 17:47, Christoph Hellwig wrote: Move the detailed gfp_t setup from __dma_direct_alloc_pages into the caller to clean things up a little. Other than a mild nitpick that it might be nicer to spend one extra line to keep both gfp adjustments next to each other, Reviewed-by: Robin

Re: [PATCH 06/12] dma-direct: remove dma_direct_{alloc,free}_pages

2020-09-10 Thread Robin Murphy
On 2020-09-08 17:47, Christoph Hellwig wrote: Just merge these helpers into the main dma_direct_{alloc,free} routines, as the additional checks are always false for the two callers. Reviewed-by: Robin Murphy Signed-off-by: Christoph Hellwig --- arch/x86/kernel/amd_gart_64.c | 6

Re: [PATCH 04/12] dma-mapping: fix DMA_OPS dependencies

2020-09-10 Thread Robin Murphy
objection to this one-liner as-is, so (modulo the couple of commit message typos), Reviewed-by: Robin Murphy (of course the hunk below is unquestionably OK) Robin. help This option is selected by any driver which registers a diff --git a/kernel/dma/Kconfig b/kernel/dma/Kco

Re: [PATCH 2/2] dma-debug: remove all exports

2020-09-10 Thread Robin Murphy
dma_addr_t dma_addr) put_hash_bucket(bucket, flags); } -EXPORT_SYMBOL(debug_dma_mapping_error); Ditto this for dma_mapping_error(). We hardly want to discourage modules from calling that ;) With those fixed (unless I've missed some other preceding change), Reviewed-by: Robin Murph

Re: [PATCH 1/2] dma-mapping: remove the dma_dummy_ops export

2020-09-10 Thread Robin Murphy
On 2020-09-08 17:39, Christoph Hellwig wrote: dma_dummy_ops is only used by the ACPI code, which can't be modular. Reviewed-by: Robin Murphy Signed-off-by: Christoph Hellwig --- kernel/dma/dummy.c | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/dma/dummy.c b/kernel/dma/dummy.c

Re: [PATCH] iommu/dma: Fix IOVA reserve dma ranges

2020-09-09 Thread Robin Murphy
On 2020-09-09 06:32, Srinath Mannam wrote: Fix IOVA reserve failure for memory regions listed in dma-ranges in the following cases. - start address of memory region is 0x0. That's fair enough, and in fact generalises to the case of zero-sized gaps between regions, which is indeed an

Re: [PATCH] iommu/iova: Replace cmpxchg with xchg in queue_iova

2020-09-04 Thread Robin Murphy
Hi Joerg, On 2020-09-04 10:37, Joerg Roedel wrote: Adding Robin. Did you miss that I've reviewed this already? :) https://lore.kernel.org/linux-iommu/3afcc7b2-0bfb-b79c-513f-1beb66c5f...@arm.com/ Robin. On Thu, Aug 27, 2020 at 04:43:54PM +0800, Shaokun Zhang wrote: From: Yuqi Jin The

[PATCH] iommu/dma: Remove broken huge page handling

2020-09-03 Thread Robin Murphy
correctly, so just get rid of it - there's little point going to the effort of allocating huge pages if we're only going to split them anyway. Reported-by: Roman Gushchin Signed-off-by: Robin Murphy --- drivers/iommu/dma-iommu.c | 13 + 1 file changed, 5 insertions(+), 8 deletions

Re: [PATCH] iommu: Allocate dev_iommu before accessing priv data

2020-09-02 Thread Robin Murphy
On 2020-09-02 06:32, Torsten Hilbrich wrote: After updating from v5.8 to v5.9-rc2 I noticed some problems when booting a system with kernel cmdline "intel_iommu=on,igfx_off". The following stacktrace was produced: <6>[0.00] Command line: BOOT_IMAGE=/isolinux/bzImage console=tty1

Re: [PATCH v9 31/32] media: pci: fix common ALSA DMA-mapping related codes

2020-09-01 Thread Robin Murphy
On 2020-08-26 07:33, Marek Szyprowski wrote: The Documentation/DMA-API-HOWTO.txt states that dma_map_sg returns the numer of the created entries in the DMA address space. However the subsequent calls to dma_sync_sg_for_{device,cpu} and dma_unmap_sg must be called with the original number of

Re: [PATCH v9 32/32] videobuf2: use sgtable-based scatterlist wrappers

2020-09-01 Thread Robin Murphy
properly did all the scaterlist related calls. ^^ typo Otherwise, Reviewed-by: Robin Murphy Signed-off-by: Marek Szyprowski --- .../common/videobuf2/videobuf2-dma-contig.c | 34 --- .../media/common/videobuf2/videobuf2-dma-sg.c | 32 +++-- .../common

Re: [PATCH v9 30/32] samples: vfio-mdev/mbochs: fix common struct sg_table related issues

2020-09-01 Thread Robin Murphy
/paste safe. While touching this code, also add missing call to dma_unmap_sgtable. Reviewed-by: Robin Murphy Signed-off-by: Marek Szyprowski --- samples/vfio-mdev/mbochs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-mdev

Re: [PATCH v9 29/32] rapidio: fix common struct sg_table related issues

2020-09-01 Thread Robin Murphy
/paste safe. Reviewed-by: Robin Murphy Signed-off-by: Marek Szyprowski --- drivers/rapidio/devices/rio_mport_cdev.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/rapidio/devices/rio_mport_cdev.c b/drivers/rapidio/devices/rio_mport_cdev.c index

Re: [PATCH v9 28/32] misc: fastrpc: fix common struct sg_table related issues

2020-09-01 Thread Robin Murphy
/paste safe. Reviewed-by: Robin Murphy Signed-off-by: Marek Szyprowski --- drivers/misc/fastrpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 7939c55daceb..9d6867749316 100644 --- a/drivers/misc/fastrpc.c

Re: [PATCH v9 24/32] drm: host1x: fix common struct sg_table related issues

2020-09-01 Thread Robin Murphy
/paste safe. Reviewed-by: Robin Murphy Signed-off-by: Marek Szyprowski --- drivers/gpu/host1x/job.c | 22 -- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c index 89b6c14b7392..82d0a60ba3f7 100644

Re: [PATCH v9 18/32] drm: tegra: fix common struct sg_table related issues

2020-09-01 Thread Robin Murphy
/paste safe. Reviewed-by: Robin Murphy Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/tegra/gem.c | 27 ++- drivers/gpu/drm/tegra/plane.c | 15 +-- 2 files changed, 15 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/tegra/gem.c b

Re: [PATCH v9 17/32] drm: rockchip: fix common struct sg_table related issues

2020-09-01 Thread Robin Murphy
/paste safe. Reviewed-by: Robin Murphy (Until now I hadn't noticed the crimes against the API that rockchip_gem_get_pages() is committing, but it's not this patch's fault... I'll have to take a closer look at that) Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/rockchip

Re: [Intel-gfx] [PATCH v9 08/32] drm: i915: fix common struct sg_table related issues

2020-09-01 Thread Robin Murphy
: Bartlomiej Zolnierkiewicz ; David Airlie ; intel-...@lists.freedesktop.org; Robin Murphy ; Christoph Hellwig ; linux-arm- ker...@lists.infradead.org; Marek Szyprowski Subject: [Intel-gfx] [PATCH v9 08/32] drm: i915: fix common struct sg_table related issues The Documentation/DMA-API-HOWTO.txt

Re: [PATCH v9 16/32] drm: rockchip: use common helper for a scatterlist contiguity check

2020-09-01 Thread Robin Murphy
On 2020-08-26 07:33, Marek Szyprowski wrote: Use common helper for checking the contiguity of the imported dma-buf. Reviewed-by: Robin Murphy Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 19 +-- 1 file changed, 1 insertion(+), 18

Re: [PATCH v9 14/32] drm: omapdrm: fix common struct sg_table related issues

2020-09-01 Thread Robin Murphy
On 2020-08-26 07:32, Marek Szyprowski wrote: The Documentation/DMA-API-HOWTO.txt states that the dma_map_sg() function returns the number of the created entries in the DMA address space. However the subsequent calls to the dma_sync_sg_for_{device,cpu}() and dma_unmap_sg must be called with the

Re: [PATCH v9 13/32] drm: omapdrm: use common helper for extracting pages array

2020-09-01 Thread Robin Murphy
ret = drm_prime_sg_to_page_addr_arrays(sgt, pages, NULL, + npages); + if (WARN_ON(ret)) { Again, I'm inclined to think the WARN_ON should remain in drm_prime_sg_to_page_addr_arrays() itself such that it could be removed here, but either way,

Re: [PATCH v9 12/32] drm: msm: fix common struct sg_table related issues

2020-09-01 Thread Robin Murphy
On 2020-08-26 07:32, Marek Szyprowski wrote: The Documentation/DMA-API-HOWTO.txt states that the dma_map_sg() function returns the number of the created entries in the DMA address space. However the subsequent calls to the dma_sync_sg_for_{device,cpu}() and dma_unmap_sg must be called with the

Re: [PATCH v9 11/32] drm: mediatek: use common helper for extracting pages array

2020-09-01 Thread Robin Murphy
On 2020-08-26 07:32, Marek Szyprowski wrote: Use common helper for converting a sg_table object into struct page pointer array. Reviewed-by: Robin Murphy Side note: is mtk_drm_gem_prime_vmap() missing a call to sg_free_table(sgt) before its kfree(sgt)? Signed-off-by: Marek Szyprowski

Re: [PATCH v9 10/32] drm: mediatek: use common helper for a scatterlist contiguity check

2020-09-01 Thread Robin Murphy
On 2020-08-26 07:32, Marek Szyprowski wrote: Use common helper for checking the contiguity of the imported dma-buf and do this check before allocating resources, so the error path is simpler. Reviewed-by: Robin Murphy Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/mediatek

Re: [PATCH v9 08/32] drm: i915: fix common struct sg_table related issues

2020-09-01 Thread Robin Murphy
oduces the common DMA-mapping wrappers operating directly on the struct sg_table objects to the dmabuf related functions, so the other drivers, which might share buffers with i915 could rely on the properly set nents and orig_nents values. This one looks mechanical enough :) Reviewed-by: Robin

Re: [PATCH v9 05/32] drm: etnaviv: fix common struct sg_table related issues

2020-09-01 Thread Robin Murphy
take a closer look to figure this out, but AFAICS it does indeed work out as a simpler way of achieving the exact same result, and in fact neatly mirrors how etnaviv_context_map() itself cleans up. Reviewed-by: Robin Murphy return ret; } @@ -113,7 +106,7 @@ static void etnaviv_iommu_unmap

Re: [PATCH v9 04/32] drm: armada: fix common struct sg_table related issues

2020-09-01 Thread Robin Murphy
On 2020-08-26 07:32, Marek Szyprowski wrote: The Documentation/DMA-API-HOWTO.txt states that the dma_map_sg() function returns the number of the created entries in the DMA address space. However the subsequent calls to the dma_sync_sg_for_{device,cpu}() and dma_unmap_sg must be called with the

Re: [PATCH v9 03/32] drm: core: fix common struct sg_table related issues

2020-09-01 Thread Robin Murphy
kfree(sgt); Should this be a separate patch to add the missing error handling to the existing code first? Otherwise the rest of the mechanical conversion looks straightforward enough, and I'm not the separation-of-concerns police (for this subsystem, at least), so either way, Review

Re: [PATCH v9 01/32] drm: prime: add common helper to check scatterlist contiguity

2020-09-01 Thread Robin Murphy
to the common sgtable API level, but let's get the individual subsystems straightened out first then worry about consolidation later. Reviewed-by: Robin Murphy Signed-off-by: Marek Szyprowski Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/drm_gem_cma_helper.c | 23

Re: [PATCH v9 02/32] drm: prime: use sgtable iterators in drm_prime_sg_to_page_addr_arrays()

2020-09-01 Thread Robin Murphy
way. I'm also assuming this isn't called in performance-critical paths with massive lists such that the two separate iterations might have a noticeable impact. Nits aside, Reviewed-by: Robin Murphy Signed-off-by: Marek Szyprowski Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/drm_prime.c

Re: [PATCH] iommu/arm-smmu-v3: add tracepoints for cmdq_issue_cmdlist

2020-08-28 Thread Robin Murphy
On 2020-08-28 12:02, Song Bao Hua (Barry Song) wrote: -Original Message- From: Will Deacon [mailto:w...@kernel.org] Sent: Friday, August 28, 2020 10:29 PM To: Song Bao Hua (Barry Song) Cc: iommu@lists.linux-foundation.org; linux-arm-ker...@lists.infradead.org; robin.mur...@arm.com;

Re: [PATCH] iommu/iova: Replace cmpxchg with xchg in queue_iova

2020-08-27 Thread Robin Murphy
that the value changes from 0 to 1 or from 1 to 1. Looks reasonable to me - the "compare" part is already covered by the separate atomic_read(), and as you say there's no harm if the "exchange" part races as long as it's still atomic. Reviewed-by: Robin Murphy Cc: Joer

Re: [RESEND PATCH v4] iommu/mediatek: check 4GB mode by reading infracfg

2020-08-27 Thread Robin Murphy
On 2020-08-27 06:31, Yong Wu wrote: On Wed, 2020-08-26 at 16:56 +0800, Miles Chen wrote: In previous discussion [1] and [2], we found that it is risky to use max_pfn or totalram_pages to tell if 4GB mode is enabled. Check 4GB mode by reading infracfg register, remove the usage of the

Re: [PATCH 13/18] iommu/tegra: Add IOMMU_DOMAIN_DMA support

2020-08-27 Thread Robin Murphy
On 2020-08-27 16:45, Thierry Reding wrote: On Thu, Aug 20, 2020 at 04:08:32PM +0100, Robin Murphy wrote: Now that arch/arm is wired up for default domains and iommu-dma, implement the corresponding driver-side support for DMA domains. Signed-off-by: Robin Murphy --- drivers/iommu/tegra

Re: [PATCH 0/8] Convert the intel iommu driver to the dma-iommu api

2020-08-26 Thread Robin Murphy
Hi Tom, On 2019-12-21 15:03, Tom Murphy wrote: This patchset converts the intel iommu driver to the dma-iommu api. While converting the driver I exposed a bug in the intel i915 driver which causes a huge amount of artifacts on the screen of my laptop. You can see a picture of it here:

Re: [PATCH] iommu: Add support to filter non-strict/lazy mode based on device names

2020-08-26 Thread Robin Murphy
On 2020-08-26 13:17, Sai Prakash Ranjan wrote: On 2020-08-26 17:07, Robin Murphy wrote: On 2020-08-25 16:42, Sai Prakash Ranjan wrote: Currently the non-strict or lazy mode of TLB invalidation can only be set for all or no domains. This works well for development platforms where setting

Re: [PATCH] iommu: Add support to filter non-strict/lazy mode based on device names

2020-08-26 Thread Robin Murphy
On 2020-08-25 16:42, Sai Prakash Ranjan wrote: Currently the non-strict or lazy mode of TLB invalidation can only be set for all or no domains. This works well for development platforms where setting to non-strict/lazy mode is fine for performance reasons but on production devices, we need a

Re: [PATCH 16/18] staging/media/tegra-vde: Clean up IOMMU workaround

2020-08-24 Thread Robin Murphy
On 2020-08-23 22:34, Dmitry Osipenko wrote: 21.08.2020 03:11, Robin Murphy пишет: ... Hello, Robin! Thank you for yours work! Some drivers, like this Tegra VDE (Video Decoder Engine) driver for example, do not want to use implicit IOMMU domain. That isn't (intentionally) changing here

Re: Where are iommu region setup in dma_alloc_from_dev_coherent() track?

2020-08-24 Thread Robin Murphy
On 2020-08-24 08:01, Сергей Пыптев wrote: Hi! I try to port our 3D scanner driver to kernel v4.9 and I have a trouble. I can not find a correct way to allocate DMA memory with correct iommu setup. Could you help me? HW: Tegra X1 and Tegra X2 (arm64), our PCIe bus master device uses about

  1   2   3   4   5   6   7   8   9   10   >