From patchwork Fri Jan 22 11:52:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 12039107 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AFEBC433E0 for ; Fri, 22 Jan 2021 11:58:05 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1DFAE22C9F for ; Fri, 22 Jan 2021 11:58:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1DFAE22C9F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=GUJdQKIqw+SQwvdSPbnS8+WCcVags0D1YMcJx0fusTw=; b=vTrMlpiRh3//I4S8HNuDtDj0XO ADb78YHndT8Kc0pJzWkI3Wx/H7dUFHda0CzTJtR7zYpXX7Z5a3sogga2k8ZWsmqQ98dmN/gXtiNhF jbrHRkkLr91hKqOBbdXvidaseA0t8ibArw06gqIjJXcu7pNPw5Mtm+gq/itVEGOIlCJBYEwrPmwJS IpxZC733+nePjbUzSE9PQpzo851MQQ3AJmez1QKyVBeo+LgTRsp8sAGOkyBLVdVK1dQuKStU+WSl/ wXLejeV7hTWifc0Jtq0m2wnti5SmuG7e8b/xidDKh1EnxPa8lCz8L4x14ZvvVWegz6sSED3IVF7+e K0cG0kBg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2v3H-0003Rq-OU; Fri, 22 Jan 2021 11:56:31 +0000 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2v3E-0003Qk-RF for linux-arm-kernel@lists.infradead.org; Fri, 22 Jan 2021 11:56:30 +0000 Received: by mail-wr1-x42e.google.com with SMTP id 6so4829367wri.3 for ; Fri, 22 Jan 2021 03:56:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pdKDptCHYJAfbzlC3FLHPAJA0x8fbBbYQpyeKd2Vy7k=; b=Hl32bO5nl2Cn3RFHu+v+gO/NSZT7WO+5u61rmicU9FUzbEunYciGLmARVj9JRNbERV vVYqiVyP5MTcVsS8UK8gFkv0ABSDHboBlDO05z5AjLmYTdKoVD5aZzSChh9R1LVjaVR+ nTvcwIIcxm9JNldlEpcuOfuZptpEK6qeHS021FtNZpVVlfXwvKOvqV8plBYOECHGWdQt gZHuiuFjFMedFF8/LYK8Jq9xWKCdNLS46fn2kKqDulSP1CDxSNO782nwqMVZso7khpJ2 plYofAVbDtsUpge1Od4B1jtyko3WpP+f6RzuMMYGTCa4eMNRlKeN/VZIddX1LG9Tlxzd C3/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pdKDptCHYJAfbzlC3FLHPAJA0x8fbBbYQpyeKd2Vy7k=; b=mkR2bA7+KhPZvpDSrxy6HqA3bKZ4MYmyNyts0yHTJzfOmoGhKBdixPAWZvHzqFJyEj qOxpCcKq2KVHqoXdtg/BKL1D40tABRIgz/L0vOmJnxP6eghhJJOfpZGIaRv+qRQYQQy5 OwEXeXK+LQjBd+LApCnS0MiDWpzjMAQUFQYzGkxjrE2KVdbtaQBEfkH9vXabW7x3kqZF 9ZIUBmVqL5IUR3x7S72gd6tpf5OszvdIN7k/RRjwprb7IDyFLABrIb7MHZGuaajM4AJm UJHLbEZjhYLCq/B+OlZLDqkLWY62pcIF0gfrXpaw/BXqHSY23/ZdjKs4so6dA0/tdeAW 6roQ== X-Gm-Message-State: AOAM533GWbIehnLfgcVE8khv4RSnMMcv3seHeyfULGdwzPaII9mxqEMA K4OyWI2SlHTI2hrIWPIBUB3BPg== X-Google-Smtp-Source: ABdhPJy1bMKqKX25Mz4Uyo7MUE5fAVdKwZqLqA9qO3qq6yPYaKhxlWSa+vbm8Yw67Dyrqqeql1KFzA== X-Received: by 2002:a5d:4391:: with SMTP id i17mr682554wrq.57.1611316587570; Fri, 22 Jan 2021 03:56:27 -0800 (PST) Received: from localhost.localdomain ([2001:1715:4e26:a7e0:116c:c27a:3e7f:5eaf]) by smtp.gmail.com with ESMTPSA id s25sm13293901wrs.49.2021.01.22.03.56.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jan 2021 03:56:26 -0800 (PST) From: Jean-Philippe Brucker To: will@kernel.org, robin.murphy@arm.com, joro@8bytes.org Subject: [PATCH 0/3] iommu/arm-smmu-v3: TLB invalidation for SVA Date: Fri, 22 Jan 2021 12:52:55 +0100 Message-Id: <20210122115257.2502526-1-jean-philippe@linaro.org> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210122_065629_194003_778DB44B X-CRM114-Status: GOOD ( 12.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jean-Philippe Brucker , vivek.gautam@arm.com, eric.auger@redhat.com, iommu@lists.linux-foundation.org, Jonathan.Cameron@huawei.com, zhangfei.gao@linaro.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org To support sharing page tables with the CPU, the SMMU can participate in Broadcast TLB Maintenance (BTM), where TLB invalidate instructions from the CPU are received by the SMMU. For platforms that do no implement BTM [1], it is still possible to use SVA, by sending all TLB invalidations through the command queue. Patch 2 implements this. This series also enables SVA for platforms that do support BTM, as an intermediate step because properly supporting BTM requires cooperating with KVM to allocate VMIDs [2]. With BTM enabled, the SMMU applies broadcast invalidations by VMID to any matching TLB entry, because there is no distinction between private and shared VMIDs like there is for ASIDs. Therefore a stage-2 domain will need a VMID that doesn't conflict with one allocated by KVM (or use the one from the corresponding VM, pinned). These patches, along with the IOPF series [3] and the quirks [4], enable SVA for the hisi accelerator that's already supported upstream. My quick performance comparison between BTM and !BTM on that platform were inconclusive. Doing invalidations via cmdq seemed to slightly reduce performance of some heavy compression jobs, but there was too much noise and not enough invalidations in my tests. This series does not depend on the IOPF one [3]. [1] https://lore.kernel.org/linux-iommu/BY5PR12MB37641E84D516054387FEE330B3CC0@BY5PR12MB3764.namprd12.prod.outlook.com/ [2] https://lore.kernel.org/linux-iommu/20200522101755.GA3453945@myrica/ [3] https://lore.kernel.org/linux-iommu/20210121123623.2060416-1-jean-philippe@linaro.org/ [4] https://lore.kernel.org/linux-pci/1610960316-28935-1-git-send-email-zhangfei.gao@linaro.org/ Jean-Philippe Brucker (3): iommu/arm-smmu-v3: Split arm_smmu_tlb_inv_range() iommu/arm-smmu-v3: Make BTM optional for SVA iommu/arm-smmu-v3: Add support for VHE drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 6 + .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 14 ++- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 104 ++++++++++++------ 3 files changed, 89 insertions(+), 35 deletions(-) Reviewed-by: Jonathan Cameron