From patchwork Thu Nov 12 12:55:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 11900165 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.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham 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 DE240C388F7 for ; Thu, 12 Nov 2020 13:05:15 +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 5D38121D91 for ; Thu, 12 Nov 2020 13:05:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="r41ZEOLb"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="uA63WGlR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5D38121D91 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:References:In-Reply-To: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:List-Owner; bh=vIzpNICNK9qprrk5DLEmMycGFudo5zKCkU2HN9YvL4U=; b=r41ZEOLbVU/toa5r5CwU7qmhf 9zP6D4GwfCTk4KUuQ/Vq8PKaWYTdwrcneJ8NBAKdHNFGIjfUZIt9OYxh130C9ptSOTuErirNtwcpq E/6f5OcLMXCGKvyK+w7OxpMdl/xlEFFsSdFD56Bd2W2KfojlIxgqdDwZXCWqE1bxZ91/CeOOCdXCM DxZy+xi2H8y+Ul95znme+XbawNKfpmu4Wad55olQh59kuOc70IzGYEg9iC04/VuIIS/Usni4U1ibe Lz66mVrppgAiAnd9thjTzvf7SRsbhxZDoHzkyIaTUNeOFyzCvAlPZtNdP4l8fJpR5+P3YT8a4Ooqs PHmMaeKIw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdCGY-0006m5-S8; Thu, 12 Nov 2020 13:03:54 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdCG1-0006YS-0d for linux-arm-kernel@lists.infradead.org; Thu, 12 Nov 2020 13:03:22 +0000 Received: by mail-wr1-x443.google.com with SMTP id c17so5872662wrc.11 for ; Thu, 12 Nov 2020 05:03:20 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=3ygm1AXTLu+53w4Gri7BYEJbuhvyMFezCUVbiVOA1cI=; b=uA63WGlRDXWDF9rIZV4RZkVq6oJU37wcFuSQmD8BzO159BANMh6M+qpRZeX3/9SDUX NgjC/6kMJoth33QcDclO+ynaJlZA5DobFNRQNYs96uO5BecxpNBWMkORbZcRWO5P6qD/ BJkF/jlsL/X45r34/KxlPQbUjbKshwp4elCUfaZGnESVEwpxokGBOQy9Uvj/8ap3OCIH X4XkbC3JjCUSG2bj/0UjM+bplVf6wDID7rR7qluxsv54s4WElIx8dWnQLCnODfH4+4TN 1fQtFlyLdLdG2hhM+mcaKhRK/XdUJ1cFPfj1ecKiWJDeJr3prD0gWxlUnB4H0tf5eUhK 2bmA== 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=3ygm1AXTLu+53w4Gri7BYEJbuhvyMFezCUVbiVOA1cI=; b=AFLg2If9VCUo3WENgupKAJESSMOx71+606lGm6jdMpmEgCXlTY7kE4UqziHKOiCk0q 3iBwErXGRoCcwxSck2mjkDrkAlyvu+Xpi8x0csK/AaxKSrKEDY/Mir2Dd0IOdAlcq7cE G/mesb0/SzwOJ6o/i9+38XTGT1lATFGvY9Hy/j5f3DB/f9jLaZAvph2kkSX740o1JkJY J8V+Pd4gY+tD+1kHO3ANPy6WfV7OopjwH77ska5LMsx4Sz0ZVh7naQw1RbxNRx9tVbYi cSa+E3jEMv/922J+zaUsFJq6q4CpJsuVf+JrZf5IqpwLY1FQDqvnCyNJYXCVBPXQ0xR2 o+tQ== X-Gm-Message-State: AOAM531O4SXkCkkBfywOIJkQ/9ax4t9tGgLk+NDgy1M+qjfL0CQi8Z4G FCEHyPnR4vGLGcyZqo3TNx7KWw== X-Google-Smtp-Source: ABdhPJz9bTvkN2/dsnznhn0qkGq1x4rrRxxckt9ZNtviWKF6XljTnBbloojb2RmpNHrLbr6LrtRoPQ== X-Received: by 2002:a5d:660f:: with SMTP id n15mr30481293wru.345.1605186200191; Thu, 12 Nov 2020 05:03:20 -0800 (PST) Received: from localhost.localdomain ([2001:1715:4e26:a7e0:116c:c27a:3e7f:5eaf]) by smtp.gmail.com with ESMTPSA id m22sm6877508wrb.97.2020.11.12.05.03.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Nov 2020 05:03:19 -0800 (PST) From: Jean-Philippe Brucker To: joro@8bytes.org, will@kernel.org, lorenzo.pieralisi@arm.com, robh+dt@kernel.org Subject: [PATCH v8 4/9] of/iommu: Support dma-can-stall property Date: Thu, 12 Nov 2020 13:55:16 +0100 Message-Id: <20201112125519.3987595-5-jean-philippe@linaro.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201112125519.3987595-1-jean-philippe@linaro.org> References: <20201112125519.3987595-1-jean-philippe@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201112_080321_114481_0659D1DF X-CRM114-Status: GOOD ( 14.83 ) 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, linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org, guohanjun@huawei.com, rjw@rjwysocki.net, shameerali.kolothum.thodi@huawei.com, eric.auger@redhat.com, iommu@lists.linux-foundation.org, Jonathan.Cameron@huawei.com, sudeep.holla@arm.com, bhelgaas@google.com, zhangfei.gao@linaro.org, vivek.gautam@arm.com, baolu.lu@linux.intel.com, robin.murphy@arm.com, Jean-Philippe Brucker , 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 Copy the dma-can-stall property into the fwspec structure. Signed-off-by: Jean-Philippe Brucker --- include/linux/iommu.h | 2 ++ drivers/iommu/of_iommu.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index a1c78c4cdeb1..9076fb592c8f 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -572,6 +572,7 @@ struct iommu_group *fsl_mc_device_group(struct device *dev); * @iommu_fwnode: firmware handle for this device's IOMMU * @iommu_priv: IOMMU driver private data for this device * @num_pasid_bits: number of PASID bits supported by this device + * @can_stall: the device is allowed to stall * @num_ids: number of associated device IDs * @ids: IDs which this device may present to the IOMMU */ @@ -579,6 +580,7 @@ struct iommu_fwspec { const struct iommu_ops *ops; struct fwnode_handle *iommu_fwnode; u32 num_pasid_bits; + bool can_stall; unsigned int num_ids; u32 ids[]; }; diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index e505b9130a1c..d6255ca823d8 100644 --- a/drivers/iommu/of_iommu.c +++ b/drivers/iommu/of_iommu.c @@ -212,9 +212,12 @@ const struct iommu_ops *of_iommu_configure(struct device *dev, err = of_iommu_configure_device(master_np, dev, id); fwspec = dev_iommu_fwspec_get(dev); - if (!err && fwspec) + if (!err && fwspec) { of_property_read_u32(master_np, "pasid-num-bits", &fwspec->num_pasid_bits); + fwspec->can_stall = of_property_read_bool(master_np, + "dma-can-stall"); + } } /*