From patchwork Fri Oct 6 13:31:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 9989515 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6EDF160247 for ; Fri, 6 Oct 2017 13:53:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B82828D89 for ; Fri, 6 Oct 2017 13:53:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4033D28DA5; Fri, 6 Oct 2017 13:53:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 33AC728D89 for ; Fri, 6 Oct 2017 13:53:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=QjS5tXtciHqfq4Ln3hrwm2NeJYaLtQKrBut2adif75o=; b=ClyUZRDqOAWfUKEuKVlonfcBxz gB+OGN3DfEBmUCjsFxWbKj5R1gA8L0VX9zF+A6SiFh/bhm+OwPewJJi/QEAU1uh58eBGqmB7K7psJ S0stu4Rj40p0+NPJkhRApz6U1nOZxtAoVAWtfBqqEhtzHRIEftt13bbqF5jwX+Vv5by3gKX0BtrFz +X5GrWzJo9cIcebym2GaIwQc3qMjFM+uyONP/hqcpFQHaFG/8Zz5CIgQinvlOO4uHhYR/uzpC8yLC +05dkvq+CnZTGFIPod5hxI0OZVNEcgXUVe9WGPJ0kVBlPs3dUNPSXej+qSbx/+U3DmzTMOQ/eLJXm qoto2aqg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e0T3s-0005ve-6m; Fri, 06 Oct 2017 13:53:08 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e0Sy6-0007ar-VG for linux-arm-kernel@bombadil.infradead.org; Fri, 06 Oct 2017 13:47:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=IvCq6tPskd8xhCi/63NwzkRjeLkyNXgL2ExlfLeVtwI=; b=buGEwvYgHnACo0Z5V8oQepOly aL2hGX5xar9WrS/ffnfU5OeZKl7HzS1KLEl/7yhXgXUIDffUstynPp3X+yel2zNQcxIARLmvBZQZb dNJ1CzFNPvtHPZKtCxyZtKHxpoSusmZVDaqFoaE5Eu2pjhWPPV0469wwGddL/dOu3zloWpDvqZnY0 yTwgGe0B35Ee2EjQMt0BOSUnFZqPI2utimTdWEM3aOzrGPEnL1Ms+k7RVXneESQeIYOqX5GRSMeMf cYR4sVZpmdAsqVahY+7WcAvTG4833x5hEEu6DF3T1gS/PO16NqQhWd0nQ1seIHXG4st32H0TQDPrI VHmchWTKA==; Received: from foss.arm.com ([217.140.101.70]) by merlin.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e0Sgk-0002CQ-Ra for linux-arm-kernel@lists.infradead.org; Fri, 06 Oct 2017 13:29:15 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 066A01688; Fri, 6 Oct 2017 06:28:59 -0700 (PDT) Received: from e106794-lin.cambridge.arm.com (e106794-lin.cambridge.arm.com [10.1.211.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 249123F578; Fri, 6 Oct 2017 06:28:54 -0700 (PDT) From: Jean-Philippe Brucker To: linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, devicetree@vger.kernel.org, iommu@lists.linux-foundation.org Subject: [RFCv2 PATCH 13/36] iommu/of: Add stall and pasid properties to iommu_fwspec Date: Fri, 6 Oct 2017 14:31:40 +0100 Message-Id: <20171006133203.22803-14-jean-philippe.brucker@arm.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20171006133203.22803-1-jean-philippe.brucker@arm.com> References: <20171006133203.22803-1-jean-philippe.brucker@arm.com> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, xieyisheng1@huawei.com, gabriele.paoloni@huawei.com, catalin.marinas@arm.com, will.deacon@arm.com, okaya@codeaurora.org, yi.l.liu@intel.com, lorenzo.pieralisi@arm.com, ashok.raj@intel.com, tn@semihalf.com, joro@8bytes.org, rfranz@cavium.com, lenb@kernel.org, jacob.jun.pan@linux.intel.com, alex.williamson@redhat.com, robh+dt@kernel.org, thunder.leizhen@huawei.com, bhelgaas@google.com, dwmw2@infradead.org, liubo95@huawei.com, rjw@rjwysocki.net, robdclark@gmail.com, hanjun.guo@linaro.org, sudeep.holla@arm.com, robin.murphy@arm.com, nwatters@codeaurora.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add stall and pasid properties to iommu_fwspec, and fill them when dma-can-stall and pasid-bits properties are present in the device tree. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/of_iommu.c | 10 ++++++++++ include/linux/iommu.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index 50947ebb6d17..345286bfdbfc 100644 --- a/drivers/iommu/of_iommu.c +++ b/drivers/iommu/of_iommu.c @@ -204,6 +204,16 @@ const struct iommu_ops *of_iommu_configure(struct device *dev, if (err) break; } + + if (!err && dev->iommu_fwspec) { + const __be32 *prop; + if (of_get_property(master_np, "dma-can-stall", NULL)) + dev->iommu_fwspec->can_stall = true; + + prop = of_get_property(master_np, "pasid-bits", NULL); + if (prop) + dev->iommu_fwspec->num_pasid_bits = be32_to_cpu(*prop); + } } /* diff --git a/include/linux/iommu.h b/include/linux/iommu.h index a6d417785c7b..2eb65d4724bb 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -535,6 +535,8 @@ struct iommu_fwspec { struct fwnode_handle *iommu_fwnode; void *iommu_priv; unsigned int num_ids; + unsigned int num_pasid_bits; + bool can_stall; u32 ids[1]; };