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: 62595 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp3238286wrd; Tue, 28 Feb 2023 12:31:02 -0800 (PST) X-Google-Smtp-Source: AK7set8YkgGWSzXY7el5kmARfJ4KUgAnUgP7D4zElpzBEcf8SPbCivN4iZM1LEsga5as2WbhO8O4 X-Received: by 2002:a17:906:2bd1:b0:8b1:fc58:a4ad with SMTP id n17-20020a1709062bd100b008b1fc58a4admr3829820ejg.11.1677616262153; Tue, 28 Feb 2023 12:31:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677616262; cv=none; d=google.com; s=arc-20160816; b=0PZLPgGawlblWisO9qTQ2VhQkZwaIvCjwN/laVPNdqgyWppNb7MPCctSAT3Hx2oyZo jQF20RMCOf5H5ZNYqsmd0ul2ukkadHqzR1onFFr7wdS+nZFkwFsE2gZI8B5EEflfEjPl ThZ9dPdxrPdxuYGadunuCztJViCISeFdpzcI4OlzPlG1xkQ2HOQnhf4TZwSrH6a/CAcZ yLpFoFixOEwVweDomGp0Hw4yWzk/cf463aDIshEck8Md5eYIj0C3SLbtWMiJlXgBFiPS pf08/1t8B+CJrfhIEHTHlsgfu09Ybb8rGf2AIZJE2ubdlIZmsnWMuk9WTk2kYMS7N5HY jC7w== 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=BAhcF142/IhXpreaLpl1FjM856sTe69lr6eU5Px591c=; b=cGzwI0+V5kA1KqZL8CxdL62wY0V8qjwKOXcUZngT4HQRA//mbbKOREUymX+miwo3B1 1Egv/SxXtbor+5E0JI9zvReMkbd3V2LV7sZq5RF+OjE1OATwUvLiy1ZWIaWrA0whI2fC jtn3CvZu+nTT8NN7g6u70m0WmccTrdk0e5curXZ0Do2ZuyHe2lgoHp81KLtPqfkXapvf pklRDaqFLtKzfk5s6PZh5el3Z9vcM5/eHxPc6W2+isTNugdpSHCqSSrZDd7kKsHJNVJM kQhRI/TJsnbWbfwnPTftUM6sFnLZyuNdejxY+ItK2h0tDSWQiyJd3lB1qIjIoOfBWiaM 3jzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm1 header.b=pX1G6Ky6; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=UDhSkP4h; 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 m11-20020a170906258b00b008e1cbdcd3basi11176554ejb.998.2023.02.28.12.30.39; Tue, 28 Feb 2023 12:31:02 -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=fm1 header.b=pX1G6Ky6; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=UDhSkP4h; 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 S229492AbjB1UWA (ORCPT + 99 others); Tue, 28 Feb 2023 15:22:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229659AbjB1UV4 (ORCPT ); Tue, 28 Feb 2023 15:21:56 -0500 Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3BD834C3D; Tue, 28 Feb 2023 12:21:52 -0800 (PST) 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-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 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?1759108149642008668?= X-GMAIL-MSGID: =?utf-8?q?1759108149642008668?= 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: