From patchwork Sat Jan 28 11:11:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 49849 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1294485wrn; Sat, 28 Jan 2023 03:16:33 -0800 (PST) X-Google-Smtp-Source: AK7set9FzqlTwR0LTsYupN9krUIIdiL0HYn5VrvrSaMh/y12wxpMaIRqW5phmMCiltDULt+bVIbj X-Received: by 2002:aa7:d310:0:b0:4a2:1618:d702 with SMTP id p16-20020aa7d310000000b004a21618d702mr4892081edq.18.1674904593250; Sat, 28 Jan 2023 03:16:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674904593; cv=none; d=google.com; s=arc-20160816; b=PYyOW7+XqgUoqTw1wwUCc1XyljLAgGXnz91/F47ZPel8rQdoENlA2jtNvLGCGMDHkl ChIquy3CYB4dRHAnR6iz9OAjin368jn3dztkB0J88d/wapnzReAuHcHw6ZGrhPfWkcb1 Pj6UteRchn5Tu3s6EL77/5yKGo0sbbOk1ON4KO58bo9+ed399bkM6VoXy5eOl2Viu+PW a5Yt/XFZRG3GhEIr4mSWhuOVScwd+f7P4CjvD08ggyt/eOGcGA3j6TPzea8FZr46zCLM IuyaEoJ9zRN6Zqb6UwSrdRbb7Ziw1hVkK5IgIGcVE2LicD6M32yYRWFeDNH88FGjBlWX jA2Q== 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=q5YiyykUrJZCR2wH4YUrGX/fn5nsnR9BnsXm4VxP70I=; b=RCZrXf2QQLOB8xNVccTG2oq3EmuNL47CtydAGf2Q3z1B8qDmYd7bh5H1568PVlL/tR wgsVAA4ak5EWewNZOfQ9OfbbnMcdTCu/upDxfImvxzA86lQZn3Ne4ysBpa3a2gApT2mH xAHYz874ezZUd/uirW1rDoq991E/36Gojqr3iaE3CMcMknAGJk1IsNuqXDI5OAMJR1+t vvW+qO7ZCkRVOBkyxxmJKO0AfkyVtIg0Q7EvdUU2fj13UzlneNQjIImT+KpCAnykkcau C6O3Z02TjQj0sOm6ds3ugjit5AJNB9mkRhYtM4dDKqvHJEJX6d0dP0nlFbBtsvbRht/t z9+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm3 header.b=M5hIrXK9; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=dwMlyRe7; 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 t16-20020a508d50000000b0049e165b5feasi7922716edt.16.2023.01.28.03.16.08; Sat, 28 Jan 2023 03:16:33 -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=fm3 header.b=M5hIrXK9; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=dwMlyRe7; 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 S234243AbjA1LLn (ORCPT + 99 others); Sat, 28 Jan 2023 06:11:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233836AbjA1LLi (ORCPT ); Sat, 28 Jan 2023 06:11:38 -0500 Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 586EA7B421; Sat, 28 Jan 2023 03:11:37 -0800 (PST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id B7BB53200437; Sat, 28 Jan 2023 06:11:35 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Sat, 28 Jan 2023 06:11:36 -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=fm3; t=1674904295; x= 1674990695; bh=q5YiyykUrJZCR2wH4YUrGX/fn5nsnR9BnsXm4VxP70I=; b=M 5hIrXK9KxWDyNn15dh2pSalCeHuM/TcV9xP7KRvPBobzBysKiF7758ZXp7kU1ZIE gcOsxPukGSmJVUSeI+g4+GNGRIDvVZ5YFIlzYKIuX0ivxovODZUrHE34ReHfHSGe P8pLqFFvZcz71UCd1Q2D6J+ARmV6V9m1L6gmBCwUAqZ4Rl6HVG7RIYPgShTKoiCT I/x4C+FiIIrEOCRiP+YFh/Rxd+WKEvrBCP76CtTTnw36XFu1gVgf1OGWseyTILF3 VHnCv6umtK2jiXVLnxQSMx68DI6hH9wA4DeYHknptnzyBLlp+4yLhPm8ic5BqdRX 9TKscmI7s6agZCokw8wPg== 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=fm3; t=1674904295; x=1674990695; bh=q5YiyykUrJZCR 2wH4YUrGX/fn5nsnR9BnsXm4VxP70I=; b=dwMlyRe75uk6OXBC6Fo6AA4vYoq7o qy21TzeJ7FYEXjGlPi7JgVFy7ohmr0LNxUI86EhLr3YcBTjeNnOdfPnCNWLoTEC2 E4GK3jFuOVFgvtXYAAeGqd0BmukKcTjttFRKsHSdK5W//9NAEgOWN+i862eW4FcO B1nrh9RyxOg50nuXYFNYDXq1WMJIUTMiJoGqaHhIdzWUs00Y48YJ+uRetUG+Ya+J wvGj6ULQ8ZDqObaiL14XANwIUAdL9ljSVVRZojsyteCYtJ+nrP/UUKUWa2lrEILV iZk3YwV+/XDNectwbw+iQ+WPvaWVXlyKKphmcVcvmJyv2o69xuU1j3HYA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedruddvkedgvdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufhvvghn ucfrvghtvghruceoshhvvghnsehsvhgvnhhpvghtvghrrdguvghvqeenucggtffrrghtth gvrhhnpeejieehheekgedvjefhveekjefguddtfefhteehtdeiffelkeeiuedufeelkeej geenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsvh gvnhesshhvvghnphgvthgvrhdruggvvh X-ME-Proxy: Feedback-ID: i51094778:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 28 Jan 2023 06:11:33 -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 2/4] iommu: dart: Add flag to override bypass support Date: Sat, 28 Jan 2023 12:11:12 +0100 Message-Id: <20230128111114.4049-3-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20230128111114.4049-1-sven@svenpeter.dev> References: <20230128111114.4049-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?1756264758524962804?= X-GMAIL-MSGID: =?utf-8?q?1756264758524962804?= The USB4 PCIe DARTs claim to support bypass but we never want to allow that on externally facing ports. Signed-off-by: Sven Peter Acked-by: Hector Martin --- 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: