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: 110822 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4172980vqr; Wed, 21 Jun 2023 00:08:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5W1IMWZlF8w2BlYp4L7+q3Zh0I4grFJFPnJwEgS38J4sIU/NWPN47kAe30Civuso+mevaJ X-Received: by 2002:a05:6358:9f88:b0:130:e3dd:a8f3 with SMTP id fy8-20020a0563589f8800b00130e3dda8f3mr5451264rwb.24.1687331302753; Wed, 21 Jun 2023 00:08:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687331302; cv=none; d=google.com; s=arc-20160816; b=pm39a810plOiIA6Y2of2ODzhTRdG75jcTCYHm+OmzgDeR5nJGe9L9QqKt3DNM12h+A 3xtqHkdcOZX1BwXLJxcV02S+cvhUAFwbioKFkyiByK22TYb0ryFYr1vAFk9tQrTsXHRQ e36rp7ySRXOPu5gsPcpsCXnwx/Ay5EpeRkcke33Zjfr/Arymi+mP9NfO31W61xYRV0JU hX/sRNR03xtxpVGVKM380mXf4OuIpckZQA3sGAXloXePmR1WoYQQGl/Fk7CvOcpUf8Zl un/hTwTCqk7eixlJ0HpYOA3MVoSytArA2wblUpa8dm87rBbvtr/fuFmrtRP2KsGzXYKw PVzQ== 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=kKyYB6nGtYqnelo6XDlWvQzY0JjgxL/I8n3xKSQjyKM=; b=VjFBXjiSnHBhoButwmHgRBY4UNsRR2McMUQbvb/OcX90MBKt/JGLj3gRAzGGcwAqNW JIKFoqGcUpSOAk0SFFdm9JufAI4Qp/tcOG4D4NJ0KCGDuazjT8gZhBPohWqDRetI/jCj fa6tkxeak7lHm/jb1kB/9kFJdo2IemCYHw0MsZ+48li2CbFSetM3lgk07RxRdvMeA4Lo KOEOXlWkRgPUF/PtDn0eWNOzOeneFeOMHx1+zaNKFDU1RhylnfFYUxpsNJR8GL71RTg+ K1bebkg+MrrWiNuwjaGQXYrHrSNNeIOc7cNZm1BvlkS8KnAVFXCdJtGfaxarT6yYs/ur CDlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=1gaS0SkW; 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 s15-20020a63af4f000000b005536fc5187asi3395578pgo.47.2023.06.21.00.08.09; Wed, 21 Jun 2023 00:08:22 -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=1gaS0SkW; 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 S229951AbjFUGpO (ORCPT + 99 others); Wed, 21 Jun 2023 02:45:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231156AbjFUGoI (ORCPT ); Wed, 21 Jun 2023 02:44:08 -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 3E2481BF4 for ; Tue, 20 Jun 2023 23:44:05 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-bc77a2d3841so5687269276.3 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=dkNSv1PxXteX/8YVt7fWsO3ybQLWTTr6TCdeYayxDpIjpPtlFa0HQikbpfy6Pccd21 cCguyLkMmV6iLxp+DMTKVOnNZq83MX3kTCtGsexjH0ArnXIOOH+HnBDIV2kGPQdGqQxg CZW0xpAQncS4Dvdcu2q7ehbFTSCu5AIudDBQfp1L+tmH2iVIi/u7xVGz72nXFXy/D69n koz+4sSNIpBwWZafec5QOpJExSUXnNLyiUzo86xFIIfv6Tve9bCLQkIwJOAm/ZWkhO+j XjR4IB9oNYDjT93g3M3DENUCA5IPatpvfeCPTskulfQB0W1wVjxv7M9otKcLeGiBpcXu xS/A== X-Gm-Message-State: AC+VfDwZoy8EgHgVh7KHKvPoBSmcs0dZEhlP7/bRBil7o5e8wCqsq4fh CbLdOjlTG9hN1TdU9rfRUMopVwsIYZWo 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-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?1769295107948875716?= X-GMAIL-MSGID: =?utf-8?q?1769295107948875716?= 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); }