Re: [PATCH] iommu: dart: Add missing module owner to ops structure

2022-05-02 Thread Sven Peter
On Mon, May 2, 2022, at 11:22, Hector Martin wrote: > This is required to make loading this as a module work. > > Signed-off-by: Hector Martin this could probably use a Fixes: 46d1fb072e76 ("iommu/dart: Add DART iommu driver") but otherwise Reviewed-by: Sven Pet

Re: [PATCH] iommu/dart: check return value after calling platform_get_resource()

2022-04-26 Thread Sven Peter via iommu
eref. > And use devm_platform_get_and_ioremap_resource() to simplify code. > > Fixes: 46d1fb072e76 ("iommu/dart: Add DART iommu driver") > Signed-off-by: Yang Yingliang Reviewed-by: Sven Peter Thanks, Sven ___ iommu mailing list i

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

2022-04-15 Thread Sven Peter via iommu
On Thu, Apr 14, 2022, at 14:42, 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 Tested-by: Sven Peter Reviewed-by: Sven Peter Can't wait until that saga is complet

[PATCH] MAINTAINERS: merge DART into ARM/APPLE MACHINE

2022-04-12 Thread Sven Peter via iommu
It's the same people anyway. Signed-off-by: Sven Peter --- MAINTAINERS | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index fd768d43e048..5af879de869c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1375,14 +1375,6 @@ L: linux

[PATCH 4/4] iommu: dart: Support t6000 variant

2021-11-17 Thread Sven Peter via iommu
The M1 Pro/Max SoCs come with a new variant of DART which supports a larger physical address space with a slightly different PTE format. Pass through the correct paddr address space size to the io-pgtable code which will take care of the rest. Signed-off-by: Sven Peter --- drivers/iommu/apple

[PATCH 1/4] dt-bindings: iommu: dart: add t6000 compatible

2021-11-17 Thread Sven Peter via iommu
The M1 Max/Pro SoCs come with a new DART variant that is incompatible with the previous one. Add a new compatible for those. Signed-off-by: Sven Peter --- Documentation/devicetree/bindings/iommu/apple,dart.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation

[PATCH 3/4] iommu/io-pgtable: Add DART PTE support for t6000

2021-11-17 Thread Sven Peter via iommu
The DARTs present in the M1 Pro/Max SoC support a 42bit physical address space by shifting the paddr and extending its mask inside the PTE. Signed-off-by: Sven Peter --- drivers/iommu/io-pgtable-arm.c | 30 +- include/linux/io-pgtable.h | 2 ++ 2 files changed

[PATCH 2/4] iommu/io-pgtable: Add DART subpage protection support

2021-11-17 Thread Sven Peter via iommu
DART allows to only expose a subpage to the device. While this is an optional feature on the M1 DARTs the new ones present on the Pro/Max models require this field in every PTE. Signed-off-by: Sven Peter --- drivers/iommu/io-pgtable-arm.c | 10 ++ 1 file changed, 10 insertions(+) diff

[PATCH 0/4] iommu: M1 Pro/Max DART support

2021-11-17 Thread Sven Peter via iommu
SoCs using the LPAE format with a large physical address space [1]. Sven [1] https://lore.kernel.org/linux-iommu/a2b45243-7e0a-a2ac-4e14-5256a3e7a...@arm.com/T/#t Sven Peter (4): dt-bindings: iommu: dart: add t6000 compatible iommu/io-pgtable: Add DART subpage protection support iommu/io

Re: [PATCH v3 4/6] iommu: Move IOMMU pagesize check to attach_device

2021-10-23 Thread Sven Peter via iommu
t;>> Lu Baolu wrote: >>>>> >>>>> On 10/20/21 10:22 PM, Marc Zyngier wrote: >>>>>> On Wed, 20 Oct 2021 06:21:44 +0100, >>>>>> Lu Baolu wrote: >>>>>>> >>>>>>> On 2021/10/20 0:37, Sve

Re: [PATCH v3 4/6] iommu: Move IOMMU pagesize check to attach_device

2021-10-21 Thread Sven Peter via iommu
On Wed, Oct 20, 2021, at 07:21, Lu Baolu wrote: > On 2021/10/20 0:37, Sven Peter via iommu wrote: >> The iova allocator is capable of handling any granularity which is a power >> of two. Remove the much stronger condition that the granularity must be >> smaller or equal

[PATCH v3 6/6] iommu/dart: Remove force_bypass logic

2021-10-19 Thread Sven Peter via iommu
Now that the dma-iommu API supports IOMMU granules which are larger than the CPU page size and that the kernel no longer runs into a BUG_ON when devices are attached to a domain with such a granule there's no need to force bypass mode anymore. Signed-off-by: Sven Peter --- drivers/iommu/apple

[PATCH v3 5/6] iommu: Introduce __IOMMU_DOMAIN_LP

2021-10-19 Thread Sven Peter via iommu
are not yet supported. Those require additional changes to allow aligning swiotlb buffers to granularities larger than PAGE_SIZE. Signed-off-by: Sven Peter --- drivers/iommu/iommu.c | 9 +++-- include/linux/iommu.h | 13 +++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff

