From patchwork Tue Feb 28 20:21:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 13155194 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 7392DC64EC4 for ; Tue, 28 Feb 2023 20:23:10 +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=TQyHHkVJcjFpineV7RnPUZy/Cw6qsGucxkal5ILyyKo=; b=QvMKPPgk6h7Zrh 9SEh4sXEFTfBPW9GxlAyAFq8OwdIY/boFYazA1gUgQOs1ALZGk74cP/4m1sFEkGHfYCD+i0Z8yrSJ d8A3ZU1iwDNazm9FjbsNjgz3lHL/2bBcoR2pqTg2y6Gpe4HCYKxbiyPDnxljhSO8DVgadJ45jekMR xIcWF3Q0Is0FyCrmlmPZpkREXKsYVM+BGY82mDVKDjQ5/y0l63Tp4TriTa/jotdlUGV+pJp0xchYV 80Elf+KkbvMV8Z6422pHlMJ0aFh27WwDrh0Y7BUZejWMWKaJ6sJh6Yg7Uwm1IpCFeGhvb70PDK2So rjboJfHoTU7khfRZNnRg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pX6U4-00EBYB-Sw; Tue, 28 Feb 2023 20:22:01 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pX6Tu-00EBTm-D7 for linux-arm-kernel@lists.infradead.org; Tue, 28 Feb 2023 20:21:51 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 0290E32008FA; Tue, 28 Feb 2023 15:21:46 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 28 Feb 2023 15:21:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=cc:cc:content-transfer-encoding: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=1677615706; x= 1677702106; bh=tRDCxZFtukaHOUD+fpMmWdeVyai9y+sjwI29CnAl7cA=; b=Z kJEz7B0qMMNujmfkrzqEcMm2hYhts7x0GIjxc8PApiIkcaSLxREQhFrts20r02Uu cFm/t3xbHQqzNQwXSh00P+lJH+mkkhX60ISO32egN+3FcTrN7fv2uRiLpS90cECS XA6op3ndCXCjnnPov8FJNo9Gpau+aZCv7dooOF+E7tzwBhpyjiUvmmqxH43MOkij ML0McgY6PEVRvYl3WU0jctXLf5FDCw55kA662RaDKLpfXbkQwCi5BUhUaIEvgSlL tyQ9Dgqfj7+QhJuZATAXk1SLCN1kOyLr/kDTxooHcPe6iV7OwvVMJM406oR7oVDj y/62+xZd/9MmCdkyWC81g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding: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=1677615706; x=1677702106; bh=tRDCxZFtukaHO UD+fpMmWdeVyai9y+sjwI29CnAl7cA=; b=TWI0AO9FfDvAoGG60KH4G15wRNyg4 W2DhQRR+xv1I/HDi9htErE3Y/zbwkKniYcXLNliidZzSVuowPsdC5eOWB8/T/+DQ ENi1VZ/EvCAW/0deB+rIrn4PjNbDFqmphmFFoj1dCRWb77lBPVfJKPHkuMKJ+256 AaJGH5xRNxAwRfh6ao0iLKP6CFR77MGoPcNDUCXpok/7A6HMYVQS1FK7K51HRlUp zBRt27o2+isZ0A15Grric3b0gI7gp9VfzLE77EMGSjksLaLt4y6WzzsDQ48u1pz4 QgLLcGEJ+WY90gN7hjYtGHBNzn2+yVxljDFLJBs76D1Ixy21URktvAcfw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudelfedgjeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufhvvghn ucfrvghtvghruceoshhvvghnsehsvhgvnhhpvghtvghrrdguvghvqeenucggtffrrghtth gvrhhnpeejieehheekgedvjefhveekjefguddtfefhteehtdeiffelkeeiuedufeelkeej geenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsvh gvnhesshhvvghnphgvthgvrhdruggvvh X-ME-Proxy: Feedback-ID: i51094778:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Feb 2023 15:21:43 -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 Subject: [PATCH v2 1/4] dt-bindings: iommu: dart: Add t8103-usb4-dart compatible Date: Tue, 28 Feb 2023 21:21:29 +0100 Message-Id: <20230228202132.4919-2-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20230228202132.4919-1-sven@svenpeter.dev> References: <20230228202132.4919-1-sven@svenpeter.dev> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230228_122150_490493_950BC2F8 X-CRM114-Status: UNSURE ( 7.90 ) 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. This variant is only found on the M1 SoCs. Acked-by: Hector Martin Signed-off-by: Sven Peter Acked-by: Rob Herring --- 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 Tue Feb 28 20:21:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 13155195 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 D8D8AC64ED6 for ; Tue, 28 Feb 2023 20:23:12 +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=srGPn9rjWTILo9lCmVqtltNbIrXwkij3QmVyVPbb+uQ=; b=1eXJSMLtUiMfmS kRHOExg7H5j4TrPcH1bdVV/cY63sarnUdtgouFDhuuaw8sbxFoDuRbiPSFdE2Uhh+ERuWYKsmfBeo ko/rP7vPo2YhnzCEexwOF/uIzEKcAlHCBfj+ek80XoJDgkzBYhLiXEEuehsM7xN5FQZKf6j73F0h3 6K4pO+LAaN2LAKYcVTJBppBfEVFrJxAWoAVuftfU+RUYvoaHqosk1GMHmvVaDe1DlTB7FBUiVcoGC F3TMmW0viNabikf4vfqIxJD/vt6UfGyIT6RufpA0AAcEULcq+SZmedDP9TiE90kdSm4yKzMnsD5PT BuTD5DWHQzv/4v7V/2Dw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pX6UD-00EBaq-1I; Tue, 28 Feb 2023 20:22:09 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pX6Tw-00EBUS-Sm for linux-arm-kernel@lists.infradead.org; Tue, 28 Feb 2023 20:21:54 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 800B5320027A; Tue, 28 Feb 2023 15:21:51 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Tue, 28 Feb 2023 15:21:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=cc:cc:content-transfer-encoding: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=1677615711; x= 1677702111; bh=BAhcF142/IhXpreaLpl1FjM856sTe69lr6eU5Px591c=; b=p X1G6Ky6/Chkf38pzpeb+li5Xw6v/M6Ro+NF7iTGBNqJlOEOoMYhN9/3ciq8d3wG6 VEeooop0g+n4ZGJIllU+3CwebccYsB6iMDViLmHyyhQ+obW9v28EwPjPMXxazV2e Y3ycgqmXvVLEtft6Nxw1HjNH4dNC1tzmoxibOKSQgBgZBK9qP+DR7wUDn2ALVYGJ SvGacmcz/uRrqNFIvpyeE/xyybeLr4WgyzTJjB/5CRHcYQVmNB20RBAS1a2sPVob PTKbbgh3eUZfnAxdk87RpKy1vBygHYUx0Mzfh8zmzyCq5G7Yy80p7crw/hfsBls9 nwV0YHl3vt7xV6UK3DvhA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding: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=1677615711; x=1677702111; bh=BAhcF142/IhXp reaLpl1FjM856sTe69lr6eU5Px591c=; b=UDhSkP4h6MGX0YuLyyd4UcMCiag5s GMifcgYHaG959sgIRShB369KGPh2fX2HBo0JbgDVEZNOEJJrOpzregoLNkUC8e56 arZyjkrcueYv9BAPaxlq2QmYiDoQ6i2BYPe1ybHWTot/gN9vou151W2PAu+FioW0 DL7c35pSCvO7yDIsjdpS63sWbpd4MMN3PW9Hu5bRunZ/ALVGlcTTKNn1vhFCr4Zy qiy570erQ6lBoC1n+KSAL2sL0JOGfZLqePU9XPLegrx/482mbRpgqCVphClvOa4H qZ5j1lBrt8HMV5MAd/cpIuuHiggA3XX7P2f29MxO7Sf5jjqaWXb5DWhdw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudelfedgjeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufhvvghn ucfrvghtvghruceoshhvvghnsehsvhgvnhhpvghtvghrrdguvghvqeenucggtffrrghtth gvrhhnpeejieehheekgedvjefhveekjefguddtfefhteehtdeiffelkeeiuedufeelkeej geenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsvh gvnhesshhvvghnphgvthgvrhdruggvvh X-ME-Proxy: Feedback-ID: i51094778:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Feb 2023 15:21:48 -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 v2 2/4] iommu: dart: Add flag to override bypass support Date: Tue, 28 Feb 2023 21:21:30 +0100 Message-Id: <20230228202132.4919-3-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20230228202132.4919-1-sven@svenpeter.dev> References: <20230228202132.4919-1-sven@svenpeter.dev> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230228_122152_980223_0D7077E6 X-CRM114-Status: GOOD ( 10.86 ) 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 USB4 PCIe DARTs claim to support bypass but we never want to allow that on externally facing ports. Acked-by: Hector Martin Signed-off-by: Sven Peter --- drivers/iommu/apple-dart.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c index 42666617803d..7d8b2b90cdb6 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -182,6 +182,8 @@ struct apple_dart_hw { u64 ttbr_addr_field_shift; u64 ttbr_shift; int ttbr_count; + + bool disable_bypass; }; /* @@ -1075,6 +1077,9 @@ static int apple_dart_probe(struct platform_device *pdev) dart->pgsize = 1 << FIELD_GET(DART_PARAMS1_PAGE_SHIFT, dart_params[0]); dart->supports_bypass = dart_params[1] & DART_PARAMS2_BYPASS_SUPPORT; + if (dart->hw->disable_bypass) + dart->supports_bypass = 0; + switch (dart->hw->type) { case DART_T8020: case DART_T6000: From patchwork Tue Feb 28 20:21:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 13155196 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 447BAC64EC4 for ; Tue, 28 Feb 2023 20:23:20 +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=lgOGq1J8+zMuYlG4CUSl21vQotHyFLdG/TITuE5uS/c=; b=YmSsjCPgrfE1Bb 2f6i8LnWryvMdgcqUTlTBKV9VtVdrDeNnWRNbkjQee0vhP/aiMLiaQkPaMCyQOtNh5CVsPM9+yxcg ew0SQ0JUaeqmLl5ZDzYsz3HI/HPVcjMND/PL4rvBFyrMDuYfMFwVhKoKkFMFvdK1AREbp8wGB7dJW X11rufBhltYAWSKJfyaDjAKRdmRpw/sW8MOLyo88KrpBh4Fj/3CaV+5dch8yjEZLvqwYp6Lw5QzeD fkjFtJ3H+eahVmQatAkQ2gezkxMZSoD6sBOsIiJGNFretWvWoG+MwkaRibxiZnNbZPtXUtuHkaIvM YAGT7WSesiUheq2FzKKw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pX6UL-00EBcK-Gf; Tue, 28 Feb 2023 20:22:17 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pX6U1-00EBW1-9f for linux-arm-kernel@lists.infradead.org; Tue, 28 Feb 2023 20:21:59 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id DF2FD32008FF; Tue, 28 Feb 2023 15:21:55 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Tue, 28 Feb 2023 15:21:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=cc:cc:content-transfer-encoding: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=1677615715; x= 1677702115; bh=oFtCq/8ptiJr0c+cZcdA6FMq2x5G60376xTChRpUewg=; b=q 4UYxns75EGHGGBpFRayF3+bpvjeBD32EKSP+0OmqaOrVMC1i4kbWqsgvrbO9Ml+3 HacPOzH90Lg7EXHPjCuqYY+uuw6bzSDo45kd8T2d2y+vPQaNcyXwjPQpBq9PNj03 basPwBuv5Cjsk3BXDHhFZdihgjmmgmIffTs09Sz0GY5MhRnpPUauoMUCry+wyu+G ZEdINlETPRPhPVqdy0qhGZBLi8xQQfGJmgZMZ8Fnkcw8ahrbUkHfeA3qRuOaLn/H N7kReeL4EptUQLhM1JrtPtBxNiy2GkB345PHybOso8RUP1cdTNHmr/Hj4J4l5LLh iQaIHoSbI4Q2BfvXIKK/Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding: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=1677615715; x=1677702115; bh=oFtCq/8ptiJr0 c+cZcdA6FMq2x5G60376xTChRpUewg=; b=iUd8hPxUyMc2gDOcqfjbtx8/TYfXI 98Py0lRk9zYMnWF8bsXsNWpK9fjwznandhnYwfPCk0FSKyev948aKvUJqEIT/orR etZPV88c2c3fUxq2wMbRtSPJjs+rbN7DIRsu5jNREtj9UP/rfzVUPTGBsfsRG4R5 PX7z5FNi61K8vxTKbGgzSH7jetFflo6yxdmY/o2dAno1stcs2NlvjyDKatW5Pa+W E9qW3/rfhBTc04aQwSI6xdXDDd3nrHC+dQVfTxAgbboIQDgB0PAIn/56qwSqyGYO uhyN3kmV1VYkaXzNQ+11f2Ekv0sgVaZZ8sy5sFFR/s9O2WAdekpxqwi9w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudelfedgjedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufhvvghn ucfrvghtvghruceoshhvvghnsehsvhgvnhhpvghtvghrrdguvghvqeenucggtffrrghtth gvrhhnpeejieehheekgedvjefhveekjefguddtfefhteehtdeiffelkeeiuedufeelkeej geenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsvh gvnhesshhvvghnphgvthgvrhdruggvvh X-ME-Proxy: Feedback-ID: i51094778:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Feb 2023 15:21:52 -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 v2 3/4] iommu: dart: Write to all DART_T8020_STREAM_SELECT Date: Tue, 28 Feb 2023 21:21:31 +0100 Message-Id: <20230228202132.4919-4-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20230228202132.4919-1-sven@svenpeter.dev> References: <20230228202132.4919-1-sven@svenpeter.dev> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230228_122157_405557_78A1B6E3 X-CRM114-Status: GOOD ( 10.23 ) 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 7d8b2b90cdb6..7579c97a9062 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -372,12 +372,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 Tue Feb 28 20:21:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 13155197 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 02EAEC64EC7 for ; Tue, 28 Feb 2023 20:23:29 +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=bZIPOcXiAGNQ2YmRJnf4t/xlTkkk8A5dvWRTxSfU1jM=; b=kZdkbbNi3qof/j XEqBpRwjIZTiK5d063B0FO5jQOmGztJJyxGOhh4EfBZwfn3DBhKT4vQmfUoOmwNSVrjuScFt7z2A4 Z6HCfmFO35Jw+lR+qf8/ez+HwQM7CfWsF1+JXcncZXp9LzIwPp/v/jUo1IEVxOxK66lACeQ8a7CH+ McY3yRSDc3UyumMJVMbxOMd2LDTf9kYGEeCEJfJSHf+kIDAwiX7iwbY6qxDTadluJyKbDIOMxgroY XKTJomKb4A5SrZ9Yt5qn7NKOEqSW70R8BVwbqlthKcumlZ8D3at9dFXLgvQOcmVdYpuPVPG0agAb9 IkPfqSnVotB3DNNwWotw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pX6UT-00EBef-SN; Tue, 28 Feb 2023 20:22:26 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pX6U5-00EBYT-HS for linux-arm-kernel@lists.infradead.org; Tue, 28 Feb 2023 20:22:02 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 2C45A3200916; Tue, 28 Feb 2023 15:22:00 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Tue, 28 Feb 2023 15:22:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=cc:cc:content-transfer-encoding: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=1677615719; x= 1677702119; bh=p8ZqQhrJ3wpAF4QuT+1zVLuNbpYdyDzeaaN6r1CTKxU=; b=t rlGkeujQfNFXD62Xfz3q4LflZgaZJsFzXo3DQBvFa0VNGFDiZWMh1IeRQwDYHGTK +HZJdsRyEgMRq5tCCgkfO/hWPiuGt4jtVT1oS8hdduw6lXVLsZCkuAD+ZQqxSoEq woW4O9IYhWuLyIVd9iPVLfVgCoIHxiK9Nv4gPsOGZElihm3mh7uPEbEy3tB2wMQC nbK1zQrIbdDphRvyjwFezNWD79Oecx3nIHaJMT6SdsYaGIstMB6hYPbFVXhJSaCb 3NUV0/Ta2XNdR3P3hn89Ik2qIx+8hrA5roaMnXBRQ3OZ8KlUnaW9SzeCcQpBNorI RwNNqjvbeeOGpzhotN2wQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding: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=1677615719; x=1677702119; bh=p8ZqQhrJ3wpAF 4QuT+1zVLuNbpYdyDzeaaN6r1CTKxU=; b=f3lmAnn4WfiAWAm3n4Xyv/uaTT4S4 e07toQkoAM1x4TorxcCICgPOVT2nNVQHl5hnaIWwbb6zR29bEhP1kHVKvSUT5w61 bMEPRApxa1U2e8V0f4Pt+063ZkM3WCGvR1nQ1ob+wS3TNNwxiUNOR1y7+sEgv2Zp qoHyQqBQyiadW8ogumsqo0PFINYEGL6cr/jjriRimO5ugh5Gg9RgVPumw6vHz4Np CBE0sgP0BvjfNA3zMnR5nwHAD69wI/tKPwtK1L3klmUO5mJDDL77rz+sxNbl4iPp 9pO2tTW7QRM+QcPyC948ol5IAtEEjpUhE635amScHqvyhQH7YUYmJ70Lg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudelfedgjeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufhvvghn ucfrvghtvghruceoshhvvghnsehsvhgvnhhpvghtvghrrdguvghvqeenucggtffrrghtth gvrhhnpeejieehheekgedvjefhveekjefguddtfefhteehtdeiffelkeeiuedufeelkeej geenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehsvh gvnhesshhvvghnphgvthgvrhdruggvvh X-ME-Proxy: Feedback-ID: i51094778:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Feb 2023 15:21:57 -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 v2 4/4] iommu: dart: Add support for t8103 USB4 DART Date: Tue, 28 Feb 2023 21:21:32 +0100 Message-Id: <20230228202132.4919-5-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20230228202132.4919-1-sven@svenpeter.dev> References: <20230228202132.4919-1-sven@svenpeter.dev> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230228_122201_630824_E59EBD81 X-CRM114-Status: GOOD ( 10.88 ) 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. We also disallow bypass support since these DARTs will only ever be used for externally facing devices on the USB4 ports. Acked-by: Hector Martin Signed-off-by: Sven Peter --- drivers/iommu/apple-dart.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c index 7579c97a9062..b9886d40a4d1 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 @@ -1184,6 +1185,35 @@ 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, + + .disable_bypass = true, +}; + static const struct apple_dart_hw apple_dart_hw_t6000 = { .type = DART_T6000, .irq_handler = apple_dart_t8020_irq, @@ -1276,6 +1306,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 }, {},