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: 11681157 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 A48D9722 for ; Thu, 23 Jul 2020 15:07:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 67599208E4 for ; Thu, 23 Jul 2020 15:07:06 +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="vmRz4siv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 67599208E4 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 565826B0030; Thu, 23 Jul 2020 11:07:05 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 53ACC6B0031; Thu, 23 Jul 2020 11:07:05 -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 451566B0032; Thu, 23 Jul 2020 11:07:05 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 2F8CF6B0030 for ; Thu, 23 Jul 2020 11:07:05 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id DFE4D8248047 for ; Thu, 23 Jul 2020 15:07:04 +0000 (UTC) X-FDA: 77069668368.25.cat56_3903b5826f3f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id 1F00B1801493D for ; Thu, 23 Jul 2020 15:05:58 +0000 (UTC) X-Spam-Summary: 10,1,0,da0875934b617214,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:2560:2564:2682:2685:2693:2859:2895:2911:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3353:3865:3867:3868:3870:3871:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4250:4321:4425:4605:5007:6261:6653:6742:7903:9025:9509:10004:11026:11473:11658:11914:12043:12291:12297:12438:12517:12519:12555:12663:12679:12895:12986:13141:13230:13848:13894:14096:14181:14394:14721:14819:21080:21213:21220:21222:21433:21444:21451:21627:21749:21811:21891:30012:30054:30055:30070:30089,0,RBL:209.85.208.67:@linaro.org:.lbl8.mailshell.net-62.2.10.100 66.100.201.201;04yfajymez7k5mqtirzu7wzqnxobwypdehwzjy63atuec8ppdgybdhchb7rks4o.7fd3fhd4w6o1rgscws9ayeprf8he8fmwnu78fon1jen9omt3fjrjzo3f43k166j.4-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0. 5,Netche X-HE-Tag: cat56_3903b5826f3f X-Filterd-Recvd-Size: 5787 Received: from mail-ed1-f67.google.com (mail-ed1-f67.google.com [209.85.208.67]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Thu, 23 Jul 2020 15:05:47 +0000 (UTC) Received: by mail-ed1-f67.google.com with SMTP id b13so2377422edz.7 for ; Thu, 23 Jul 2020 08:05:47 -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=nAaePo0jb3maMKWg99EI9oSfXoD0qPP8SeklbyZ72V71oAYuvJR9LmTAGkC+ePIbTA QY40mkSe1bod5PCtnKk45r1K6Le1+MRY5jUu6LHr9e3NRKTsCj8kEZL+aKtVLhoAjHTg qSD6VRM+xn6RxMUOz7l5h9tzH1SjMOpPv1l7i75mKv1U3ur2A5odT8ivsJPL+bRm08FK ij/HxhzyHvTPN/FxycLfWH2S1Gkr2K5yNuzDYo4MKzKwUkQSl1TEvubR/9GG+/s5aqVU plNouo6SrVJqgc5HHaa4m7DXDIGahgDwGyjQvKkeX5sD25FxyuRd5p2u+HogCxw5Vz3Y L+nA== X-Gm-Message-State: AOAM5324Aq7KUVSjpk/JppQMnP2/FXhNyilwtjdSR68uFYES9001EGqD 2L6JesfE7WXtoWFYzTUUqdkcQg== 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 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, hch@infradead.org, Jean-Philippe Brucker 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-Rspamd-Queue-Id: 1F00B1801493D X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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: 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