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: 68113 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp284884wrd; Sat, 11 Mar 2023 05:42:39 -0800 (PST) X-Google-Smtp-Source: AK7set96gpkaMGYe8FtvFY7FoVeQity8z8IdTObloIYU9H29spWFBns+fugUSZRkMEKOXtG6gG/+ X-Received: by 2002:a17:902:cec6:b0:196:8292:e879 with SMTP id d6-20020a170902cec600b001968292e879mr37774247plg.1.1678542158951; Sat, 11 Mar 2023 05:42:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678542158; cv=none; d=google.com; s=arc-20160816; b=sX//4wYQk4LcteRJ/q3gglru0ZVbhF66QP4Hul9sVm0AkA+xK5j3L3/R8YW/3anlZl a6rAM7JcLlgPSFg4xqGGZRId5mROebuQ6B/6apvRgjKNOBiG3bCxMnAsh2UWeDWFmqfd PbVSphiKxOsepKbsI9gnrT3dUuWHX73p2Ckhi6oeCWDS1NKsoNyK348wm2oLrFJ348s7 Xe69/QqHLa47Z3Pc7VYvGhef0ActOiDc12uJdjln0Dm7EukqzgMowzktn9VqLI6C95HJ f5nsKa1COGjpsYk03JswVbSZfKByx26VFAdNCNY8liLsG27QThfIN8kxr0utrAuKD+ZN fW7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=NLAAjqI5hAqO+6T5ybLfjafnBv2sskMvoLWugFUpxvk=; b=yMd6Zf14/YSl5E0aPpK0DI2DnQBhctfx1dpUW9mJyU6E1rirrHS0QUzmJtZu6z8hXh k62s7gVRKz8jAFW+DomLsnah2EsLVA9P0ZRKgKPnEv1jS7ACIr1zULF+rZSZnoxoZCCk 9XwOx6RihocN5c08tm4g6tEddH9IeilOtz7h5TtUnGOr6PLx2BQX/Az1W9Nma87Upf9U 2CJ0uXxoenRqnxcVWOb7WVlIfrLIm9+wKQUUULe4vN+abljDnwO4GRasp2GVO8TXcD/j qVDwnzskgj5b9Ri4JCVyr7ulUSgHoUTR6W8Xgx0iC0jF588iLBpbi6bP1EvR2b/6dgWF 0fuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm2 header.b=msfuyDZ6; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=AUsB758y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=svenpeter.dev Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n3-20020a1709026a8300b0019ead64ae76si2361491plk.282.2023.03.11.05.42.26; Sat, 11 Mar 2023 05:42:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm2 header.b=msfuyDZ6; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=AUsB758y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=svenpeter.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230001AbjCKNjI (ORCPT + 99 others); Sat, 11 Mar 2023 08:39:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229957AbjCKNjF (ORCPT ); Sat, 11 Mar 2023 08:39:05 -0500 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25F24120494; Sat, 11 Mar 2023 05:39:04 -0800 (PST) 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-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760079022971934229?= X-GMAIL-MSGID: =?utf-8?q?1760079022971934229?= 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: 68117 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp288330wrd; Sat, 11 Mar 2023 05:51:29 -0800 (PST) X-Google-Smtp-Source: AK7set+b8sHLjsmt9O3AEQ1PakMwg8shkbg6SAU6SR43C7AwS9s/PFxOjkgH0B+cAeZZ4EN5UBAJ X-Received: by 2002:a17:903:187:b0:19f:2328:beee with SMTP id z7-20020a170903018700b0019f2328beeemr2629918plg.11.1678542688843; Sat, 11 Mar 2023 05:51:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678542688; cv=none; d=google.com; s=arc-20160816; b=vsc4d2AwPJe2QYcij4uBeaB5Z81exZI4YyXHEETHN5WlgVZcaQpKw1O8Gvfuq+Cctn IbhrZ0zlPbPPXPF9bzmdurStT307gDKyqpL4PMmt/wYrCC83Q22zkn/wAyyaP5xQgs9D 4vX0HdCmQVpS4IVgr0lbrbJkaSt7oN4OXYL5lHAmvA01NWWfjCWBYtduDxpxCVsHqVU5 r5IUNWqXQSLu749jbtmJBkycybSO4bhIA0oamjceyMmM8xytewlphdgkeTY3/w3MR3pn QFXcKMV46LMbW/C1tqK5XdcXOV0Nz1hXQhIryrqlso7ihm0QU2ZKiEspPeb6LSBAOWoA 5AgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=Mb4+mJwB9+LzuGO9Ggk72OOMawB9qgwmFuhWOsw7aP4=; b=VEpogESw4jUOvzcNpiET1Kq5qFzpKh4OTZlGyajl/UxRejf9SbHfUEz1YSYjquag1A 6g269bJVLmWQyK729+1zKXvXRq04w37T2fTpR1BDj5QZFJ9TqO/JHodFKoVVdx+RVy11 +qAQjy9R+4c+qbzcL4DaRKYPNp0MNkXbSNaZ3t4iRdBcx9f9aRthel4vOA2dLH1yR1Il DsBDpSeYjcb1MrLMgkZ9eK8p8eWMj9f8Fxk9QAPxUySKEBCd61rbXmrYyTYCanX/ddvc tSLCtgU6IN14FMP1dgd0Zod8xsPqY+Umbezm6+snSNpqOi4iFKZbhFrJbQFbbd2aZ3lo 1PNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm2 header.b=UG4Qt1C3; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=AQo+JKgx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=svenpeter.dev Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s191-20020a632cc8000000b00503754660e8si2182679pgs.679.2023.03.11.05.51.11; Sat, 11 Mar 2023 05:51:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm2 header.b=UG4Qt1C3; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=AQo+JKgx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=svenpeter.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230019AbjCKNjP (ORCPT + 99 others); Sat, 11 Mar 2023 08:39:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229998AbjCKNjH (ORCPT ); Sat, 11 Mar 2023 08:39:07 -0500 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E73A1204BC; Sat, 11 Mar 2023 05:39:06 -0800 (PST) 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-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760079578817052564?= X-GMAIL-MSGID: =?utf-8?q?1760079578817052564?= 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: 68115 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp285830wrd; Sat, 11 Mar 2023 05:45:11 -0800 (PST) X-Google-Smtp-Source: AK7set/5DR5/zmlVjMz6JPU8hBnMCQ/pIqN17Z+1k/WzsVXLFS7aqLml2rrvWnGce0A8zqZGoC5J X-Received: by 2002:a17:90b:2391:b0:23b:4005:26e6 with SMTP id mr17-20020a17090b239100b0023b400526e6mr1051926pjb.34.1678542311039; Sat, 11 Mar 2023 05:45:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678542311; cv=none; d=google.com; s=arc-20160816; b=b+RvDUHT3WLtM65DSxhsU5pvWTOn5C9FgNqhUc8x77j6paMVGHqxb7GsFs+d5+KwIo P5ubMLFZDcuzq1sx7GGSSXGbrehc5ePw8UNcAY0QCpio8TTnkx/9UUzs2g+aNCKxBPjh PYTeTZyzsTHKv37M/gzHwT9SDuAWA+yfn5PbyzT+2ofqZhY4ZWT+z/UT1AgXoqEZKWF6 ErTqgKjRx1fjXs9i4qb4vzLp7CZ4lP7x4D1sFBHP4HwI8NV/ljW2622jvZFNp4Grlp1t pQMCJadYcHSmpwJxFMzfniduT5C2vfL/7o/J/VSWvKdb8UCugLh0RGs9mdTH8jag91cW +58A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=4yK7FQCj5sNr0/yKnIfjlg5p1SyzkrDsZm+IWMQebB0=; b=wqwqHQ5oVOTATcUIwi8c0EGJbJY5X0B2DU/5I5tsEwNSAZ2jl2COHbYTLofHMJqxBt sJZcbrkmTOtEmSMyiY1d6nWX3BhjPfhQc3bnfhX+6mBEShO5pRHKwFovt7Fcrr2N2saH rKljfqtXuLl58Iz3eqTCVRGKbR59cQfelZDi1kC8poAXraYdt0Bml1a14DmQCnOrEzQl fh/xlz3MptD3dV8kiu4LlZvyYR8NxU/YAlZExCTrA9drelEk1JYhPBQ6IHlrmG70X2ZZ W4tcZf150eUK60eGZhunnSWJ+hVfvVwaSzq3+F/BqtCMWQeP676kUmL1NfzuHwprQQF4 NTmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm2 header.b=f4ojv2Ok; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=luxl2pT6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=svenpeter.dev Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lp9-20020a17090b4a8900b00233dc8b7c82si2312268pjb.54.2023.03.11.05.44.56; Sat, 11 Mar 2023 05:45:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm2 header.b=f4ojv2Ok; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=luxl2pT6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=svenpeter.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229774AbjCKNjT (ORCPT + 99 others); Sat, 11 Mar 2023 08:39:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229776AbjCKNjN (ORCPT ); Sat, 11 Mar 2023 08:39:13 -0500 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3A6E120851; Sat, 11 Mar 2023 05:39:08 -0800 (PST) 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-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760079182743152627?= X-GMAIL-MSGID: =?utf-8?q?1760079182743152627?= 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 }, {},