Skip to contentSkip to conversation

Doc: dt: arch_timer: discourage clock-frequency use

PATCH RESEND Superseded Mark Rutland 2 participants 5 messages Mar 20, 2015 – Apr 16, 2015 Device tree bindings

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 Doc: dt: arch_timer: discourage clock-frequency use

The ARM Generic Timer (AKA the architected timer, arm_arch_timer) features a CPU register (CNTFRQ) which firmware is intended to initialize, and non-secure software can read to determine the frequency of the timer. On CPUs with secure state, this register cannot be written from non-secure states.

The firmware of early SoCs featuring the timer did not correctly initialize CNTFRQ correctly on all CPUs, requiring the frequency to be described in DT as a workaround. This workaround is not complete however as it is exposed to all software in a privileged non-secure mode (including guests running under a hypervisor). The firmware and DTs for recent SoCs have followed the example set by these early SoCs.

This patch updates the arch timer binding documentation to make it clearer that the use of the clock-frequency property is a poor work-around. The MMIO generic timer binding is similarly updated, though this is less of a concern as there is generally no need to expose the MMIO timers to guest OSs.

---
 Documentation/devicetree/bindings/arm/arch_timer.txt | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

This patch has fallen through the cracks a few times [1,2], though that appears to be my fault for not sorting out a reasonable Cc list.

Rob, are you happy to take this through your tree?

Mark.

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-August/282804.html
[2] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-August/282830.html

Documentation/devicetree/bindings/arm/arch_timer.txt +6 -2
index 256b4d8..e774128 100644
@@ -17,7 +17,10 @@ to deliver its interrupts via SPIs.
 - interrupts : Interrupt list for secure, non-secure, virtual and
   hypervisor timers, in that order.
 
-- clock-frequency : The frequency of the main counter, in Hz. Optional.
+- clock-frequency : The frequency of the main counter, in Hz. Should be present
+  only where necessary to work around broken firmware which does not configure
+  CNTFRQ on all CPUs to a uniform correct value. Use of this property is
+  strongly discouraged; fix your firmware unless absolutely impossible.
 
 - always-on : a boolean property. If present, the timer is powered through an
   always-on power domain, therefore it never loses context.
@@ -46,7 +49,8 @@ Example:
 
 - compatible : Should at least contain "arm,armv7-timer-mem".
 
-- clock-frequency : The frequency of the main counter, in Hz. Optional.
+- clock-frequency : The frequency of the main counter, in Hz. Should be present
+  only when firmware has not configured the MMIO CNTFRQ registers.
 
 - reg : The control frame base address.
 
Signature · 1 line
1.9.1
#1 lore raw

PATCH RESEND 1/1 Doc: dt: arch_timer: discourage clock-frequency use

Quoted 26 lines · Mark Rutland

The ARM Generic Timer (AKA the architected timer, arm_arch_timer) features a CPU register (CNTFRQ) which firmware is intended to initialize, and non-secure software can read to determine the frequency of the timer. On CPUs with secure state, this register cannot be written from non-secure states.

The firmware of early SoCs featuring the timer did not correctly initialize CNTFRQ correctly on all CPUs, requiring the frequency to be described in DT as a workaround. This workaround is not complete however as it is exposed to all software in a privileged non-secure mode (including guests running under a hypervisor). The firmware and DTs for recent SoCs have followed the example set by these early SoCs.

This patch updates the arch timer binding documentation to make it clearer that the use of the clock-frequency property is a poor work-around. The MMIO generic timer binding is similarly updated, though this is less of a concern as there is generally no need to expose the MMIO timers to guest OSs.

Quoted 8 lines
---
 Documentation/devicetree/bindings/arm/arch_timer.txt | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

This patch has fallen through the cracks a few times [1,2], though that appears to be my fault for not sorting out a reasonable Cc list.

Rob, are you happy to take this through your tree?

Yes, I'll take it.

Rob

Quoted 36 lines

