From patchwork Fri Jan 8 14:52:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 12006775 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A76FDC43381 for ; Fri, 8 Jan 2021 15:06:22 +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 59C852388B for ; Fri, 8 Jan 2021 15:06:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 59C852388B 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+linux-arm-kernel=archiver.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=o/28MawFbyWWS3s0pSA5YUL/Q7TW5z+72b5md4I3lQY=; b=K2TMNfzfH2Plim3XSoYXtAHHKs +sZ59BeAEDRSRvuOdnLRFLf9m48eOr7uA8Wg4gATYaoOBBleZqkcAWwRd6I6qv8grEPumYMZ1umiI nqU7KWVyE+u8LHL6ukb5SFexSe/Lw+Aib32wb/JoIL+OmGbfXD13oIhhv/tH9Mm+Wlu//xdUCgtXe KqfeKK606W/gL0Nyrs28gEoioqPMNmwGCycMlcmLEveQ1mjnESIkMKil1f6BZNv8cRlQ/KIVJCXpd Mxn4sg53n0xbG8WzPagqN/xMDOyBFKigtasfpaLX4EYLJq6NMYDXz8/eWOcscsXsaaOxaoT/+2+J7 QF1sPyXg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kxtI2-0005sl-Cx; Fri, 08 Jan 2021 15:02:59 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kxtHe-0005pk-Ee for linux-arm-kernel@lists.infradead.org; Fri, 08 Jan 2021 15:02:36 +0000 Received: by mail-wm1-x329.google.com with SMTP id r4so8653344wmh.5 for ; Fri, 08 Jan 2021 07:02:29 -0800 (PST) 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=9LxmaGFsoHsyiW4BIZVKPeyt3J9qr8cLi2zlatmsMp0=; b=KZFJdK1uOxU13tuF7A1+PLi2EH+/cnbUqwMv9T1ACMWomHP3A/P/Bpr6aDWS7/LBsg r7hV7S/g38e3vl2vdXsDzcl/HJsUBPgyWSl8s0Ir3r9LXLbpYkYjy4j258sT+zyf5NX/ jenNm/Spg8b6eOUDml2FPQZPKN0KaobawaJTgkpigzohy3P5Rob0HL6m+DZFOsAs02uX 65SuIJt6sFoG+R5MlglHdQQyE/F/iMPD4WRur8w5d9ORqq2DDjhtde80HUrtnc5RQdbN TH2UcgGb6BE5Xo1XAAx3ZRRHtt3w5YKmWY79M9kgcluqs5Wo7EFME/KmHGx6Wbv2n4vw cQAw== 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=9LxmaGFsoHsyiW4BIZVKPeyt3J9qr8cLi2zlatmsMp0=; b=kjmPXTjccZNonJpyCqZN4g/0pk9UP+gnqlRDkShL6M3371En8ZlUc37cWu4c+hWktp FgRLl57YClRN7jZaJo9Ofvcvxbl459DFJgmxmbWhA13qYJUn6EMVV9PgM8xF53hK0QIN PunarhQPOEW722Q/1LWy9ZNosOD6px0eqj4VVViICujv4WgS10jqnHfZlhKGgv21iEMQ OT5P/yS5zPCVRP52iBlory9jWzpfLdqocE6FnKg9SDP2G3QDsBJbqdvW9dsj+YWtDThX orPK+D2FBMDy8KXZLI0nAY9EoXCizdqSW8kGBhEO1BIM3AiFBpiLBiIrMXX+1HdaKfia NtOQ== X-Gm-Message-State: AOAM531CHl08qcgyZTU80/kQWu77/teoaXhzMX29orLPyNDZKXbFPPTv stxTtTAo5WGxXwZnm99quzbG+A== X-Google-Smtp-Source: ABdhPJwryieGz+IIpJFdRcitNF3mYDnUq00efz6rzlTllf+zarGcbHI5biYr33cJ6dUnp49vkxQ9ZQ== X-Received: by 2002:a1c:e10b:: with SMTP id y11mr3515616wmg.65.1610118147821; Fri, 08 Jan 2021 07:02:27 -0800 (PST) Received: from localhost.localdomain ([2001:1715:4e26:a7e0:116c:c27a:3e7f:5eaf]) by smtp.gmail.com with ESMTPSA id s13sm14258464wra.53.2021.01.08.07.02.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:02:26 -0800 (PST) From: Jean-Philippe Brucker To: joro@8bytes.org, will@kernel.org Subject: [PATCH v9 00/10] iommu: I/O page faults for SMMUv3 Date: Fri, 8 Jan 2021 15:52:08 +0100 Message-Id: <20210108145217.2254447-1-jean-philippe@linaro.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210108_100234_528097_6D1DC432 X-CRM114-Status: GOOD ( 15.19 ) 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: devicetree@vger.kernel.org, lorenzo.pieralisi@arm.com, linux-acpi@vger.kernel.org, Jean-Philippe Brucker , guohanjun@huawei.com, rjw@rjwysocki.net, shameerali.kolothum.thodi@huawei.com, eric.auger@redhat.com, iommu@lists.linux-foundation.org, robh+dt@kernel.org, linux-accelerators@lists.ozlabs.org, Jonathan.Cameron@huawei.com, sudeep.holla@arm.com, vivek.gautam@arm.com, zhangfei.gao@linaro.org, baolu.lu@linux.intel.com, robin.murphy@arm.com, linux-arm-kernel@lists.infradead.org, lenb@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add stall support to the SMMUv3, along with a common I/O Page Fault handler. Changes since v8 [1]: * Added patches 1 and 2 which aren't strictly related to IOPF but need to be applied in order - 8 depends on 2 which depends on 1. Patch 2 moves pasid-num-bits to a device property, following Robin's comment on v8. * Patches 3-5 extract the IOPF feature from the SVA one, to support SVA implementations that handle I/O page faults through the device driver rather than the IOMMU driver [2] * Use device properties for dma-can-stall, instead of a special fwspec member. * Dropped PRI support for now, since it doesn't seem to be available in hardware and adds some complexity. * Had to drop some Acks and Tested tags unfortunately, due to code changes. As usual, you can get the latest SVA patches from http://jpbrucker.net/git/linux sva/current [1] https://lore.kernel.org/linux-iommu/20201112125519.3987595-1-jean-philippe@linaro.org/ [2] https://lore.kernel.org/linux-iommu/BY5PR12MB3764F5D07E8EC48327E39C86B3C60@BY5PR12MB3764.namprd12.prod.outlook.com/ Jean-Philippe Brucker (10): iommu: Remove obsolete comment iommu/arm-smmu-v3: Use device properties for pasid-num-bits iommu: Separate IOMMU_DEV_FEAT_IOPF from IOMMU_DEV_FEAT_SVA iommu/vt-d: Support IOMMU_DEV_FEAT_IOPF uacce: Enable IOMMU_DEV_FEAT_IOPF iommu: Add a page fault handler iommu/arm-smmu-v3: Maintain a SID->device structure dt-bindings: document stall property for IOMMU masters ACPI/IORT: Enable stall support for platform devices iommu/arm-smmu-v3: Add stall support for platform devices drivers/iommu/Makefile | 1 + .../devicetree/bindings/iommu/iommu.txt | 18 + drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 74 ++- drivers/iommu/iommu-sva-lib.h | 53 ++ include/linux/iommu.h | 25 +- drivers/acpi/arm64/iort.c | 15 +- .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 70 ++- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 354 ++++++++++++-- drivers/iommu/intel/iommu.c | 11 +- drivers/iommu/io-pgfault.c | 462 ++++++++++++++++++ drivers/iommu/of_iommu.c | 5 - drivers/misc/uacce/uacce.c | 32 +- 12 files changed, 1046 insertions(+), 74 deletions(-) create mode 100644 drivers/iommu/io-pgfault.c