From patchwork Sat Mar 11 13:38:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 13170835 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 6258FC61DA4 for ; Sat, 11 Mar 2023 13:40:21 +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=oDMlZJp91i5ssirMcz0INZ74UcgBq6EV2/NmgoEu8DM=; b=RYU/74+PS2kcKg TVqtlyRpi4MJQAZRqH6ARSzCmQYX+YqFzTIjGuqsuReCAU2FoxahK9EvkUAavWRfZIzCcmhz/xAgC CtItx1jJ4tOTOurwJWbcIbq32rcIXuWFhBgTvVhXoTxVDPriePY7KBQ0GEVttc5Qm2S54qcH+/WYh NtNumdKP2ugiWlVHjQ+dIhMGUP2msGj8bBN+FRzZ6BkBctMCSloyQZ/sr8nD+vlVUdBjv3sHIgF9C V2qybP5Qg17EN9OLzIdOqOmieXC+MjeZEMnCPdXhbmKU/F/zDgl4filShvJIXuvdakWLKOI9afUes ICqZ1c8d7RZbxa/s6PnQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pazRX-000cn6-Eg; Sat, 11 Mar 2023 13:39:27 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pazRE-000cfu-Ul for linux-arm-kernel@lists.infradead.org; Sat, 11 Mar 2023 13:39:11 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 858BF5C00E8; Sat, 11 Mar 2023 08:39:03 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Sat, 11 Mar 2023 08:39:03 -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=fm2; t=1678541943; x= 1678628343; bh=NLAAjqI5hAqO+6T5ybLfjafnBv2sskMvoLWugFUpxvk=; b=m sfuyDZ6xSrSyN9Bs0NFxcqy01mxu9waEbETR1YmpTJRfs0eMDUwM4pLgkCPwP3Eb HLJMZdVGiV5+SSyKqfbBMJPlZnzCCYUfMpIqp22dFQDbbBV3v3gkJwoAGtZksGaV /DenYe35jdZSHTuxlxr81Me+D2M1/cGDeR3WE55inEdr68ucK18flVcRhRJ+ByEf brk3rHVGGAF4UPVFcRBTb7rr47GLX/3cCAoz3nTZoEoaeIBswnDVaevXio82r2Px 0GCbf5yxLFAmd3ESJl40dlIEHTrzdtcni7EstHgP6LZMQJXqULK8+xxP/BlOJa9l yxLn/j/Dy4xlV0A5cfRiw== 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=fm2; t=1678541943; x= 1678628343; bh=NLAAjqI5hAqO+6T5ybLfjafnBv2sskMvoLWugFUpxvk=; b=A UsB758ypS4D8RDAwC5ujxUdLmi7kpaEPNR4YVak6988PrG4eldZcFkxiDuqjoZ+b zvhcXqnsnw2evLT53FP4wp4iYmcJOFJFjA75Df1sbR4vOCQjcExNthoouXLQM+yC cWsETBinXc5VAcH8mGr2Ld+k+WMsq3W5BwSreUVx3Eqmy2nqSnkdmlZeAHvX0dwH oujoX/T2Bjas2s6Cr/fBJD6jqDsz+16oXqZuyHMCOTi7ZKGDcBRpORPUn/FWFQpN QQCUVgalS1ci7iv3mnF85dw7yuTdr0LHsan3BYSNo2CGRiyD3kWChTnv90VT3z6L IuHsIsehiXuEZj+WaRGSQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvddvtddgfedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufhvvghn ucfrvghtvghruceoshhvvghnsehsvhgvnhhpvghtvghrrdguvghvqeenucggtffrrghtth gvrhhnpeejieehheekgedvjefhveekjefguddtfefhteehtdeiffelkeeiuedufeelkeej geenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsvh gvnhesshhvvghnphgvthgvrhdruggvvh X-ME-Proxy: Feedback-ID: i51094778:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 11 Mar 2023 08:39:01 -0500 (EST) From: Sven Peter To: Hector Martin , Sven Peter , Rob Herring , Krzysztof Kozlowski 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 v3 1/3] dt-bindings: iommu: dart: Add t8103-usb4-dart compatible Date: Sat, 11 Mar 2023 14:38:54 +0100 Message-Id: <20230311133856.63840-2-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20230311133856.63840-1-sven@svenpeter.dev> References: <20230311133856.63840-1-sven@svenpeter.dev> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230311_053909_096565_F4DAD2F2 X-CRM114-Status: UNSURE ( 7.34 ) 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 Reviewed-by: Mark Kettenis --- 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 Sat Mar 11 13:38:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 13170834 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 8B3F8C61DA4 for ; Sat, 11 Mar 2023 13:40:13 +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=cupb0VuAkamANkQn8RXgoxCXes12zIMttvCrVEkkH0E=; b=LPc5zMdo9oFR06 udVK3E117msa/nuu/rrd7ha6+uFj/Hsly9tXzs0cKYs+CZM8W9GyNd3Y1TmRUrQQrsAgDESLfVmiL Cj2jytfzDaa94gQAHd3hcHeoYzjDsgjoCcMWUJg/cth+2q+ei451yubIxVQR+qLzJXyGRiPYtbBpX qdt6I3maVjJc79YEhBQrlFvHWAdTlfaDylZeWeruZdkjN5M1ELrCmDGQqxBtq6FeHXaI9uxSjS/36 QpojvTLcpoTX5w2k4x4iwKsV1JbA9alhFmL60XQfiVHbBV6QZn2yvV+BRVZIgwilS6ruIaGDVxGLi vq2fcbzCFioN/++gBUXg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pazRH-000cjG-Ra; Sat, 11 Mar 2023 13:39:11 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pazRE-000cg2-PC for linux-arm-kernel@lists.infradead.org; Sat, 11 Mar 2023 13:39:10 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id CE6C35C00EA; Sat, 11 Mar 2023 08:39:05 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sat, 11 Mar 2023 08:39:05 -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=fm2; t=1678541945; x= 1678628345; bh=Mb4+mJwB9+LzuGO9Ggk72OOMawB9qgwmFuhWOsw7aP4=; b=U G4Qt1C3qNvQ4eS4ZygEkSYDQSVWu69siFHSTTejTJLT2+xUEyXfaH/zui3oOpNSa tRLOedAAB9OVKxBueQ1zqtpeKBA6m/DFVXFxvxxRMDMv+dsmFafR9mQ+uJv+bMep o7K41ngxxW7Zj9KWuO08zS6+LOlnPuRWE9kMi/ZlwvAl+C2X9YShncPYaXsHdJR/ JbCKkpc+TyDknYdw6abhj3ur6iquyEy/mFZXVwkvtap7nLgM5buXcgZSjmCgVENx gxLs0GpiKv7FhkmId8YJ9vc0dJ7WYbJN4Q0PSDof0YcMgXO4aXY+fHex/r8VCYZY OkVYtW04Iogh7j98h4/Hw== 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=fm2; t=1678541945; x= 1678628345; bh=Mb4+mJwB9+LzuGO9Ggk72OOMawB9qgwmFuhWOsw7aP4=; b=A Qo+JKgxfrPg7AL9JYNClLePLxZ5HlQec6TDPmHsDIUgAC4RBxvTAuHouTKsR/tYn 4X/uBb5OK0Ka+MpBDr7I57rZ3px1vMTbuZZftfbv6j0ms3nsx9Ymtvi2ReEFbp7E gJKx9HAtm5mA1vzeNoQnyTG+4hjNA49drTua57yxZzbIabHFX6ylerT/ODfQXHJY +WjBz30YzVOMl5eBd62EVnpdMY7/fgbf4fZDqOgH7AdoZf+mNLum3dH2zTzPm2+X GCmEw+mIiKhndyUJT4531OYZpn1BDXINtfhBdsD5wd160n9iyhlfEyf96pPA4LCZ AdOPaIS8IiQPwjOA9XVqA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvddvtddgfedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufhvvghn ucfrvghtvghruceoshhvvghnsehsvhgvnhhpvghtvghrrdguvghvqeenucggtffrrghtth gvrhhnpeejieehheekgedvjefhveekjefguddtfefhteehtdeiffelkeeiuedufeelkeej geenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsvh gvnhesshhvvghnphgvthgvrhdruggvvh X-ME-Proxy: Feedback-ID: i51094778:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 11 Mar 2023 08:39:03 -0500 (EST) From: Sven Peter To: Hector Martin , Sven Peter , Joerg Roedel , Will Deacon , Robin Murphy Cc: Rob Herring , Krzysztof Kozlowski , 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 v3 2/3] iommu: dart: Write to all DART_T8020_STREAM_SELECT Date: Sat, 11 Mar 2023 14:38:55 +0100 Message-Id: <20230311133856.63840-3-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20230311133856.63840-1-sven@svenpeter.dev> References: <20230311133856.63840-1-sven@svenpeter.dev> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230311_053908_927933_11F4879D X-CRM114-Status: UNSURE ( 9.92 ) 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 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 74a367302d34..f73d0288e133 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -370,12 +370,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 Sat Mar 11 13:38:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 13170836 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 3BED0C61DA4 for ; Sat, 11 Mar 2023 13:40:25 +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=dD0L3QOr/xCxiu+UT0dxdCtUu5INOU5Gix1xeGSlm8c=; b=2z/taEjsHaWWF0 TAggMVgsI5wmATMiBg50qHL1NnC+eU27VNAni1eJTe/n3xJsKsfhsPk1WhKLwtjH95GAhc+Qx7qfP yezH9RfAolywtdNh8XMi/TWVksKX7oLoLPJY9jz5mcuqVyLD1fNui493Ea7d6aYFnOrQKjZCEaZUr YKxtVvkKrr5FM0OZkTHd6r4pnf/eV6ySSn2LmjUDzoExFH0SlCxbi4bnl7mkPMz7Bns0qU7KbayFG AEbp/Z2jVOBZADSl0aWXeI+HKFiU7Q+PAOJHOf/oOB2hCdMOVd0ff32ONzwMgmuxBseS6i/wc00Go mW1INDO4iajsX3kXv0iw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pazRf-000coU-2S; Sat, 11 Mar 2023 13:39:35 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pazRG-000cgd-JR for linux-arm-kernel@lists.infradead.org; Sat, 11 Mar 2023 13:39:12 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id F30535C00F8; Sat, 11 Mar 2023 08:39:07 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sat, 11 Mar 2023 08:39:07 -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=fm2; t=1678541947; x= 1678628347; bh=4yK7FQCj5sNr0/yKnIfjlg5p1SyzkrDsZm+IWMQebB0=; b=f 4ojv2OkJiyTvEYCjKIIGR68r4djyuTWSBxKCcDWkDIzB/+SiEThAxzXG9hiQirkz jDs2aJ+ARRON2X/V99I0w//pKhhFpei2cKMgc54AvpFyeUiCGtwfvXNVr/pnclCD khRo0hgy9YovIvOtFGY5hJN2UWpPny1j9YQw46kuooKSXRaPEKcaHVmlCYifp+n/ yo8vg/fzjRoDkoixrbh7uOz5QIbR8ZNQ5Wx3PpaLHZFGEDl3CPp647baee2F+QRw RQuB/Yix9n/J5afKWt9Gd3CvpiyxjNItpaCFdIgkY2eTWEH9Cz93e5KOLEMWxdtu 0EE/B+mCZcFK5POy5gVtw== 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=fm2; t=1678541947; x= 1678628347; bh=4yK7FQCj5sNr0/yKnIfjlg5p1SyzkrDsZm+IWMQebB0=; b=l uxl2pT6hJmT0n13oDTEYQ7CFT+xa2vLs3h4Ejso1Q7gEpbSfvOXsq6MGZLIkgUI4 H4aUV1sUZeBx0oY+lEEHfCgfRMP6mBXvNoScnuYqeCOZuk+aXwcFMMQ4LBl+qItw UWKSLtyEwWsQv3o0+JEDkED0QFXO6mnaUXYrpfpiiHTiwjEfJ0r2kOmlNDpiwpiW nLPV93xbUMjCKTpkjjHvOjLMf0JS+q925+sHK9t0D+RowYekTk2cXGlgNPqNRmXw VZax6ecrWpexhBT68wumBylQIYCqeo2KKIdi45w/9+exg5bUbZEqhM25wEedPYHX XKE2Oau1/rj/bqG29t+hg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvddvtddgfedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufhvvghn ucfrvghtvghruceoshhvvghnsehsvhgvnhhpvghtvghrrdguvghvqeenucggtffrrghtth gvrhhnpeejieehheekgedvjefhveekjefguddtfefhteehtdeiffelkeeiuedufeelkeej geenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsvh gvnhesshhvvghnphgvthgvrhdruggvvh X-ME-Proxy: Feedback-ID: i51094778:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 11 Mar 2023 08:39:05 -0500 (EST) From: Sven Peter To: Hector Martin , Sven Peter , Joerg Roedel , Will Deacon , Robin Murphy Cc: Rob Herring , Krzysztof Kozlowski , 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 v3 3/3] iommu: dart: Add support for t8103 USB4 DART Date: Sat, 11 Mar 2023 14:38:56 +0100 Message-Id: <20230311133856.63840-4-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20230311133856.63840-1-sven@svenpeter.dev> References: <20230311133856.63840-1-sven@svenpeter.dev> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230311_053910_744963_28BC9E68 X-CRM114-Status: GOOD ( 10.50 ) 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 f73d0288e133..23f79659a48b 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 @@ -1192,6 +1193,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, @@ -1292,6 +1320,7 @@ DEFINE_SIMPLE_DEV_PM_OPS(apple_dart_pm_ops, apple_dart_suspend, apple_dart_resum 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 }, {},