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: 11718861 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 C6E2C15E4 for ; Mon, 17 Aug 2020 17:18:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 87C3820748 for ; Mon, 17 Aug 2020 17:18:31 +0000 (UTC) Authentication-Results: mail.kernel.org; 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 87C3820748 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9D4046B0002; Mon, 17 Aug 2020 13:18:30 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 9832A6B0005; Mon, 17 Aug 2020 13:18:30 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8988A6B0006; Mon, 17 Aug 2020 13:18:30 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0192.hostedemail.com [216.40.44.192]) by kanga.kvack.org (Postfix) with ESMTP id 719D36B0002 for ; Mon, 17 Aug 2020 13:18:30 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 2C25D181AEF21 for ; Mon, 17 Aug 2020 17:18:30 +0000 (UTC) X-FDA: 77160719580.17.moon00_4905d2427018 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id A6A7F180D0184 for ; Mon, 17 Aug 2020 17:18:29 +0000 (UTC) X-Spam-Summary: 10,1,0,3cbd6ab0b4d45666,d41d8cd98f00b204,jean-philippe@linaro.org,,RULES_HIT:41:69:334:355:368:369:379:541:800:967:973:988:989:1260:1311:1314:1345:1437:1515:1535:1542:1711:1730:1747:1777:1792:1801:2393:2525:2559:2564:2682:2685:2859:2895:2911:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3870:3871:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4117:4250:4321:4425:4605:5007:6261:6653:6742:7903:9025:9509:10004:11026:11658:11914:12043:12297:12438:12517:12519:12555:12663:12679:12895:12986:13141:13230:13255:13848:13894:14096:14181:14394:14721:21080:21213:21220:21222:21433:21444:21451:21627:21749:21811:21891:30012:30054:30055:30070:30089,0,RBL:209.85.218.66:@linaro.org:.lbl8.mailshell.net-66.201.201.201 62.14.0.100;04yraumet98qwnfftycw9xnumka9iopw5qaau1jz1w5xhm4opffy9fp8ape188i.ob5rd4htf6chb356gn8bqt8m1gshstzkhog94my8ancecmt3fjrjzo5trps6pui.6-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netch eck:none X-HE-Tag: moon00_4905d2427018 X-Filterd-Recvd-Size: 6104 Received: from mail-ej1-f66.google.com (mail-ej1-f66.google.com [209.85.218.66]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Mon, 17 Aug 2020 17:18:29 +0000 (UTC) Received: by mail-ej1-f66.google.com with SMTP id kq25so18657158ejb.3 for ; Mon, 17 Aug 2020 10:18:29 -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=dygBbKbwO7A/K6KnDDL3ilKYDpW0yp3D/sHHzKD+x/+rZwRm8yBXLHw3MZpf7sqtxf qAjG9GJEzvcroaBi352lTPgqjXY+qwdx4Cqm4lwj/6VVp95U0RRbr7DNxkBkaduZF7bp W5GTz+a5+AJVde57UvktLSDtDIYd0NB/uYHSXuKmlTenQCw9wFK2YM1CtOIp3624iQsP A+3r+OD61NJL2uq7JicvGHLF567lfb5ceKR79pOyt4U7ZpzDKP61XTQSTRiN4Y8ByWj0 oOwK5b1+fDYq07TiK+rhJ4qq94VLlA0aj4bCJDgJt0T5DQa0rsmgOtde4g2JnupDZOU0 vxIw== X-Gm-Message-State: AOAM532VzlUF3QVOqoqr0HdNnFuv7+k4D1hG86YfAxits1PbFtzL/8f5 achwRrrMJv1NlmbLCx8MRr6y7Q== 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 Cc: joro@8bytes.org, catalin.marinas@arm.com, will@kernel.org, robin.murphy@arm.com, baolu.lu@linux.intel.com, Jonathan.Cameron@huawei.com, jacob.jun.pan@linux.intel.com, zhangfei.gao@linaro.org, xuzaibo@huawei.com, zhengxiang9@huawei.com, fenghua.yu@intel.com, Jean-Philippe Brucker 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-Rspamd-Queue-Id: A6A7F180D0184 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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