From patchwork Wed Jan 27 15:43:13 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: 12050593 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.1 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 4BF73C433DB for ; Wed, 27 Jan 2021 17:11:35 +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 D3F1764DA0 for ; Wed, 27 Jan 2021 17:11:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D3F1764DA0 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=ELg53+kv5mFGLHm8BpOlV5W6d0FwTgl166Xr4EnlfU8=; b=D2xffpZOQMOhtI79gmfwz3vH7c 0nfoAGgKpzcNlosMahmErn4Iah0YLpUY0i94nzwcASWRUOd36t5zOs1Q/43u9DulTX07MkXKEarWZ 6GjoLgpZdqw0DBsZtJoYWupNzfF43PzDJWVBB6vehLuXrdFBWiacXhsOUeyxWhbJQ9sk2l5CR752n wtlpeDegQXWnCPg6ofjZSYot+tLgJYfuSzcqRNeq+GhfxsBRHw61pZiaNV2cFoXFi1SjSG8/i5CHF WYT9z+eHKKy1Ki+s5ySaSivw00GyT+n2JORuRT/ReMrw/S2ZXX+PE5YIplZAgiyI6+BROYqvnNf6m 4xpNvTkg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l4mzo-0005tk-JE; Wed, 27 Jan 2021 15:44:41 +0000 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l4mzk-0005rC-RK for linux-arm-kernel@lists.infradead.org; Wed, 27 Jan 2021 15:44:37 +0000 Received: by mail-wr1-x42b.google.com with SMTP id h9so2380291wrr.9 for ; Wed, 27 Jan 2021 07:44:34 -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=wS1ZhkPy53Ug869D5KbFul/TixGQjhvdRxH2RGl6FFE=; b=yN8+ZEYXs60LN4H3/iPUmkayFZ/QFexI3MYPBddUqnXmHvaY0MXGcSoHtKGUGxBV7c htle9Dm4IzXGK+AFIQBxOCDlyawRU2/4Zxpk022izvBIRBliGrxNFxcTQBDRUV8NGYff WjI+fQb5fNoNcnAcq1+EM4Zr40bYkcq0Pq9P8M1MRSSkWNS/u7gmKPYcWqSWnuZDM2sY 7O235W+myUX8QySNqVx40PNuAvAQePQiBSFrRXdcGt1cNOmrWFEiBxF2Y2jp5jL50DRM UNJ9LSP88Qref/3tFFBjVg1GkIQGAKo4NjTZsaCKcq8f9eE2WMxyrP1DYs3odfFOss1P Nhuw== 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=wS1ZhkPy53Ug869D5KbFul/TixGQjhvdRxH2RGl6FFE=; b=FWTnxkVrBz4dYz/BIqm1/s8yo1NeszGoJ0OsrHvA+C7L41QPVUjia4Kuuk73R+bU4q zixQWe/KJrpvZJaiqT/nPv8laoqCZitgaGYXqXee/lAdFxWrjRfN47ZlcDEmhy3x5tmq 6XpEtcIZlrpTC6hYIOo82lYdblTLIEoSMSIqN4BiCFWIVLkx09JuTP1VTJX67xCpcmeu HBAjHnAnAmbvx0kAfYp8HN88bOoH/r5wFi6Iy/4uCFStaNYugouwHmCMFdW3OM/cG9NB 6mCdDQKXEEP3iBvVleHem8xIO7C1fpgXuncqoIyy/KVT9C0bnkRrhma4NZHOsN0akPJi WyVw== X-Gm-Message-State: AOAM533ueInj2fU28ig0usFu2eNQqFXi2rjEa8NV6TvKKkq9LEED95ch PbeFOI6DMWkQkfgWWs95yrdk2xm6rERbVQ== X-Google-Smtp-Source: ABdhPJw8bmHv9UQA9WE+SkZNIdRG10VRBsv+I85VSHEhTtrJjAVrYGHN6RHpUEQcYQaNw5S9xdZKEg== X-Received: by 2002:adf:f743:: with SMTP id z3mr11958548wrp.165.1611762273360; Wed, 27 Jan 2021 07:44:33 -0800 (PST) Received: from localhost.localdomain ([2001:1715:4e26:a7e0:116c:c27a:3e7f:5eaf]) by smtp.gmail.com with ESMTPSA id r13sm3046921wmh.9.2021.01.27.07.44.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Jan 2021 07:44:32 -0800 (PST) From: Jean-Philippe Brucker To: joro@8bytes.org, will@kernel.org Subject: [PATCH v12 00/10] iommu: I/O page faults for SMMUv3 Date: Wed, 27 Jan 2021 16:43:13 +0100 Message-Id: <20210127154322.3959196-1-jean-philippe@linaro.org> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210127_104437_007006_7090C77B X-CRM114-Status: GOOD ( 11.89 ) 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: vivek.gautam@arm.com, guohanjun@huawei.com, Jean-Philippe Brucker , lorenzo.pieralisi@arm.com, linux-acpi@vger.kernel.org, zhangfei.gao@linaro.org, lenb@kernel.org, devicetree@vger.kernel.org, kevin.tian@intel.com, jacob.jun.pan@linux.intel.com, eric.auger@redhat.com, robh+dt@kernel.org, Jonathan.Cameron@huawei.com, linux-arm-kernel@lists.infradead.org, rjw@rjwysocki.net, shameerali.kolothum.thodi@huawei.com, iommu@lists.linux-foundation.org, sudeep.holla@arm.com, robin.murphy@arm.com, linux-accelerators@lists.ozlabs.org, baolu.lu@linux.intel.com 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. Since v11 I added a sanity check in arm_smmu_dev_disable_feature(), patch 10: return -EBUSY if device drivers attempt to disable the IOPF feature before SVA. That would leak the IOPF param and fault handler. v11: https://lore.kernel.org/linux-iommu/20210125110650.3232195-1-jean-philippe@linaro.org/ v10: https://lore.kernel.org/linux-iommu/20210121123623.2060416-1-jean-philippe@linaro.org/ v9: https://lore.kernel.org/linux-iommu/20210108145217.2254447-1-jean-philippe@linaro.org/ Jean-Philippe Brucker (10): iommu: Fix comment for struct iommu_fwspec 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 | 56 ++- drivers/iommu/iommu-sva-lib.h | 53 ++ include/linux/iommu.h | 26 +- drivers/acpi/arm64/iort.c | 15 +- .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 59 ++- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 351 +++++++++++-- drivers/iommu/intel/iommu.c | 11 +- drivers/iommu/io-pgfault.c | 461 ++++++++++++++++++ drivers/iommu/of_iommu.c | 5 - drivers/misc/uacce/uacce.c | 39 +- 12 files changed, 1021 insertions(+), 74 deletions(-) create mode 100644 drivers/iommu/io-pgfault.c