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: 13155196 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 447BAC64EC4 for ; Tue, 28 Feb 2023 20:23:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lgOGq1J8+zMuYlG4CUSl21vQotHyFLdG/TITuE5uS/c=; b=YmSsjCPgrfE1Bb 2f6i8LnWryvMdgcqUTlTBKV9VtVdrDeNnWRNbkjQee0vhP/aiMLiaQkPaMCyQOtNh5CVsPM9+yxcg ew0SQ0JUaeqmLl5ZDzYsz3HI/HPVcjMND/PL4rvBFyrMDuYfMFwVhKoKkFMFvdK1AREbp8wGB7dJW X11rufBhltYAWSKJfyaDjAKRdmRpw/sW8MOLyo88KrpBh4Fj/3CaV+5dch8yjEZLvqwYp6Lw5QzeD fkjFtJ3H+eahVmQatAkQ2gezkxMZSoD6sBOsIiJGNFretWvWoG+MwkaRibxiZnNbZPtXUtuHkaIvM YAGT7WSesiUheq2FzKKw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pX6UL-00EBcK-Gf; Tue, 28 Feb 2023 20:22:17 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pX6U1-00EBW1-9f for linux-arm-kernel@lists.infradead.org; Tue, 28 Feb 2023 20:21:59 +0000 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230228_122157_405557_78A1B6E3 X-CRM114-Status: GOOD ( 10.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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(