Skip to content

Commit a380b8d

Browse files
svenpeter42joergroedel
authored andcommitted
iommu: dart: Support t6000 variant
The M1 Pro/Max/Ultra SoCs come with a new variant of DART which supports a larger physical address space with a different PTE format. Pass through the correct paddr address space size and the PTE format to the io-pgtable code which will take care of the rest. Signed-off-by: Sven Peter <sven@svenpeter.dev> Co-developed-by: Janne Grunau <j@jannau.net> Signed-off-by: Janne Grunau <j@jannau.net> Reviewed-by: Rob Herring <robh@kernel.org> Acked-by: Hector Martin <marcan@marcan.st> Link: https://lore.kernel.org/r/20220916094152.87137-6-j@jannau.net Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent dc09fe1 commit a380b8d

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

drivers/iommu/apple-dart.c

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,16 @@
8181
#define DART_TTBR_VALID BIT(31)
8282
#define DART_TTBR_SHIFT 12
8383

84+
struct apple_dart_hw {
85+
u32 oas;
86+
enum io_pgtable_fmt fmt;
87+
};
88+
8489
/*
8590
* Private structure associated with each DART device.
8691
*
8792
* @dev: device struct
93+
* @hw: SoC-specific hardware data
8894
* @regs: mapped MMIO region
8995
* @irq: interrupt number, can be shared with other DARTs
9096
* @clks: clocks associated with this DART
@@ -98,6 +104,7 @@
98104
*/
99105
struct apple_dart {
100106
struct device *dev;
107+
const struct apple_dart_hw *hw;
101108

102109
void __iomem *regs;
103110

@@ -421,13 +428,13 @@ static int apple_dart_finalize_domain(struct iommu_domain *domain,
421428
pgtbl_cfg = (struct io_pgtable_cfg){
422429
.pgsize_bitmap = dart->pgsize,
423430
.ias = 32,
424-
.oas = 36,
431+
.oas = dart->hw->oas,
425432
.coherent_walk = 1,
426433
.iommu_dev = dart->dev,
427434
};
428435

429436
dart_domain->pgtbl_ops =
430-
alloc_io_pgtable_ops(APPLE_DART, &pgtbl_cfg, domain);
437+
alloc_io_pgtable_ops(dart->hw->fmt, &pgtbl_cfg, domain);
431438
if (!dart_domain->pgtbl_ops) {
432439
ret = -ENOMEM;
433440
goto done;
@@ -854,6 +861,7 @@ static int apple_dart_probe(struct platform_device *pdev)
854861
return -ENOMEM;
855862

856863
dart->dev = dev;
864+
dart->hw = of_device_get_match_data(dev);
857865
spin_lock_init(&dart->lock);
858866

859867
dart->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
@@ -942,8 +950,18 @@ static int apple_dart_remove(struct platform_device *pdev)
942950
return 0;
943951
}
944952

953+
static const struct apple_dart_hw apple_dart_hw_t8103 = {
954+
.oas = 36,
955+
.fmt = APPLE_DART,
956+
};
957+
static const struct apple_dart_hw apple_dart_hw_t6000 = {
958+
.oas = 42,
959+
.fmt = APPLE_DART2,
960+
};
961+
945962
static const struct of_device_id apple_dart_of_match[] = {
946-
{ .compatible = "apple,t8103-dart", .data = NULL },
963+
{ .compatible = "apple,t8103-dart", .data = &apple_dart_hw_t8103 },
964+
{ .compatible = "apple,t6000-dart", .data = &apple_dart_hw_t6000 },
947965
{},
948966
};
949967
MODULE_DEVICE_TABLE(of, apple_dart_of_match);

0 commit comments

Comments
 (0)