Mark.

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-August/282804.html
[2] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-August/282830.html

Documentation/devicetree/bindings/arm/arch_timer.txt +6 -3
index 256b4d8..e774128 100644
@@ -17,7 +17,10 @@ to deliver its interrupts via SPIs.
 - interrupts : Interrupt list for secure, non-secure, virtual and
   hypervisor timers, in that order.
 
-- clock-frequency : The frequency of the main counter, in Hz. Optional.
+- clock-frequency : The frequency of the main counter, in Hz. Should be present
+  only where necessary to work around broken firmware which does not configure
+  CNTFRQ on all CPUs to a uniform correct value. Use of this property is
+  strongly discouraged; fix your firmware unless absolutely impossible.
 
 - always-on : a boolean property. If present, the timer is powered through an
   always-on power domain, therefore it never loses context.
@@ -46,7 +49,8 @@ Example:
 
 - compatible : Should at least contain "arm,armv7-timer-mem".
 
-- clock-frequency : The frequency of the main counter, in Hz. Optional.
+- clock-frequency : The frequency of the main counter, in Hz. Should be present
+  only when firmware has not configured the MMIO CNTFRQ registers.
 
 - reg : The control frame base address.
 
--

1.9.1

#2 lore raw

PATCH RESEND 1/1 Doc: dt: arch_timer: discourage clock-frequency use

Quoted 3 lines
Quoted 1 line

Rob, are you happy to take this through your tree?

Yes, I'll take it.

Are you still planning on taking this for v4.1? I couldn't spot it in a public branch yet.

Mark

Quoted 40 lines

Rob

Quoted 36 lines

Mark.

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-August/282804.html
[2] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-August/282830.html

Documentation/devicetree/bindings/arm/arch_timer.txt +6 -3
index 256b4d8..e774128 100644
@@ -17,7 +17,10 @@ to deliver its interrupts via SPIs.
 - interrupts : Interrupt list for secure, non-secure, virtual and
   hypervisor timers, in that order.
 
-- clock-frequency : The frequency of the main counter, in Hz. Optional.
+- clock-frequency : The frequency of the main counter, in Hz. Should be present
+  only where necessary to work around broken firmware which does not configure
+  CNTFRQ on all CPUs to a uniform correct value. Use of this property is
+  strongly discouraged; fix your firmware unless absolutely impossible.
 
 - always-on : a boolean property. If present, the timer is powered through an
   always-on power domain, therefore it never loses context.
@@ -46,7 +49,8 @@ Example:
 
 - compatible : Should at least contain "arm,armv7-timer-mem".
 
-- clock-frequency : The frequency of the main counter, in Hz. Optional.
+- clock-frequency : The frequency of the main counter, in Hz. Should be present
+  only when firmware has not configured the MMIO CNTFRQ registers.
 
 - reg : The control frame base address.
 
--

1.9.1

#3 lore raw

PATCH RESEND 1/1 Doc: dt: arch_timer: discourage clock-frequency use

Quoted 6 lines · Mark Rutland
Quoted 3 lines
Quoted 1 line

Rob, are you happy to take this through your tree?

Yes, I'll take it.

Are you still planning on taking this for v4.1? I couldn't spot it in a public branch yet.

Humm, I had marked that I applied it, but you're right. Anyway, it is there now in my for-next branch. Sorry about that.

Rob

#4 lore raw

PATCH RESEND 1/1 Doc: dt: arch_timer: discourage clock-frequency use

Quoted 10 lines · Rob Herring
Quoted 6 lines · Mark Rutland
Quoted 3 lines
Quoted 1 line

Rob, are you happy to take this through your tree?

Yes, I'll take it.

Are you still planning on taking this for v4.1? I couldn't spot it in a public branch yet.

Humm, I had marked that I applied it, but you're right. Anyway, it is there now in my for-next branch. Sorry about that.

No worries. Thanks for picking it up!

Mark.