~john-cabaj/ubuntu/+source/linux-gcp/+git/jammy-gcp:master-next

Last commit made on 2023-11-30
Get this branch:
git clone -b master-next https://git.launchpad.net/~john-cabaj/ubuntu/+source/linux-gcp/+git/jammy-gcp
Only John Cabaj can upload to this branch. If you are John Cabaj please log in for upload directions.

Branch merges

Branch information

Recent commits

a67b024... by Marc Zyngier <email address hidden>

clocksource/drivers/arch_arm_timer: Move workaround synchronisation around

BugLink: https://bugs.launchpad.net/bugs/2044192

We currently handle synchronisation when workarounds are enabled
by having an ISB in the __arch_counter_get_cnt?ct_stable() helpers.

While this works, this prevents us from relaxing this synchronisation.

Instead, move it closer to the point where the synchronisation is
actually needed. Further patches will subsequently relax this.

Signed-off-by: Marc Zyngier <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Daniel Lezcano <email address hidden>
(cherry picked from commit db26f8f2da92471e9f7f71ec78d6fa455cd9c821)
Signed-off-by: John Cabaj <email address hidden>
Acked-by: Tim Gardner <email address hidden>
Acked-by: Manuel Diewald <email address hidden>
Signed-off-by: John Cabaj <email address hidden>

e17a115... by Oliver Upton <email address hidden>

clocksource/drivers/arm_arch_timer: Fix masking for high freq counters

BugLink: https://bugs.launchpad.net/bugs/2044192

Unfortunately, the architecture provides no means to determine the bit
width of the system counter. However, we do know the following from the
specification:

 - the system counter is at least 56 bits wide
 - Roll-over time of not less than 40 years

To date, the arch timer driver has depended on the first property,
assuming any system counter to be 56 bits wide and masking off the rest.
However, combining a narrow clocksource mask with a high frequency
counter could result in prematurely wrapping the system counter by a
significant margin. For example, a 56 bit wide, 1GHz system counter
would wrap in a mere 2.28 years!

This is a problem for two reasons: v8.6+ implementations are required to
provide a 64 bit, 1GHz system counter. Furthermore, before v8.6,
implementers may select a counter frequency of their choosing.

Fix the issue by deriving a valid clock mask based on the second
property from above. Set the floor at 56 bits, since we know no system
counter is narrower than that.

[maz: fixed width computation not to lose the last bit, added
      max delta generation for the timer]

Suggested-by: Marc Zyngier <email address hidden>
Signed-off-by: Oliver Upton <email address hidden>
Reviewed-by: Linus Walleij <email address hidden>
Signed-off-by: Marc Zyngier <email address hidden>
Link: https://<email address hidden>
Link: https://<email address hidden>
Signed-off-by: Daniel Lezcano <email address hidden>
(cherry picked from commit c1153d52c4140424a5e31a5916fca3edd91fe13a)
Signed-off-by: John Cabaj <email address hidden>
Acked-by: Tim Gardner <email address hidden>
Acked-by: Manuel Diewald <email address hidden>
Signed-off-by: John Cabaj <email address hidden>

8cda773... by Marc Zyngier <email address hidden>

clocksource/drivers/arm_arch_timer: Drop unnecessary ISB on CVAL programming

BugLink: https://bugs.launchpad.net/bugs/2044192

Switching from TVAL to CVAL has a small drawback: we need an ISB
before reading the counter. We cannot get rid of it, but we can
instead remove the one that comes just after writing to CVAL.

This reduces the number of ISBs from 3 to 2 when programming
the timer.

Signed-off-by: Marc Zyngier <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Daniel Lezcano <email address hidden>
(cherry picked from commit ec8f7f3342c88780d682cc2464daf0fe43259c4f)
Signed-off-by: John Cabaj <email address hidden>
Acked-by: Tim Gardner <email address hidden>
Acked-by: Manuel Diewald <email address hidden>
Signed-off-by: John Cabaj <email address hidden>

4b13497... by Marc Zyngier <email address hidden>

clocksource/drivers/arm_arch_timer: Remove any trace of the TVAL programming interface

BugLink: https://bugs.launchpad.net/bugs/2044192

TVAL usage is now long gone, get rid of the leftovers.

Signed-off-by: Marc Zyngier <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Daniel Lezcano <email address hidden>
(cherry picked from commit 41f8d02a6a558f80775bf61fe6312a14eeabbca0)
Signed-off-by: John Cabaj <email address hidden>
Acked-by: Tim Gardner <email address hidden>
Acked-by: Manuel Diewald <email address hidden>
Signed-off-by: John Cabaj <email address hidden>

b4d9201... by Marc Zyngier <email address hidden>

clocksource/drivers/arm_arch_timer: Work around broken CVAL implementations

BugLink: https://bugs.launchpad.net/bugs/2044192

The Applied Micro XGene-1 SoC has a busted implementation of the
CVAL register: it looks like it is based on TVAL instead of the
other way around. The net effect of this implementation blunder
is that the maximum deadline you can program in the timer is
32bit wide.

