From patchwork Sat Mar 11 13:38:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 68117 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp288330wrd; Sat, 11 Mar 2023 05:51:29 -0800 (PST) X-Google-Smtp-Source: AK7set+b8sHLjsmt9O3AEQ1PakMwg8shkbg6SAU6SR43C7AwS9s/PFxOjkgH0B+cAeZZ4EN5UBAJ X-Received: by 2002:a17:903:187:b0:19f:2328:beee with SMTP id z7-20020a170903018700b0019f2328beeemr2629918plg.11.1678542688843; Sat, 11 Mar 2023 05:51:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678542688; cv=none; d=google.com; s=arc-20160816; b=vsc4d2AwPJe2QYcij4uBeaB5Z81exZI4YyXHEETHN5WlgVZcaQpKw1O8Gvfuq+Cctn IbhrZ0zlPbPPXPF9bzmdurStT307gDKyqpL4PMmt/wYrCC83Q22zkn/wAyyaP5xQgs9D 4vX0HdCmQVpS4IVgr0lbrbJkaSt7oN4OXYL5lHAmvA01NWWfjCWBYtduDxpxCVsHqVU5 r5IUNWqXQSLu749jbtmJBkycybSO4bhIA0oamjceyMmM8xytewlphdgkeTY3/w3MR3pn QFXcKMV46LMbW/C1tqK5XdcXOV0Nz1hXQhIryrqlso7ihm0QU2ZKiEspPeb6LSBAOWoA 5AgQ== 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=Mb4+mJwB9+LzuGO9Ggk72OOMawB9qgwmFuhWOsw7aP4=; b=VEpogESw4jUOvzcNpiET1Kq5qFzpKh4OTZlGyajl/UxRejf9SbHfUEz1YSYjquag1A 6g269bJVLmWQyK729+1zKXvXRq04w37T2fTpR1BDj5QZFJ9TqO/JHodFKoVVdx+RVy11 +qAQjy9R+4c+qbzcL4DaRKYPNp0MNkXbSNaZ3t4iRdBcx9f9aRthel4vOA2dLH1yR1Il DsBDpSeYjcb1MrLMgkZ9eK8p8eWMj9f8Fxk9QAPxUySKEBCd61rbXmrYyTYCanX/ddvc tSLCtgU6IN14FMP1dgd0Zod8xsPqY+Umbezm6+snSNpqOi4iFKZbhFrJbQFbbd2aZ3lo 1PNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm2 header.b=UG4Qt1C3; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=AQo+JKgx; 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 s191-20020a632cc8000000b00503754660e8si2182679pgs.679.2023.03.11.05.51.11; Sat, 11 Mar 2023 05:51:28 -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=fm2 header.b=UG4Qt1C3; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=AQo+JKgx; 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 S230019AbjCKNjP (ORCPT + 99 others); Sat, 11 Mar 2023 08:39:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229998AbjCKNjH (ORCPT ); Sat, 11 Mar 2023 08:39:07 -0500 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E73A1204BC; Sat, 11 Mar 2023 05:39:06 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id CE6C35C00EA; Sat, 11 Mar 2023 08:39:05 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sat, 11 Mar 2023 08:39:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1678541945; x= 1678628345; bh=Mb4+mJwB9+LzuGO9Ggk72OOMawB9qgwmFuhWOsw7aP4=; b=U G4Qt1C3qNvQ4eS4ZygEkSYDQSVWu69siFHSTTejTJLT2+xUEyXfaH/zui3oOpNSa tRLOedAAB9OVKxBueQ1zqtpeKBA6m/DFVXFxvxxRMDMv+dsmFafR9mQ+uJv+bMep o7K41ngxxW7Zj9KWuO08zS6+LOlnPuRWE9kMi/ZlwvAl+C2X9YShncPYaXsHdJR/ JbCKkpc+TyDknYdw6abhj3ur6iquyEy/mFZXVwkvtap7nLgM5buXcgZSjmCgVENx gxLs0GpiKv7FhkmId8YJ9vc0dJ7WYbJN4Q0PSDof0YcMgXO4aXY+fHex/r8VCYZY OkVYtW04Iogh7j98h4/Hw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type: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=fm2; t=1678541945; x= 1678628345; bh=Mb4+mJwB9+LzuGO9Ggk72OOMawB9qgwmFuhWOsw7aP4=; b=A Qo+JKgxfrPg7AL9JYNClLePLxZ5HlQec6TDPmHsDIUgAC4RBxvTAuHouTKsR/tYn 4X/uBb5OK0Ka+MpBDr7I57rZ3px1vMTbuZZftfbv6j0ms3nsx9Ymtvi2ReEFbp7E gJKx9HAtm5mA1vzeNoQnyTG+4hjNA49drTua57yxZzbIabHFX6ylerT/ODfQXHJY +WjBz30YzVOMl5eBd62EVnpdMY7/fgbf4fZDqOgH7AdoZf+mNLum3dH2zTzPm2+X GCmEw+mIiKhndyUJT4531OYZpn1BDXINtfhBdsD5wd160n9iyhlfEyf96pPA4LCZ AdOPaIS8IiQPwjOA9XVqA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvddvtddgfedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufhvvghn ucfrvghtvghruceoshhvvghnsehsvhgvnhhpvghtvghrrdguvghvqeenucggtffrrghtth gvrhhnpeejieehheekgedvjefhveekjefguddtfefhteehtdeiffelkeeiuedufeelkeej geenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsvh gvnhesshhvvghnphgvthgvrhdruggvvh X-ME-Proxy: Feedback-ID: i51094778:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 11 Mar 2023 08:39:03 -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 v3 2/3] iommu: dart: Write to all DART_T8020_STREAM_SELECT Date: Sat, 11 Mar 2023 14:38:55 +0100 Message-Id: <20230311133856.63840-3-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20230311133856.63840-1-sven@svenpeter.dev> References: <20230311133856.63840-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,URIBL_BLOCKED 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?1760079578817052564?= X-GMAIL-MSGID: =?utf-8?q?1760079578817052564?= We're about to add support for a DART variant that use more than 16 streams and requires writing to two separate stream select registers when issuing TLB flushes. Acked-by: Hector Martin Signed-off-by: Sven Peter --- drivers/iommu/apple-dart.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c index 74a367302d34..f73d0288e133 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -370,12 +370,14 @@ apple_dart_t8020_hw_stream_command(struct apple_dart_stream_map *stream_map, u32 command) { unsigned long flags; - int ret; + int ret, i; u32 command_reg; spin_lock_irqsave(&stream_map->dart->lock, flags); - writel(stream_map->sidmap[0], stream_map->dart->regs + DART_T8020_STREAM_SELECT); + for (i = 0; i < BITS_TO_U32(stream_map->dart->num_streams); i++) + writel(stream_map->sidmap[i], + stream_map->dart->regs + DART_T8020_STREAM_SELECT + 4 * i); writel(command, stream_map->dart->regs + DART_T8020_STREAM_COMMAND); ret = readl_poll_timeout_atomic(