From: Sven Peter <sven@xxxxxxxxxxxxx>[...]
The DARTs present in the M1 Pro/Max/Ultra SoC use a diffent PTE format.
They support a 42bit physical address space by shifting the paddr and
extending its mask inside the PTE.
They also come with mandatory sub-page protection now which we just
configure to always allow access to the entire page. This feature is
already present but optional on the previous DARTs which allows to
unconditionally configure it.
Signed-off-by: Sven Peter <sven@xxxxxxxxxxxxx>
Co-developed-by: Janne Grunau <j@xxxxxxxxxx>
Signed-off-by: Janne Grunau <j@xxxxxxxxxx>
---
Changes in v3:
- apply change to io-pgtable-dart.c
- handle pte <> paddr conversion based on the pte format instead of
the output address size
Changes in v2:
- add APPLE_DART2 PTE format
drivers/iommu/io-pgtable-dart.c | 51 +++++++++++++++++++++++++++------
drivers/iommu/io-pgtable.c | 1 +
include/linux/io-pgtable.h | 1 +
3 files changed, 45 insertions(+), 8 deletions(-)
@@ -536,7 +571,7 @@ apple_dart_alloc_pgtable(struct io_pgtable_cfg *cfg, void *cookie)
if (!cfg->coherent_walk)
return NULL;
- if (cfg->oas > 36)
+ if (cfg->oas != 36 && cfg->oas != 42)
return NULL;