From patchwork Wed May 26 16:19:26 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: 448205 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp5377988jac; Wed, 26 May 2021 09:21:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzO9QqnUfMWrCVCdR1OqOcgPBmuQqyVgsp6U6dzDzKiJt4h3Svf641hHwkqRVl0xL1gYxjA X-Received: by 2002:a6b:da05:: with SMTP id x5mr8418478iob.68.1622046099878; Wed, 26 May 2021 09:21:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622046099; cv=none; d=google.com; s=arc-20160816; b=UBnd0gV0kL5uQhR8SnkBXIhic+nwpU2mnfCxH020GvBsySfz+PVMkZV+aCiP7+tkUi JfR2Vw4aWkjP4u821AjzHTCmA8yb6zPoheANd4CyBdyZasA8/cmQojnB44hIIUCn0RsO mtg38zmrAI9j7UxpnfOSxgbHMHcaeDmK9Ua1VUIJQ2hkr3Y+GIdpObPYiu8TXSjypVjb OtdVxXHa9/eSlNsRbAopgTwDlFjddCci+KQ4cgc5CmftwB/fn+KVLZb+sJkWYlK9JWX0 34AqtYHfIzRYyQPTrayKNplQh9wj63+suTaezlDKxu0Rll6zG41W6Z3z5BlpF3mAS0LY gzmw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qpxpWMnrPJKc07Z7A57L4cT+PGNv1GXXzLI4P6Yd1EE=; b=FXcKG+IMYWMtGeNhwdRpxnfatn+KqYWb1gCHvi1KU35ZVBik8VWGOkYrkf98fhJ9NW lXCLC6zehbGspYCC5y6kvD5koygr+1y2+w0t8uoAoL1CDtcchDGPFXxUZdg4i1fV6wW2 kLAc+9hfeG5uQSkMP+O4wFdTS7fExr/WhoR1GT5ALuWOD5EAvZ6RT1Z9Ll+fMPeOMhg9 1FLzH02J2KDuEzN+uiwSv1BzefZ4ZhgOt0Drt7zWnjDn5ogwE2nLflXBD/YS2vmc3JaJ mwQYtYm94BkLvDJ8AO1ySEwlEoJp1p8UDPYIlNiClYWnStsCy3/eI2t4/Pwcc4pFOPwD HvGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="igtqyM//"; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 q7si8644761iow.93.2021.05.26.09.21.39; Wed, 26 May 2021 09:21:39 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-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="igtqyM//"; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S233893AbhEZQXI (ORCPT + 7 others); Wed, 26 May 2021 12:23:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233836AbhEZQXI (ORCPT ); Wed, 26 May 2021 12:23:08 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62955C061756 for ; Wed, 26 May 2021 09:21:36 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id o5so2247413edc.5 for ; Wed, 26 May 2021 09:21:36 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=qpxpWMnrPJKc07Z7A57L4cT+PGNv1GXXzLI4P6Yd1EE=; b=igtqyM//LYjdds1ytHCniCgg8zwXeW+EZ8GUvM0m2FRDNDeVRq9vskLXhwydDfk8I1 Py+Iv1uCGEMhmYD2qpm+O2OSqMgjpeMutUiLdEcnWGKoeriIt/AE8DKSXYiTUxiyznbe FVzBP6qI4Px6bkTjqE0BruPZj/fjxlr0WhZ7KV8kWd9BbRvRG47PkuIFm0nrg1TTkArn T6b0IDjr4ltS+qRRAtM2FeMsHX0vCGj0W+xGELgKG65hDbF2uQlsZbnB1i5SVT38WK3o 72JWxaT5VTxUZBWIrmWxI2hh1HFSn5kD6YQkLSO9vewdxJhgHUS2S/wf0yd5pzk65gzR 1qZA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=qpxpWMnrPJKc07Z7A57L4cT+PGNv1GXXzLI4P6Yd1EE=; b=jhLTw7ONzORzKKQwo3Z2fwQgI/NfLuwbhP33b+TXWLVwm9OGpc8ym0LrH7of7N3QVy 6YpbkmvcJbBe8+ba0/ZrIo9y4Oeevw8rlNcvjcwwKDN/c/lJY/jkt+aQ72QQzqrk5u8i zsvkWcRL8okcwdvTfgCflwVT3e5ubuNFh1uEF7sK1HRHxhYebzUXAzCnFU6WFmQK/24c ZVN/Fju2CZ/HoxbcYSQZJVtymhmC1SjFYOsnaE2LhxCxIuHknPH8PgL4oEquKwd6mW5C +06ljHuXhl3l25jzHrU/4MxU/hlwAgWziLsgm1qL0eNdS5aD1T7FIPl4V8FyRMP9XiHJ FWbA== X-Gm-Message-State: AOAM532eMmOJTYC5Mtttv4rdiYwnM610iRLZjKr7UR5Nu/m5u9nt+Mlk Q8wFVA1QWUmT4fC2lLBr5umxkg== X-Received: by 2002:aa7:c152:: with SMTP id r18mr38149878edp.266.1622046094940; Wed, 26 May 2021 09:21:34 -0700 (PDT) Received: from localhost.localdomain (adsl-84-226-106-126.adslplus.ch. [84.226.106.126]) by smtp.gmail.com with ESMTPSA id e6sm10497145ejd.31.2021.05.26.09.21.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 09:21:34 -0700 (PDT) From: Jean-Philippe Brucker To: joro@8bytes.org, will@kernel.org Cc: robh+dt@kernel.org, lorenzo.pieralisi@arm.com, 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, zhangfei.gao@linaro.org, wangzhou1@hisilicon.com, iommu@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jean-Philippe Brucker , Rob Herring Subject: [PATCH v15 1/3] dt-bindings: document stall property for IOMMU masters Date: Wed, 26 May 2021 18:19:26 +0200 Message-Id: <20210526161927.24268-2-jean-philippe@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210526161927.24268-1-jean-philippe@linaro.org> References: <20210526161927.24268-1-jean-philippe@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On ARM systems, some platform devices behind an IOMMU may support stall, which is the ability to recover from page faults. Let the firmware tell us when a device supports stall. Reviewed-by: Eric Auger Reviewed-by: Rob Herring Signed-off-by: Jean-Philippe Brucker --- .../devicetree/bindings/iommu/iommu.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) -- 2.31.1 diff --git a/Documentation/devicetree/bindings/iommu/iommu.txt b/Documentation/devicetree/bindings/iommu/iommu.txt index 3c36334e4f94..26ba9e530f13 100644 --- a/Documentation/devicetree/bindings/iommu/iommu.txt +++ b/Documentation/devicetree/bindings/iommu/iommu.txt @@ -92,6 +92,24 @@ Optional properties: tagging DMA transactions with an address space identifier. By default, this is 0, which means that the device only has one address space. +- dma-can-stall: When present, the master can wait for a transaction to + complete for an indefinite amount of time. Upon translation fault some + IOMMUs, instead of aborting the translation immediately, may first + notify the driver and keep the transaction in flight. This allows the OS + to inspect the fault and, for example, make physical pages resident + before updating the mappings and completing the transaction. Such IOMMU + accepts a limited number of simultaneous stalled transactions before + having to either put back-pressure on the master, or abort new faulting + transactions. + + Firmware has to opt-in stalling, because most buses and masters don't + support it. In particular it isn't compatible with PCI, where + transactions have to complete before a time limit. More generally it + won't work in systems and masters that haven't been designed for + stalling. For example the OS, in order to handle a stalled transaction, + may attempt to retrieve pages from secondary storage in a stalled + domain, leading to a deadlock. + Notes: ====== From patchwork Wed May 26 16:19:27 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: 448353 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, 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 5E3FBC4708C for ; Wed, 26 May 2021 16:21:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3E8D76124B for ; Wed, 26 May 2021 16:21:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233822AbhEZQXK (ORCPT ); Wed, 26 May 2021 12:23:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233836AbhEZQXJ (ORCPT ); Wed, 26 May 2021 12:23:09 -0400 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73540C061756 for ; Wed, 26 May 2021 09:21:37 -0700 (PDT) Received: by mail-ej1-x634.google.com with SMTP id gb17so3362855ejc.8 for ; Wed, 26 May 2021 09:21:37 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=AKRl4agdQb3jtkg+VysQNU7Kzn0dH+xQTWOrQHzW2HY=; b=x7BoDKcPMf9PizrgqgcjzRKKfGmllOzwKzdaaX3UPgB3QI5dv56ITViep78v3Eh7H+ eP6MDtp7cQwimaV/W8QYj6NVqqzPFKR0Ar+nzPDUa0vakwUOXLtlT6fHPj3h7BqLSZ0q 3z6kNH0z4LR/3PfGuSmssDmJDyXq3BbbWyNPWdfGCL8E1ILFMDi8MXv3z+NFgxzgEW0P oX48LUzPUxvtkJ2t2nK6iTPjD1V/3h8l82JBh0I4OwefGwWmoneh5SX7nHbLiuiZGiUN izK+uNkWcnOXi1pX/KhuGev304wxSaRl9mSyIJrQZr6Ms2fkTKX0Nd96LMrGHrid18X5 E9XQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=AKRl4agdQb3jtkg+VysQNU7Kzn0dH+xQTWOrQHzW2HY=; b=mkoyHb8tGTnpqmmf+sbFbPv39mHNtWd3MZEsQgCm7pokfHcqk9eKRueAX4dhJW/j9r TdAWT3BOpBQgtWDJrOgQq+T0BD821mIpuHqiuC0RlVfe0yRN46Iez4vDANertAiithT1 v7huWmYqPJ0YJFyfJEkBc+GKpOpDrhwBn/QWky9cKXwcWiUAmCtbkUoHAy6PBH8OfWVq eP7RVHuNFbxzSReqwKeXyJzeYN01UsxGKMHN3NJsm+JHMVvyvknjtVaZF/ls0mixjzjP 1lIa1poLGKCtJEFnu+g0/XMnCU2xcbXmeWBc/5sBajY6yPfn9jDv0tBOtgmbM7kpYlX3 GggQ== X-Gm-Message-State: AOAM532QpooFJAXshakQ/l5lQ4kdrAoMiGhHd0KNwmx7G56rNYsXABNa DR0A4Fqb2jaM7hOTdMSgqbQBWw== X-Google-Smtp-Source: ABdhPJzziFGCZPNo+X7H2xQvWb9YNPVpQXThfZSV/V0nc1qoc/ySSYykIs+pLOKnLaLnkZzP4z7Nzg== X-Received: by 2002:a17:907:7654:: with SMTP id kj20mr34813609ejc.439.1622046095954; Wed, 26 May 2021 09:21:35 -0700 (PDT) Received: from localhost.localdomain (adsl-84-226-106-126.adslplus.ch. [84.226.106.126]) by smtp.gmail.com with ESMTPSA id e6sm10497145ejd.31.2021.05.26.09.21.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 09:21:35 -0700 (PDT) From: Jean-Philippe Brucker To: joro@8bytes.org, will@kernel.org Cc: robh+dt@kernel.org, lorenzo.pieralisi@arm.com, 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, zhangfei.gao@linaro.org, wangzhou1@hisilicon.com, iommu@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jean-Philippe Brucker Subject: [PATCH v15 2/3] ACPI/IORT: Enable stall support for platform devices Date: Wed, 26 May 2021 18:19:27 +0200 Message-Id: <20210526161927.24268-3-jean-philippe@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210526161927.24268-1-jean-philippe@linaro.org> References: <20210526161927.24268-1-jean-philippe@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Copy the "Stall supported" bit, that tells whether a named component supports stall, into the dma-can-stall device property. Acked-by: Hanjun Guo Acked-by: Jonathan Cameron Acked-by: Lorenzo Pieralisi Signed-off-by: Jean-Philippe Brucker --- drivers/acpi/arm64/iort.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c index 3912a1f6058e..0828f70cb782 100644 --- a/drivers/acpi/arm64/iort.c +++ b/drivers/acpi/arm64/iort.c @@ -968,13 +968,15 @@ static int iort_pci_iommu_init(struct pci_dev *pdev, u16 alias, void *data) static void iort_named_component_init(struct device *dev, struct acpi_iort_node *node) { - struct property_entry props[2] = {}; + struct property_entry props[3] = {}; struct acpi_iort_named_component *nc; nc = (struct acpi_iort_named_component *)node->node_data; props[0] = PROPERTY_ENTRY_U32("pasid-num-bits", FIELD_GET(ACPI_IORT_NC_PASID_BITS, nc->node_flags)); + if (nc->node_flags & ACPI_IORT_NC_STALL_SUPPORTED) + props[1] = PROPERTY_ENTRY_BOOL("dma-can-stall"); if (device_add_properties(dev, props)) dev_warn(dev, "Could not add device properties\n");