devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Marc Zyngier <maz@kernel.org>,
	Phil Edworthy <phil.edworthy@renesas.com>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Biju Das <biju.das.jz@bp.renesas.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
	<devicetree@vger.kernel.org>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH v3 04/12] dt-bindings: timer: arm,arch_timer: Add optional clock and reset
Date: Tue, 3 May 2022 15:55:41 +0100	[thread overview]
Message-ID: <YnFCbe4ULoRRft4u@lakrids> (raw)
In-Reply-To: <CAMuHMdU4j=Uaz5fAODFrPud0i40TdHUo6bYq0YpdnUzWaM3-Og@mail.gmail.com>

Hi Geert,

On Tue, May 03, 2022 at 04:22:35PM +0200, Geert Uytterhoeven wrote:
> On Tue, May 3, 2022 at 3:12 PM Marc Zyngier <maz@kernel.org> wrote:
> > On 2022-05-03 12:55, Phil Edworthy wrote:
> > > Some SoCs use a gated clock for the timer and the means to reset the
> > > timer.
> > > Hence add these as optional.
> >
> > The architecture is crystal clear on the subject: the counter
> > is in an always-on domain. Why should this be visible to SW?
> > Also, reseting the counter breaks the guaranteed monotonicity
> > we rely on.
> 
> The DT bindings do state:
> 
>   always-on:
>     type: boolean
>     description: If present, the timer is powered through an always-on power
>       domain, therefore it never loses context.
> 
> and (surprisingly?) the absence of this property seems to be the
> norm...

That's the *timer* (i.e. the comparator logic within each CPU which
fires an interrupt), not the *counter* (i.e. the incrementing value fed
by a clock). What this is trying to say is whether that can be relied
upon to cause a wakeup while the CPU is in a low-power state, or whether
it cannot (and hence SW needs to use another timer for the wakeup).

It's legitimate for each timer to not be in an always-on power domain
because it is part of each CPU, whereas the counter is global to the
system.

We can clear up the wording here since it's apparently confusing.

> And:
> 
>   arm,no-tick-in-suspend:
>     type: boolean
>     description: The main counter does not tick when the system is in
>       low-power system suspend on some SoCs. This behavior does not match the
>       Architecture Reference Manual's specification that the system
> counter "must
>       be implemented in an always-on power domain."

This is admittedly a workaround for an integration bug, but it's quite
different and only affects the time jump that can be observed when going
into suspend an exiting from it. Whenever software is running the
counter is incrementing.

> So there's already precedent for clocks that can be disabled.

There's precedent for the clock being disabled in a specific deep sleep
state, not when SW is actively running.

> > Worse case, this belongs to the boot firmware, not the kernel,
> > and I don't think this should be described in the DT.
> 
> "DT describes hardware, not software policy"?

It's still describing the HW. There's plenty of other always-on stuff
that we don't describe because for all intents and purposes it is always
on.

Note that this being always-on isn't just a Linux thing; that affects
plenty of other SW which may run and it's an *architectural property*
that's apparently being violated.

Thanks,
Mark.

  reply	other threads:[~2022-05-03 14:55 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-03 11:55 [PATCH v3 00/12] Add new Renesas RZ/V2M SoC and Renesas RZ/V2M EVK support Phil Edworthy
2022-05-03 11:55 ` [PATCH v3 01/12] dt-bindings: serial: renesas,em-uart: Add RZ/V2M clock to access the registers Phil Edworthy
2022-05-04  8:06   ` Geert Uytterhoeven
2022-05-04  8:13     ` Phil Edworthy
2022-05-03 11:55 ` [PATCH v3 02/12] dt-bindings: clock: Add r9a09g011 CPG Clock Definitions Phil Edworthy
2022-05-04  8:43   ` Geert Uytterhoeven
2022-05-03 11:55 ` [PATCH v3 03/12] dt-bindings: clock: renesas,rzg2l: Document RZ/V2M SoC Phil Edworthy
2022-05-04  8:43   ` Geert Uytterhoeven
2022-05-03 11:55 ` [PATCH v3 04/12] dt-bindings: timer: arm,arch_timer: Add optional clock and reset Phil Edworthy
2022-05-03 13:11   ` Mark Rutland
2022-05-04 22:33     ` Rob Herring
2022-05-05  6:42       ` Geert Uytterhoeven
2022-05-03 13:12   ` Marc Zyngier
2022-05-03 14:22     ` Geert Uytterhoeven
2022-05-03 14:55       ` Mark Rutland [this message]
2022-05-03 15:56       ` Marc Zyngier
2022-05-04  9:05         ` Phil Edworthy
2022-05-03 11:55 ` [PATCH v3 11/12] arm64: dts: renesas: Add initial DTSI for RZ/V2M SoC Phil Edworthy
2022-05-04  8:47   ` Geert Uytterhoeven
2022-05-03 11:55 ` [PATCH v3 12/12] arm64: dts: renesas: Add initial device tree for RZ/V2M EVK Phil Edworthy
2022-05-04  8:51   ` Geert Uytterhoeven
2022-05-04  9:00     ` Phil Edworthy

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=YnFCbe4ULoRRft4u@lakrids \
    --to=mark.rutland@arm.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=phil.edworthy@renesas.com \
    --cc=robh+dt@kernel.org \
    --cc=tglx@linutronix.de \
    /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).