From nobody Thu Apr 9 10:40:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7264ECAAD5 for ; Thu, 1 Sep 2022 01:33:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232374AbiIABc7 (ORCPT ); Wed, 31 Aug 2022 21:32:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230101AbiIABc4 (ORCPT ); Wed, 31 Aug 2022 21:32:56 -0400 X-Greylist: delayed 450 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 31 Aug 2022 18:32:54 PDT Received: from soltyk.jannau.net (soltyk.jannau.net [144.76.91.90]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35352155A59 for ; Wed, 31 Aug 2022 18:32:53 -0700 (PDT) Received: from coburn.home.jannau.net (p54acc2ba.dip0.t-ipconnect.de [84.172.194.186]) by soltyk.jannau.net (Postfix) with ESMTPSA id 4832426EF51; Thu, 1 Sep 2022 03:25:23 +0200 (CEST) From: Janne Grunau To: iommu@lists.linux.dev Cc: Konrad Dybcio , asahi@lists.linux.dev, Sven Peter , Alyssa Rosenzweig , Hector Martin , Joerg Roedel , Will Deacon , iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 5/5] iommu: dart: Support t6000 variant Date: Thu, 1 Sep 2022 03:25:19 +0200 Message-Id: <20220901012519.7167-6-j@jannau.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220901012519.7167-1-j@jannau.net> References: <20220901012519.7167-1-j@jannau.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sven Peter 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 Co-developed-by: Janne Grunau Signed-off-by: Janne Grunau --- (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 =20 +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; =20 void __iomem *regs; =20 @@ -421,13 +428,13 @@ static int apple_dart_finalize_domain(struct iommu_do= main *domain, pgtbl_cfg =3D (struct io_pgtable_cfg){ .pgsize_bitmap =3D dart->pgsize, .ias =3D 32, - .oas =3D 36, + .oas =3D dart->hw->oas, .coherent_walk =3D 1, .iommu_dev =3D dart->dev, }; =20 dart_domain->pgtbl_ops =3D - 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 =3D -ENOMEM; goto done; @@ -858,6 +865,7 @@ static int apple_dart_probe(struct platform_device *pde= v) return -ENOMEM; =20 dart->dev =3D dev; + dart->hw =3D of_device_get_match_data(dev); spin_lock_init(&dart->lock); =20 dart->regs =3D devm_platform_get_and_ioremap_resource(pdev, 0, &res); @@ -946,8 +954,18 @@ static int apple_dart_remove(struct platform_device *p= dev) return 0; } =20 +static const struct apple_dart_hw apple_dart_hw_t8103 =3D { + .oas =3D 36, + .fmt =3D APPLE_DART, +}; +static const struct apple_dart_hw apple_dart_hw_t6000 =3D { + .oas =3D 42, + .fmt =3D APPLE_DART2, +}; + static const struct of_device_id apple_dart_of_match[] =3D { - { .compatible =3D "apple,t8103-dart", .data =3D NULL }, + { .compatible =3D "apple,t8103-dart", .data =3D &apple_dart_hw_t8103 }, + { .compatible =3D "apple,t6000-dart", .data =3D &apple_dart_hw_t6000 }, {}, }; MODULE_DEVICE_TABLE(of, apple_dart_of_match); --=20 2.35.1