From: Janne Grunau <j@jannau.net> To: iommu@lists.linux.dev Cc: Konrad Dybcio <konrad.dybcio@somainline.org>, asahi@lists.linux.dev, Sven Peter <sven@svenpeter.dev>, Alyssa Rosenzweig <alyssa@rosenzweig.io>, Hector Martin <marcan@marcan.st>, Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 5/5] iommu: dart: Support t6000 variant Date: Fri, 16 Sep 2022 11:41:52 +0200 [thread overview] Message-ID: <20220916094152.87137-6-j@jannau.net> (raw) In-Reply-To: <20220916094152.87137-1-j@jannau.net> From: Sven Peter <sven@svenpeter.dev> 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> --- (no changes since v3) Changes in v3: - apply change to io-pgtable-dart.c Changes in v2: - use APPLE_DART2 PTE format for dart-t6000 drivers/iommu/apple-dart.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c index 8af0242a90d9..e5793c0d08b4 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -81,10 +81,16 @@ #define DART_TTBR_VALID BIT(31) #define DART_TTBR_SHIFT 12 +struct apple_dart_hw { + u32 oas; + enum io_pgtable_fmt fmt; +}; + /* * Private structure associated with each DART device. * * @dev: device struct + * @hw: SoC-specific hardware data * @regs: mapped MMIO region * @irq: interrupt number, can be shared with other DARTs * @clks: clocks associated with this DART @@ -98,6 +104,7 @@ */ struct apple_dart { struct device *dev; + const struct apple_dart_hw *hw; void __iomem *regs; @@ -421,13 +428,13 @@ static int apple_dart_finalize_domain(struct iommu_domain *domain, pgtbl_cfg = (struct io_pgtable_cfg){ .pgsize_bitmap = dart->pgsize, .ias = 32, - .oas = 36, + .oas = dart->hw->oas, .coherent_walk = 1, .iommu_dev = dart->dev, }; dart_domain->pgtbl_ops = - alloc_io_pgtable_ops(APPLE_DART, &pgtbl_cfg, domain); + alloc_io_pgtable_ops(dart->hw->fmt, &pgtbl_cfg, domain); if (!dart_domain->pgtbl_ops) { ret = -ENOMEM; goto done; @@ -858,6 +865,7 @@ static int apple_dart_probe(struct platform_device *pdev) return -ENOMEM; dart->dev = dev; + dart->hw = of_device_get_match_data(dev); spin_lock_init(&dart->lock); dart->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); @@ -946,8 +954,18 @@ static int apple_dart_remove(struct platform_device *pdev) return 0; } +static const struct apple_dart_hw apple_dart_hw_t8103 = { + .oas = 36, + .fmt = APPLE_DART, +}; +static const struct apple_dart_hw apple_dart_hw_t6000 = { + .oas = 42, + .fmt = APPLE_DART2, +}; + static const struct of_device_id apple_dart_of_match[] = { - { .compatible = "apple,t8103-dart", .data = NULL }, + { .compatible = "apple,t8103-dart", .data = &apple_dart_hw_t8103 }, + { .compatible = "apple,t6000-dart", .data = &apple_dart_hw_t6000 }, {}, }; MODULE_DEVICE_TABLE(of, apple_dart_of_match); -- 2.35.1
WARNING: multiple messages have this Message-ID (diff)
From: Janne Grunau <j@jannau.net> To: iommu@lists.linux.dev Cc: Konrad Dybcio <konrad.dybcio@somainline.org>, asahi@lists.linux.dev, Sven Peter <sven@svenpeter.dev>, Alyssa Rosenzweig <alyssa@rosenzweig.io>, Hector Martin <marcan@marcan.st>, Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 5/5] iommu: dart: Support t6000 variant Date: Fri, 16 Sep 2022 11:41:52 +0200 [thread overview] Message-ID: <20220916094152.87137-6-j@jannau.net> (raw) In-Reply-To: <20220916094152.87137-1-j@jannau.net> From: Sven Peter <sven@svenpeter.dev> 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> --- (no changes since v3) Changes in v3: - apply change to io-pgtable-dart.c Changes in v2: - use APPLE_DART2 PTE format for dart-t6000 drivers/iommu/apple-dart.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c index 8af0242a90d9..e5793c0d08b4 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -81,10 +81,16 @@ #define DART_TTBR_VALID BIT(31) #define DART_TTBR_SHIFT 12 +struct apple_dart_hw { + u32 oas; + enum io_pgtable_fmt fmt; +}; + /* * Private structure associated with each DART device. * * @dev: device struct + * @hw: SoC-specific hardware data * @regs: mapped MMIO region * @irq: interrupt number, can be shared with other DARTs * @clks: clocks associated with this DART @@ -98,6 +104,7 @@ */ struct apple_dart { struct device *dev; + const struct apple_dart_hw *hw; void __iomem *regs; @@ -421,13 +428,13 @@ static int apple_dart_finalize_domain(struct iommu_domain *domain, pgtbl_cfg = (struct io_pgtable_cfg){ .pgsize_bitmap = dart->pgsize, .ias = 32, - .oas = 36, + .oas = dart->hw->oas, .coherent_walk = 1, .iommu_dev = dart->dev, }; dart_domain->pgtbl_ops = - alloc_io_pgtable_ops(APPLE_DART, &pgtbl_cfg, domain); + alloc_io_pgtable_ops(dart->hw->fmt, &pgtbl_cfg, domain); if (!dart_domain->pgtbl_ops) { ret = -ENOMEM; goto done; @@ -858,6 +865,7 @@ static int apple_dart_probe(struct platform_device *pdev) return -ENOMEM; dart->dev = dev; + dart->hw = of_device_get_match_data(dev); spin_lock_init(&dart->lock); dart->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); @@ -946,8 +954,18 @@ static int apple_dart_remove(struct platform_device *pdev) return 0; } +static const struct apple_dart_hw apple_dart_hw_t8103 = { + .oas = 36, + .fmt = APPLE_DART, +}; +static const struct apple_dart_hw apple_dart_hw_t6000 = { + .oas = 42, + .fmt = APPLE_DART2, +}; + static const struct of_device_id apple_dart_of_match[] = { - { .compatible = "apple,t8103-dart", .data = NULL }, + { .compatible = "apple,t8103-dart", .data = &apple_dart_hw_t8103 }, + { .compatible = "apple,t6000-dart", .data = &apple_dart_hw_t6000 }, {}, }; MODULE_DEVICE_TABLE(of, apple_dart_of_match); -- 2.35.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-09-16 9:42 UTC|newest] Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-09-16 9:41 [PATCH v5 0/5] iommu: M1 Pro/Max DART support Janne Grunau 2022-09-16 9:41 ` Janne Grunau 2022-09-16 9:41 ` [PATCH v5 1/5] dt-bindings: iommu: dart: add t6000 compatible Janne Grunau 2022-09-16 9:41 ` Janne Grunau 2022-09-22 12:05 ` Hector Martin 2022-09-22 12:05 ` Hector Martin 2022-09-16 9:41 ` [PATCH v5 2/5] iommu/io-pgtable: Move Apple DART support to its own file Janne Grunau 2022-09-16 9:41 ` Janne Grunau 2022-09-22 14:05 ` Hector Martin 2022-09-22 14:05 ` Hector Martin 2022-09-16 9:41 ` [PATCH v5 3/5] iommu/io-pgtable: Add DART subpage protection support Janne Grunau 2022-09-16 9:41 ` Janne Grunau 2022-09-16 11:57 ` Rob Herring 2022-09-16 11:57 ` Rob Herring 2022-09-16 9:41 ` [PATCH v5 4/5] iommu/io-pgtable-dart: Add DART PTE support for t6000 Janne Grunau 2022-09-16 9:41 ` Janne Grunau 2022-09-16 12:03 ` Rob Herring 2022-09-16 12:03 ` Rob Herring 2022-09-16 9:41 ` Janne Grunau [this message] 2022-09-16 9:41 ` [PATCH v5 5/5] iommu: dart: Support t6000 variant Janne Grunau 2022-09-16 12:05 ` Rob Herring 2022-09-16 12:05 ` Rob Herring 2022-09-21 13:20 ` [PATCH v5 0/5] iommu: M1 Pro/Max DART support Robin Murphy 2022-09-21 13:20 ` Robin Murphy 2022-09-22 14:05 ` Hector Martin 2022-09-22 14:05 ` Hector Martin 2022-09-26 11:50 ` Joerg Roedel 2022-09-26 11:50 ` Joerg Roedel
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220916094152.87137-6-j@jannau.net \ --to=j@jannau.net \ --cc=alyssa@rosenzweig.io \ --cc=asahi@lists.linux.dev \ --cc=iommu@lists.linux-foundation.org \ --cc=iommu@lists.linux.dev \ --cc=joro@8bytes.org \ --cc=konrad.dybcio@somainline.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=marcan@marcan.st \ --cc=sven@svenpeter.dev \ --cc=will@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.