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 }, {},