From patchwork Thu Jul 23 14:57:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 11681163 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AF00D722 for ; Thu, 23 Jul 2020 15:07:54 +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 86FD7207BB for ; Thu, 23 Jul 2020 15:07:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="vBer8W9Q"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="vmRz4siv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 86FD7207BB 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+patchwork-linux-arm=patchwork.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=FmPU90yUNpT1pWt/baWv3a1nsehi40uZHuebQbJrBpI=; b=vBer8W9QZRGfaGX61KpWOf8QQn 3s5UkUUCVmvgIr8j1LEuxvvHAIouMdr1FNIb0+3QrVmy6hot7rI69cmuBGksldbgmV0se5XRr0+Ss CX9MY3dUzZ98PiMGfJGYnACg2vhkTBEJcz7fZIhwifXWlcVY+z90xTmTaEIZkXvaLhHRVPNAHE2MZ 89PsYhJfzc+yfD/TmH0pajIMgzHzA1YPEXz49Im0RQmIbWZH99Kdp99pJOA6Uy+1oEtqxgUqbEWPc c4uhAoBoCwQ9WltnxGwybFlGV9MyKkq5s9mm+hKSbuh0jw5ZHvNDVx9BZllV+FWZnPyTIdEAvYiZn asBXlu6w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jycnL-0002SI-5I; Thu, 23 Jul 2020 15:06:03 +0000 Received: from mail-ed1-x542.google.com ([2a00:1450:4864:20::542]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jycn8-0002K8-2m for linux-arm-kernel@lists.infradead.org; Thu, 23 Jul 2020 15:05:55 +0000 Received: by mail-ed1-x542.google.com with SMTP id q4so1530563edv.13 for ; Thu, 23 Jul 2020 08:05:46 -0700 (PDT) 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=A/+f3sKHAM8Sl/CeofgRbHbyBXYMnQ69ejRLSfXkX4A=; b=vmRz4sivyaOvBBjRqJwfzi3Xv+4wC9cfKI6lJ9Or4nspLfYw2U3rEQemEA3Exo193I WxM4L9s64uZDgC0gVj48RpcNjAt/WkC5ow+Q9s7I3btCvBpm1IvhU9QAEt8ozQaeYVP6 DufnDTFEM0AZZN68xviRbnICMO3/m8ZaS+s+HKo4UlidZEIJl/jqyak9ARVUmIqs6NMt N9O2hhxLsw1R/AUnWoPx+RJsrPmGHfsX1+OfghxggEfWj0jnrbyLJvOKyf8Zx4jmO7Wz wW7uf/hA6mni5+2pM7jg7t/K8ezHSBu0h3FNKNVYOYnrtNakXPMzBprkCkx14WuAQzFj JucA== 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=A/+f3sKHAM8Sl/CeofgRbHbyBXYMnQ69ejRLSfXkX4A=; b=Q/SriSfc2szqrV5m2Vc/OaDtzF/eoV/PODuAzy9Fj2eHLFVvsP6I4EpI4tKmiqtTtK G8LXy9573wvD5DfEMqgvUP1wS4ye0GfaxKGE5kk07wOSZwMgDL43eKCKgzTvxZPwzApw 9WPH1ntfSy+A/VOE7SqExW04VqN+hPgt3P40gUasP0oE+TfFM5qKBowVNaf2s7V9x3fq STE/JfoBQ1nPElje8SGb0DGEDWzZ6HANfQTd0D0Xvfl6Yd/DnZ05g3pDDJXzEnGzeCjw s42yWZr6hFaCAY0hvmRu1ZmjyHogDRSWGLzP/6JA6ETWhjEljq9x/Ug3GawwB3FfK5JE v0gQ== X-Gm-Message-State: AOAM5332FPmp4qxBclAqs/TpK+hljci78QjrzkDW6tGCT/9yzg+oTJ0n +XXm3PgjK2uVjLOtya3kbwrRtw== X-Google-Smtp-Source: ABdhPJxO+3iuENTupXWAIhZuhGsltmVGrjTe5cZDQuBd3cd5FCLL/Gxd045cWgTluRNETEALgQAkvQ== X-Received: by 2002:a05:6402:1c96:: with SMTP id cy22mr4467189edb.79.1595516746076; Thu, 23 Jul 2020 08:05:46 -0700 (PDT) Received: from localhost.localdomain ([2001:1715:4e26:a7e0:116c:c27a:3e7f:5eaf]) by smtp.gmail.com with ESMTPSA id k15sm2145952eji.49.2020.07.23.08.05.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 08:05:45 -0700 (PDT) From: Jean-Philippe Brucker To: iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org Subject: [PATCH v9 00/13] iommu: Shared Virtual Addressing for SMMUv3 (PT sharing part) Date: Thu, 23 Jul 2020 16:57:12 +0200 Message-Id: <20200723145724.3014766-1-jean-philippe@linaro.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200723_110550_516498_0B5B5B19 X-CRM114-Status: GOOD ( 11.38 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:542 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 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: fenghua.yu@intel.com, jacob.jun.pan@linux.intel.com, Jean-Philippe Brucker , catalin.marinas@arm.com, joro@8bytes.org, robin.murphy@arm.com, hch@infradead.org, zhengxiang9@huawei.com, Jonathan.Cameron@huawei.com, zhangfei.gao@linaro.org, will@kernel.org, xuzaibo@huawei.com, baolu.lu@linux.intel.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Add support for sharing CPU page tables with the SMMUv3. Support for I/O page faults and additional features (DVM, VHE and HTTU) needed for SVA is available on my sva/current branch [2] and will be sent later. Since v8 [1]: * Moved the SVA code to arm-smmu-v3-sva.c under CONFIG_ARM_SMMU_V3_SVA. This required moving struct definitions and macros to arm-smmu-v3.h (patch 7), hence the new 700 insertions/deletions in the diffstat. * Updated patches 4 and 8 following review. * Fixed bug in patch 9 when replacing a private ASID. [1] https://lore.kernel.org/linux-iommu/20200618155125.1548969-1-jean-philippe@linaro.org/ [2] https://jpbrucker.net/git/linux sva/current Fenghua Yu (1): mm: Define pasid in mm Jean-Philippe Brucker (12): iommu/ioasid: Add ioasid references iommu/sva: Add PASID helpers arm64: mm: Pin down ASIDs for sharing mm with devices iommu/io-pgtable-arm: Move some definitions to a header arm64: cpufeature: Export symbol read_sanitised_ftr_reg() iommu/arm-smmu-v3: Move definitions to a header iommu/arm-smmu-v3: Share process page tables iommu/arm-smmu-v3: Seize private ASID iommu/arm-smmu-v3: Check for SVA features iommu/arm-smmu-v3: Add SVA device feature iommu/arm-smmu-v3: Implement iommu_sva_bind/unbind() iommu/arm-smmu-v3: Hook up ATC invalidation to mm ops drivers/iommu/Kconfig | 17 + drivers/iommu/Makefile | 6 +- arch/arm64/include/asm/mmu.h | 3 + arch/arm64/include/asm/mmu_context.h | 11 +- drivers/iommu/arm-smmu-v3.h | 752 +++++++++++++++++++++++ drivers/iommu/io-pgtable-arm.h | 30 + drivers/iommu/iommu-sva-lib.h | 15 + include/linux/ioasid.h | 10 +- include/linux/mm_types.h | 4 + arch/arm64/kernel/cpufeature.c | 1 + arch/arm64/mm/context.c | 105 +++- drivers/iommu/arm-smmu-v3-sva.c | 487 +++++++++++++++ drivers/iommu/arm-smmu-v3.c | 860 ++++++--------------------- drivers/iommu/intel/iommu.c | 4 +- drivers/iommu/intel/svm.c | 6 +- drivers/iommu/io-pgtable-arm.c | 27 +- drivers/iommu/ioasid.c | 38 +- drivers/iommu/iommu-sva-lib.c | 85 +++ MAINTAINERS | 3 +- 19 files changed, 1729 insertions(+), 735 deletions(-) create mode 100644 drivers/iommu/arm-smmu-v3.h create mode 100644 drivers/iommu/io-pgtable-arm.h create mode 100644 drivers/iommu/iommu-sva-lib.h create mode 100644 drivers/iommu/arm-smmu-v3-sva.c create mode 100644 drivers/iommu/iommu-sva-lib.c