From patchwork Fri Sep 18 10:18:40 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: 11784573 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 E29CA6CB for ; Fri, 18 Sep 2020 10:20:17 +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 A7D702075E for ; Fri, 18 Sep 2020 10:20:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="oiDEWKwk"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="aawrGoT0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A7D702075E 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=q/XhrEYL9At06iNrQ4S37oig8MmXuIr43QJK+aP/CUA=; b=oiDEWKwkK4E+JYR2TeJloXsfcw bWKjD5hwyyGCVUhl1Bsw7gLEDX4M3VAgqhoTo5mlZYrWinKxNF7RNvOhejMVPsic0fZ+TrkkXZxNz LAmW3HDT+SyJ2VAly/+VZYPlom2c+PVzFnm2S/ZhfwERt4pwMFX6laKAmGgMFcuTiZgTsgR6Uw3Nb esKcqeSOkonZJN/1syg99LAonixvJRNW7MmGfa0m6nRfMXiIzECM3SrkTfWIkAIPhh/tSzA+KGnu4 kkYB8WDhQpZCXDcu7iwMjEKMJaRmejXkUCXaXek1IeE/5/iiCamqgsA0KGfMdQne1Be953KTQ64Lq eCT/LBVg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kJDUl-0005BO-VP; Fri, 18 Sep 2020 10:20:00 +0000 Received: from mail-ed1-x541.google.com ([2a00:1450:4864:20::541]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kJDUh-00059F-DG for linux-arm-kernel@lists.infradead.org; Fri, 18 Sep 2020 10:19:57 +0000 Received: by mail-ed1-x541.google.com with SMTP id g4so5607678edk.0 for ; Fri, 18 Sep 2020 03:19:54 -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=Lv4b9GY6+/bQQk9KCigu2YOyVf5wGbkZ83LEMpm6G8I=; b=aawrGoT0HCqKrNQLDsu4ySNkEpm9PttsoV+pu7FbzHS81I9fNNjUJyKDF4TsAV1ufp 9E/FoBjhs1QgEv5nLGUt1aSMg+T32u2GOYujngMtZVPBALd3S+ZY9cRBoi+BTkFOPP0V JbUHqZEVcB8zGGWRHcO96t1EaUKaN0+xktEBQ6mZOtbCZiOZR0C2nt/278BH3wJWhJC9 1G5i9+7H7VsoOhMRLzbQJp8c/fgFAfUIvUUx5yA4i7EKVUWcmpXN2j9I4xy0tIekT6GQ +Tym/HBZZa3/UoH7uqJiCPkyDGzw7zhcEzXkPJ5vUi0ZhB3MqWKrggWJGhVSs1zh09e0 GJUg== 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=Lv4b9GY6+/bQQk9KCigu2YOyVf5wGbkZ83LEMpm6G8I=; b=Oo5/riFIX4dN9Q70Cx2OWHFR4ZbdJfAZIrkBsYtV9pZWdKWRINbPzdPagtE8ECV3HE UWL43nYxbvzhg9nIt0cargADzyV4l8csiAVITDEaqPW4Gj2T7LQ5Sbzh2pSyRxT/VGvT FBN0KQgmQRcCvvoOGRPVD3k6aAD45J3uzWMq/BDGYtTh/wH4sroG3DusujG5QfK8UI8R d+YYJThSfzXiFzuA7e/pCYo0ExybDQdGTx23372AEBDadWp5b7OmszS4DgEUlAjObgGY fyfaOA3rE1yWnIUyhyVNPDODpT7W2PgMzkM2W4wbZDMLuTATdQriwHPLPtbKcltEefle 5yeA== X-Gm-Message-State: AOAM532t0f2WTCRSGX35KiF1nSBNRrSX8tZtfcs0898psArtekF12XJZ qM1AYPL83k41tikQbUy2vplMRS6WhU10wrrf X-Google-Smtp-Source: ABdhPJyUUObxySn2EBQo1QBdHyPSiPfxzCfd37bHd4/MqRE0Cc6VLlNPyEeZiwMMHqJCW9gF33Crwg== X-Received: by 2002:a50:9d0a:: with SMTP id v10mr37167009ede.144.1600424393968; Fri, 18 Sep 2020 03:19:53 -0700 (PDT) Received: from localhost.localdomain ([2001:1715:4e26:a7e0:116c:c27a:3e7f:5eaf]) by smtp.gmail.com with ESMTPSA id r16sm1940674edc.57.2020.09.18.03.19.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 03:19:53 -0700 (PDT) From: Jean-Philippe Brucker To: iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org Subject: [PATCH v10 00/13] iommu: Shared Virtual Addressing for SMMUv3 (PT sharing part) Date: Fri, 18 Sep 2020 12:18:40 +0200 Message-Id: <20200918101852.582559-1-jean-philippe@linaro.org> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200918_061955_958176_3753D4B7 X-CRM114-Status: GOOD ( 13.79 ) 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:541 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_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from 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, eric.auger@redhat.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 This is version 10 of the page table sharing support for Arm SMMUv3. Patch 1 still needs an Ack from mm maintainers. However patches 4-11 do not depend on it, and could get merged for v5.10 regardless. v10: * Fix patches 3, 8, 9 and 10 following Eric's review. v9 resend: https://lore.kernel.org/linux-iommu/20200817171558.325917-1-jean-philippe@linaro.org/ * Rebased onto v5.9-rc1. Moved to drivers/iommu/arm/arm-smmu-v3/ as a result. v9: https://lore.kernel.org/linux-iommu/20200723145724.3014766-1-jean-philippe@linaro.org/ * Moved most of the SVA code to arm-smmu-v3-sva.c. 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 a bug when replacing a private ASID. v8: https://lore.kernel.org/linux-iommu/20200618155125.1548969-1-jean-philippe@linaro.org/ * Split SVA series into three parts: page table sharing, I/O page faults, and additional features (DVM, VHE and HTTU). 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 | 1 + drivers/iommu/arm/arm-smmu-v3/Makefile | 5 +- arch/arm64/include/asm/mmu.h | 3 + arch/arm64/include/asm/mmu_context.h | 11 +- drivers/iommu/arm/arm-smmu-v3/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 ++- .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 488 ++++++++++ drivers/iommu/arm/arm-smmu-v3/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 | 86 ++ MAINTAINERS | 3 +- 20 files changed, 1731 insertions(+), 735 deletions(-) create mode 100644 drivers/iommu/arm/arm-smmu-v3/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/arm-smmu-v3/arm-smmu-v3-sva.c create mode 100644 drivers/iommu/iommu-sva-lib.c Reviewed-by: Jonathan Cameron