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: