Message ID | 20221205100837.29212-2-johan+linaro@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2164605wrr; Mon, 5 Dec 2022 02:18:25 -0800 (PST) X-Google-Smtp-Source: AA0mqf49E6OkipTv3nXvjWmi9zTnihZnivGG2+1LGR5qTAbLSEzx9bbwj+sK1rYMv8bYT+xldbtC X-Received: by 2002:a05:6a00:f8a:b0:56c:2576:9d2a with SMTP id ct10-20020a056a000f8a00b0056c25769d2amr65500988pfb.60.1670235505449; Mon, 05 Dec 2022 02:18:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670235505; cv=none; d=google.com; s=arc-20160816; b=LFCfmfLhnq8c98OhlhVCEibTXdFw3gmfgZS3gQPXkHPbd0S6hgCUfBnM+RuY7B6n2l podh4+68+ggEaJv1yytTwg7hL3kh84g+c0Rqy4+YI8bkdpquDKLMbMERzg5EoxJjPQRX dSN3e5YtJVl7K90/I9EVCXFfwhkc6DLUkn/KA/WiyuyigHoq6p7aTFdBf8C9QYS2hnfi aasC3taZIF1Kr+sBa27BeYvBuj7KVaFWclMQCohvSkI3/qida4tpAkLJO62d96Ek3S9n Kgfx/zBxYkXALh7wTCgZkk4RtM/ybMAYxCryEi8NxII5dfrY2/fT32QQj5ib/zLF+KcC 17NQ== 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=apvZBYE2lgismTw9RWGcCoT1NWhC81NmViVQcjG0LvU=; b=qFBOFjwj0pJjhpbb1wcSqpCPC5r3X8InwXN7OT3cPkkfkX5WDP4o9OgIxBSZSbsS63 vB6HPxflh6MDd0ilJWm7YjlmX49zcvo1nRev8UYo0kIwGbfuRIG8ujuOGWEPEbggy/ax AYviI14Woz+kKasZ1A6Bmuv63APrX+B8i9ki8SnECGiwawFpLaVnaaaHTqdPSYW76Dg+ qMN0lzbaFEFZLnGjVCjbqe2aB/Trf7WEw0XYmZUZBhnVHvAcCcPshdAot1U3C0gs6CZM ocYA/sd3G2QaaWZvz6umDrL07KaPrLxqpLiU6sCvBcm1LVNyALsl0FY3ZSEdTOSkVpl+ mWLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=s8AB7kPv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v2-20020a170902d68200b0018962fa3890si13507371ply.601.2022.12.05.02.18.11; Mon, 05 Dec 2022 02:18:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=s8AB7kPv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231579AbiLEKKi (ORCPT <rfc822;jaysivo@gmail.com> + 99 others); Mon, 5 Dec 2022 05:10:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230123AbiLEKKc (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 5 Dec 2022 05:10:32 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02738183B5; Mon, 5 Dec 2022 02:10:31 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A7865B80E60; Mon, 5 Dec 2022 10:10:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55EF1C433B5; Mon, 5 Dec 2022 10:10:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670235029; bh=YMlE6nWRDtF//ri9V9yKEVsMMR4A33b7UQugBFmOK7Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s8AB7kPviA+CsoLJTDlHHp0Ikx1yznlxLrVS43pQzT6D0sdKkbEiZSEJUKp1LxALF xhXyEboNzeqWBEGRw9vJNejXBVR8/WZdHC33robFiJkSzYiaPTj8SzOMURYnpByu8I SWBJzKWg97UAmcJcIkpgL7IJ3KGxVw6IpAbpW5a3dra0dft/XyFwV8fGfM0LpnAZ5/ gfG80lxdQQGyksTrtMAVZ6qGR5VnFztHvu10tvT/pGaUNfiG+16Nkhc1XxJU8ekw4k 0OIUa/GHTE12Wx95wkPARz7k6WL+ny+ZN01swZZnzc5VBx1misR6YMTe+6MMZPClFi BpPO/wLhiUXvQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from <johan+linaro@kernel.org>) id 1p28Qk-0007c8-AI; Mon, 05 Dec 2022 11:10:34 +0100 From: Johan Hovold <johan+linaro@kernel.org> To: Bjorn Andersson <andersson@kernel.org>, Alim Akhtar <alim.akhtar@samsung.com>, Avri Altman <avri.altman@wdc.com> Cc: Andy Gross <agross@kernel.org>, Konrad Dybcio <konrad.dybcio@linaro.org>, Bart Van Assche <bvanassche@acm.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>, linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold <johan+linaro@kernel.org> Subject: [PATCH 1/2] dt-bindings: ufs: qcom: allow 'dma-coherent' property Date: Mon, 5 Dec 2022 11:08:36 +0100 Message-Id: <20221205100837.29212-2-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221205100837.29212-1-johan+linaro@kernel.org> References: <20221205100837.29212-1-johan+linaro@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751368865535945543?= X-GMAIL-MSGID: =?utf-8?q?1751368865535945543?= |
Series |
arm64: dts: qcom: sc8280xp: fix UFS DMA coherency
|
|
Commit Message
Johan Hovold
Dec. 5, 2022, 10:08 a.m. UTC
UFS controllers may be cache coherent and must be marked as such in the
devicetree to avoid data corruption.
This is specifically needed on recent Qualcomm platforms like SC8280XP.
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
Documentation/devicetree/bindings/ufs/qcom,ufs.yaml | 2 ++
1 file changed, 2 insertions(+)
Comments
On Mon, Dec 05, 2022 at 11:08:36AM +0100, Johan Hovold wrote: > UFS controllers may be cache coherent and must be marked as such in the > devicetree to avoid data corruption. > > This is specifically needed on recent Qualcomm platforms like SC8280XP. > > Signed-off-by: Johan Hovold <johan+linaro@kernel.org> > --- > Documentation/devicetree/bindings/ufs/qcom,ufs.yaml | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml b/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml > index f2d6298d926c..1f1d286749c0 100644 > --- a/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml > +++ b/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml > @@ -44,6 +44,8 @@ properties: > minItems: 8 > maxItems: 11 > > + dma-coherent: true > + This property is not applicable to all SoCs. So setting true here will make it valid for all. Thanks, Mani > interconnects: > minItems: 2 > maxItems: 2 > -- > 2.37.4 >
On Mon, Dec 05, 2022 at 05:29:06PM +0530, Manivannan Sadhasivam wrote: > On Mon, Dec 05, 2022 at 11:08:36AM +0100, Johan Hovold wrote: > > UFS controllers may be cache coherent and must be marked as such in the > > devicetree to avoid data corruption. > > > > This is specifically needed on recent Qualcomm platforms like SC8280XP. > > > > Signed-off-by: Johan Hovold <johan+linaro@kernel.org> > > --- > > Documentation/devicetree/bindings/ufs/qcom,ufs.yaml | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml b/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml > > index f2d6298d926c..1f1d286749c0 100644 > > --- a/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml > > +++ b/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml > > @@ -44,6 +44,8 @@ properties: > > minItems: 8 > > maxItems: 11 > > > > + dma-coherent: true > > + > > This property is not applicable to all SoCs. So setting true here will make it > valid for all. Yes, it would be a valid, but it will only be added to the DTs of SoCs that actually require it. No need to re-encode the dtsi in the binding. Johan
On Mon, Dec 05, 2022 at 01:07:16PM +0100, Johan Hovold wrote: > On Mon, Dec 05, 2022 at 05:29:06PM +0530, Manivannan Sadhasivam wrote: > > On Mon, Dec 05, 2022 at 11:08:36AM +0100, Johan Hovold wrote: > > > UFS controllers may be cache coherent and must be marked as such in the > > > devicetree to avoid data corruption. > > > > > > This is specifically needed on recent Qualcomm platforms like SC8280XP. > > > > > > Signed-off-by: Johan Hovold <johan+linaro@kernel.org> > > > --- > > > Documentation/devicetree/bindings/ufs/qcom,ufs.yaml | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git a/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml b/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml > > > index f2d6298d926c..1f1d286749c0 100644 > > > --- a/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml > > > +++ b/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml > > > @@ -44,6 +44,8 @@ properties: > > > minItems: 8 > > > maxItems: 11 > > > > > > + dma-coherent: true > > > + > > > > This property is not applicable to all SoCs. So setting true here will make it > > valid for all. > > Yes, it would be a valid, but it will only be added to the DTs of SoCs > that actually require it. No need to re-encode the dtsi in the binding. > But if you make a property valid in the binding then it implies that anyone could add it to DTS which is wrong. You should make this property valid for SoCs that actually support it. Thanks, Mani > Johan
On Mon, Dec 05, 2022 at 05:50:18PM +0530, Manivannan Sadhasivam wrote: > On Mon, Dec 05, 2022 at 01:07:16PM +0100, Johan Hovold wrote: > > On Mon, Dec 05, 2022 at 05:29:06PM +0530, Manivannan Sadhasivam wrote: > > > On Mon, Dec 05, 2022 at 11:08:36AM +0100, Johan Hovold wrote: > > > > UFS controllers may be cache coherent and must be marked as such in the > > > > devicetree to avoid data corruption. > > > > > > > > This is specifically needed on recent Qualcomm platforms like SC8280XP. > > > > > > > > Signed-off-by: Johan Hovold <johan+linaro@kernel.org> > > > > --- > > > > Documentation/devicetree/bindings/ufs/qcom,ufs.yaml | 2 ++ > > > > 1 file changed, 2 insertions(+) > > > > > > > > diff --git a/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml b/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml > > > > index f2d6298d926c..1f1d286749c0 100644 > > > > --- a/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml > > > > +++ b/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml > > > > @@ -44,6 +44,8 @@ properties: > > > > minItems: 8 > > > > maxItems: 11 > > > > > > > > + dma-coherent: true > > > > + > > > > > > This property is not applicable to all SoCs. So setting true here will make it > > > valid for all. > > > > Yes, it would be a valid, but it will only be added to the DTs of SoCs > > that actually require it. No need to re-encode the dtsi in the binding. > > > > But if you make a property valid in the binding then it implies that anyone > could add it to DTS which is wrong. You should make this property valid for > SoCs that actually support it. No, it's not wrong. Note that the binding only requires 'compatible' and 'regs', all other properties are optional, and you could, for example, add a 'reset' property to a node for a device which does not have a reset without the DT validation failing. It's the devicetree which is supposed to describe hardware, you don't have to encode it also in the binding. Johan
On Mon, Dec 05, 2022 at 01:27:34PM +0100, Johan Hovold wrote: > On Mon, Dec 05, 2022 at 05:50:18PM +0530, Manivannan Sadhasivam wrote: > > On Mon, Dec 05, 2022 at 01:07:16PM +0100, Johan Hovold wrote: > > > On Mon, Dec 05, 2022 at 05:29:06PM +0530, Manivannan Sadhasivam wrote: > > > > On Mon, Dec 05, 2022 at 11:08:36AM +0100, Johan Hovold wrote: > > > > > UFS controllers may be cache coherent and must be marked as such in the > > > > > devicetree to avoid data corruption. > > > > > > > > > > This is specifically needed on recent Qualcomm platforms like SC8280XP. > > > > > > > > > > Signed-off-by: Johan Hovold <johan+linaro@kernel.org> > > > > > --- > > > > > Documentation/devicetree/bindings/ufs/qcom,ufs.yaml | 2 ++ > > > > > 1 file changed, 2 insertions(+) > > > > > > > > > > diff --git a/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml b/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml > > > > > index f2d6298d926c..1f1d286749c0 100644 > > > > > --- a/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml > > > > > +++ b/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml > > > > > @@ -44,6 +44,8 @@ properties: > > > > > minItems: 8 > > > > > maxItems: 11 > > > > > > > > > > + dma-coherent: true > > > > > + > > > > > > > > This property is not applicable to all SoCs. So setting true here will make it > > > > valid for all. > > > > > > Yes, it would be a valid, but it will only be added to the DTs of SoCs > > > that actually require it. No need to re-encode the dtsi in the binding. > > > > > > > But if you make a property valid in the binding then it implies that anyone > > could add it to DTS which is wrong. You should make this property valid for > > SoCs that actually support it. > > No, it's not wrong. > > Note that the binding only requires 'compatible' and 'regs', all other > properties are optional, and you could, for example, add a > 'reset' property to a node for a device which does not have a reset > without the DT validation failing. > Then what is the point of devicetree validation using bindings? There is also a comment from Krzysztof: https://lkml.org/lkml/2022/11/24/390 Thanks, Mani > It's the devicetree which is supposed to describe hardware, you don't > have to encode it also in the binding. > > Johan
On Mon, Dec 05, 2022 at 06:30:48PM +0530, Manivannan Sadhasivam wrote: > On Mon, Dec 05, 2022 at 01:27:34PM +0100, Johan Hovold wrote: > > On Mon, Dec 05, 2022 at 05:50:18PM +0530, Manivannan Sadhasivam wrote: > > > On Mon, Dec 05, 2022 at 01:07:16PM +0100, Johan Hovold wrote: > > > > On Mon, Dec 05, 2022 at 05:29:06PM +0530, Manivannan Sadhasivam wrote: > > > > > On Mon, Dec 05, 2022 at 11:08:36AM +0100, Johan Hovold wrote: > > > > > > UFS controllers may be cache coherent and must be marked as such in the > > > > > > devicetree to avoid data corruption. > > > > > > > > > > > > This is specifically needed on recent Qualcomm platforms like SC8280XP. > > > > > > > > > > > > Signed-off-by: Johan Hovold <johan+linaro@kernel.org> > > > > Yes, it would be a valid, but it will only be added to the DTs of SoCs > > > > that actually require it. No need to re-encode the dtsi in the binding. > > > > > > > > > > But if you make a property valid in the binding then it implies that anyone > > > could add it to DTS which is wrong. You should make this property valid for > > > SoCs that actually support it. > > > > No, it's not wrong. > > > > Note that the binding only requires 'compatible' and 'regs', all other > > properties are optional, and you could, for example, add a > > 'reset' property to a node for a device which does not have a reset > > without the DT validation failing. > > > > Then what is the point of devicetree validation using bindings? You're still making sure that no properties are added that are not documented, number of clocks, names of clocks, etc. > There is also a comment from Krzysztof: https://lkml.org/lkml/2022/11/24/390 Speaking of Krzysztof: https://lore.kernel.org/lkml/20221204094717.74016-5-krzysztof.kozlowski@linaro.org/ Johan
On Mon, Dec 05, 2022 at 02:12:48PM +0100, Johan Hovold wrote: > On Mon, Dec 05, 2022 at 06:30:48PM +0530, Manivannan Sadhasivam wrote: > > On Mon, Dec 05, 2022 at 01:27:34PM +0100, Johan Hovold wrote: > > > On Mon, Dec 05, 2022 at 05:50:18PM +0530, Manivannan Sadhasivam wrote: > > > > On Mon, Dec 05, 2022 at 01:07:16PM +0100, Johan Hovold wrote: > > > > > On Mon, Dec 05, 2022 at 05:29:06PM +0530, Manivannan Sadhasivam wrote: > > > > > > On Mon, Dec 05, 2022 at 11:08:36AM +0100, Johan Hovold wrote: > > > > > > > UFS controllers may be cache coherent and must be marked as such in the > > > > > > > devicetree to avoid data corruption. > > > > > > > > > > > > > > This is specifically needed on recent Qualcomm platforms like SC8280XP. > > > > > > > > > > > > > > Signed-off-by: Johan Hovold <johan+linaro@kernel.org> > > > > > > Yes, it would be a valid, but it will only be added to the DTs of SoCs > > > > > that actually require it. No need to re-encode the dtsi in the binding. > > > > > > > > > > > > > But if you make a property valid in the binding then it implies that anyone > > > > could add it to DTS which is wrong. You should make this property valid for > > > > SoCs that actually support it. > > > > > > No, it's not wrong. > > > > > > Note that the binding only requires 'compatible' and 'regs', all other > > > properties are optional, and you could, for example, add a > > > 'reset' property to a node for a device which does not have a reset > > > without the DT validation failing. > > > > > > > Then what is the point of devicetree validation using bindings? > > You're still making sure that no properties are added that are not > documented, number of clocks, names of clocks, etc. > > > There is also a comment from Krzysztof: https://lkml.org/lkml/2022/11/24/390 > > Speaking of Krzysztof: > > https://lore.kernel.org/lkml/20221204094717.74016-5-krzysztof.kozlowski@linaro.org/ > Heh... I will wait for him to chime in then. Thanks, Mani > Johan
On Mon, Dec 05, 2022 at 02:12:48PM +0100, Johan Hovold wrote: > On Mon, Dec 05, 2022 at 06:30:48PM +0530, Manivannan Sadhasivam wrote: > > On Mon, Dec 05, 2022 at 01:27:34PM +0100, Johan Hovold wrote: > > > On Mon, Dec 05, 2022 at 05:50:18PM +0530, Manivannan Sadhasivam wrote: > > > > On Mon, Dec 05, 2022 at 01:07:16PM +0100, Johan Hovold wrote: > > > > > On Mon, Dec 05, 2022 at 05:29:06PM +0530, Manivannan Sadhasivam wrote: > > > > > > On Mon, Dec 05, 2022 at 11:08:36AM +0100, Johan Hovold wrote: > > > > > > > UFS controllers may be cache coherent and must be marked as such in the > > > > > > > devicetree to avoid data corruption. Typically, you'd only be doing unnecessary cache flushes without it rather than getting data corruption. However, it is possible this property triggers other system setup or something that would cause problems if not setup right. > > > > > > > > > > > > > > This is specifically needed on recent Qualcomm platforms like SC8280XP. > > > > > > > > > > > > > > Signed-off-by: Johan Hovold <johan+linaro@kernel.org> > > > > > > Yes, it would be a valid, but it will only be added to the DTs of SoCs > > > > > that actually require it. No need to re-encode the dtsi in the binding. > > > > > > > > > > > > > But if you make a property valid in the binding then it implies that anyone > > > > could add it to DTS which is wrong. You should make this property valid for > > > > SoCs that actually support it. > > > > > > No, it's not wrong. > > > > > > Note that the binding only requires 'compatible' and 'regs', all other > > > properties are optional, and you could, for example, add a > > > 'reset' property to a node for a device which does not have a reset > > > without the DT validation failing. > > > > > > > Then what is the point of devicetree validation using bindings? > > You're still making sure that no properties are added that are not > documented, number of clocks, names of clocks, etc. The schema can never be 100%. If it was, then we could practically just generate the DT. IMO, 'dma-coherent' is bit special. I'd say it is valid on any DMA capable device node, but there's not any generic way to determine that. So it has to be explicit in a device binding. Rob
On Mon, 05 Dec 2022 11:08:36 +0100, Johan Hovold wrote: > UFS controllers may be cache coherent and must be marked as such in the > devicetree to avoid data corruption. > > This is specifically needed on recent Qualcomm platforms like SC8280XP. > > Signed-off-by: Johan Hovold <johan+linaro@kernel.org> > --- > Documentation/devicetree/bindings/ufs/qcom,ufs.yaml | 2 ++ > 1 file changed, 2 insertions(+) > Reviewed-by: Rob Herring <robh@kernel.org>
On Mon, Dec 05, 2022 at 11:08:36AM +0100, Johan Hovold wrote: > UFS controllers may be cache coherent and must be marked as such in the > devicetree to avoid data corruption. > > This is specifically needed on recent Qualcomm platforms like SC8280XP. > > Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Reviewed-by: Bjorn Andersson <andersson@kernel.org> But I think this should be picked up by James or Martin. Added them as explicit recipients, but perhaps they would like you to resubmit this? I'm picking the dts change for now. Thanks, Bjorn > --- > Documentation/devicetree/bindings/ufs/qcom,ufs.yaml | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml b/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml > index f2d6298d926c..1f1d286749c0 100644 > --- a/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml > +++ b/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml > @@ -44,6 +44,8 @@ properties: > minItems: 8 > maxItems: 11 > > + dma-coherent: true > + > interconnects: > minItems: 2 > maxItems: 2 > -- > 2.37.4 >
On Mon, Dec 05, 2022 at 04:35:22PM -0600, Rob Herring wrote: > On Mon, Dec 05, 2022 at 02:12:48PM +0100, Johan Hovold wrote: > > On Mon, Dec 05, 2022 at 06:30:48PM +0530, Manivannan Sadhasivam wrote: > > > On Mon, Dec 05, 2022 at 01:27:34PM +0100, Johan Hovold wrote: > > > > On Mon, Dec 05, 2022 at 05:50:18PM +0530, Manivannan Sadhasivam wrote: > > > > > On Mon, Dec 05, 2022 at 01:07:16PM +0100, Johan Hovold wrote: > > > > > > On Mon, Dec 05, 2022 at 05:29:06PM +0530, Manivannan Sadhasivam wrote: > > > > > > > On Mon, Dec 05, 2022 at 11:08:36AM +0100, Johan Hovold wrote: > > > > > > > > UFS controllers may be cache coherent and must be marked as such in the > > > > > > > > devicetree to avoid data corruption. > > Typically, you'd only be doing unnecessary cache flushes without it > rather than getting data corruption. However, it is possible this > property triggers other system setup or something that would cause > problems if not setup right. You can end up with data corruption, for example, if the kernel remaps a consistent buffer and writes data through the non-cacheable alias while the coherent device snoops stale data from the caches. Johan
On Mon, Dec 05, 2022 at 05:07:51PM -0600, Bjorn Andersson wrote: > On Mon, Dec 05, 2022 at 11:08:36AM +0100, Johan Hovold wrote: > > UFS controllers may be cache coherent and must be marked as such in the > > devicetree to avoid data corruption. > > > > This is specifically needed on recent Qualcomm platforms like SC8280XP. > > > > Signed-off-by: Johan Hovold <johan+linaro@kernel.org> > > Reviewed-by: Bjorn Andersson <andersson@kernel.org> > > But I think this should be picked up by James or Martin. Added them as > explicit recipients, but perhaps they would like you to resubmit this? They were not included in the get_maintainer.pl output so I'm guessing they prefer to pick UFS binding patches from the scsi list. > I'm picking the dts change for now. Thanks. Johan
On 05/12/2022 14:37, Manivannan Sadhasivam wrote: > On Mon, Dec 05, 2022 at 02:12:48PM +0100, Johan Hovold wrote: >> On Mon, Dec 05, 2022 at 06:30:48PM +0530, Manivannan Sadhasivam wrote: >>> On Mon, Dec 05, 2022 at 01:27:34PM +0100, Johan Hovold wrote: >>>> On Mon, Dec 05, 2022 at 05:50:18PM +0530, Manivannan Sadhasivam wrote: >>>>> On Mon, Dec 05, 2022 at 01:07:16PM +0100, Johan Hovold wrote: >>>>>> On Mon, Dec 05, 2022 at 05:29:06PM +0530, Manivannan Sadhasivam wrote: >>>>>>> On Mon, Dec 05, 2022 at 11:08:36AM +0100, Johan Hovold wrote: >>>>>>>> UFS controllers may be cache coherent and must be marked as such in the >>>>>>>> devicetree to avoid data corruption. >>>>>>>> >>>>>>>> This is specifically needed on recent Qualcomm platforms like SC8280XP. >>>>>>>> >>>>>>>> Signed-off-by: Johan Hovold <johan+linaro@kernel.org> >> >>>>>> Yes, it would be a valid, but it will only be added to the DTs of SoCs >>>>>> that actually require it. No need to re-encode the dtsi in the binding. >>>>>> >>>>> >>>>> But if you make a property valid in the binding then it implies that anyone >>>>> could add it to DTS which is wrong. You should make this property valid for >>>>> SoCs that actually support it. >>>> >>>> No, it's not wrong. >>>> >>>> Note that the binding only requires 'compatible' and 'regs', all other >>>> properties are optional, and you could, for example, add a >>>> 'reset' property to a node for a device which does not have a reset >>>> without the DT validation failing. Optional properties are optional primarily looking at one variant. It means that on different boards with the same SoC, things can be routed a bit differently and some property can be skipped. E.g. sometimes regulators come from PMIC and sometimes are wired to some VBATT, so we do not have regulator in DTS for them. Or some interrupt/pin is not connected. Now between variants of devices - different SoCs: I don't think that "optional" should be used in such context, except special cases or lack of knowledge about hardware. For given SoC/variant, the property is either: 1. valid and possible (can be required or optional), 2. not valid, not possible. And this we should express in constraints, if doable with reasonable complexity. Therefore the question is: is dma-coherent not valid for other SoCs? If it is "not needed" for other SoCs, then I would leave it like this. Consider also what Rob said, that otherwise we would create DTS from the bindings. Also, too many allOf:if:then: constraints in the bindings make them trickier to read. >>>> >>> >>> Then what is the point of devicetree validation using bindings? >> >> You're still making sure that no properties are added that are not >> documented, number of clocks, names of clocks, etc. >> >>> There is also a comment from Krzysztof: https://lkml.org/lkml/2022/11/24/390 >> >> Speaking of Krzysztof: >> >> https://lore.kernel.org/lkml/20221204094717.74016-5-krzysztof.kozlowski@linaro.org/ That's not the best example, because I just do not know where dma-coherent is applicable and where it is not, thus I added it as valid for all variants. Also, I think that all variants are capable of using IOMMU - it isn't restricted per variant. If they are capable of IOMMU, then dma-coherent is a possible choice. Best regards, Krzysztof
On Tue, Dec 06, 2022 at 09:14:30AM +0100, Krzysztof Kozlowski wrote: > On 05/12/2022 14:37, Manivannan Sadhasivam wrote: > > On Mon, Dec 05, 2022 at 02:12:48PM +0100, Johan Hovold wrote: > >> On Mon, Dec 05, 2022 at 06:30:48PM +0530, Manivannan Sadhasivam wrote: > >>> On Mon, Dec 05, 2022 at 01:27:34PM +0100, Johan Hovold wrote: > >>>> On Mon, Dec 05, 2022 at 05:50:18PM +0530, Manivannan Sadhasivam wrote: > >>>>> On Mon, Dec 05, 2022 at 01:07:16PM +0100, Johan Hovold wrote: > >>>>>> On Mon, Dec 05, 2022 at 05:29:06PM +0530, Manivannan Sadhasivam wrote: > >>>>>>> On Mon, Dec 05, 2022 at 11:08:36AM +0100, Johan Hovold wrote: > >>>>>>>> UFS controllers may be cache coherent and must be marked as such in the > >>>>>>>> devicetree to avoid data corruption. > >>>>>>>> > >>>>>>>> This is specifically needed on recent Qualcomm platforms like SC8280XP. > >>>>>>>> > >>>>>>>> Signed-off-by: Johan Hovold <johan+linaro@kernel.org> > >> > >>>>>> Yes, it would be a valid, but it will only be added to the DTs of SoCs > >>>>>> that actually require it. No need to re-encode the dtsi in the binding. > >>>>>> > >>>>> > >>>>> But if you make a property valid in the binding then it implies that anyone > >>>>> could add it to DTS which is wrong. You should make this property valid for > >>>>> SoCs that actually support it. > >>>> > >>>> No, it's not wrong. > >>>> > >>>> Note that the binding only requires 'compatible' and 'regs', all other > >>>> properties are optional, and you could, for example, add a > >>>> 'reset' property to a node for a device which does not have a reset > >>>> without the DT validation failing. > > Optional properties are optional primarily looking at one variant. It > means that on different boards with the same SoC, things can be routed a > bit differently and some property can be skipped. E.g. sometimes > regulators come from PMIC and sometimes are wired to some VBATT, so we > do not have regulator in DTS for them. Or some interrupt/pin is not > connected. > > Now between variants of devices - different SoCs: I don't think that > "optional" should be used in such context, except special cases or lack > of knowledge about hardware. For given SoC/variant, the property is either: > 1. valid and possible (can be required or optional), > 2. not valid, not possible. > And this we should express in constraints, if doable with reasonable > complexity. > > Therefore the question is: is dma-coherent not valid for other SoCs? > Yes, it is not valid on older SoCs because they don't support I/O coherency. So setting this property on those un-supported SoCs may lead to wierd behavior. This was the concern I had for setting this property valid for all SoCs. So far we only know that SC8280XP and newer SoCs support I/O coherency. Thanks, Mani > If it is "not needed" for other SoCs, then I would leave it like this. > Consider also what Rob said, that otherwise we would create DTS from the > bindings. > > Also, too many allOf:if:then: constraints in the bindings make them > trickier to read. > > >>>> > >>> > >>> Then what is the point of devicetree validation using bindings? > >> > >> You're still making sure that no properties are added that are not > >> documented, number of clocks, names of clocks, etc. > >> > >>> There is also a comment from Krzysztof: https://lkml.org/lkml/2022/11/24/390 > >> > >> Speaking of Krzysztof: > >> > >> https://lore.kernel.org/lkml/20221204094717.74016-5-krzysztof.kozlowski@linaro.org/ > > That's not the best example, because I just do not know where > dma-coherent is applicable and where it is not, thus I added it as valid > for all variants. Also, I think that all variants are capable of using > IOMMU - it isn't restricted per variant. If they are capable of IOMMU, > then dma-coherent is a possible choice. > > > Best regards, > Krzysztof >
diff --git a/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml b/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml index f2d6298d926c..1f1d286749c0 100644 --- a/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml +++ b/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml @@ -44,6 +44,8 @@ properties: minItems: 8 maxItems: 11 + dma-coherent: true + interconnects: minItems: 2 maxItems: 2