devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Doug Anderson <dianders@chromium.org>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Konrad Dybcio <konrad.dybcio@somainline.org>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
	<devicetree@vger.kernel.org>, Stephen Boyd <swboyd@chromium.org>
Subject: Re: [PATCH 0/3] dt-bindings: arm: qcom: define schema, not devices
Date: Mon, 25 Jul 2022 18:56:36 +0200	[thread overview]
Message-ID: <4298c7a7-b730-635f-ae32-4662935c767f@linaro.org> (raw)
In-Reply-To: <76defcb3-8566-286a-d953-54c4a2b04782@linaro.org>

On 25/07/2022 18:41, Krzysztof Kozlowski wrote:
> On 25/07/2022 18:25, Doug Anderson wrote:
>> Let's look specifically at the device tree file for the LTE board. One
>> way to look at it is that the dts for the LTE board should have
>> compatibles:
>>   compatible = "lte", "wifi-only"
>>
>> The above matches the normal device tree mentality. It says: "hey, if
>> you've got a lte driver for this board then use it; otherwise use the
>> wifi-only driver".
>>
>> However, the above is actually broken for the bootloader use case. The
>> bootloader is trying to pick a device tree and, to the bootloader, the
>> above says "you can use this dts for either an lte board or a
>> wifi-only board". That's bad. If the bootloader picks this device tree
>> for a wifi-only board then the OS will try to initialize lte and
>> things will crash. To go further, if you think about it things
>> actually work fine if the wifi-only device tree says it's compatible
>> with the LTE board. This is why I say it's opposite... ;-)
> 
> This is not specific to "bootloaders" but your specific implementation
> of entire chain. How you described it, you have dependent pieces -
> user-space must use the same DTB as bootloader chosen, but bootloader
> makes different choices than user-space. It's perfectly fine to make
> these choices different, but then user-space should not depend on
> something which was/was not initialized in bootloader.
> 
> IOW, if bootloader picked up generic WiFi compatible and user-space will
> crash if picking up specific comaptible, you have a dependency and
> user-space should probably bind to modified DTB, where LTE comaptible is
> removed.
> 
> Other systems - I would say most of them - are independent, IOW, we try
> to make kernel and user-space independent of what bootloader did,
> because we are never sure what bootloader actually did and what DTS it
> received.

You can BTW compare it nicely to Linux device driver binding. If a
driver binds to more generic (WiFi) compatible, it is not allowed to use
any features/code related to more specific compatible (LTE).

Your case breaks this rule. Bootloader bound to generic (WiFi)
compatible, but it passed entire DTB/FDT to kernel/user-space which can
then run code for more specific compatible.

Although I understand the point the board compatibles by themself
provide little help for such use case.

Best regards,
Krzysztof

  parent reply	other threads:[~2022-07-25 16:56 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-23  9:09 [PATCH 0/3] dt-bindings: arm: qcom: define schema, not devices Dmitry Baryshkov
2022-07-23  9:09 ` [PATCH 1/3] dt-bindings: arm: qcom: stop describing individual boards Dmitry Baryshkov
2022-07-23 17:49   ` Krzysztof Kozlowski
2022-07-23  9:09 ` [PATCH 2/3] dt-bindings: arm: qcom: merge simple platform definitions Dmitry Baryshkov
2022-07-23 17:50   ` Krzysztof Kozlowski
2022-07-23  9:09 ` [PATCH 3/3] dt-bindings: arm: qcom: drop individual descriptions of Google devices Dmitry Baryshkov
2022-07-23 17:51   ` Krzysztof Kozlowski
2022-07-23 17:48 ` [PATCH 0/3] dt-bindings: arm: qcom: define schema, not devices Krzysztof Kozlowski
2022-07-23 22:50   ` Dmitry Baryshkov
2022-07-25 16:18     ` Krzysztof Kozlowski
2022-07-25 17:13       ` Dmitry Baryshkov
2022-07-25 17:25         ` Krzysztof Kozlowski
2022-07-25 16:25     ` Doug Anderson
2022-07-25 16:41       ` Krzysztof Kozlowski
2022-07-25 16:54         ` Doug Anderson
2022-07-25 17:07           ` Krzysztof Kozlowski
2022-07-25 17:09             ` Doug Anderson
2022-07-25 17:14               ` Krzysztof Kozlowski
2022-07-25 17:22                 ` Doug Anderson
2022-07-25 17:29                   ` Krzysztof Kozlowski
2022-07-25 17:35                     ` Doug Anderson
2022-07-25 16:56         ` Krzysztof Kozlowski [this message]
2022-07-25 17:30     ` Rob Herring

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=4298c7a7-b730-635f-ae32-4662935c767f@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dianders@chromium.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=konrad.dybcio@somainline.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=swboyd@chromium.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).