]> git.baikalelectronics.ru Git - kernel.git/commit
clocksource/drivers/arm_arch_timer: Validate CNTFRQ after enabling frame
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 16 Oct 2017 15:28:38 +0000 (16:28 +0100)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Thu, 19 Oct 2017 21:49:05 +0000 (23:49 +0200)
commit5839fdf714e0d9f3fb45cfa1b09b2d611cdd5d74
treee9c0acefa6bff885274b37ef0de7804821da01e6
parentdf26e19d0f211cc11ff53226a516cf666eed1f17
clocksource/drivers/arm_arch_timer: Validate CNTFRQ after enabling frame

The ACPI GTDT code validates the CNTFRQ field of each MMIO timer
frame against the CNTFRQ system register of the current CPU, to
ensure that they are equal, which is mandated by the architecture.

However, reading the CNTFRQ field of a frame is not possible until
the RFRQ bit in the frame's CNTACRn register is set, and doing so
before that willl produce the following error:

  arch_timer: [Firmware Bug]: CNTFRQ mismatch: frame @ 0x00000000e0be0000: (0x00000000), CPU: (0x0ee6b280)
  arch_timer: Disabling MMIO timers due to CNTFRQ mismatch
  arch_timer: Failed to initialize memory-mapped timer.

The reason is that the CNTFRQ field is RES0 if access is not enabled.

So move the validation of CNTFRQ into the loop that iterates over the
timers to find the best frame, but defer it until after we have selected
the best frame, which should also have enabled the RFRQ bit.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
drivers/clocksource/arm_arch_timer.c