[PATCH v3 4/6] iommu: Move IOMMU pagesize check to attach_device

2021-10-19 Thread Sven Peter via iommu
-by: Sven Peter --- drivers/iommu/iommu.c | 35 --- drivers/iommu/iova.c | 7 --- include/linux/iommu.h | 5 + 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index dd7863e453a5..28896739964b

[PATCH v3 3/6] iommu/dma: Support granule > PAGE_SIZE allocations

2021-10-19 Thread Sven Peter via iommu
. Some spillover pages might be allocated at the end, which can however immediately be freed. Signed-off-by: Sven Peter --- drivers/iommu/dma-iommu.c | 103 ++ 1 file changed, 93 insertions(+), 10 deletions(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers

[PATCH v3 2/6] iommu/dma: Support granule > PAGE_SIZE in dma_map_sg

2021-10-19 Thread Sven Peter via iommu
Add support to iommu_dma_map_sg's impedance matching to also align sg_lists correctly when the IOMMU granule is larger than PAGE_SIZE. Co-developed-by: Robin Murphy Signed-off-by: Robin Murphy Signed-off-by: Sven Peter --- drivers/iommu/dma-iommu.c | 25 - 1 file

[PATCH v3 1/6] iommu/dma: Disable get_sgtable for granule > PAGE_SIZE

2021-10-19 Thread Sven Peter via iommu
While this function *probably* works correctly without any changes for granule > PAGE_SIZE I don't have any code to actually test it and cannot reason about how the function is supposed to work. Disable it instead until we run into a use case where it's required. Signed-off-by: Sven Pe

[PATCH v3 0/6] Support IOMMU page sizes larger than the CPU page size

2021-10-19 Thread Sven Peter via iommu
s is essentially done by always mapping the encapsulating IOMMU page and adjusting the returned iova offset. There are also changes to only allow DMA domains to make use of this and prevent UNMANAGED domains from encountering unexpected situations. Best, Sven Sven Peter (6): iommu/dma: Dis

[PATCH] iommu/dart: Initialize DART_STREAMS_ENABLE

2021-10-19 Thread Sven Peter via iommu
) however have some streams disabled initially. Make sure those work by initializing DART_STREAMS_ENABLE during reset. Reported-by: Martin PoviĊĦer Signed-off-by: Sven Peter --- While this could technically count as a fix I don't think it needs to go to 5.15 since no driver that requires

Re: [PATCH] iommu/dart: use kmemdup instead of kzalloc and memcpy

2021-10-16 Thread Sven Peter via iommu
2 deletions(-) Looks good to me, thanks! Acked-by: Sven Peter Sven ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

[PATCH] iommu/dart: Clear sid2group entry when a group is freed

2021-09-24 Thread Sven Peter via iommu
Fixes: 46d1fb072e76b161 ("iommu/dart: Add DART iommu driver") Reported-by: Marc Zyngier Signed-off-by: Sven Peter --- drivers/iommu/apple-dart.c | 38 +++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/apple-dart.c b/dri

[PATCH] iommu/dart: Remove iommu_flush_ops

2021-09-21 Thread Sven Peter via iommu
iommu_release_device+0x50/0xa0 [...] Fixes: 46d1fb072e76b161 ("iommu/dart: Add DART iommu driver") Reported-by: Marc Zyngier Signed-off-by: Sven Peter --- drivers/iommu/apple-dart.c | 18 -- 1 file changed, 18 deletions(-) diff --git a/drivers/iommu/apple-dart.c b/dri

Re: [PATCH v2 3/8] iommu/dma: Disable get_sgtable for granule > PAGE_SIZE

2021-09-03 Thread Sven Peter via iommu
On Fri, Sep 3, 2021, at 17:45, Robin Murphy wrote: > On 2021-09-03 16:16, Sven Peter wrote: > > > > > > On Thu, Sep 2, 2021, at 21:42, Robin Murphy wrote: > >> On 2021-09-02 19:19, Sven Peter wrote: > >>> > >>> > >>> On Wed,

Re: [PATCH v2 3/8] iommu/dma: Disable get_sgtable for granule > PAGE_SIZE

2021-09-03 Thread Sven Peter via iommu
On Thu, Sep 2, 2021, at 21:42, Robin Murphy wrote: > On 2021-09-02 19:19, Sven Peter wrote: > > > > > > On Wed, Sep 1, 2021, at 23:10, Alyssa Rosenzweig wrote: > >>> My biggest issue is that I do not understand how this function is supposed > >>

Re: [PATCH v2 3/8] iommu/dma: Disable get_sgtable for granule > PAGE_SIZE

2021-09-02 Thread Sven Peter via iommu
On Wed, Sep 1, 2021, at 23:10, Alyssa Rosenzweig wrote: > > My biggest issue is that I do not understand how this function is supposed > > to be used correctly. It would work fine as-is if it only ever gets passed > > buffers > > allocated by the coherent API but there's not way to check or

Re: [PATCH v2 6/8] iommu: Move IOMMU pagesize check to attach_device

