From patchwork Tue Feb 28 20:21:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 62597 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp3238646wrd; Tue, 28 Feb 2023 12:31:43 -0800 (PST) X-Google-Smtp-Source: AK7set/pM7wgRRfXATg73QVIQBBtxh03Zr2S2fCxKp87/86l5wE9ejHREzmAi7LV8Vrm+k/mv1k4 X-Received: by 2002:aa7:d1c6:0:b0:4ab:4676:f92f with SMTP id g6-20020aa7d1c6000000b004ab4676f92fmr4542512edp.37.1677616303419; Tue, 28 Feb 2023 12:31:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677616303; cv=none; d=google.com; s=arc-20160816; b=SuzlR/8jA5KoOyaCM6D78P2SGDn7TmyhVBQANlNCK78xlpJohLb74OyLJ2gXPhuh6V j1R9I5D5cKN3kS3CSM4TzZhbibqf0mWitvmpJLFoKKKxadoyryTjsBoDJpIQ0METm5vU DbQE68DOmOcr8mVU7rvMyu6gWMLOjDxn+lzXyLdL4LaMJvMF0yPJUcHS/viN8cUqEfSG 4IfmUAnZMrjtN3Nud7wCilJvvl51hV+1MJig3iQJoLJ3fC3+fiqalKUGKYSeNFe8joAr dK/WBIzFGs+yHovfTBSNrC4oZtMPvKYjvC0SJ4ORVzM7QNhp7TzNZ/fMeANL9rtxkm6E BMTw== 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=oFtCq/8ptiJr0c+cZcdA6FMq2x5G60376xTChRpUewg=; b=HuBQtEcq3qcf6PEoYFH9/pJMpR/M12QGLrDHlMUg0+IGElinBxjK9qU1DtMV31nhB8 YAmatTu0ybkbiyjQEWVJDdF8ciWicGkJb13LAAaypt6qRj2Kfdqz+QSk5VjiOBPtx6VP hyEtEZE/uYXVkhvdGSHqzEVTsHK1Gy0JzRoD5/IaJizQeFNMBjxyjc16wKXBqCqydHAV eFLEDKvG+7EK4AAi+kNTw8sijqezeXjo9PtxW98HrlmhtIXKOWLZqm48+gHO87LOFk0l bz/saSt6u5d5IK7GP0fieHoNOPdA3/T0cxnPNQdLfzmXrZtYBaizVbpYRUYYB7Gu+EEl BWfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm1 header.b=q4UYxns7; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=iUd8hPxU; 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 sg6-20020a170907a40600b008d0a9a403f8si16884095ejc.796.2023.02.28.12.31.19; Tue, 28 Feb 2023 12:31:43 -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=q4UYxns7; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=iUd8hPxU; 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 S229696AbjB1UWE (ORCPT + 99 others); Tue, 28 Feb 2023 15:22:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229520AbjB1UV7 (ORCPT ); Tue, 28 Feb 2023 15:21:59 -0500 Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 660A934C23; Tue, 28 Feb 2023 12:21:57 -0800 (PST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id DF2FD32008FF; Tue, 28 Feb 2023 15:21:55 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Tue, 28 Feb 2023 15:21:56 -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=1677615715; x= 1677702115; bh=oFtCq/8ptiJr0c+cZcdA6FMq2x5G60376xTChRpUewg=; b=q 4UYxns75EGHGGBpFRayF3+bpvjeBD32EKSP+0OmqaOrVMC1i4kbWqsgvrbO9Ml+3 HacPOzH90Lg7EXHPjCuqYY+uuw6bzSDo45kd8T2d2y+vPQaNcyXwjPQpBq9PNj03 basPwBuv5Cjsk3BXDHhFZdihgjmmgmIffTs09Sz0GY5MhRnpPUauoMUCry+wyu+G ZEdINlETPRPhPVqdy0qhGZBLi8xQQfGJmgZMZ8Fnkcw8ahrbUkHfeA3qRuOaLn/H N7kReeL4EptUQLhM1JrtPtBxNiy2GkB345PHybOso8RUP1cdTNHmr/Hj4J4l5LLh iQaIHoSbI4Q2BfvXIKK/Q== 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=1677615715; x=1677702115; bh=oFtCq/8ptiJr0 c+cZcdA6FMq2x5G60376xTChRpUewg=; b=iUd8hPxUyMc2gDOcqfjbtx8/TYfXI 98Py0lRk9zYMnWF8bsXsNWpK9fjwznandhnYwfPCk0FSKyev948aKvUJqEIT/orR etZPV88c2c3fUxq2wMbRtSPJjs+rbN7DIRsu5jNREtj9UP/rfzVUPTGBsfsRG4R5 PX7z5FNi61K8vxTKbGgzSH7jetFflo6yxdmY/o2dAno1stcs2NlvjyDKatW5Pa+W E9qW3/rfhBTc04aQwSI6xdXDDd3nrHC+dQVfTxAgbboIQDgB0PAIn/56qwSqyGYO uhyN3kmV1VYkaXzNQ+11f2Ekv0sgVaZZ8sy5sFFR/s9O2WAdekpxqwi9w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudelfedgjedvucetufdoteggodetrfdotf 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:52 -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 3/4] iommu: dart: Write to all DART_T8020_STREAM_SELECT Date: Tue, 28 Feb 2023 21:21:31 +0100 Message-Id: <20230228202132.4919-4-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?1759108193008387809?= X-GMAIL-MSGID: =?utf-8?q?1759108193008387809?= 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 7d8b2b90cdb6..7579c97a9062 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -372,12 +372,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(