From patchwork Thu Aug 3 10:12:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shavit X-Patchwork-Id: 13339654 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 056A6C0015E for ; Thu, 3 Aug 2023 10:14:48 +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=NlK/LAC1/LnyfTWCvr1Z86uLErTNsbr59MjwWMHPjqI=; b=FMQkrGwKEuO+IiBC6txifEnHss VyZHn0TKeppSBmiN5EcyoPEp18VnKdnOexnZemDI30Zpw0FOA6fKRBpOBojcHkseuvh4adAOqfqzn 0PP4y7HaryO3UWkTgoGTaRYK3NENiL8xWEpKmpbnsn8ZOTVJHm3BdzqS4HaRq5U5jjbYOCpa1bTOQ Negn1VrOPmRnn4MWwUdjXvFM7LhWEU5uHjlTMRjkcTpf5MahU86kcdXGen+coV0/9ZLaUPHXkZE2V h5dIZmAYA+KyjpiB3+/fS6tR8vLC+QFFIKwAO8ryRguNLRGJxpaW5c2BiOrgvwl0ggHe5dtgk9FUQ r/d4vghg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qRVLa-007JhQ-1N; Thu, 03 Aug 2023 10:14:22 +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 1qRVLV-007JfD-2n for linux-arm-kernel@lists.infradead.org; Thu, 03 Aug 2023 10:14:19 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-57320c10635so8482147b3.3 for ; Thu, 03 Aug 2023 03:14:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1691057656; x=1691662456; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=rOifn/Wuhm3Lbc3GJRKlq49fGVZtVjA5QOC6h6hHPVo=; b=zJO63gTN+QV8Tfx+6gzEyj5dUonNQXVuyOR/4CqHTz6PD/3cyRUXHXVcphE0fpyuCR ZKz98+w5g8mFMMzzvIJ747TDQzawpo9yAa/1f6z+hOOvccv3tyru4rVG/SNKz9FZCl5s uIn2qnCLLDiJNac2CKJCfNSreSw5An3t/Kx+wsM8Pcw1M5SxyvLmfICMMkWalT4pT/fH IEFOJ549A2Nn1ee23hdlvSi7Y3WyIy4Tdve79X6p9c1NumDYR1CfcPF3sBfoSZXRe5Qr WrgHPCqRl2usHE3RPid/EudzlKgU3D4crbQvFz+8xt4Mn708pcq+X+TmyEB36fv7aHaX l0Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691057656; x=1691662456; 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=rOifn/Wuhm3Lbc3GJRKlq49fGVZtVjA5QOC6h6hHPVo=; b=LMdvp3thp/hlV6zqMzcckKUYl3o+ZEgA6TSnZvvHirVo+Z5qh2atdkD0zt/ZfY1/ua QAaRyTcxhnyaVxjM76nfvAnH/7kYCLxXNUgE5QGK9uuezRgeg84iGGH2RFk79PKOrF5S vrHiymSENCtVTkj9bAVRx2NsL+C/NZK3mMPnKcxlLv2jOnAeC64iP47QKyB6rxsA1fKu jUHQqwzZNqsUtdBD/GY7ZbYePnOZGGknI+F8eUQGCSGpXh1miiUHLb6qKsEvGxL4hxEN mNrOG0Jcfu9e+m9HaiV20XhJjhGEEcx3IrrQH3bujneWnrulLHaEnZMpItBKrpaHW/8G mtdQ== X-Gm-Message-State: ABy/qLaqzBBRSGSllkEhzuhuV8odSv0OKGQD2IvGZqUJJy4B2nEhJrap yaQ8LRmFVKlJZKY9yhvDJV2yTbtS/Ggq X-Google-Smtp-Source: APBJJlEww5GzZLOemvoHR0jnjoJTpv9UvSTAuAgQXGJ5jhZ7oiz42irlxltf7zXwxFAEDzkY/BIZ2zeS4ZW5 X-Received: from mshavit.ntc.corp.google.com ([2401:fa00:95:20c:39d1:8774:b733:6210]) (user=mshavit job=sendgmr) by 2002:a25:ab0b:0:b0:d0e:e780:81b3 with SMTP id u11-20020a25ab0b000000b00d0ee78081b3mr118271ybi.2.1691057656667; Thu, 03 Aug 2023 03:14:16 -0700 (PDT) Date: Thu, 3 Aug 2023 18:12:23 +0800 In-Reply-To: <20230803101351.1561031-1-mshavit@google.com> Mime-Version: 1.0 References: <20230803101351.1561031-1-mshavit@google.com> X-Mailer: git-send-email 2.41.0.585.gd2178a4bd4-goog Message-ID: <20230803181225.v5.3.I374b2826d8b01f3a0110fd42a01208d2e8adb0a2@changeid> Subject: [PATCH v5 3/6] iommu/arm-smmu-v3: Add helper for atc invalidation From: Michael Shavit To: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: baolu.lu@linux.intel.com, will@kernel.org, jgg@nvidia.com, jean-philippe@linaro.org, robin.murphy@arm.com, nicolinc@nvidia.com, Michael Shavit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230803_031417_916787_FE3F5E56 X-CRM114-Status: GOOD ( 14.76 ) 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 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 --- (no changes since v2) Changes in 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 6e614ad12fb48..e0565c644ffdb 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -1798,13 +1798,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; @@ -1814,6 +1816,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