From patchwork Wed Jun 14 15:41:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shavit X-Patchwork-Id: 13280158 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 C1A14EB64D9 for ; Wed, 14 Jun 2023 15:44:37 +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=Mu6hEl5PZNs7PZUk/gMPOV6lvU qo+b5gHUxmrjFNYjMLugEdSGtjtfWdjW79LKIkGcCsDAmcf3szaUgHiKM5Bttwjk/T3Q/R8vP/azo rpMLa2Pi8D2yyIG5/hMbBbn10rGe2rw5mowBozwWDoJfbN3DFR3TcVV9cj0wImKrDX8lzJ9qkmmXI y3S89UnJGFv5+SpYSAmxMCYOQ2trN5UT/9XFVG2XjxtPo8+hupyw9SnCcoWm5K7Utu3tdtOOpnvcN PRD+GpH3AzvdG8oWqJNhODqoBJmDZdxHK51umghkvriF7A47XmqlY9s+P6MLRysHLM5bba60xpSQ6 buhyHVEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q9SfT-00C6Q0-0h; Wed, 14 Jun 2023 15:44:19 +0000 Received: from mail-pf1-x44a.google.com ([2607:f8b0:4864:20::44a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q9SfQ-00C6OU-2H for linux-arm-kernel@lists.infradead.org; Wed, 14 Jun 2023 15:44:17 +0000 Received: by mail-pf1-x44a.google.com with SMTP id d2e1a72fcca58-666693a71acso501850b3a.3 for ; Wed, 14 Jun 2023 08:44:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1686757455; x=1689349455; 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=ZreyidDpJbP1PBXH0/670/kPY2SsUh00/efeS6mDpY0HajYSURNuwl2jgv15mHAY+8 BQnjoS82KZhUCP+ZW8JKdnnpOoil/pxglVP0s2csLwMNXQxHU51EaIYCRwcdKqquCh0q 3bWW4wrsmrxasyohwzBecrXf6yKsHWQhn0bySkpCPo4xUAgaHO41cs19iiK6VFDnmGcL 1z3TlJElBou8TAuRPKhYnjDJwUUqq75L0bf3w6VNMdMUoFGls32SxQ9iHK9xTnV32fN7 YIabDW9594lEZ4404D02Bxq7KeKnTkNz75qnKx2pKgIU+oWiPHE0kF1iXqTgciI2k5V0 H35Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686757455; x=1689349455; 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=YvwmRHKS4mFSqzMdWVMR4NxUEJDQe+f/1OryAUkF0Zr/q+pF4iHBScTnCiIOYnnA/Z vI6hZ9NqIl8wz4RN/ScsSe0KC5myEJOrtGBeOJ0TCp9eb8ZUArc8mne+Dr6rFTg+96UM NRrlg2MNpbnhbI7Q4GKJmFuMvA9Kp85+tSdUxtQZIsQD9XmTTaUAgI4BqtufbUO82gEY zxFtccid/vN9UHQtIcB/3aajDU2MHAJYRXDEXNDs14JtPZSUF3fr7/WQj4FyB4qoHdXC zxU+9eruOdwebkT6iOMbSLPZfVx+PnZUQnbCR693ws6QbJhwFeyXsz6/6/G2Mq7gdOsz KgGQ== X-Gm-Message-State: AC+VfDwaBXH2n9UcIxBbb1cIfRh3C2RZGCZVc+BMeuWla+sHsTxyUE0Z dO4nG3F/0yLCp79i2/1iqVylekZ49pxC X-Google-Smtp-Source: ACHHUZ5hvf161DqxDEUjciWGgh2uDlHkYPKEsVFxC66gt2tXnPwcs58oZC95f7+2kSAq6UzNy1BZjwtxJnV7 X-Received: from mshavit.ntc.corp.google.com ([2401:fa00:95:20c:c6e6:49bf:5c44:5965]) (user=mshavit job=sendgmr) by 2002:a05:6a00:2e99:b0:654:424b:17d2 with SMTP id fd25-20020a056a002e9900b00654424b17d2mr664816pfb.2.1686757454862; Wed, 14 Jun 2023 08:44:14 -0700 (PDT) Date: Wed, 14 Jun 2023 23:41:58 +0800 In-Reply-To: <20230614154304.2860121-1-mshavit@google.com> Mime-Version: 1.0 References: <20230614154304.2860121-1-mshavit@google.com> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog Message-ID: <20230614154304.2860121-7-mshavit@google.com> Subject: [PATCH v3 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-20230614_084416_744675_80D6CD06 X-CRM114-Status: GOOD ( 12.87 ) 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); }