linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: rjw@rjwysocki.net, lukasz.luba@arm.com, robh@kernel.org,
	heiko@sntech.de, arnd@linaro.org, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org, ulf.hansson@linaro.org,
	Andy Gross <agross@kernel.org>,
	"open list:ARM/QUALCOMM SUPPORT" <linux-arm-msm@vger.kernel.org>
Subject: Re: [PATCH v5 6/6] qcom/soc/drivers: Add DTPM description for sdm845
Date: Fri, 7 Jan 2022 15:51:18 -0800	[thread overview]
Message-ID: <YdjR9kQSFEydZybr@ripper> (raw)
In-Reply-To: <8e2fa6b6-4f95-9381-4d7e-810afe98fcea@linaro.org>

On Fri 07 Jan 14:07 PST 2022, Daniel Lezcano wrote:

> 
> Hi Bjorn,
> 
> On 07/01/2022 20:27, Bjorn Andersson wrote:
> 
> [ ... ]
> 
> >> +#include <linux/dtpm.h>
> >> +#include <linux/module.h>
> >> +#include <linux/of.h>
> >> +#include <linux/platform_device.h>
> >> +
> >> +static struct dtpm_node __initdata sdm845_hierarchy[] = {
> >> +	[0]{ .name = "sdm845" },
> > 
> > Why is the index signifiant here?
> > Doesn't this imply risk that we forget one element, which will be
> > thereby implicitly be left initialized as {} and hence denote
> > termination of the list?
> 
> Yes, that is possible. The other annotation is also possible. The index
> helps to refer from the .parent field.
> 
> That said nothing forces to use the index, so it is a matter of taste.
> 
> >> +	[1]{ .name = "package",
> >> +	     .parent = &sdm845_hierarchy[0] },
> >> +	[2]{ .name = "/cpus/cpu@0",
> >> +	     .type = DTPM_NODE_DT,
> >> +	     .parent = &sdm845_hierarchy[1] },
> >> +	[3]{ .name = "/cpus/cpu@100",
> >> +	     .type = DTPM_NODE_DT,
> >> +	     .parent = &sdm845_hierarchy[1] },
> >> +	[4]{ .name = "/cpus/cpu@200",
> >> +	     .type = DTPM_NODE_DT,
> >> +	     .parent = &sdm845_hierarchy[1] },
> >> +	[5]{ .name = "/cpus/cpu@300",
> >> +	     .type = DTPM_NODE_DT,
> >> +	     .parent = &sdm845_hierarchy[1] },
> >> +	[6]{ .name = "/cpus/cpu@400",
> >> +	     .type = DTPM_NODE_DT,
> >> +	     .parent = &sdm845_hierarchy[1] },
> >> +	[7]{ .name = "/cpus/cpu@500",
> >> +	     .type = DTPM_NODE_DT,
> >> +	     .parent = &sdm845_hierarchy[1] },
> >> +	[8]{ .name = "/cpus/cpu@600",
> >> +	     .type = DTPM_NODE_DT,
> >> +	     .parent = &sdm845_hierarchy[1] },
> >> +	[9]{ .name = "/cpus/cpu@700",
> >> +	     .type = DTPM_NODE_DT,
> >> +	     .parent = &sdm845_hierarchy[1] },
> >> +	[10]{ .name = "/soc@0/gpu@5000000",
> > 
> > It worries me that we encode the textual structure of the dts in the
> > kernel. E.g. for quite a while this was "/soc/gpu@5000000", so if this
> > landed a year ago this driver would have prevented us from correcting
> > the dts.
> 
> Why ? The change should be reflected in the driver also, no ?
> 

There was no update needed to change /soc to /soc@0, but with this
driver in place we would need to do that.

The problem is that the life cycle of the DTB is different from Linux
and we promise our users that the kernel will be backwards compatible
with existing DTBs (at least for a reasonable amount of time).

So if we made a change in the kernel to turn the incorrect
"/soc/gpu@5000000" into "/soc@0/gpu@5000000" we would no longer find a
match if you try to boot with yesterday's DTB.

> > Another concern is that not all busses in the system are capable of
> > 36-bit wide addresses, so it's plausible that we might one day have to
> > create a more accurate representation of the address space. Maybe not on
> > SDM845, but this would force us to be inconsistent.
> 
> Sorry, I'm missing the point :/
> 
> If a change is done in the DT, the code using the description must be
> changed accordingly, no?
> 

No, the kernel should continue to function with the old DTB.

Consider when your Linux distro gives you a new kernel version on your
computer, that shouldn't require an upgrade of "BIOS" in order to boot
the new kernel.

Regards,
Bjorn

> 
> > Regards,
> > Bjorn
> > 
> >> +	     .type = DTPM_NODE_DT,
> >> +	     .parent = &sdm845_hierarchy[1] },
> >> +	[11]{ },
> >> +};
> >> +
> >> +static struct of_device_id __initdata sdm845_dtpm_match_table[] = {
> >> +        { .compatible = "qcom,sdm845", .data = sdm845_hierarchy },
> >> +        {},
> >> +};
> >> +
> >> +static int __init sdm845_dtpm_init(void)
> >> +{
> >> +	return dtpm_create_hierarchy(sdm845_dtpm_match_table);
> >> +}
> >> +late_initcall(sdm845_dtpm_init);
> >> +
> >> +MODULE_DESCRIPTION("Qualcomm DTPM driver");
> >> +MODULE_LICENSE("GPL");
> >> +MODULE_ALIAS("platform:dtpm");
> >> +MODULE_AUTHOR("Daniel Lezcano <daniel.lezcano@kernel.org");
> >> +
> >> -- 
> >> 2.25.1
> >>
> 
> 
> -- 
> <http://www.linaro.org/> Linaro.org ??? Open source software for ARM SoCs
> 
> Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
> <http://twitter.com/#!/linaroorg> Twitter |
> <http://www.linaro.org/linaro-blog/> Blog

  reply	other threads:[~2022-01-07 23:50 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-18 13:00 [PATCH v5 0/6] powercap/drivers/dtpm: Create the dtpm hierarchy Daniel Lezcano
2021-12-18 13:00 ` [PATCH v5 1/6] powercap/drivers/dtpm: Move dtpm table from init to data section Daniel Lezcano
2021-12-31 13:33   ` Ulf Hansson
2022-01-04  8:57     ` Daniel Lezcano
2022-01-07 13:15     ` Daniel Lezcano
2022-01-07 14:49       ` Ulf Hansson
2022-01-10 13:33         ` Daniel Lezcano
2021-12-18 13:00 ` [PATCH v5 2/6] powercap/drivers/dtpm: Add hierarchy creation Daniel Lezcano
2021-12-31 13:45   ` Ulf Hansson
2022-01-05 16:00     ` Daniel Lezcano
2022-01-07 15:54       ` Ulf Hansson
2022-01-10 15:55         ` Daniel Lezcano
2022-01-11  8:28           ` Ulf Hansson
2022-01-11 17:52             ` Daniel Lezcano
2022-01-12 12:00               ` Ulf Hansson
2022-01-14 19:15                 ` Daniel Lezcano
2021-12-18 13:00 ` [PATCH v5 3/6] powercap/drivers/dtpm: Add CPU DT initialization support Daniel Lezcano
2021-12-31 13:46   ` Ulf Hansson
2021-12-18 13:00 ` [PATCH v5 4/6] powercap/drivers/dtpm: Add dtpm devfreq with energy model support Daniel Lezcano
2021-12-18 13:00 ` [PATCH v5 5/6] rockchip/soc/drivers: Add DTPM description for rk3399 Daniel Lezcano
2021-12-31 13:57   ` Ulf Hansson
2022-01-04  9:29     ` Geert Uytterhoeven
2022-01-05  9:21       ` Daniel Lezcano
2022-01-05 11:25     ` Daniel Lezcano
2021-12-18 13:00 ` [PATCH v5 6/6] qcom/soc/drivers: Add DTPM description for sdm845 Daniel Lezcano
2021-12-18 19:47   ` Steev Klimaszewski
2021-12-18 20:11     ` Daniel Lezcano
2021-12-19 18:44       ` Steev Klimaszewski
2021-12-19 20:27         ` Daniel Lezcano
2022-01-07 19:27   ` Bjorn Andersson
2022-01-07 22:07     ` Daniel Lezcano
2022-01-07 23:51       ` Bjorn Andersson [this message]
2021-12-23 13:20 ` [PATCH v5 0/6] powercap/drivers/dtpm: Create the dtpm hierarchy Daniel Lezcano
2021-12-23 13:32   ` Ulf Hansson
2021-12-23 13:42     ` Daniel Lezcano

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=YdjR9kQSFEydZybr@ripper \
    --to=bjorn.andersson@linaro.org \
    --cc=agross@kernel.org \
    --cc=arnd@linaro.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=heiko@sntech.de \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=rjw@rjwysocki.net \
    --cc=robh@kernel.org \
    --cc=ulf.hansson@linaro.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).