From patchwork Mon Aug 17 17:15:46 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: 11718901 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 D3ABE13A4 for ; Mon, 17 Aug 2020 17:20:46 +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 956FC20657 for ; Mon, 17 Aug 2020 17:20:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="zL5rMtCR"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="BR09cPe8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 956FC20657 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=jhEcoxSDDHrQgK3wt2pll1dePuX0QxzqnPlY0DZ0Gpo=; b=zL5rMtCRh65SYbb0yWK/em2+dl A39rzP/BgpubImhJbXGhDsNvdBENfChgtrHBtSMDD5f/FgXPknXf5YDwPAb6KaeOdK9J0VUEHJ3Dx C2n13yKyXMQmfGzfyRSBCq7bYeGtE0HhSiBg1w9aQc9N3lGy3kmu3p/3hjvrgr4PvHC4j3hLC5OvV X8riAB2M6XOafW234XyU7t69xA2fpUmUC9Xg6mmz0Yr4woCQWFK+QA2BTxiY705Btoa7LFbuDtQNR bEU7jfeieLKSyCbd0c5SeyadVX1EXArj8tAe/o8Z4hnTN8BxrnaPlHl1bJJjPA80WhHsA69vad+pD 7jvg49iQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k7imI-0002KP-Hb; Mon, 17 Aug 2020 17:18:34 +0000 Received: from mail-ej1-x644.google.com ([2a00:1450:4864:20::644]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k7imE-0002HL-V1 for linux-arm-kernel@lists.infradead.org; Mon, 17 Aug 2020 17:18:32 +0000 Received: by mail-ej1-x644.google.com with SMTP id o23so18684297ejr.1 for ; Mon, 17 Aug 2020 10:18:28 -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=R7aC/DW1op4r+Z4hZksSzHEK9PjzVJ3p6kxoSLnPAKg=; b=BR09cPe8bipj+PNSPJ1rZYq6F49uZsaAAEaiZZeLUza/HWSgYsHfiQUqvehNj/zHdo qbAxbhzWgLv+JgXc9Hf8u2r0v1qrwMCu7IY9bpfe2MF85MUYUijjETNvgjULx5UIGbMx vN81Nd7Fr3GNRpruujEBEwi/FOk3fs+L+J1ksom42jt/RIrqDQ7WW/C4Q+72/n9Kq5Tq due0daqEBODsHaOjJ9pd0+84Yq8HsJ3xE9GoW+cLGESU0YeMSiOWmp56VWa09Lly0cQo yQVqNC6ia55Pl7kROeww6SaTcZpoM6TDOlbVsdYI6d9Y6hnApPDaUub8SL5YIR+nIsKH UcNg== 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=R7aC/DW1op4r+Z4hZksSzHEK9PjzVJ3p6kxoSLnPAKg=; b=VRsGN1LcV2P8U4VZNWv9AgenOF9YYjh8hqUQc5rFsjaCb0cytQj/7M1E8EaZaug7Dh BMGl3LWn5ot6LH2WZxzZL9x3xlPLstlsphGyjMI/aWV6Xcx49sG9aBJy0dLLfuOOVqdJ GM8FvLq7d4NISb8RTd6RLlFVnQbmq8SzhlMHxTuYnLqKFnsTwarerJ9lINy49B8pkaUV qmhQ0OQ9Ci/Tfr4ftk58fAIsKpXwakaDyVVBJ5HynU4xBmggkX6mJfga7xeNymwuFQn5 vE7meJtQas3cyPkQ7+RxDugbw2G1W2z1KIl3XOs8aTMLjHUo/eqD+9X9lU41NaWg5y4i vdAQ== X-Gm-Message-State: AOAM532I+QqDAuemjdzwIh1WwbEE5Nj3WIXGcvdXBT4phyxHiCzyh4cL IvBFm80IZLqTHFapnSX0EJWHXA== X-Google-Smtp-Source: ABdhPJz+VQOQnttZCxy1+owk4CZNaUQxcFkQ4Xi34Vfk+EDoxMENCWtTQOcb42FV3aeK6PlTS6T3Tg== X-Received: by 2002:a17:906:c7c8:: with SMTP id dc8mr15694071ejb.285.1597684707897; Mon, 17 Aug 2020 10:18:27 -0700 (PDT) Received: from localhost.localdomain ([2001:1715:4e26:a7e0:116c:c27a:3e7f:5eaf]) by smtp.gmail.com with ESMTPSA id lc18sm14672502ejb.29.2020.08.17.10.18.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2020 10:18:27 -0700 (PDT) From: Jean-Philippe Brucker To: iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org Subject: [PATCH RESEND v9 00/13] iommu: Shared Virtual Addressing for SMMUv3 (PT sharing part) Date: Mon, 17 Aug 2020 19:15:46 +0200 Message-Id: <20200817171558.325917-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-20200817_131831_160367_C0DA9241 X-CRM114-Status: GOOD ( 13.12 ) 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:644 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches 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_AU Message has a valid DKIM or DK signature from author's domain -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, 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 This is version 9 of the page table sharing support for SMMUv3, rebased onto v5.9-rc1. v9 resend: * 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 | 487 ++++++++++ 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 | 85 ++ MAINTAINERS | 3 +- 20 files changed, 1729 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