From patchwork Sun Nov 26 15:17:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 13468875 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 1EE27C07D5A for ; Sun, 26 Nov 2023 15:18:02 +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=tMDZQZeakCAPjZU1C0zA3T4pMFN8SaDcg98AYJvIaD4=; b=kbmM7/k07RHBHs 4dKVQw+ut+1uGHD5UHevtZ7FLzybR5C2BNJin0yw1KfyM0lhNNeMEvTqty+cIqB2/PQnhdfvHRIQz Pw+cIExdl0ovNn8hQ1gzRBDa66WFdYjtwm4u6O1clkPAGSBRDkUAhu2otHlE0q+BNERL1hfMauDWl LXGdKuIqlR2UFDsmSQS29HMvPj3McKZS6u+5NrCkX5xiC35FUnyGmrSGUy3MPpQBhOhHaHt5xpYQV jsiplCkgV24X8yjGoc2CuOhafg6NxCUuYiMp2Hi0IgM+jizEvCvBBeRo2zCLQ1U7kFGfYYGU8IdcB rV/tA7K4s+cCnOzMXjaQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r7Gt6-00CEEV-0Q; Sun, 26 Nov 2023 15:17:36 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r7Gsq-00CDxQ-1K for linux-arm-kernel@lists.infradead.org; Sun, 26 Nov 2023 15:17:22 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 317325C0131; Sun, 26 Nov 2023 10:17:18 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sun, 26 Nov 2023 10:17:18 -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=fm1; t=1701011838; x= 1701098238; bh=9BqopU5P2Px1rSuq122+Z/QyeeLtFNsRvUhaSSz0syw=; b=e zdyI/jxZYTzfUTEFLakFWlSynjXobfWGWzQIhm+OCpQslUXsbD7z/ZsLyz+/UGLL ozme/EpYJtKHNPpvvAyLCb1qPWQ2SOGNT/BoXXmP8GO3roa0KLKAg+HgO5eQF0zs VJkp9NVhkUWF+fHX5VmJ+d0SYHZO3akv6BdANvXzBgc86M07YEyp6a40JWeoFwV3 WZE8yIxKeGHSBR4C+v0RBpQe7CtxUm+3xdtc733qs/kQzBEjGlwhDfkuS+OtHuhO uSI/N3P+IEh0OHbPfucwz0xThFixoapTz1mTMwJ56tr0BtwwtF9ECnXziUB4Epb8 n6pK3l4evE2CgxYZ/z8Mw== 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=fm1; t=1701011838; x= 1701098238; bh=9BqopU5P2Px1rSuq122+Z/QyeeLtFNsRvUhaSSz0syw=; b=s 6+2g9E0kBaKNt/GTBJQPcSkV52YeUbnk23Qmv8F4LjozXhJBi6KzxzOZPSdtGW23 t1PVFKSZBVaL+kwotHSI8tYjGQgzxWc3FD1vIeI/FFTAyy+iHpQg+ZSmk40J9Mg2 pPbUw7QAo4xAhGq6WgcUJMxdv+/CemwsAVLdRBrPE6zdQ51e4UnSrQoQ29wHv097 Lu30lsozzZm1uM6hJot/lps+i1GHf/+WAqST60ttWsbmnmz88O4Ve4bGfbsZpmsc dFiIqkJguKvJfmyVF0vscWrgI8WzHzSaRLkW3oeueXlwi7bYoyvy3xIvgodVnVet /6FKYRpb5CV8v6fzjU/9g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehledgjeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufhvvghn ucfrvghtvghruceoshhvvghnsehsvhgvnhhpvghtvghrrdguvghvqeenucggtffrrghtth gvrhhnpeejieehheekgedvjefhveekjefguddtfefhteehtdeiffelkeeiuedufeelkeej geenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsvh gvnhesshhvvghnphgvthgvrhdruggvvh X-ME-Proxy: Feedback-ID: i51094778:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 26 Nov 2023 10:17:15 -0500 (EST) From: Sven Peter To: Hector Martin , Sven Peter , Joerg Roedel , Will Deacon , Robin Murphy Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , 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 v4 2/3] iommu: dart: Write to all DART_T8020_STREAM_SELECT Date: Sun, 26 Nov 2023 16:17:00 +0100 Message-Id: <20231126151701.16534-3-sven@svenpeter.dev> X-Mailer: git-send-email 2.39.3 (Apple Git-145) In-Reply-To: <20231126151701.16534-1-sven@svenpeter.dev> References: <20231126151701.16534-1-sven@svenpeter.dev> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231126_071720_679331_970704D5 X-CRM114-Status: GOOD ( 10.12 ) 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 ee05f4824bfa..8b6b0cdba9b5 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -368,12 +368,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(