From patchwork Wed Jun 21 06:37:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shavit X-Patchwork-Id: 13286740 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 CA036EB64D8 for ; Wed, 21 Jun 2023 06:44:30 +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:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=nu9LBXnbxFHMhKav0NhMnxvs5X5YFBLA83ZGBy2Wu18=; b=sPyiHZ2xKvs7fNWQpTLslJG6xa VmaCYBFneL0ikQLWCwMh2lbbc/gc8YcZ4EXCfKmSCdiV2Li1IZakDglJtkRL4xzu9uxjsbTyNrkRb PHD7jDCdQtQt82Q8p0gAIyLyvbo1JP7LN1bvg1l23dSS8LTspx/XQVkAHmlfv4z7qslGKYadoChRE XDYJ0a9CmLf+q7f0H1Zwpd5dMWxU5mSKfuKwifR4yLsHL+x22vKwxFRNLu/qPeGBAW7eQFEky9+ql a72iQJHUf5eOktAE3L6A5ehdG0o797Bhylw5Be4xomAtdROFq15enKriMx5RUe2D7bCWtTmaFiAQ7 gHuc6kJg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qBrZZ-00DSJS-2q; Wed, 21 Jun 2023 06:44:09 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qBrZV-00DSGt-3B for linux-arm-kernel@lists.infradead.org; Wed, 21 Jun 2023 06:44:07 +0000 Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-be47a3b3a01so5526913276.2 for ; Tue, 20 Jun 2023 23:44:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687329844; x=1689921844; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=kKyYB6nGtYqnelo6XDlWvQzY0JjgxL/I8n3xKSQjyKM=; b=1gaS0SkW/Sq1tXITKeGmUGTrKdPbcpqB9xL6/exaE20A1NUvR9wFlTNBFxrCnmmx1W noltPOrcY64SY3zBIRAqGGfbitthNieh+upEIdv0gNliNAenwXtXVAvyOqY984mtAd6s nZgSwJLTL85y1xBHpiEsiHarlo3Bmr5RbJEloL0e473xQwEsJxKBB34H4CbuybmXI0iF wQwBCGVX4lZWA1O+4ztFmOn8qil9C1LlaOpKaRxZ4fVPxqw4z+x6RhcaqWte8IpC0cAV lWLdyIWdY+62QfGdY9MFUSCJ+NVCLxGu5r6cyaSOI9Fao6Wur1O0Gop63zLuED1qwKea cevQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687329844; x=1689921844; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=kKyYB6nGtYqnelo6XDlWvQzY0JjgxL/I8n3xKSQjyKM=; b=QnbFL04XqX7WRIOw1JynRIufERphbiayIIVEYdq/2fUACYWVpAoM108A23rkb+/OtH ZDKL2Crq73Hr/jzriVe8OJf1yKZToiaihGn+g33CoFfoBKNzFXGvxXdewTp7jO4H2jCf 9e0n7LplrzjyNi5yqn11uotOs6RzL1UvxgBb8GfKEiYaohJPmc7l9fVXYhqfn9bdzRmu jcTW25bey27JA9Rt8VBdjz+mMboVT6wpZerdAo99lQxrbEl0TJ6gZmY+bWwNRK7RfC8c X2dyr2wUf9EbcKkVwflT7eh4bysD36WKpxX7nCulfubME731thk05io92JonbbfuNYwh 8BMA== X-Gm-Message-State: AC+VfDw8v6FW4SFMuTAVZqTbewtc2PI5S5wXocQEGYC7csoMqg0xfflG UpQex4dEc+mYBiSIEIHmPFdCZFQ2LBAF X-Google-Smtp-Source: ACHHUZ6RcCmWn2rv5cCpEtepK8VPy5yY5wftqIvcrh1WvBJEI4R+LQYSq6Xo61BWKeoCrTmvyiGy/yG28bPE X-Received: from mshavit.ntc.corp.google.com ([2401:fa00:95:20c:384f:f7da:c61d:5a3e]) (user=mshavit job=sendgmr) by 2002:a05:6902:1363:b0:bea:918f:2ef6 with SMTP id bt3-20020a056902136300b00bea918f2ef6mr1543181ybb.0.1687329844564; Tue, 20 Jun 2023 23:44:04 -0700 (PDT) Date: Wed, 21 Jun 2023 14:37:18 +0800 In-Reply-To: <20230621063825.268890-1-mshavit@google.com> Mime-Version: 1.0 References: <20230621063825.268890-1-mshavit@google.com> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog Message-ID: <20230621063825.268890-7-mshavit@google.com> Subject: [PATCH v4 06/13] iommu/arm-smmu-v3: Simplify arm_smmu_enable_ats From: Michael Shavit To: Will Deacon , Robin Murphy , Joerg Roedel Cc: Michael Shavit , jean-philippe@linaro.org, nicolinc@nvidia.com, jgg@nvidia.com, baolu.lu@linux.intel.com, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230620_234406_024201_6C396D3F X-CRM114-Status: GOOD ( 12.76 ) 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 arm_smmu_enable_ats's call to inv_domain would trigger an invalidation for all masters that a domain is attached to everytime it's attached to another ATS-enabled master. It doesn't seem like those invalidations are necessary, and it's easier to reason about arm_smmu_enable_ats if it only issues invalidation commands for the current master. Signed-off-by: Michael Shavit --- v1->v2: Fix commit message wrapping --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c index 08f440fe1da6d..dc7a59e87a2b4 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -2286,7 +2286,7 @@ static void arm_smmu_enable_ats(struct arm_smmu_master *master) pdev = to_pci_dev(master->dev); atomic_inc(&smmu_domain->nr_ats_masters); - arm_smmu_atc_inv_domain(smmu_domain, 0, 0, 0); + arm_smmu_atc_inv_master(master); if (pci_enable_ats(pdev, stu)) dev_err(master->dev, "Failed to enable ATS (STU %zu)\n", stu); }