From mboxrd@z Thu Jan 1 00:00:00 1970 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=-15.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 105DEC63697 for ; Thu, 26 Nov 2020 18:11:19 +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 88EBA2068D for ; Thu, 26 Nov 2020 18:11:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ZsGJa5Qv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 88EBA2068D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com 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-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1JT9/eNZgYhrZ55E0/6diuHrrr8znm2TOJgmW+aj+pw=; b=ZsGJa5Qv+FxwyN/xDCO9yP+P7 cKk3y5EyWCzovgPuE3WT77YNbt7BaeZGW2RY8zofB8qWlWbrOZNRqtXnLHRJsMKCd3fUJF9YjeZ70 Cl/LuqFZdOJqzFjxT8uyCCmLkI3W245EKdszhI9dRcp7Tit7F9STEpeiZxDDZFbEzmJoUP8NyTrlZ 0oGyFskxrx5soCGOL+lcgEPEGUvpn30uzg8dOAGn1b5VFqoLnS4eip2ew/Q2ih2m62nFdZy34rSjk IPsezIbeskdxKQY4Kgk8IUlE1YzFChsOUI8IvPql7qPvr1yuCugITlRL5ck/5v0UNuMc07fDonGdR 7+JsKzReg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kiLiP-00082j-K3; Thu, 26 Nov 2020 18:09:57 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kiLi0-0007uY-CO for linux-arm-kernel@lists.infradead.org; Thu, 26 Nov 2020 18:09:33 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4512431B; Thu, 26 Nov 2020 10:09:31 -0800 (PST) Received: from [10.57.59.159] (unknown [10.57.59.159]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D587E3F23F; Thu, 26 Nov 2020 10:09:27 -0800 (PST) Subject: Re: [PATCH v8 4/9] of/iommu: Support dma-can-stall property To: Jean-Philippe Brucker , joro@8bytes.org, will@kernel.org, lorenzo.pieralisi@arm.com, robh+dt@kernel.org References: <20201112125519.3987595-1-jean-philippe@linaro.org> <20201112125519.3987595-5-jean-philippe@linaro.org> From: Robin Murphy Message-ID: Date: Thu, 26 Nov 2020 18:09:26 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <20201112125519.3987595-5-jean-philippe@linaro.org> Content-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201126_130932_607420_DA078E90 X-CRM114-Status: GOOD ( 22.81 ) 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, guohanjun@huawei.com, linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org, Jonathan.Cameron@huawei.com, rjw@rjwysocki.net, shameerali.kolothum.thodi@huawei.com, eric.auger@redhat.com, iommu@lists.linux-foundation.org, sudeep.holla@arm.com, bhelgaas@google.com, zhangfei.gao@linaro.org, vivek.gautam@arm.com, baolu.lu@linux.intel.com, linux-arm-kernel@lists.infradead.org, lenb@kernel.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2020-11-12 12:55, Jean-Philippe Brucker wrote: > Copy the dma-can-stall property into the fwspec structure. Can't we just handle this as a regular device property? It's not part of the actual IOMMU specifier, it doesn't need to be translated in any way, and AFAICS it's used a grand total of once, in a slow path. Simply treating it as the per-device property that it is should require zero additional code for DT, and a simple device_add_properties() call for IORT. TBH that appears to be true of pasid-num-bits as well. Robin. > 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"); > + } > } > > /* > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel