From patchwork Tue Jun 6 12:07:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shavit X-Patchwork-Id: 13269051 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 7020EC7EE24 for ; Tue, 6 Jun 2023 12:10: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=h3OreILsMLhwqFatPU1CKs6YUGXd2V/taXD1bYhi5f4=; b=uQ2p95x1nYFJjDWS9rj0SR67wE 9+z4djv0lKz9tTIiwwCGfomLAcT5BvC2ywEWuX7CqOWw4ct0WkSPFXwKr+NGZaxGg2taEkwExN54J EdbMlGHO+T5UslY0UBkiyfpgdp4eNjCGbk8bxo3koAMr50nol0/Xu4vqUnHCimYoHDL84SIvZzVdG /bGs/En4ZTpSw6Hplp0z/xzC+lPMJDyMFpxraJkM52AfpqIksyo4PkEznzfvpVqb4H39sOdEI6nPB prnprAXEszkFF/RZBcmkJy/qMrgBQw54NYieOu7/Yj8Hm3h3a8kHJLLijvIDY9plkHZVe9YpyrOXi 03aMhm+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q6VVl-001YsZ-1Y; Tue, 06 Jun 2023 12:10:05 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q6VVi-001Yqk-1Q for linux-arm-kernel@lists.infradead.org; Tue, 06 Jun 2023 12:10:03 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-56561689700so98858057b3.2 for ; Tue, 06 Jun 2023 05:10:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1686053400; x=1688645400; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=q3oiLY+ykJwBM19GqpOciDwpUp4BC6bUpIyUkrOw/lU=; b=3hPQpvgL+wDxU0OjZQfIfZ4PvVC+sRTH9qlAAPJqZw1xiM2Q3iNaeKDiXdelb0sVio D6xhz8ENSzVt3nnIIlVKdYJfctHXIAa0AVbONky2oo5QejO9Xh6VEvVppH5VVD/R0DTg Rz+4hNgCNRDD7UxQBbLKaWHBeXwxqhF9abdIbDSldq7wOSbdk8rtegg1ed7wG1S+DX4F 9gDbr52SBPiRvOlnYTCDE5jSJQThXBeNqvfSEcx2+4zLLOYwZ5zlaQVcRWkWS8JjZRaJ XFM2GVTbPxXllz89+WNgxWz51t+GrQPq+ZkabafS5wNcTuWm2e98+FU9XPrgilTH4onp qvPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686053400; x=1688645400; 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=q3oiLY+ykJwBM19GqpOciDwpUp4BC6bUpIyUkrOw/lU=; b=FDDRQr6m9FfsSc9E2r58YiFTSu/KldGWxsz5cI2uuLKCTSSbJa/UvzGnW+eAk2txH0 UdT0ZKwtrdUqT6ruUQUs+jg96tyebxQF4iNdN7YzTdFFkwkO5fmPC3Qi0GIG61RqxMSa dXqSp+NKoa6XSfV7ktapUGI3HasNkY6g9joi1SlgS5CahLil+PQK3m640XB/4wtSjsaI BLcZGny03moNaPuT/zeZOHZRUvrXZJ+LCwCVvnTMGGEPOR4e0DBCsIhzZ1D8dWo5eRY0 XBZYC/VYSXBoovT0NmyjcBklsqJzKy1et1Uq6tfnfLfCGtuX3UzdSEzSNJ46uoT4eKMS L8iA== X-Gm-Message-State: AC+VfDyIR/0PaAtU4gu2MygfBwK3MxtBWHi0Skge8miMvkJjVNJRSZ5R mBCIL8zdIp0lv9+AW+EN8g9FX/9jBwbL X-Google-Smtp-Source: ACHHUZ4SbzdX0vrWGGzX8FEpBXrbLqYVs8p8cs/JwhdTrNJ2i2fH3FCcYmqUDP7FZD+MtLPKPWmNhTPp6j14 X-Received: from mshavit.ntc.corp.google.com ([2401:fa00:95:20c:a615:63d5:b54e:6919]) (user=mshavit job=sendgmr) by 2002:a05:6902:10c8:b0:ba8:797c:9bc7 with SMTP id w8-20020a05690210c800b00ba8797c9bc7mr1064725ybu.11.1686053400830; Tue, 06 Jun 2023 05:10:00 -0700 (PDT) Date: Tue, 6 Jun 2023 20:07:42 +0800 In-Reply-To: <20230606120854.4170244-1-mshavit@google.com> Mime-Version: 1.0 References: <20230606120854.4170244-1-mshavit@google.com> X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog Message-ID: <20230606120854.4170244-7-mshavit@google.com> Subject: [PATCH v2 06/18] 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-20230606_051002_494344_346D62E9 X-CRM114-Status: GOOD ( 12.97 ) 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); }