devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Johan Hovold <johan@kernel.org>,
	Johan Hovold <johan+linaro@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Avri Altman <avri.altman@wdc.com>, 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>,
	linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] dt-bindings: ufs: qcom: allow 'dma-coherent' property
Date: Tue, 6 Dec 2022 14:47:37 +0530	[thread overview]
Message-ID: <20221206091737.GC15486@thinkpad> (raw)
In-Reply-To: <2699840b-9746-473b-fa17-900258db555d@linaro.org>

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
> 

-- 
மணிவண்ணன் சதாசிவம்

  reply	other threads:[~2022-12-06  9:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-05 10:08 [PATCH 0/2] arm64: dts: qcom: sc8280xp: fix UFS DMA coherency Johan Hovold
2022-12-05 10:08 ` [PATCH 1/2] dt-bindings: ufs: qcom: allow 'dma-coherent' property Johan Hovold
2022-12-05 11:59   ` Manivannan Sadhasivam
2022-12-05 12:07     ` Johan Hovold
2022-12-05 12:20       ` Manivannan Sadhasivam
2022-12-05 12:27         ` Johan Hovold
2022-12-05 13:00           ` Manivannan Sadhasivam
2022-12-05 13:12             ` Johan Hovold
2022-12-05 13:37               ` Manivannan Sadhasivam
2022-12-06  8:14                 ` Krzysztof Kozlowski
2022-12-06  9:17                   ` Manivannan Sadhasivam [this message]
2022-12-05 22:35               ` Rob Herring
2022-12-06  7:49                 ` Johan Hovold
2022-12-05 22:35   ` Rob Herring
2022-12-05 23:07   ` Bjorn Andersson
2022-12-06  7:55     ` Johan Hovold
2022-12-05 10:08 ` [PATCH 2/2] arm64: dts: qcom: sc8280xp: fix UFS DMA coherency Johan Hovold
2022-12-05 11:37   ` Konrad Dybcio
2022-12-05 12:01   ` Manivannan Sadhasivam
2022-12-06 18:18 ` (subset) [PATCH 0/2] " Bjorn Andersson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221206091737.GC15486@thinkpad \
    --to=manivannan.sadhasivam@linaro.org \
    --cc=agross@kernel.org \
    --cc=alim.akhtar@samsung.com \
    --cc=andersson@kernel.org \
    --cc=avri.altman@wdc.com \
    --cc=bvanassche@acm.org \
    --cc=devicetree@vger.kernel.org \
    --cc=johan+linaro@kernel.org \
    --cc=johan@kernel.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).