From patchwork Fri May 11 19:06:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 10394935 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 BDD5860153 for ; Fri, 11 May 2018 19:08:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA41F28F54 for ; Fri, 11 May 2018 19:08:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9DA8328F8B; Fri, 11 May 2018 19:08:58 +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=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3CC8B28F54 for ; Fri, 11 May 2018 19:08:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CDAF56B069D; Fri, 11 May 2018 15:08:56 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C5DB76B069E; Fri, 11 May 2018 15:08:56 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B28276B069F; Fri, 11 May 2018 15:08:56 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-oi0-f70.google.com (mail-oi0-f70.google.com [209.85.218.70]) by kanga.kvack.org (Postfix) with ESMTP id 840936B069D for ; Fri, 11 May 2018 15:08:56 -0400 (EDT) Received: by mail-oi0-f70.google.com with SMTP id b13-v6so3430342oib.11 for ; Fri, 11 May 2018 12:08:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=bbU7gNAEiXyLj6glEiouiAz/hg1HZcdPPXKUBEsGe2o=; b=uJ0z0HwS+oUPT5b5JdzCmH06bBS2h3Nkx4NoSJxlKiGnJ0wVfo50W/rBSGiT664f1n TksDXttOCL5bMKjvUqilOuCgVX7Tc/MUPQFUsC+E+bSUwIcvQTI+xqo30NNmK7ZPepT6 6bizfeADgFUg/VruUd8O9DMOXokqjMKsECAkbLgpPNT1tZv2OnI9foMol4ORjqdBJRHF sAhHmv5DBvGa69tE1tXs4X86LiZcPq9EnoI//LI4oleLdNlu2EeFg6M3eXJ4R2Tr4gnj 9diMPx5bQHt0Q0WzxYo3F5h5SBp83QneD6qmEM25yXKwVMeBLr/NOQEbo/fKhahgEm+e 0OsQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of jean-philippe.brucker@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=jean-philippe.brucker@arm.com X-Gm-Message-State: ALKqPwcHVqXj7n9q5TX4PQbIDr/IzkaoSpxWuN8pdiexttahwnezrc+t dLPIggkDLCMS4WvrVlpkOZ5hMz3BjObl/2JHWHh4PfEIscP1d+h5b7JxpkkTPbyJM80+N8dvphY cP0P7bqwPHDPdSnKTf3X9VtMCP1VQHG3EC39Lpn75upiSnIJCuyfmVqvulyoRRvuIlA== X-Received: by 2002:a9d:4b8f:: with SMTP id k15-v6mr4882160otf.248.1526065736351; Fri, 11 May 2018 12:08:56 -0700 (PDT) X-Google-Smtp-Source: AB8JxZomiM2uwQu4wVwUKFsS8sEBVm8PXE+qfzbpzMUau+i5VQxEHUZt1Th9wsh/6D1LO5+jDLcy X-Received: by 2002:a9d:4b8f:: with SMTP id k15-v6mr4882132otf.248.1526065735767; Fri, 11 May 2018 12:08:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526065735; cv=none; d=google.com; s=arc-20160816; b=RVCG5yV1F6ryg1nq6vysxjEowJJL0K3mNM6iV+yU3mmEWQDL+y4lPRY3VTA7gG8B+r JxFMURqUxM/+I4csRnyTZfcoxT0A3oLxBSd07aEa0/GmuXesUFQHnOFR1OfnqjNqZKqV ZWPMlQbDyI+Mhuy+A45k/9wj7Ha+qL/onNfbEncMryqFUqDgHyHII87+oxKEf5WA0AFJ L8ObDfm18Z3iSbY/fju06c4zbnS0T/ieJ+d8swMAfGhQppzOsjrJhOjLhqy3tGN+Hy7p /+14r0tzunDBsxrQQbBu1/nhhQbXtrULzLWMg+0x751dOk06xyBMHRFpDDi7tktQ5qm+ IjDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=bbU7gNAEiXyLj6glEiouiAz/hg1HZcdPPXKUBEsGe2o=; b=ss9PDZMsVOXefeFbHVPxlU4/AMyFLBYol6CyZy7LTjX7tfbTVAi9ctN/Fvlryn6RUu 5vuiUscGASzteTjw+V+o7SpRohWqNAkKRKp2NE2sp7JPrF6EQfIn5vT/rovVh2A+9GnH kJ23yTevkPLXERu5zjlvXp+kpD1C8zmILewVNcjC7bvBv7E6nO2vfvLq/Y7UGE2EybXC /bykgWNfVpBA2yqbnLfOIOE/L2AEdtJk9GfBERcA7MKcvg0ktx9tDTU5vzifX/1j6+Jm YLmGWjzF93mBvEbXEamFfHcnTWH2aUOWlEezP6imcLbYmbs2D025QCLDOw/DaAMxwM53 FNMw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of jean-philippe.brucker@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=jean-philippe.brucker@arm.com Received: from foss.arm.com (foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id v38-v6si1331821oti.291.2018.05.11.12.08.55 for ; Fri, 11 May 2018 12:08:55 -0700 (PDT) Received-SPF: pass (google.com: domain of jean-philippe.brucker@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of jean-philippe.brucker@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=jean-philippe.brucker@arm.com 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 619DE1713; Fri, 11 May 2018 12:08:55 -0700 (PDT) Received: from ostrya.cambridge.arm.com (ostrya.cambridge.arm.com [10.1.210.33]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 1AA3B3F23C; Fri, 11 May 2018 12:08:49 -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, kvm@vger.kernel.org, linux-mm@kvack.org Cc: joro@8bytes.org, will.deacon@arm.com, robin.murphy@arm.com, alex.williamson@redhat.com, tn@semihalf.com, liubo95@huawei.com, thunder.leizhen@huawei.com, xieyisheng1@huawei.com, xuzaibo@huawei.com, ilias.apalodimas@linaro.org, jonathan.cameron@huawei.com, liudongdong3@huawei.com, shunyong.yang@hxt-semitech.com, nwatters@codeaurora.org, okaya@codeaurora.org, jcrouse@codeaurora.org, rfranz@cavium.com, dwmw2@infradead.org, jacob.jun.pan@linux.intel.com, yi.l.liu@intel.com, ashok.raj@intel.com, kevin.tian@intel.com, baolu.lu@linux.intel.com, robdclark@gmail.com, christian.koenig@amd.com, bharatku@xilinx.com, rgummal@xilinx.com Subject: [PATCH v2 15/40] iommu/of: Add stall and pasid properties to iommu_fwspec Date: Fri, 11 May 2018 20:06:16 +0100 Message-Id: <20180511190641.23008-16-jean-philippe.brucker@arm.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180511190641.23008-1-jean-philippe.brucker@arm.com> References: <20180511190641.23008-1-jean-philippe.brucker@arm.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 | 12 ++++++++++++ include/linux/iommu.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index 5c36a8b7656a..9b6b55f3cccd 100644 --- a/drivers/iommu/of_iommu.c +++ b/drivers/iommu/of_iommu.c @@ -204,6 +204,18 @@ const struct iommu_ops *of_iommu_configure(struct device *dev, if (err) break; } + + fwspec = dev->iommu_fwspec; + if (!err && fwspec) { + const __be32 *prop; + + if (of_get_property(master_np, "dma-can-stall", NULL)) + fwspec->can_stall = true; + + prop = of_get_property(master_np, "pasid-num-bits", NULL); + if (prop) + fwspec->num_pasid_bits = be32_to_cpu(*prop); + } } /* diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 933100678f64..bcce44455117 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -656,6 +656,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]; };