From patchwork Sat Jan 28 11:11:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 49847 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1294059wrn; Sat, 28 Jan 2023 03:15:31 -0800 (PST) X-Google-Smtp-Source: AMrXdXtg6HWIVwVJknz2VuJPRTzXpAmo9DnfDI5QaY90Rrg5l+gc0jlnRb2iGIZbv5k75nkgIVXJ X-Received: by 2002:a05:6402:1f85:b0:45c:835c:eab7 with SMTP id c5-20020a0564021f8500b0045c835ceab7mr47044450edc.37.1674904531707; Sat, 28 Jan 2023 03:15:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674904531; cv=none; d=google.com; s=arc-20160816; b=U/AjZaEnRiZvSX6B9wIh+NcYiaLGAvSqsGLNmtZAUul2YQsoARmyIVYZTtO08yz7mL kINbe71xpiDMIh8xYOS9kQyw/xszo6+2FRbgyLW/mg3+ZIFtZrjr/+c/IOOtnm20zzCx uNTPcqg54hz9Z7VJQ3BM6A9n7FjSm84ilKTF6C+kAQz1guJNJiEfXVoSXxx+2394V2KS rp+pbpA0XJbVRwehyyCdXkcanVQzz0zmgBfWtvXf/evEMlzij0Mq0CjGkyPkSZFbm8/1 Afv2cUAA3SeW3WK0mOVbIi7HNf/x/TnWWGNZtbVWuI/BorvysowssSSO/MWbeve+dFE0 xqkg== 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=95cFYESovP/5VNc+cPvOHG0EQFnShh8vh/vZRQA6QEE=; b=Es/nZnkdanLX90OBb11FRUfspkBltjkvYhQKnwS5RjJEyfRJSKNyl2em6xKaPCEus0 JCDBhhowzch2z54Acjj+7pgxhZlijxBc5PeuJ0vaP7fd50pBqf65B0wB2jQNhMkw063y kY/bPp8pNLL3lF4gZjMOEm8NfPtfcZC7qgndvXPxEdbN2riV0osJkkMYU0GAwbiBJnj7 GkCbcpLcjzrCf/PKMF7E4it6f7vmzzH7VDLhyfVFuNWX9sDJQoktnZEb01Enbp84o7rT eyw0D6xaq6q2nlRajnOb7Sj2h1uLL8EHK08TkcbXNEKuzgtlwCWauv0NkMwzh3I5LEXu Zu2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm3 header.b=dzeyfbiW; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=ROaUUwA6; 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 fy15-20020a1709069f0f00b007ae0e8f697fsi8194397ejc.652.2023.01.28.03.15.08; Sat, 28 Jan 2023 03:15:31 -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=dzeyfbiW; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=ROaUUwA6; 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 S234012AbjA1LLx (ORCPT + 99 others); Sat, 28 Jan 2023 06:11:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232323AbjA1LLo (ORCPT ); Sat, 28 Jan 2023 06:11:44 -0500 Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13567518DD; Sat, 28 Jan 2023 03:11:41 -0800 (PST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 769B73200437; Sat, 28 Jan 2023 06:11:39 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sat, 28 Jan 2023 06:11:40 -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=1674904299; x= 1674990699; bh=95cFYESovP/5VNc+cPvOHG0EQFnShh8vh/vZRQA6QEE=; b=d zeyfbiWH4qMpOpayK7ptqs/ng+h+UgBQdxg/M4/Mz7jQPHAh/1PCYaBYJIM3sFXS 8nlSvqzTb+0krb/EMFEDzd7lw0nQPwC3T+/xbt4EPVmb1cU8FThiW99FA/h/6nOW nPbgsE0YeWFmP05XvIP4BCGnHg0e9slquaog6aKjpJlvYPAshVFKj7DMqQAA7gQW JrybH740/n8ns0hpT/SWhxVOI1R2PCpREIs40xJao2DKG2zTGrXc/vNVwZtpBsXE 2b+bCnnOyKwAjzNLsA4ljovkKS8KQ+Ku+Ay6pHYxe/jL5COFdgKG5VYh2aU1+yy3 coBtuvkoUGsPauhpxnJVg== 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=1674904299; x=1674990699; bh=95cFYESovP/5V Nc+cPvOHG0EQFnShh8vh/vZRQA6QEE=; b=ROaUUwA60NdlI0CcuJvUlvx9txZuX hlp6qf5PB7wiihk5tUJVba2gOwg8WcyArMzhnlL8+2B1oHYaOaDbqDbST8gPB87t mwmIskktVbBlrOnzr5wfCUD//megIbNXEsQYbQRvQxwcd+yz4WmGxAnPxKDb4tU4 e5D28B+Ni0fwjAmh0rUC/B8O9XxUFYUJWlaDgzhnM4UHfPL0hwbzoq9Do6aw9oQW rASYPbPnyvRtg/8TYN4f6SBGDtaC90ueRt02HZaDX6UsjNn4l/7/co2s24BWKY7y i3J1AxOp6sjcxdigYbd6izvIyuMIgPFVY63S8qG1zVIBmrBFgL9Djsswg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedruddvkedgvdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufhvvghn ucfrvghtvghruceoshhvvghnsehsvhgvnhhpvghtvghrrdguvghvqeenucggtffrrghtth gvrhhnpeejieehheekgedvjefhveekjefguddtfefhteehtdeiffelkeeiuedufeelkeej geenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehsvh gvnhesshhvvghnphgvthgvrhdruggvvh X-ME-Proxy: Feedback-ID: i51094778:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 28 Jan 2023 06:11:37 -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 3/4] iommu: dart: Write to all DART_T8020_STREAM_SELECT Date: Sat, 28 Jan 2023 12:11:13 +0100 Message-Id: <20230128111114.4049-4-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?1756264694088749372?= X-GMAIL-MSGID: =?utf-8?q?1756264694088749372?= 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. Signed-off-by: Sven Peter Acked-by: Hector Martin --- 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(