Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3532674ybi; Mon, 10 Jun 2019 11:53:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqzn24KW3sDmBux6hXaHpzVNczV2YXeqUx0OUoFznqJtUXaxBctQLGmokRb56yLtJ4P4r0ah X-Received: by 2002:a17:90a:ae10:: with SMTP id t16mr22761777pjq.51.1560192807906; Mon, 10 Jun 2019 11:53:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560192807; cv=none; d=google.com; s=arc-20160816; b=TlDE0LmVXT0tC0n8Ux00BrY/FR5Ztgj3hiT+oxxzf75DkYcc60FlKHu7ifMkeA2kqz fTAalz9zp0A/FGd8Ib6vNMlZcc01+zL68CTXVrVOPHyfbYOLlooc2010VAnPzGXIy1GN UPwYwXR3QdFV8wLzbpM+BUBiiAUL9hRn8UHtwwXhCPYqPxd/cF3aYpf0qTCkUVMDnPWG 6TOdCX1CKzmPwcXz8454j9MEOKseNCuS1FoZ5exIDniv7E3kSrbPqhdMQ6g8L8Y7JYHR +yo1/y4vrSD8W0LkSZzQbLNiWaQiyrqlraFtxGLGqZcizqxIXpDZF/ygM/kzdt5Tl7a5 NiKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=WGsnEX3KrLS1/C6nIhlRDMUecmCjdJAmuoODsxwUX2U=; b=FbAkzoPOZhrCZ+/SWS6tekAudEj8itswd+mRGLQ+Gl2gHRDy8N9zxQFn9qGj1QU60l SSkb9AOdJrLMKjgyCj38zzh6Q2+SzzMZ5RhIpCzEWbLJ1bhJcld0bdBPdRh7n/yAlvMp vAwlSd2XrtT3N6vEoTIcvvWIo5bPP9oPAmIoNGHi55ajba+jfopTJHdBaucmdfRA5n4b YE0Lzwvc6KE1+3L2FMVg8GEfso3uPzG98vVIml2BAhgXN4YLv0fZ/+0Gk+CpKqHTfv3r A6XF6Asjk1EXtpT+X9NqNQbN45sx6d5kuTDRFLgddpr/bC/c50r5fGQyeMvYe//+rvQ2 k/ZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q3si172879pjv.92.2019.06.10.11.53.13; Mon, 10 Jun 2019 11:53:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388564AbfFJSvt (ORCPT + 99 others); Mon, 10 Jun 2019 14:51:49 -0400 Received: from foss.arm.com ([217.140.110.172]:47510 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387643AbfFJSvt (ORCPT ); Mon, 10 Jun 2019 14:51:49 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C227C337; Mon, 10 Jun 2019 11:51:48 -0700 (PDT) Received: from ostrya.cambridge.arm.com (ostrya.cambridge.arm.com [10.1.196.129]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 511F03F246; Mon, 10 Jun 2019 11:51:47 -0700 (PDT) From: Jean-Philippe Brucker To: will.deacon@arm.com Cc: joro@8bytes.org, robh+dt@kernel.org, mark.rutland@arm.com, robin.murphy@arm.com, jacob.jun.pan@linux.intel.com, iommu@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, eric.auger@redhat.com Subject: [PATCH 0/8] iommu: Add auxiliary domain and PASID support to Arm SMMUv3 Date: Mon, 10 Jun 2019 19:47:06 +0100 Message-Id: <20190610184714.6786-1-jean-philippe.brucker@arm.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add substreams and PCI PASID support to the SMMUv3 driver. At the moment the driver supports a single address space per device. PASID enables multiple address spaces per device, up to a million in theory (1 << 20). Two kernel features will make use of PASIDs, auxiliary domains (AUXD) and Shared Virtual Addressing (SVA). Auxiliary domains allow to program PASID contexts using IOMMU domains. SVA allows to bind process address spaces to device contexts and relieve device drivers of DMA management. Since SVA support for SMMUv3 has a lot more dependencies (new fault API, ASID pinning, generic bind, PRI or stall support, and so on), introducing PASID support to the SMMUv3 driver is easier with auxiliary domains. The AUXD API allows device drivers to easily test PASID support of their devices, although they need to allocate IOVA and pages themselves because the DMA API doesn't support AUXD for the moment: iommu_dev_enable_feature(dev, IOMMU_DEV_FEAT_AUX); domain = iommu_domain_alloc(dev->bus); iommu_aux_attach_device(domain, dev); iommu_map(domain, iova, phys_addr, size, prot); pasid = iommu_aux_get_pasid(domain); /* Then launch DMA with the PASID and IOVA */ Auxiliary domains also allow to split devices into multiple contexts assignable to guest, with vfio-mdev. Past discussions for these patches: * Auxiliary domains (patch 6) [RFC PATCH 0/6] Auxiliary IOMMU domains and Arm SMMUv3 https://www.spinics.net/lists/iommu/msg30637.html * SSID support for the SMMU (patches 2, 3, 4, 5, 7 and 8) [PATCH v2 00/40] Shared Virtual Addressing for the IOMMU https://lists.linuxfoundation.org/pipermail/iommu/2018-May/027595.html * I/O ASID (patch 1) [PATCH v3 00/16] Shared virtual address IOMMU and VT-d support https://lkml.kernel.org/lkml/1556922737-76313-4-git-send-email-jacob.jun.pan@linux.intel.com/ Jean-Philippe Brucker (8): iommu: Add I/O ASID allocator dt-bindings: document PASID property for IOMMU masters iommu/arm-smmu-v3: Support platform SSID iommu/arm-smmu-v3: Add support for Substream IDs iommu/arm-smmu-v3: Add second level of context descriptor table iommu/arm-smmu-v3: Support auxiliary domains iommu/arm-smmu-v3: Improve add_device() error handling iommu/arm-smmu-v3: Add support for PCI PASID .../devicetree/bindings/iommu/iommu.txt | 6 + drivers/iommu/Kconfig | 5 + drivers/iommu/Makefile | 1 + drivers/iommu/arm-smmu-v3.c | 714 ++++++++++++++++-- drivers/iommu/ioasid.c | 150 ++++ drivers/iommu/of_iommu.c | 6 +- include/linux/ioasid.h | 49 ++ include/linux/iommu.h | 1 + 8 files changed, 865 insertions(+), 67 deletions(-) create mode 100644 drivers/iommu/ioasid.c create mode 100644 include/linux/ioasid.h -- 2.21.0