From patchwork Sun Nov 26 15:16:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 13468872 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 9C3EEC4167B for ; Sun, 26 Nov 2023 15:17:46 +0000 (UTC) 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=6LoegDuqS++vQI31fovxhbRNNfiMH8yb/tBpT62cjO4=; b=irjvK8xE2A4xlZ HFbbTATby5wgGqqIDZrZ3lC9SwnhqEFhu+nOB4pHuuwIlfEPGhhL8Zrl6rO3DwpiE5k56mBZU2X2Y jb6xrJRD4PmOKfux7522gQL8w49ILKj+pgfBc6WJpmdSFryU3ir4RHp7p1Kg8lDV3nayNNyinxY54 fSJhr2l6PPTBts24mayK133aJetgD/VPAEGleKams48+fN+yk4LOAmJ6lvabjN2CVTsM41Ys/bTvH PYkbIy8o8IE3nEHQKP/78lBhr0apXo8RQ2mlMpxh59IbVxjgxEnt6F4dRszOsIUxdV9z0gjFg5oKE jDrj1cj3uMD4VLTovEYA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r7Gst-00CE2O-10; Sun, 26 Nov 2023 15:17:23 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r7Gso-00CDvR-2x for linux-arm-kernel@lists.infradead.org; Sun, 26 Nov 2023 15:17:20 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id C07A85C012F; Sun, 26 Nov 2023 10:17:15 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Sun, 26 Nov 2023 10:17:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1701011835; x= 1701098235; bh=XVtyE04XY4dqCT+UkfC1YCtGKiDywJpGnTG5uxs+pJY=; b=U LEoZG3l9iVHGOXiB9+KdBr/EjOFg11nHIoA1WQfnYd18Cru+9dKewmF3ncAnsUIJ i/BryN/+90xfvDSrjMGqqHq3P0TdVS5imP5ghTDygG7QtQjqo9vikAjiJDGHwobb auu3A4Z2CcHcRoDaQRLgRBaBx43jTbj53Lqz9oM4IkNyYq50kg69bWO8HiC2U+WD CzwoXq6GhlL8JGDu1wDjrsJd7jJrDI0cTx3uNLHJTWSmOXnRPOQZxD4ESkavdAXk br+1ChxRoI7efRhHEgWUpEx2Sp2+JWbtDP1Dq6KSU8tFYySmWUWIgwE61unoWgrn 8UiAb6+9qP4xeBeeu6rpg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1701011835; x= 1701098235; bh=XVtyE04XY4dqCT+UkfC1YCtGKiDywJpGnTG5uxs+pJY=; b=Z nprjepqAr4U3ParLlXz8GJkUG+nzuNiY/otM03vH6IHOTsGQWDjLyz4GaeoRTaow QliTPim6vg2xUH2gNkYI/hzuaroxlmUAcFss93R6QAciB4XacP9sTD0TLxDu5NhW y39M330KxhRQ2aGm3HnGvb3aT4SkOwO7p1d2ph4ckQXOYclDV1sSeRiHTXfaZOS/ 6AjpakdieHRGipvuWYZ+KP5xTHE++5Y3ByQqm3WWEf0fUmFTJCiKjw7VKg92nhoM 8RIKdAY65IcSlf1MErRca9l0uJL5TAvB3+0p9JbepyZCTPy2162WMQeqs/GaXlJ6 xzw9csVnQCAeeUkwDeDEw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehledgjeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufhvvghn ucfrvghtvghruceoshhvvghnsehsvhgvnhhpvghtvghrrdguvghvqeenucggtffrrghtth gvrhhnpeejieehheekgedvjefhveekjefguddtfefhteehtdeiffelkeeiuedufeelkeej geenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsvh gvnhesshhvvghnphgvthgvrhdruggvvh X-ME-Proxy: Feedback-ID: i51094778:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 26 Nov 2023 10:17:13 -0500 (EST) From: Sven Peter To: Hector Martin , Sven Peter , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Alyssa Rosenzweig , Joerg Roedel , Will Deacon , Robin Murphy , linux-arm-kernel@lists.infradead.org, asahi@lists.linux.dev, iommu@lists.linux.dev, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Herring Subject: [PATCH v4 1/3] dt-bindings: iommu: dart: Add t8103-usb4-dart compatible Date: Sun, 26 Nov 2023 16:16:59 +0100 Message-Id: <20231126151701.16534-2-sven@svenpeter.dev> X-Mailer: git-send-email 2.39.3 (Apple Git-145) In-Reply-To: <20231126151701.16534-1-sven@svenpeter.dev> References: <20231126151701.16534-1-sven@svenpeter.dev> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231126_071719_156724_2C2E35A8 X-CRM114-Status: UNSURE ( 7.53 ) X-CRM114-Notice: Please train this message. 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 This DART variant is found in the t8103 (M1) SoCs and used for the USB4/Thunderbolt PCIe ports. Unlike the regular t8103 DART these support up to 64 SIDs and require a slightly different MMIO layout. Acked-by: Hector Martin Acked-by: Rob Herring Signed-off-by: Sven Peter --- Documentation/devicetree/bindings/iommu/apple,dart.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/iommu/apple,dart.yaml b/Documentation/devicetree/bindings/iommu/apple,dart.yaml index 903edf85d72e..7adb1de455a5 100644 --- a/Documentation/devicetree/bindings/iommu/apple,dart.yaml +++ b/Documentation/devicetree/bindings/iommu/apple,dart.yaml @@ -24,6 +24,7 @@ properties: compatible: enum: - apple,t8103-dart + - apple,t8103-usb4-dart - apple,t8110-dart - apple,t6000-dart From patchwork Sun Nov 26 15:17:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 13468875 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 1EE27C07D5A for ; Sun, 26 Nov 2023 15:18:02 +0000 (UTC) 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=tMDZQZeakCAPjZU1C0zA3T4pMFN8SaDcg98AYJvIaD4=; b=kbmM7/k07RHBHs 4dKVQw+ut+1uGHD5UHevtZ7FLzybR5C2BNJin0yw1KfyM0lhNNeMEvTqty+cIqB2/PQnhdfvHRIQz Pw+cIExdl0ovNn8hQ1gzRBDa66WFdYjtwm4u6O1clkPAGSBRDkUAhu2otHlE0q+BNERL1hfMauDWl LXGdKuIqlR2UFDsmSQS29HMvPj3McKZS6u+5NrCkX5xiC35FUnyGmrSGUy3MPpQBhOhHaHt5xpYQV jsiplCkgV24X8yjGoc2CuOhafg6NxCUuYiMp2Hi0IgM+jizEvCvBBeRo2zCLQ1U7kFGfYYGU8IdcB rV/tA7K4s+cCnOzMXjaQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r7Gt6-00CEEV-0Q; Sun, 26 Nov 2023 15:17:36 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r7Gsq-00CDxQ-1K for linux-arm-kernel@lists.infradead.org; Sun, 26 Nov 2023 15:17:22 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 317325C0131; Sun, 26 Nov 2023 10:17:18 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sun, 26 Nov 2023 10:17:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1701011838; x= 1701098238; bh=9BqopU5P2Px1rSuq122+Z/QyeeLtFNsRvUhaSSz0syw=; b=e zdyI/jxZYTzfUTEFLakFWlSynjXobfWGWzQIhm+OCpQslUXsbD7z/ZsLyz+/UGLL ozme/EpYJtKHNPpvvAyLCb1qPWQ2SOGNT/BoXXmP8GO3roa0KLKAg+HgO5eQF0zs VJkp9NVhkUWF+fHX5VmJ+d0SYHZO3akv6BdANvXzBgc86M07YEyp6a40JWeoFwV3 WZE8yIxKeGHSBR4C+v0RBpQe7CtxUm+3xdtc733qs/kQzBEjGlwhDfkuS+OtHuhO uSI/N3P+IEh0OHbPfucwz0xThFixoapTz1mTMwJ56tr0BtwwtF9ECnXziUB4Epb8 n6pK3l4evE2CgxYZ/z8Mw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1701011838; x= 1701098238; bh=9BqopU5P2Px1rSuq122+Z/QyeeLtFNsRvUhaSSz0syw=; b=s 6+2g9E0kBaKNt/GTBJQPcSkV52YeUbnk23Qmv8F4LjozXhJBi6KzxzOZPSdtGW23 t1PVFKSZBVaL+kwotHSI8tYjGQgzxWc3FD1vIeI/FFTAyy+iHpQg+ZSmk40J9Mg2 pPbUw7QAo4xAhGq6WgcUJMxdv+/CemwsAVLdRBrPE6zdQ51e4UnSrQoQ29wHv097 Lu30lsozzZm1uM6hJot/lps+i1GHf/+WAqST60ttWsbmnmz88O4Ve4bGfbsZpmsc dFiIqkJguKvJfmyVF0vscWrgI8WzHzSaRLkW3oeueXlwi7bYoyvy3xIvgodVnVet /6FKYRpb5CV8v6fzjU/9g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehledgjeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufhvvghn ucfrvghtvghruceoshhvvghnsehsvhgvnhhpvghtvghrrdguvghvqeenucggtffrrghtth gvrhhnpeejieehheekgedvjefhveekjefguddtfefhteehtdeiffelkeeiuedufeelkeej geenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsvh gvnhesshhvvghnphgvthgvrhdruggvvh X-ME-Proxy: Feedback-ID: i51094778:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 26 Nov 2023 10:17:15 -0500 (EST) From: Sven Peter To: Hector Martin , Sven Peter , Joerg Roedel , Will Deacon , Robin Murphy Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alyssa Rosenzweig , linux-arm-kernel@lists.infradead.org, asahi@lists.linux.dev, iommu@lists.linux.dev, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 2/3] iommu: dart: Write to all DART_T8020_STREAM_SELECT Date: Sun, 26 Nov 2023 16:17:00 +0100 Message-Id: <20231126151701.16534-3-sven@svenpeter.dev> X-Mailer: git-send-email 2.39.3 (Apple Git-145) In-Reply-To: <20231126151701.16534-1-sven@svenpeter.dev> References: <20231126151701.16534-1-sven@svenpeter.dev> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231126_071720_679331_970704D5 X-CRM114-Status: GOOD ( 10.12 ) 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 We're about to add support for a DART variant that use more than 16 streams and requires writing to two separate stream select registers when issuing TLB flushes. Acked-by: Hector Martin Signed-off-by: Sven Peter --- drivers/iommu/apple-dart.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c index ee05f4824bfa..8b6b0cdba9b5 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -368,12 +368,14 @@ apple_dart_t8020_hw_stream_command(struct apple_dart_stream_map *stream_map, u32 command) { unsigned long flags; - int ret; + int ret, i; u32 command_reg; spin_lock_irqsave(&stream_map->dart->lock, flags); - writel(stream_map->sidmap[0], stream_map->dart->regs + DART_T8020_STREAM_SELECT); + for (i = 0; i < BITS_TO_U32(stream_map->dart->num_streams); i++) + writel(stream_map->sidmap[i], + stream_map->dart->regs + DART_T8020_STREAM_SELECT + 4 * i); writel(command, stream_map->dart->regs + DART_T8020_STREAM_COMMAND); ret = readl_poll_timeout_atomic( From patchwork Sun Nov 26 15:17:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 13468874 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id CF4CEC4167B for ; Sun, 26 Nov 2023 15:18:01 +0000 (UTC) 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=Mtn9NVrhuNRpkxm5uUhzkV5WFTFi3uWU7yHLgclSK8E=; b=JrIs8y8AFIo6cc WPh2+o65JTidHxZ+Kl3W3L0D3K7+bJ/JF10sgtVxyzT62H0X60Wa8ZR7eKxU8lvuoUKLFiaCQgmKI SKitQOuQs4kAgFcsMggYXEayMj24b2dqcJHXH1eT9sienXfXyBiQbemBQabk4XORgMgdn0GPOsxWv 1nZwlhsfSbY3OpW0897MjAm8rV+2sDKuC93S30FwD8y9E1GQEksN8wjCYixGUzuBc8yU8cLoP+iAF BL41ycm11YWq669zKNcFxcq/HDlSG8SO8TA99tL4ZsAEjClWzS7HTodDG+2+5M96KFSKLqfZaKwJE ada93kbt5KfUcYEMsmqw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r7Gt7-00CEFT-0Z; Sun, 26 Nov 2023 15:17:37 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r7Gsr-00CDzO-0U for linux-arm-kernel@lists.infradead.org; Sun, 26 Nov 2023 15:17:22 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 8895C5C0130; Sun, 26 Nov 2023 10:17:20 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Sun, 26 Nov 2023 10:17:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1701011840; x= 1701098240; bh=8R0p6DlkXF+oFfSCrVqGL6mEemuNQRmY1fVSrZeXoEA=; b=Z 0trJmkX4q1fVZfB1XQyy6tkRrvUMNsk5XtYTLvwCq4RShayw8OvHIHdWng0PC+6q qWlyMTphrtYq6Fra8y2H8dAtnmTmAvKgI4MX2vEZpyuuv7ZkaKUVAZohep16VRdS buk1tEB50Sr1+DtbyJKTJyicWW3Ho9Sx82qWxwP81ZCshxM4ePxme+Wjvmwb9dFn kjFF5nioIYYzaqakcgMyuSCAHxC+LAfOXxdsW7vBqKjjusWkImcHeOha6atnDgFG gJQ3A2U6XMgRWVFUIK4OoalwLa63NgLwnQ0aKyIPKQDUmuFIiAmPQ8l2AOcZpgxu LYBSAe0KWphdsn8qlTpHA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1701011840; x= 1701098240; bh=8R0p6DlkXF+oFfSCrVqGL6mEemuNQRmY1fVSrZeXoEA=; b=V 2ZlWk6SZ/YL3bxtXeocJt8UjUvfK7pF2TV8LH+HWLif3MMIh06Ap1MRaixQCkNlj ZwwpYKXVlGRPqvA00YsqUhEdPBkqgkZPzxeZVWUznNLAVhzUByTSdl/ZVECpUUSG PTUoqrXBu+qn1xRAHubC/S4hz6+9IHtgEPuxeQeyiqHqEpNCbBEFBpezCYLFVUTh ueZ6TomLyPaxguyK+m/W+WLRmInGQOtym2tdJkbmlUaWCx6lr4uLESsgOVNjRAdu dwL3S4cDHbZcClNW0NtxEGHI/Ku9zt1kVWj6wQ2RDCBfkuXOl82gFKN77dFjOe21 6csLZwA0NSRgfNn7fW2ew== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehledgjeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufhvvghn ucfrvghtvghruceoshhvvghnsehsvhgvnhhpvghtvghrrdguvghvqeenucggtffrrghtth gvrhhnpeejieehheekgedvjefhveekjefguddtfefhteehtdeiffelkeeiuedufeelkeej geenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsvh gvnhesshhvvghnphgvthgvrhdruggvvh X-ME-Proxy: Feedback-ID: i51094778:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 26 Nov 2023 10:17:18 -0500 (EST) From: Sven Peter To: Hector Martin , Sven Peter , Joerg Roedel , Will Deacon , Robin Murphy Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alyssa Rosenzweig , linux-arm-kernel@lists.infradead.org, asahi@lists.linux.dev, iommu@lists.linux.dev, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 3/3] iommu: dart: Add support for t8103 USB4 DART Date: Sun, 26 Nov 2023 16:17:01 +0100 Message-Id: <20231126151701.16534-4-sven@svenpeter.dev> X-Mailer: git-send-email 2.39.3 (Apple Git-145) In-Reply-To: <20231126151701.16534-1-sven@svenpeter.dev> References: <20231126151701.16534-1-sven@svenpeter.dev> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231126_071721_305265_911F9A38 X-CRM114-Status: GOOD ( 10.69 ) 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 This variant of the regular t8103 DART is used for the two USB4/Thunderbolt PCIe controllers. It supports 64 instead of 16 streams which requires a slightly different MMIO layout. Acked-by: Hector Martin Signed-off-by: Sven Peter --- drivers/iommu/apple-dart.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c index 8b6b0cdba9b5..f47f60c0a4d0 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -81,6 +81,7 @@ #define DART_T8020_TCR_BYPASS_DAPF BIT(12) #define DART_T8020_TTBR 0x200 +#define DART_T8020_USB4_TTBR 0x400 #define DART_T8020_TTBR_VALID BIT(31) #define DART_T8020_TTBR_ADDR_FIELD_SHIFT 0 #define DART_T8020_TTBR_SHIFT 12 @@ -1217,6 +1218,33 @@ static const struct apple_dart_hw apple_dart_hw_t8103 = { .ttbr_shift = DART_T8020_TTBR_SHIFT, .ttbr_count = 4, }; + +static const struct apple_dart_hw apple_dart_hw_t8103_usb4 = { + .type = DART_T8020, + .irq_handler = apple_dart_t8020_irq, + .invalidate_tlb = apple_dart_t8020_hw_invalidate_tlb, + .oas = 36, + .fmt = APPLE_DART, + .max_sid_count = 64, + + .enable_streams = DART_T8020_STREAMS_ENABLE, + .lock = DART_T8020_CONFIG, + .lock_bit = DART_T8020_CONFIG_LOCK, + + .error = DART_T8020_ERROR, + + .tcr = DART_T8020_TCR, + .tcr_enabled = DART_T8020_TCR_TRANSLATE_ENABLE, + .tcr_disabled = 0, + .tcr_bypass = 0, + + .ttbr = DART_T8020_USB4_TTBR, + .ttbr_valid = DART_T8020_TTBR_VALID, + .ttbr_addr_field_shift = DART_T8020_TTBR_ADDR_FIELD_SHIFT, + .ttbr_shift = DART_T8020_TTBR_SHIFT, + .ttbr_count = 4, +}; + static const struct apple_dart_hw apple_dart_hw_t6000 = { .type = DART_T6000, .irq_handler = apple_dart_t8020_irq, @@ -1309,6 +1337,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(apple_dart_pm_ops, apple_dart_suspend, apple_dar static const struct of_device_id apple_dart_of_match[] = { { .compatible = "apple,t8103-dart", .data = &apple_dart_hw_t8103 }, + { .compatible = "apple,t8103-usb4-dart", .data = &apple_dart_hw_t8103_usb4 }, { .compatible = "apple,t8110-dart", .data = &apple_dart_hw_t8110 }, { .compatible = "apple,t6000-dart", .data = &apple_dart_hw_t6000 }, {},