Message ID | 20230228202132.4919-3-sven@svenpeter.dev |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> 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 <rfc822;aaron.seo0120@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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: <xms:XmL-Y5dnOgwKbT_GMYUqVauzwMTF_G3IdOhZpp5RK1sVkHuVd98wFQ> <xme:XmL-Y3PhGWfhouYhW2rmL8XvTHx8ncybSTw_G8mteW-sNUULlf9bLUBaXEeIR-h9O 9uOIsW1p4RayLf5v-E> X-ME-Received: <xmr:XmL-Yyio9q0YI4jgMcOQnkp7wqnHwEPPbYZJbnCiVLhoBL6-wSnb3gaJZB5sld5_6d_GWKlfyBDGk3-SrDf7DWdLegrdyhY7xLWn0CGOTlF7nSl2BVyqwtojRiV2DQ> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudelfedgjeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufhvvghn ucfrvghtvghruceoshhvvghnsehsvhgvnhhpvghtvghrrdguvghvqeenucggtffrrghtth gvrhhnpeejieehheekgedvjefhveekjefguddtfefhteehtdeiffelkeeiuedufeelkeej geenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsvh gvnhesshhvvghnphgvthgvrhdruggvvh X-ME-Proxy: <xmx:XmL-Yy_13KYfa9wrnHheFPww1c7wZB-orkrW5i9Vlh7NKP-nHmcZYg> <xmx:XmL-Y1tj9JVAiRJvNEbnHNUfduWMIIX4mCslSFHbl9Qq9L-VrcqC5g> <xmx:XmL-YxGsHG0IvO9Bjksp8jWmFTq5-WX1e9IcUA51ihMRqUd-kjKxDg> <xmx:X2L-YxHl6YO0XFUwxlyfvq4kdwAC_1QUQmW93H-Mq-_G7QitSQIu7Q> Feedback-ID: i51094778:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Feb 2023 15:21:48 -0500 (EST) From: Sven Peter <sven@svenpeter.dev> To: Hector Martin <marcan@marcan.st>, Sven Peter <sven@svenpeter.dev>, Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>, Robin Murphy <robin.murphy@arm.com> Cc: Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Alyssa Rosenzweig <alyssa@rosenzweig.io>, 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 Content-Transfer-Encoding: 8bit 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: <linux-kernel.vger.kernel.org> 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?= |
Series |
Apple M1 USB4/Thunderbolt DART support
|
|
Commit Message
Sven Peter
Feb. 28, 2023, 8:21 p.m. UTC
The USB4 PCIe DARTs claim to support bypass but we never want to allow that on externally facing ports. Acked-by: Hector Martin <marcan@marcan.st> Signed-off-by: Sven Peter <sven@svenpeter.dev> --- drivers/iommu/apple-dart.c | 5 +++++ 1 file changed, 5 insertions(+)
Comments
On 28/02/2023 8:21 pm, Sven Peter wrote: > The USB4 PCIe DARTs claim to support bypass but we never want to allow > that on externally facing ports. IOMMU drivers shouldn't be implementing their own individual policies for this - externally-facing ports should be correctly marked as such[1], so that the PCI layer is properly informed, which in turn will be picked up and handled properly by IOMMU core code. Thanks, Robin. [1] see Documentation/devicetree/bindings/pci/pci.txt > Acked-by: Hector Martin <marcan@marcan.st> > Signed-off-by: Sven Peter <sven@svenpeter.dev> > --- > 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:
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: