From patchwork Wed Jun 21 06:37:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shavit X-Patchwork-Id: 110836 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4184063vqr; Wed, 21 Jun 2023 00:33:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5wDIptUi3iuNybndzya66MM3gOiyDEA+ooH3EPeYI1fkoS8J4rXDyrJq+JQdm3NX6gUIpH X-Received: by 2002:a05:6a21:6da4:b0:121:b5af:acb1 with SMTP id wl36-20020a056a216da400b00121b5afacb1mr10396921pzb.29.1687332791812; Wed, 21 Jun 2023 00:33:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687332791; cv=none; d=google.com; s=arc-20160816; b=H5nem2woncsgjGKjsXS8nEKvhBCBF4n/nU2TamnxPDxPAEH7T/v1+Gim5gsFIscfAr fmjqHK8r2Z4ekylDBJifqEokJF946whrNFqI2nRj/gmZnv16a14BlmMZ51rdGUa3IsJa Qo+z/YKLcQWXACYz07pN+UqOT3donqNJxZW4fkin14PJChsETab7CDww1Ji9qpo5l73Z EcdzaZzLX0F00qgOC+SBduG4RHGWvIznoWgoSSgqLT1p4IOcyAYGnl9BZYEfubyf+26j xI8IBDJyyk+X3wdeKVn2sjT3W+3kgzRY5M2eYGrqjEmR40hSTjdmMfzC2uQBSTrk5Jso 4Owg== 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=C8az5zJDH0ESFjwiqnExbJyBaF+tF0BTQf7Bxk21/Xo=; b=Z+wQZvskwyBI6ijOLMWCFC1z1r3gWRe8oyXM4mfQNRnKF0lG/d2tvf6E+e3irekJmW QjG5L/rH5hGaJvuFluOiR6veECgoYGHele6rXrDebe/Wlnn90cP0to/hXdefJPQQpnpI UEhUqKcX9ZqfF0udd4cUim0B2gZAu9FWs9VKqt2GjpjN8KUV1op2a7YFNK0otb0X863u LRBcy904MnOUBdWB/y15h0svQVH606sLuTs6jEtPbBdN+0mFRi8bgijed/urKLV77muU oPzlgHR3Mdk9DfZewk1LeILSizD1+dGA1+qBz/2f+CWF45KNT6YSg/WUQGGmW6VjplPT nu9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=MmssWY+3; 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 x15-20020aa7940f000000b006630be2db05si3406475pfo.182.2023.06.21.00.32.58; Wed, 21 Jun 2023 00:33:11 -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=MmssWY+3; 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 S231149AbjFUGpp (ORCPT + 99 others); Wed, 21 Jun 2023 02:45:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231267AbjFUGo7 (ORCPT ); Wed, 21 Jun 2023 02:44:59 -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 1260B2112 for ; Tue, 20 Jun 2023 23:44:22 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-bc7267224adso10882628276.0 for ; Tue, 20 Jun 2023 23:44:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687329861; x=1689921861; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=C8az5zJDH0ESFjwiqnExbJyBaF+tF0BTQf7Bxk21/Xo=; b=MmssWY+3YFktxIF/WA4KOY5DVa4UBDzQVE2mTxNFaVyKAMTQcPmzrUyKnRow1u5/1i 0meUrWB+7qdjGxGk/BZXzmzb1pQ53nSbLZW7KEXzmJ1wTWPeYpDaHRWw5MR6gg5fRS/t ku0AYHWl3On0+y1JE0YaBf7Aeap5dO2iKcztXzsyi5LQbiU3nBTbOOBGFhj+kVO1nPS/ L1ltlHWhVDA8Qr/1MoVmRNWP3cN11BDGjlQjTXU+uttVYyoXzTzGdapoPcBYaZqSXJL0 P6GwQQiyXHV7CzI5aqwk/8XCza5dBcBmpLoo5ytAswHLv7lm0GTilChwtaq7QlU0zcFb bo5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687329861; x=1689921861; 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=C8az5zJDH0ESFjwiqnExbJyBaF+tF0BTQf7Bxk21/Xo=; b=daZGyYb/OLJiyxJkNjW3gKexX752r6/FAkASZygWU3wLmUSk4q0p6kwsxz32bZpIyH uvMvL+uP02nGF3ikYyXkTr3ghy0H+eEO/XMUh038ZY0ANC979352nGkAwhF9i3qqcO0l 6oDOaqmXkdo6/gDqTxsQh49W38c4Yco0tHaVsuJLW/5+ybl+hYipUtB+vrbZTcVjrFY3 mpIqYJYhR90heXt0k29vpsvcZPADHwIhdU/tK6Vt7nR3uKIcGdVS5HS7rCnE9vm1ytrc zCRhgHEUdpiYzF+/fG9dOb2ujAFV50xSw0tFgJjPLRoXnjnKYrRUXYQWdQeuobdDhysR 4Rnw== X-Gm-Message-State: AC+VfDzShRkFrVXtmQwJ4+FCS3Rd63bGicmUJ9PleoM+GsXXazN7hUww q83ZwgQv95DjGVBhqk7NcZdmYE1JlqT/ X-Received: from mshavit.ntc.corp.google.com ([2401:fa00:95:20c:384f:f7da:c61d:5a3e]) (user=mshavit job=sendgmr) by 2002:a05:6902:92:b0:bc4:a660:528f with SMTP id h18-20020a056902009200b00bc4a660528fmr3348263ybs.5.1687329861096; Tue, 20 Jun 2023 23:44:21 -0700 (PDT) Date: Wed, 21 Jun 2023 14:37:20 +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-9-mshavit@google.com> Subject: [PATCH v4 08/13] iommu/arm-smmu-v3: Add helper for atc invalidation 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?1769296669087545084?= X-GMAIL-MSGID: =?utf-8?q?1769296669087545084?= This will be used to invalidate ATC entries made on an SSID for a master when detaching a domain with pasid. Signed-off-by: Michael Shavit --- v1->v2: Make use of arm_smmu_atc_inv_cmd_set_ssid --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 9 ++++++++- 1 file changed, 8 insertions(+), 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 65e2dfd28b7d8..0a5e875abda86 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -1784,13 +1784,15 @@ arm_smmu_atc_inv_to_cmd(unsigned long iova, size_t size, cmd->atc.size = log2_span; } -static int arm_smmu_atc_inv_master(struct arm_smmu_master *master) +static int arm_smmu_atc_inv_master_ssid(struct arm_smmu_master *master, + int ssid) { int i; struct arm_smmu_cmdq_ent cmd; struct arm_smmu_cmdq_batch cmds; arm_smmu_atc_inv_to_cmd(0, 0, &cmd); + arm_smmu_atc_inv_cmd_set_ssid(ssid, &cmd); cmds.num = 0; for (i = 0; i < master->num_streams; i++) { cmd.atc.sid = master->streams[i].id; @@ -1800,6 +1802,11 @@ static int arm_smmu_atc_inv_master(struct arm_smmu_master *master) return arm_smmu_cmdq_batch_submit(master->smmu, &cmds); } +static int arm_smmu_atc_inv_master(struct arm_smmu_master *master) +{ + return arm_smmu_atc_inv_master_ssid(master, 0); +} + /* * If ssid is non-zero, issue atc invalidations with the given ssid instead of * the one the domain is attached to. This is used by SVA since it's pasid