2021-09-01 Thread Sven Peter via iommu
On Tue, Aug 31, 2021, at 23:39, Alyssa Rosenzweig wrote: > > + if ((1 << __ffs(domain->pgsize_bitmap)) > PAGE_SIZE) { > > Not a fan of this construction. Could you assign `(1 << > __ffs(domain->pgsize_bitmap))` to an appropriately named temporary (e.g > min_io_pgsize) so it's clearer what's

Re: [PATCH v2 3/8] iommu/dma: Disable get_sgtable for granule > PAGE_SIZE

2021-09-01 Thread Sven Peter via iommu
result will be a single contiguous block in IOVA space and doesn't required the sgt roundtrip. Sven > On Sat, Aug 28, 2021 at 05:36:37PM +0200, Sven Peter wrote: > > Pretend that iommu_dma_get_sgtable is not implemented when > > granule > PAGE_SIZE since I can neither test

Re: [PATCH v2 2/8] iommu/dma: Fail unaligned map requests for untrusted devs

2021-08-28 Thread Sven Peter via iommu
, Aug 28, 2021, at 17:36, Sven Peter wrote: > If swiotlb is enabled we should never try to create any mappings that > would expose more memory than requested to the device. > WARN_ON and refuse those mappings just in case. > > Signed-off-by: Sven Peter > --- > drivers/

[PATCH v2 8/8] iommu/dart: Remove force_bypass logic

2021-08-28 Thread Sven Peter via iommu
Now that the dma-iommu API supports IOMMU granules which are larger than the CPU page size and that the kernel no longer runs into a BUG_ON when devices are attached to a domain with such a granule there's no need to force bypass mode anymore. Signed-off-by: Sven Peter --- drivers/iommu/apple

[PATCH v2 7/8] iommu: Introduce __IOMMU_DOMAIN_LP

2021-08-28 Thread Sven Peter via iommu
__IOMMU_DOMAIN_LP (large pages) indicates that a domain can handle conditions where PAGE_SIZE might be smaller than the IOMMU page size. Always allow attaching devices to such domains and set the flag for IOMMU_DOMAIN_DMA, which can now handle these situations. Signed-off-by: Sven Peter

[PATCH v2 6/8] iommu: Move IOMMU pagesize check to attach_device

2021-08-28 Thread Sven Peter via iommu
-by: Sven Peter --- drivers/iommu/iommu.c | 34 +++--- drivers/iommu/iova.c | 7 --- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index b4499b1915fa..f02b727d3054 100644 --- a/drivers/iommu/iommu.c

[PATCH v2 4/8] iommu/dma: Support granule > PAGE_SIZE in dma_map_sg

2021-08-28 Thread Sven Peter via iommu
Add support to iommu_dma_map_sg's impedance matching to also align sg_lists correctly when the IOMMU granule is larger than PAGE_SIZE. Co-developed-by: Robin Murphy Signed-off-by: Robin Murphy Signed-off-by: Sven Peter --- drivers/iommu/dma-iommu.c | 18 ++ 1 file changed, 10

[PATCH v2 5/8] iommu/dma: Support PAGE_SIZE < iovad->granule allocations

2021-08-28 Thread Sven Peter via iommu
. Some spillover pages might be allocated at the end, which can however immediately be freed. Signed-off-by: Sven Peter --- drivers/iommu/dma-iommu.c | 99 +++ 1 file changed, 89 insertions(+), 10 deletions(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers

[PATCH v2 3/8] iommu/dma: Disable get_sgtable for granule > PAGE_SIZE

2021-08-28 Thread Sven Peter via iommu
Pretend that iommu_dma_get_sgtable is not implemented when granule > PAGE_SIZE since I can neither test this function right now nor do I fully understand how it is used. Signed-off-by: Sven Peter --- drivers/iommu/dma-iommu.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/driv

[PATCH v2 1/8] iommu/dma: Align size for untrusted devs to IOVA granule

2021-08-28 Thread Sven Peter via iommu
Signed-off-by: Sven Peter --- drivers/iommu/dma-iommu.c | 40 ++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index d0bc8c06e1a4..e8eae34e9e4f 100644 --- a/drivers/iommu/dma-iommu.c +

[PATCH v2 2/8] iommu/dma: Fail unaligned map requests for untrusted devs

2021-08-28 Thread Sven Peter via iommu
If swiotlb is enabled we should never try to create any mappings that would expose more memory than requested to the device. WARN_ON and refuse those mappings just in case. Signed-off-by: Sven Peter --- drivers/iommu/dma-iommu.c | 9 - 1 file changed, 8 insertions(+), 1 deletion

[PATCH v2 0/8] Support IOMMU page sizes larger than the CPU page size

2021-08-28 Thread Sven Peter via iommu
lso on iommu/core). It won't apply cleanly on apple/dart since it already takes Robin's DMA domain cleanup series into account. Best, Sven Sven Peter (8): iommu/dma: Align size for untrusted devs to IOVA granule iommu/dma: Fail unaligned map requests for untrusted devs iommu/dma: Disa

Re: [PATCH v4 00/24] iommu: Refactor DMA domain strictness

2021-08-21 Thread Sven Peter via iommu
Just tested your branch and everything works. Feel free to add Acked-by: Sven Peter Tested-by: Sven Peter Best, Sven ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [iommu:apple/dart 3/3] drivers/iommu/apple-dart.c:730:17: error: initialization of 'size_t (*)(struct iommu_domain *, long unsigned int, size_t, struct iommu_iotlb_gather *)' {aka 'long unsigned

2021-08-16 Thread Sven Peter via iommu
On Thu, Aug 12, 2021, at 13:29, Joerg Roedel wrote: > Hi Sven, > > On Tue, Aug 10, 2021 at 08:09:53AM +0200, Sven Peter wrote: > > This happens because apple/dart is missing the "Optimizing > > iommu_[map/unmap] performance" > > series which is already

Re: [RFC PATCH 2/3] iommu/dma-iommu: Support iovad->granule > PAGE_SIZE

2021-08-11 Thread Sven Peter via iommu
On Tue, Aug 10, 2021, at 11:51, Robin Murphy wrote: > On 2021-08-09 21:45, Sven Peter wrote: > > > > > > On Mon, Aug 9, 2021, at 19:41, Robin Murphy wrote: > >> On 2021-08-07 12:47, Sven Peter via iommu wrote: > >>> > >>> > >>>

Re: [PATCH] iommu: APPLE_DART should depend on ARCH_APPLE

2021-08-11 Thread Sven Peter via iommu
Good catch, thanks! Acked-by: Sven Peter Sven On Tue, Aug 10, 2021, at 15:47, Geert Uytterhoeven wrote: > The Apple DART (Device Address Resolution Table) IOMMU is only present > on Apple ARM SoCs like the M1. Hence add a dependency on ARCH_APPLE, to > prevent asking the u

Re: [iommu:apple/dart 3/3] drivers/iommu/apple-dart.c:730:17: error: initialization of 'size_t (*)(struct iommu_domain *, long unsigned int, size_t, struct iommu_iotlb_gather *)' {aka 'long unsigned

2021-08-10 Thread Sven Peter via iommu
evice_group, >738.of_xlate = apple_dart_of_xlate, > 739 .def_domain_type = apple_dart_def_domain_type, >740.pgsize_bitmap = -1UL, /* Restricted during dart probe > */ >741}; >742 > > --- > 0-DAY CI Kernel Test Service, Intel Corporation > https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org > > Attachments: > * .config.gz -- Sven Peter ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [RFC PATCH 2/3] iommu/dma-iommu: Support iovad->granule > PAGE_SIZE

2021-08-09 Thread Sven Peter via iommu
On Mon, Aug 9, 2021, at 19:41, Robin Murphy wrote: > On 2021-08-07 12:47, Sven Peter via iommu wrote: > > > > > > On Fri, Aug 6, 2021, at 20:04, Robin Murphy wrote: > >> On 2021-08-06 16:55, Sven Peter via iommu wrote: > >>> @@ -1006,6 +1019,31 @@

Re: [RFC PATCH 2/3] iommu/dma-iommu: Support iovad->granule > PAGE_SIZE

2021-08-09 Thread Sven Peter via iommu
Hi, On Mon, Aug 9, 2021, at 20:37, Robin Murphy wrote: > On 2021-08-07 09:41, Sven Peter wrote: > > Hi, > > > > Thanks a lot for quick reply! > > > > On Fri, Aug 6, 2021, at 20:04, Robin Murphy wrote: > >> On 2021-08-06 16:55, Sven Peter via iommu

Re: [RFC PATCH 2/3] iommu/dma-iommu: Support iovad->granule > PAGE_SIZE

2021-08-07 Thread Sven Peter via iommu
On Fri, Aug 6, 2021, at 20:04, Robin Murphy wrote: > On 2021-08-06 16:55, Sven Peter via iommu wrote: > > @@ -1006,6 +1019,31 @@ static int iommu_dma_map_sg(struct device *dev, > > struct scatterlist *sg, > > if (dev_is_untrusted(dev)) > > return i

Re: [RFC PATCH 2/3] iommu/dma-iommu: Support iovad->granule > PAGE_SIZE

2021-08-07 Thread Sven Peter via iommu
Hi, Thanks a lot for quick reply! On Fri, Aug 6, 2021, at 20:04, Robin Murphy wrote: > On 2021-08-06 16:55, Sven Peter via iommu wrote: > > DMA IOMMU domains can support hardware where the IOMMU page size is > > larger than the CPU page size. > > Alignments need to be done

[RFC PATCH 0/3] iommu/dma-iommu: Support IOMMU page size larger than the CPU page size

2021-08-06 Thread Sven Peter via iommu
ory as requested and will leave it unused :-( The other issue I'm aware of is v4l2 which expects that a page-aligned sglist can be represented contiguously in IOVA space [1]. Best, Sven [1] https://lore.kernel.org/linux-iommu/0d20bd6b-d0a1-019c-6398-b12f83f4f...@arm.com/ Sven Peter (3): iommu: M

[RFC PATCH 3/3] iommu: Introduce __IOMMU_DOMAIN_LARGE_PAGES

2021-08-06 Thread Sven Peter via iommu
__IOMMU_DOMAIN_LARGE_PAGES indicates that a domain can handle conditions where PAGE_SIZE might be smaller than the IOMMU page size. Always allow attaching devices to such domains and set the flag for IOMMU_DOMAIN_DMA, which can now handle these situations. Signed-off-by: Sven Peter --- drivers

[RFC PATCH 2/3] iommu/dma-iommu: Support iovad->granule > PAGE_SIZE

2021-08-06 Thread Sven Peter via iommu
cal addresses will very likely not be aligned to the larger IOMMU page size. Signed-off-by: Sven Peter --- drivers/iommu/dma-iommu.c | 87 ++- 1 file changed, 77 insertions(+), 10 deletions(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c in

[RFC PATCH 1/3] iommu: Move IOMMU pagesize check to attach_device

2021-08-06 Thread Sven Peter via iommu
-by: Sven Peter --- drivers/iommu/iommu.c | 34 +++--- drivers/iommu/iova.c | 7 --- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 1de503ddb343..5854a4ef5681 100644 --- a/drivers/iommu/iommu.c

[PATCH v5 3/3] iommu/dart: Add DART iommu driver

2021-08-03 Thread Sven Peter via iommu
Apple's new SoCs use iommus for almost all peripherals. These Device Address Resolution Tables must be setup before these peripherals can act as DMA masters. Tested-by: Alyssa Rosenzweig Signed-off-by: Sven Peter --- MAINTAINERS| 1 + drivers/iommu/Kconfig | 14

[PATCH v5 1/3] iommu/io-pgtable: Add DART pagetable format

2021-08-03 Thread Sven Peter via iommu
Rosenzweig Reviewed-by: Robin Murphy Signed-off-by: Sven Peter --- drivers/iommu/io-pgtable-arm.c | 63 ++ drivers/iommu/io-pgtable.c | 1 + include/linux/io-pgtable.h | 7 3 files changed, 71 insertions(+) diff --git a/drivers/iommu/io-pgtable

[PATCH v5 2/3] dt-bindings: iommu: add DART iommu bindings

2021-08-03 Thread Sven Peter via iommu
DART (Device Address Resolution Table) is the iommu found on Apple ARM SoCs such as the M1. Reviewed-by: Rob Herring Reviewed-by: Alyssa Rosenzweig Signed-off-by: Sven Peter --- .../devicetree/bindings/iommu/apple,dart.yaml | 81 +++ MAINTAINERS

[PATCH v5 0/3] Apple M1 DART IOMMU driver

2021-08-03 Thread Sven Peter via iommu
86ddeb46ec29d7feb [6] https://github.com/AsahiLinux/m1n1/commit/9529ec2b4fd6550f9cfd66d9f2448b90804699a1 [7] https://lore.kernel.org/linux-iommu/20210627143405.77298-1-s...@svenpeter.dev/ Sven Peter (3): iommu/io-pgtable: Add DART pagetable format dt-bindings: iommu: add DART iommu bindings

Re: [PATCH v4 3/3] iommu: dart: Add DART iommu driver

2021-07-25 Thread Sven Peter via iommu
On Mon, Jul 19, 2021, at 20:15, Robin Murphy wrote: > On 2021-07-15 17:41, Sven Peter via iommu wrote: > [...] > >>> + u64 sw_bypass_cpu_start; > >>> + u64 sw_bypass_dma_start; > >>> + u64 sw_bypass_len; > >>> + > >>> + struct

Re: [PATCH v4 3/3] iommu: dart: Add DART iommu driver

2021-07-15 Thread Sven Peter via iommu
> On 2021-06-27 15:34, Sven Peter wrote: > > Apple's new SoCs use iommus for almost all peripherals. These Device > > Address Resolution Tables must be setup before these peripherals can > > act as DMA masters. > > > > Signed-off-by: Sven Peter > > --- > &

Re: [PATCH v4 1/3] iommu: io-pgtable: add DART pagetable format

2021-07-14 Thread Sven Peter via iommu
Hi, On Tue, Jul 13, 2021, at 21:17, Robin Murphy wrote: > On 2021-06-27 15:34, Sven Peter wrote: > > Apple's DART iommu uses a pagetable format that shares some > > similarities with the ones already implemented by io-pgtable.c. > > Add a new format variant to support the

Re: [PATCH v4 3/3] iommu: dart: Add DART iommu driver

2021-07-12 Thread Sven Peter via iommu
Hi, On Wed, Jun 30, 2021, at 15:49, Alyssa Rosenzweig wrote: > Looks really good! Just a few minor comments. With them addressed, > > Reviewed-by: Alyssa Rosenzweig Thanks! > > > + Say Y here if you are using an Apple SoC with a DART IOMMU. > > Nit: Do we need to spell out "with

Re: [PATCH v4 1/3] iommu: io-pgtable: add DART pagetable format

2021-06-29 Thread Sven Peter via iommu
On Mon, Jun 28, 2021, at 12:54, Alexander Graf wrote: > > > On 27.06.21 16:34, Sven Peter wrote: > > > > Apple's DART iommu uses a pagetable format that shares some > > similarities with the ones already implemented by io-pgtable.c. > > Add a new forma

[PATCH v4 3/3] iommu: dart: Add DART iommu driver

2021-06-27 Thread Sven Peter via iommu
Apple's new SoCs use iommus for almost all peripherals. These Device Address Resolution Tables must be setup before these peripherals can act as DMA masters. Signed-off-by: Sven Peter --- MAINTAINERS |1 + drivers/iommu/Kconfig| 15 + drivers/iommu

[PATCH v4 2/3] dt-bindings: iommu: add DART iommu bindings

2021-06-27 Thread Sven Peter via iommu
DART (Device Address Resolution Table) is the iommu found on Apple ARM SoCs such as the M1. Reviewed-by: Rob Herring Signed-off-by: Sven Peter --- .../devicetree/bindings/iommu/apple,dart.yaml | 81 +++ MAINTAINERS | 6 ++ 2 files changed, 87

[PATCH v4 0/3] Apple M1 DART IOMMU driver

2021-06-27 Thread Sven Peter via iommu
art/dev [7] https://github.com/AsahiLinux/m1n1/commit/9529ec2b4fd6550f9cfd66d9f2448b90804699a1 Sven Peter (3): iommu: io-pgtable: add DART pagetable format dt-bindings: iommu: add DART iommu bindings iommu: dart: Add DART iommu driver .../devicetree/bindings/iommu/apple,dart.yaml | 81 ++ M

[PATCH v4 1/3] iommu: io-pgtable: add DART pagetable format

2021-06-27 Thread Sven Peter via iommu
Apple's DART iommu uses a pagetable format that shares some similarities with the ones already implemented by io-pgtable.c. Add a new format variant to support the required differences so that we don't have to duplicate the pagetable handling code. Signed-off-by: Sven Peter --- drivers/iommu/io

Re: [PATCH v3 2/3] dt-bindings: iommu: add DART iommu bindings

2021-06-12 Thread Sven Peter via iommu
Hi, On Thu, Jun 10, 2021, at 18:52, Rob Herring wrote: > On Thu, Jun 03, 2021 at 10:50:02AM +0200, Sven Peter wrote: > > + > > +examples: > > + - |+ > > +dart1: iommu@82f8 { > > + compatible = "apple,t8103-dart"; > > + reg = <

Re: [PATCH v3 3/3] iommu: dart: Add DART iommu driver

2021-06-05 Thread Sven Peter via iommu
Hi Rouven, On Sat, Jun 5, 2021, at 13:50, Rouven Czerwinski wrote: > Hi Sven, > > just a small comment, see inline. > > On Thu, 2021-06-03 at 10:50 +0200, Sven Peter wrote: > > + > > +/* must be called with held dart_domain->lock */ > > You can re

[PATCH v3 3/3] iommu: dart: Add DART iommu driver

2021-06-03 Thread Sven Peter via iommu
Apple's new SoCs use iommus for almost all peripherals. These Device Address Resolution Tables must be setup before these peripherals can act as DMA masters. Signed-off-by: Sven Peter --- MAINTAINERS | 1 + drivers/iommu/Kconfig| 15 + drivers/iommu/Makefile

[PATCH v3 1/3] iommu: io-pgtable: add DART pagetable format

2021-06-03 Thread Sven Peter via iommu
Apple's DART iommu uses a pagetable format that shares some similarities with the ones already implemented by io-pgtable.c. Add a new format variant to support the required differences so that we don't have to duplicate the pagetable handling code. Signed-off-by: Sven Peter --- drivers/iommu/io

[PATCH v3 2/3] dt-bindings: iommu: add DART iommu bindings

2021-06-03 Thread Sven Peter via iommu
DART (Device Address Resolution Table) is the iommu found on Apple ARM SoCs such as the M1. Signed-off-by: Sven Peter --- .../devicetree/bindings/iommu/apple,dart.yaml | 81 +++ MAINTAINERS | 6 ++ 2 files changed, 87 insertions(+) create mode

[PATCH v3 0/3] Apple M1 DART IOMMU driver

2021-06-03 Thread Sven Peter via iommu
y s/DOMAIN/STREAM/ to prevent confusion with linux's iommu domain concept). [1] v1: https://lore.kernel.org/linux-iommu/20210320151903.60759-1-s...@svenpeter.dev/ [2] v2: https://lore.kernel.org/linux-iommu/20210328074009.95932-1-s...@svenpeter.dev/ Sven Peter (3): iommu: io-pgtable: add DART

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

2021-06-02 Thread Sven Peter via iommu
Hi, I just ran into the exact same issue while working on the M1 DART IOMMU driver and it was fixed by this commit. Thanks! Would be great if this could be picked up. Tested-by: Sven Peter Best, Sven On Mon, Sep 14, 2020, at 09:23, Srinath Mannam via iommu wrote: > Fix IOVA rese

Re: [PATCH] iommu: dart: fix call_kern.cocci warnings

2021-04-09 Thread Sven Peter via iommu
On Sun, Apr 4, 2021, at 17:26, Julia Lawall wrote: > From: kernel test robot > > Function apple_dart_attach_stream called on line 519 inside > lock on line 509 but uses GFP_KERNEL Thanks! Fixed for v3. Best, Sven ___ iommu mailing list

Re: [PATCH v2 1/3] iommu: io-pgtable: add DART pagetable format

2021-04-09 Thread Sven Peter via iommu
On Wed, Apr 7, 2021, at 12:44, Will Deacon wrote: > On Sun, Mar 28, 2021 at 09:40:07AM +0200, Sven Peter wrote: [...] > > > > +static struct io_pgtable * > > +apple_dart_alloc_pgtable(struct io_pgtable_cfg *cfg, void *cookie) > > +{ > > +

Re: [PATCH v2 3/3] iommu: dart: Add DART iommu driver

2021-04-09 Thread Sven Peter via iommu
On Wed, Apr 7, 2021, at 12:42, Will Deacon wrote: > On Sun, Mar 28, 2021 at 09:40:09AM +0200, Sven Peter wrote: > > Apple's new SoCs use iommus for almost all peripherals. These Device > > Address Resolution Tables must be setup before these peripherals can > &g

Re: [PATCH v2 2/3] dt-bindings: iommu: add DART iommu bindings

2021-03-28 Thread Sven Peter via iommu
On Sun, Mar 28, 2021, at 10:16, Arnd Bergmann wrote: > On Sun, Mar 28, 2021 at 9:40 AM Sven Peter wrote: > > I noticed only one detail here: > > > + - |+ > > +dart2a: dart2a@82f0 { > > + compatible = "apple,t8103-dart&qu

[PATCH v2 3/3] iommu: dart: Add DART iommu driver

2021-03-28 Thread Sven Peter via iommu
Apple's new SoCs use iommus for almost all peripherals. These Device Address Resolution Tables must be setup before these peripherals can act as DMA masters. Signed-off-by: Sven Peter --- MAINTAINERS | 1 + drivers/iommu/Kconfig| 14 + drivers/iommu/Makefile

[PATCH v2 2/3] dt-bindings: iommu: add DART iommu bindings

2021-03-28 Thread Sven Peter via iommu
DART (Device Address Resolution Table) is the iommu found on Apple ARM SoCs such as the M1. Signed-off-by: Sven Peter --- .../devicetree/bindings/iommu/apple,dart.yaml | 81 +++ MAINTAINERS | 6 ++ 2 files changed, 87 insertions(+) create mode

[PATCH v2 0/3] Apple M1 DART IOMMU driver

2021-03-28 Thread Sven Peter via iommu
github.com/svenpeter42/m1n1/tree/usb-dwc3-serial-wip Sven Peter (3): iommu: io-pgtable: add DART pagetable format dt-bindings: iommu: add DART iommu bindings iommu: dart: Add DART iommu driver .../devicetree/bindings/iommu/apple,dart.yaml | 81 ++ MAINTAINERS | 7

[PATCH v2 1/3] iommu: io-pgtable: add DART pagetable format

2021-03-28 Thread Sven Peter via iommu
Apple's DART iommu uses a pagetable format that shares some similarities with the ones already implemented by io-pgtable.c. Add a new format variant to support the required differences so that we don't have to duplicate the pagetable handling code. Signed-off-by: Sven Peter --- drivers/iommu/io

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-27 Thread Sven Peter via iommu
Hi Robin, On Thu, Mar 25, 2021, at 12:50, Robin Murphy wrote: > On 2021-03-25 07:53, Sven Peter wrote: > > The iommu binding documentation [1] mentions that > > > > The device tree node of the IOMMU device's parent bus must contain a > > valid > > &qu

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-27 Thread Sven Peter via iommu
On Fri, Mar 26, 2021, at 20:59, Arnd Bergmann wrote: > On Fri, Mar 26, 2021 at 6:51 PM Sven Peter wrote: > > dart-sio: 0021c000 fbde4000 (at least their Secure Enclave/TPM > > co-processor) > > Same here: > dart-sio { >vm-base = <0x0>

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-26 Thread Sven Peter via iommu
On Fri, Mar 26, 2021, at 18:34, Robin Murphy wrote: > On 2021-03-26 17:26, Mark Kettenis wrote: > > > > Anyway, from my viewpoint having the information about the IOVA > > address space sit on the devices makes little sense. This information > > is needed by the DART driver, and there is no

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-26 Thread Sven Peter via iommu
On Fri, Mar 26, 2021, at 17:38, Arnd Bergmann wrote: > On Fri, Mar 26, 2021 at 5:10 PM Sven Peter wrote: > > On Fri, Mar 26, 2021, at 16:59, Mark Kettenis wrote: > > > Some of the DARTs provide a bypass facility. That code make using the > > > standard &

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-26 Thread Sven Peter via iommu
On Fri, Mar 26, 2021, at 16:59, Mark Kettenis wrote: > Some of the DARTs provide a bypass facility. That code make using the > standard "dma-ranges" property tricky. That property would need to > contain the bypass address range. But that would mean that if the > DART driver needs to look at

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-25 Thread Sven Peter via iommu
On Thu, Mar 25, 2021, at 12:50, Robin Murphy wrote: > On 2021-03-25 07:53, Sven Peter wrote: > > > > > > On Tue, Mar 23, 2021, at 21:53, Rob Herring wrote: > >> On Sun, Mar 21, 2021 at 05:00:50PM +0100, Mark Kettenis wrote: > >>> > >>> As

Re: [PATCH 1/3] iommu: io-pgtable: add DART pagetable format

2021-03-25 Thread Sven Peter via iommu
Hi Robin, Thanks for the review! On Wed, Mar 24, 2021, at 17:37, Robin Murphy wrote: > On 2021-03-20 15:19, Sven Peter wrote: > > Apple's DART iommu uses a pagetable format that's very similar to the ones > > already implemented by io-pgtable.c. > > Add a new form

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-25 Thread Sven Peter via iommu
Hi Robin, On Wed, Mar 24, 2021, at 16:29, Robin Murphy wrote: > On 2021-03-20 15:19, Sven Peter wrote: > > > > I have just noticed today though that at least the USB DWC3 controller in > > host > > mode uses *two* darts at the same time. I'm not sure yet which part

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-25 Thread Sven Peter via iommu
On Tue, Mar 23, 2021, at 21:53, Rob Herring wrote: > On Sun, Mar 21, 2021 at 05:00:50PM +0100, Mark Kettenis wrote: > > > Date: Sat, 20 Mar 2021 15:19:33 + > > > From: Sven Peter > > > I have just noticed today though that at least the USB DWC3 controller

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-23 Thread Sven Peter via iommu
Hi Mark, On Tue, Mar 23, 2021, at 21:00, Mark Kettenis wrote: > The problem with both #1 and #2 is that you end up with two references > to (effectively) different iommu's in the dwc3 device node. I don't > see how that is compatible with the idea of using a single translation > table for both

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-22 Thread Sven Peter via iommu
Hi Mark, On Sun, Mar 21, 2021, at 19:35, Mark Kettenis wrote: > > Guess we do need to understand a little bit better how the USB DART > actually works. My hypothesis (based on our discussion on #asahi) is > that the XHCI host controller and the peripheral controller of the > DWC3 block use

Re: [PATCH 2/3] dt-bindings: iommu: add DART iommu bindings

2021-03-22 Thread Sven Peter via iommu
Hi Rob, On Mon, Mar 22, 2021, at 01:15, Rob Herring wrote: > > This check can fail if there are any dependencies. The base for a patch > series is generally the most recent rc1. > > If you already ran 'make dt_binding_check' and didn't see the above > error(s), then make sure 'yamllint' is

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-21 Thread Sven Peter via iommu
Hi Mark, > On 21. Mar 2021, at 17:00, Mark Kettenis wrote: > > I don't think the first option is going to work for PCIe. PCIe > devices will have to use "iommu-map" properties to map PCI devices to > the right iommu, and the currently implementation seems to assume that > #iommu-cells = <1>.

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-21 Thread Sven Peter via iommu
Hi Mark, Sorry for the spam if you get this message twice. This is pretty embarrassing but I've just switched mail providers after ProtonMail messed up yesterday and it looks like my new one defaulted to sending HTML messages even though I only typed plaintext. This shouldn't have happened in

[PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-20 Thread Sven Peter via iommu
Hi, After Hector's initial work [1] to bring up Linux on Apple's M1 it's time to bring up more devices. Most peripherals connected to the SoC are behind a iommu which Apple calls "Device Address Resolution Table", or DART for short [2]. Unfortunately, it only shares the name with PowerPC's DART.

[PATCH 3/3] iommu: dart: Add DART iommu driver

2021-03-20 Thread Sven Peter via iommu
Apple's new SoCs use iommus for almost all peripherals. These Device Address Resolution Tables must be setup before these peripherals can act as DMA masters. Signed-off-by: Sven Peter --- MAINTAINERS | 1 + drivers/iommu/Kconfig| 13 + drivers/iommu/Makefile

[PATCH 1/3] iommu: io-pgtable: add DART pagetable format

2021-03-20 Thread Sven Peter via iommu
Apple's DART iommu uses a pagetable format that's very similar to the ones already implemented by io-pgtable.c. Add a new format variant to support the required differences. Signed-off-by: Sven Peter --- drivers/iommu/Kconfig | 13 +++ drivers/iommu/io-pgtable-arm.c | 70

[PATCH 2/3] dt-bindings: iommu: add DART iommu bindings

2021-03-20 Thread Sven Peter via iommu
DART (Device Address Resolution Table) is the iommu found on Apple ARM SoCs such as the M1. Signed-off-by: Sven Peter --- .../bindings/iommu/apple,t8103-dart.yaml | 82 +++ MAINTAINERS | 6 ++ 2 files changed, 88 insertions(+) create mode