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: 371559 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp385766jam; Wed, 27 Jan 2021 07:47:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJy67lOWUyEYM1Mn53B6Bof656g3+2I5D4Wnl+/QIUvlg29+Nq5ApDQtDyYuZtg/zNB8es+a X-Received: by 2002:aa7:d649:: with SMTP id v9mr9464089edr.383.1611762453131; Wed, 27 Jan 2021 07:47:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611762453; cv=none; d=google.com; s=arc-20160816; b=FSqu7AcYVaKyB3cSI6m4uWUdkpOvyJjOV3Xn9mfcoJpwVwyqy3si/dPonrPNp9TDga bR6m/YqEZjucJBaDF+Krsh8MVs90iY3QBlkoEyjnSrIUgMKVLgE8NOTyyIfOP9VpVbI5 59JOlrfmJLHaKEoV6RBtC1fmfxhCLV1WeWkoc+ey35Gjy8fwyQaYn+QMifNpOfklRRGy pfZNLq/X/V/KlFProUOkfyWu8lnxSSzTZr12pBpDLT5QB/7Zngx8+UGtLHUeIX8by2Cm ggXc4mwJtuWV8VSaH7hiutMbCNRknglzHmve0EoOPW6wb1V862sE1jIxdu8QwdW0MKUI NAfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=wS1ZhkPy53Ug869D5KbFul/TixGQjhvdRxH2RGl6FFE=; b=yWiY8K1tLgybhq1Qp0BZDWB74Jds6QRTkKuCULzBFec8q/Q12U8RtosKbYTu/tkVcr 6RVkd6ILqYF7YbXDrOHk42bcseo1R/Frv7c6kFhtI7e2HEHn8gywxvJeNdeceMANRYsU aca4YjE6zSalg+DYbG7Iq9ra798NPg3dJhw1QoQ+4Z1LRrsrcL8xylF0Kii6fuxE4U4W lysz5yqetZvBZOpTSaiVw3doLjeg/4rQ9RPwlH+TdF77OR5XN0WuB3OFErIl3mbutN1y PpLDtRQdpc7KpEx4+T+Qbua+1N965B18aW/ch8b2jHoENAWMHVRg+4BdQTg3rgHrkIkH 9TEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yN8+ZEYX; spf=pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cy17si1201994edb.193.2021.01.27.07.47.32; Wed, 27 Jan 2021 07:47:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yN8+ZEYX; spf=pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235978AbhA0PqB (ORCPT + 4 others); Wed, 27 Jan 2021 10:46:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236507AbhA0Pou (ORCPT ); Wed, 27 Jan 2021 10:44:50 -0500 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2BD1C0613ED for ; Wed, 27 Jan 2021 07:44:34 -0800 (PST) Received: by mail-wr1-x434.google.com with SMTP id q7so2362300wre.13 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=CC+P59fk1slvAyNtrzhnJ+uUm3j0nqovuraFHYwvP4PfBqiKv1JgPyG3V0yRIeWyCe 5CJnBEvzuKKrpra6VC+9e60OGNOCjiXnkHiNNtudWglx6A48lW6m8QpOgwKauKiuWXET S+yyLkjeOmFeyry299oU7Fg2TvZwRu/3pForKqRb8GZ1rRpkuNgdASSuf6fSZdWAx5RP PoApTa5eW3hkRBtYybKjSdW5zvgSo+0bp+X4qTXblQ7g2FHEYRBtQvz5Nbf2wq/kCsu+ cPBWOdg7BE9DrM3lvi2aRgYNTjDueJnbSYme/77T5PJ2/VVhwdt44sJOuilXCo5I7iho hR3w== X-Gm-Message-State: AOAM530KIyESRETtHPkUFegrk0+TqpIf6QeszTTTfOfG3GGJye9PkKdC mYvkd88jXzE25jsXBRko+PQEWg== 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 Cc: lorenzo.pieralisi@arm.com, robh+dt@kernel.org, guohanjun@huawei.com, sudeep.holla@arm.com, rjw@rjwysocki.net, lenb@kernel.org, robin.murphy@arm.com, Jonathan.Cameron@huawei.com, eric.auger@redhat.com, iommu@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-accelerators@lists.ozlabs.org, baolu.lu@linux.intel.com, jacob.jun.pan@linux.intel.com, kevin.tian@intel.com, vdumpa@nvidia.com, zhangfei.gao@linaro.org, shameerali.kolothum.thodi@huawei.com, vivek.gautam@arm.com, Jean-Philippe Brucker 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 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.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 -- 2.30.0