From patchwork Wed Nov 17 21:15:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 12692994 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DA2AC433F5 for ; Wed, 17 Nov 2021 21:17:43 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6E28F61B44 for ; Wed, 17 Nov 2021 21:17:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6E28F61B44 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=svenpeter.dev Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Pc9bCE6yY4U3lT549Xlhd1KY+c9XgJmMvb9iA9WbZZU=; b=hsJbfIEbgsfiKG yAuknNo0mxQeZU33fYrtyUabdY5KDpNvgb7F8OEPXtTt+5gm63Vy9DKkBiWOZ0wf9nL9w8CFQv4qf vFIAQfoW7pZtkjKK+GNNbbL+5nPmPZ6y+ITw9KPboFwGKoKabgJalg8Ys+kxKfZfpjQGMCqf1Te+S MflvMA/fAY1hDP7OaCLTM14YEwt+nLD8N2b0Eim0NWF4yySLhmEMSbILqjM1R0WutviPBu+By0Qjp QFSVVwunKCokyyezyJRJcC4HMFhsPCDrDd5m5D/lJDxINmW8ARf9ng7NKA96f/IUzt1NvPqna7iig JGO4/5rC2CtGkB0MjzNA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mnSI1-006I9L-A0; Wed, 17 Nov 2021 21:16:21 +0000 Received: from new2-smtp.messagingengine.com ([66.111.4.224]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mnSHG-006Hw7-Vs for linux-arm-kernel@lists.infradead.org; Wed, 17 Nov 2021 21:15:36 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 403315806CC; Wed, 17 Nov 2021 16:15:34 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 17 Nov 2021 16:15:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=RZy5jJe6QukHS cO8gascVhRqt3WsYPfRDs+/HqZFOpA=; b=YJtXE1hmGj34qSjO2WQuEyQ4F8+5s UkH5mJWpoIobxM7vUCc9vSPfUm/m6eMrGprM2H6LcymYwdLz4SFknXzm+mYteVJ3 Cn/XiCa0wtxIe59v5r8Ho0QRdLeMalYq8IpAv4hLWAUWYEUJlWXDKOMWgGY88iKh grWhApXgc1uf0g/dlAlOeLgD2gpuBlO8QvmjfuJeiz2ZmVouO9Gt/PmsellU4VmK dyFJPEnV3Vor91HN0OOpARdTuxqFIamtKks50K5aL0iZ+xJRutdxmG82UzQhSfn1 lNKQbbh6G95v0aAmkGU9CwG6z4U9pgVwdeE8muWiUvAMHxguFk5vNrXeQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=RZy5jJe6QukHScO8gascVhRqt3WsYPfRDs+/HqZFOpA=; b=a1rJLphZ 0RUNMQKrBvu8DOFqUxD5MrSeEmXZjn/A+QMfSyti8rMgQXKnUNjQQtPzAX36UnWM t17bK8yagNVfgTEbCjrAi1PgVIHl0i6j2sJvda3F+eAS2ViTqOcJ6bePuKAl4iCK jRIKzvqB6umoeASgQx1Tqu6WJK22Vgf9ixGncx3bRQnEXENTe9uh1asoiXcfMjo7 Kt18HRQQ6JFwB4QjI5nMhaPv1+4EbTDJSR7NxWROlXQpyJWa/KPPE5H1cuxtUq4/ DybtaqhqdSc855XYRzJG+iFu+DjCxPBPT6sjBZFaXOvv7Mq7JSaZSbVXn1KJY/X3 ZWT/utmEpRF6cA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrfeeggddugedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuvhgvnhcu rfgvthgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrthhtvg hrnheptedvkeetleeuffffhfekteetffeggffgveehieelueefvddtueffveevlefhfeej necuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepshhvvg hnsehsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 17 Nov 2021 16:15:32 -0500 (EST) From: Sven Peter To: iommu@lists.linux-foundation.org Cc: Sven Peter , Joerg Roedel , Will Deacon , Rob Herring , Janne Grunau , Hector Martin , Robin Murphy , Alyssa Rosenzweig , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 4/4] iommu: dart: Support t6000 variant Date: Wed, 17 Nov 2021 22:15:09 +0100 Message-Id: <20211117211509.28066-5-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20211117211509.28066-1-sven@svenpeter.dev> References: <20211117211509.28066-1-sven@svenpeter.dev> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211117_131535_174940_CB98430A X-CRM114-Status: GOOD ( 14.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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-dart.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c index 565ef5598811..c04648dfd747 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -81,10 +81,15 @@ #define DART_TTBR_VALID BIT(31) #define DART_TTBR_SHIFT 12 +struct apple_dart_hw { + u32 oas; +}; + /* * 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 +103,7 @@ */ struct apple_dart { struct device *dev; + const struct apple_dart_hw *hw; void __iomem *regs; @@ -421,7 +427,7 @@ 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, }; @@ -855,6 +861,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); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -944,8 +951,16 @@ static int apple_dart_remove(struct platform_device *pdev) return 0; } +static const struct apple_dart_hw apple_dart_hw_t8103 = { + .oas = 36, +}; +static const struct apple_dart_hw apple_dart_hw_t6000 = { + .oas = 42, +}; + 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);