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: 103768 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3350309vqr; Tue, 6 Jun 2023 05:19:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Tv+yV5iu9i4r5VuFZrWJDzXkTZ7W5WOy+xmyK1+DL6Z3o8edmhmCKaIlAxSYlQPcupUQC X-Received: by 2002:a05:6214:29e5:b0:626:2b44:40c with SMTP id jv5-20020a05621429e500b006262b44040cmr1582768qvb.59.1686053988586; Tue, 06 Jun 2023 05:19:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686053988; cv=none; d=google.com; s=arc-20160816; b=tDKpKV5bRshiTJhmVVHw90NamFXfHIVxAFaH1IKQQ1CJ7+f75ENWP4zc3mTT0Kq1J2 K4kShh5sodcVOICo75/GmFNRsuUdYrm6D0MzWNgKrcaMs5JCo/gdQMJKy1mcrM5VIR7a YGMY+51a9T336cpfdZP+T0rYcrMFhLOJc+XiVFNoM8TuAvlACBhqY5hKfkmCxdETw3z2 41r3FCPY8znYBezF0M8iwXWRb95iT8UrnLJlYFuiNZkpeAVchW95D2iWAScXtAesdOqQ ANhUUBReGD4hm4+wFg2KstrNZd4XikMvFnv7KOwys4j6IaWTp/ASvx6h/9THmU/T1G9X dsbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=q3oiLY+ykJwBM19GqpOciDwpUp4BC6bUpIyUkrOw/lU=; b=rT/L78qe9NbMIP6BlJPzXk3WLvwbDOrXxA1T01RG601GMQSd0eZB2vfLqrFLO5b5dc Cd83SMwxnd5s16kTKHkf9hlt+dGtDIYx94SlC2uWmzosTkz6CkrbjUcMb+qMxC5lUJby M9MR7fRvCn4Z2xoojGDdax9uXfo2CTCEdmYPUf2jYA+xNEcecBTPUyDyXYa+aVOyoo/k FS6NyNnr+qsQvuJOgmp2PCxt8uVJdxmYZEV9h1aFTESvPzV3o0ayNnWjcgvk/x9V+M7C jrcyOhGYtP6THDP0UZVo+gl0eK8fAPsD0po/t91kEwKS/GAE/STQm1uMymHcbV1wjLbg xaVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=3hPQpvgL; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fn1-20020ad45d61000000b006262021ac11si6242832qvb.258.2023.06.06.05.19.33; Tue, 06 Jun 2023 05:19:48 -0700 (PDT) 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=@google.com header.s=20221208 header.b=3hPQpvgL; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237383AbjFFMKT (ORCPT + 99 others); Tue, 6 Jun 2023 08:10:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237031AbjFFMKP (ORCPT ); Tue, 6 Jun 2023 08:10:15 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94DC610DE for ; Tue, 6 Jun 2023 05:10:01 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-bacfa4ef059so9693846276.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=cPbsJNERGABPpdd+o4HcVPl6bjF5MUhtEj0PGjRKA7TUMDDptgW29F/g4tUzH7pMmu 6KRRH5q0oXVsN/adPkfUbChTH7av5zwX79cvEjfXMEZ3pmfLm1lDgn4Brr+naa3BnGjh WrAI6tn7OIZE0LNR/naPAWpGQu3vGdhYYGVyW9SEoWNoOL+7o0NLgNgFkpKWBSmixhxA jPI6dxcVJf9+HyUaW/HQURTqayShaCM2d7X3vUImAHwzx3+SlSkU7XtD6l9xmbiZ4uEs ZWoZ60RXo5Qpl9yedTM8+xGviDkik0G1iogKPEB1pkEDwYFv+V8utSwPdY0rI3TEHqqh m1QA== X-Gm-Message-State: AC+VfDyTH3vZd3qHGsniocOi32K+emVa18NHI41IX0POYOD74D+z0W+Q 2Qcw77HgjMVZhaxOPtNg8WjDfoDFw6yt 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-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL 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?1767955747036605180?= X-GMAIL-MSGID: =?utf-8?q?1767955747036605180?= 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); }