Use a MIDR check to notice the broken CPU, and reduce the width
of the timer to 32bit.

Signed-off-by: Marc Zyngier <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Daniel Lezcano <email address hidden>
(cherry picked from commit 012f188504528b8cb32f441ac3bd9ea2eba39c9e)
Signed-off-by: John Cabaj <email address hidden>
Acked-by: Tim Gardner <email address hidden>
Acked-by: Manuel Diewald <email address hidden>
Signed-off-by: John Cabaj <email address hidden>

bdba391... by Marc Zyngier <email address hidden>

clocksource/drivers/arm_arch_timer: Advertise 56bit timer to the core code

BugLink: https://bugs.launchpad.net/bugs/2044192

Proudly tell the code code that we have a timer able to handle
56 bits deltas.

Signed-off-by: Marc Zyngier <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Daniel Lezcano <email address hidden>
(cherry picked from commit 30aa08da35e07a51a81d489517a3f6fb5164b09c)
Signed-off-by: John Cabaj <email address hidden>
Acked-by: Tim Gardner <email address hidden>
Acked-by: Manuel Diewald <email address hidden>
Signed-off-by: John Cabaj <email address hidden>

725285f... by Marc Zyngier <email address hidden>

clocksource/drivers/arm_arch_timer: Move MMIO timer programming over to CVAL

BugLink: https://bugs.launchpad.net/bugs/2044192

Similarily to the sysreg-based timer, move the MMIO over to using
the CVAL registers instead of TVAL. Note that there is no warranty
that the 64bit MMIO access will be atomic, but the timer is always
disabled at the point where we program CVAL.

Signed-off-by: Marc Zyngier <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Daniel Lezcano <email address hidden>
(cherry picked from commit 8b82c4f883a7b22660464c0232fbdb7a6deb3061)
Signed-off-by: John Cabaj <email address hidden>
Acked-by: Tim Gardner <email address hidden>
Acked-by: Manuel Diewald <email address hidden>
Signed-off-by: John Cabaj <email address hidden>

c61fbc3... by Marc Zyngier <email address hidden>

clocksource/drivers/arm_arch_timer: Fix MMIO base address vs callback ordering issue

BugLink: https://bugs.launchpad.net/bugs/2044192

The MMIO timer base address gets published after we have registered
the callbacks and the interrupt handler, which is... a bit dangerous.

Fix this by moving the base address publication to the point where
we register the timer, and expose a pointer to the timer structure
itself rather than a naked value.

Reviewed-by: Oliver Upton <email address hidden>
Reviewed-by: Mark Rutland <email address hidden>
Signed-off-by: Marc Zyngier <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Daniel Lezcano <email address hidden>
(cherry picked from commit 72f47a3f0ea4cda4ca5d90c0d6043f697b9b0647)
Signed-off-by: John Cabaj <email address hidden>
Acked-by: Tim Gardner <email address hidden>
Acked-by: Manuel Diewald <email address hidden>
Signed-off-by: John Cabaj <email address hidden>

91d6c29... by Marc Zyngier <email address hidden>

clocksource/drivers/arm_arch_timer: Move drop _tval from erratum function names

BugLink: https://bugs.launchpad.net/bugs/2044192

The '_tval' name in the erratum handling function names doesn't
make much sense anymore (and they were using CVAL the first place).

Drop the _tval tag.

Reviewed-by: Oliver Upton <email address hidden>
Reviewed-by: Mark Rutland <email address hidden>
Tested-by: Mark Rutland <email address hidden>
Signed-off-by: Marc Zyngier <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Daniel Lezcano <email address hidden>
(cherry picked from commit ac9ef4f24cb2313fb047f2097396204b033799b8)
Signed-off-by: John Cabaj <email address hidden>
Acked-by: Tim Gardner <email address hidden>
Acked-by: Manuel Diewald <email address hidden>
Signed-off-by: John Cabaj <email address hidden>

49a5617... by Marc Zyngier <email address hidden>

clocksource/drivers/arm_arch_timer: Move system register timer programming over to CVAL

BugLink: https://bugs.launchpad.net/bugs/2044192

In order to cope better with high frequency counters, move the
programming of the timers from the countdown timer (TVAL) over
to the comparator (CVAL).

The programming model is slightly different, as we now need to
read the current counter value to have an absolute deadline
instead of a relative one.

There is a small overhead to this change, which we will address
in the following patches.

Reviewed-by: Oliver Upton <email address hidden>
Reviewed-by: Mark Rutland <email address hidden>
Tested-by: Mark Rutland <email address hidden>
Signed-off-by: Marc Zyngier <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Daniel Lezcano <email address hidden>
(cherry picked from commit a38b71b0833eb2fabd2b1fa37d665c0a88b8b7e4)
Signed-off-by: John Cabaj <email address hidden>
Acked-by: Tim Gardner <email address hidden>
Acked-by: Manuel Diewald <email address hidden>
Signed-off-by: John Cabaj <email address hidden>