Commit graph

24 commits

Author SHA1 Message Date
Gerwin Klein
4b8bed320d arm_global: document deadline assert
The comment that PRECISION is too low when the assert fails was wrong.
PRECISION should have no influence on it.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-11-08 11:01:00 +11:00
Gerwin Klein
dac2857229 mcs: move setDeadline assertions
Move the ksCurTime assertions out of setDeadline, because they are not
necessarily true there. Assert ksCurTime in setNextInterrupt instead.

We only know that the deadline being set is at least ksCurTime -
getTimerPrecision(), which can be slightly in the past (ksCurTime is
already slightly in the past, at kernel entry).

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-11-08 11:01:00 +11:00
JorgeMVP
b544529615 generc_timer: enable only once for mcs/non-mcs
Enable the timer only at initialization and since it is always
enabled. It is not needed to be re-enabled.

Signed-off-by: JorgeMVP <jorgepereira89@gmail.com>
2023-05-25 20:42:02 +10:00
JorgeMVP
62c8148268 generic_timer: force timer to de-assert irq
Generic Timer IRQs are level-sensitive, when the CNT_TVAL
is updated the trigger condition is de-asserted and the
change is propagated to the GIC in a finite time to clear
the pending state.

However, we have to make sure the timer deasserts before
EOIR/DIR, otherwise the interrupt happens again. Therefore,
we need an isb() to cause the timer to de-assert before EOIR/DIR.

There is also a chance of spurious IRQ. A spurious IRQ can be
generated, in the case we have a level-sensitive IRQ, and its
pending state is cleared at device-level but not yet propagated
to the GIC. In between the IRQ deactivation and IRQ ack of the
new interrupt if the requested change from the timer gets propagated
then it causes a spurious IRQ.

Signed-off-by: JorgeMVP <jorgepereira89@gmail.com>
2023-05-25 20:42:02 +10:00
Luca (Wei) Chen
e9bdd85e81 allwinnerA20: switch to the ARM generic timer
The memory mapping for the timer only uses 1K on AllwinnerA20, but
the minimum device mapping is 4K in seL4. Other devices within this
4K page (CCU and PIO) cannot be accessed in the userland.
Replace the kernel timer with the ARM generic timer on AllwinnerA20,
and remove the implementation for AllwinnerA20 specific timer in the
kernel. So we should have user access to those devices now.

Signed-off-by: Luca (Wei) Chen <wei@cvluca.com>
2021-10-28 08:30:41 +11:00
Kent McLeod
3defbff461 Remove KZM/imx31 platform
The platform was the original verification target of seL4 over 10 years
ago and by now there doesn't appear to be any ways to obtain new
hardware.

Currently, the KZM platform is the only ARMv6 platform and supporting it
requires a few work-arounds for emulating mechanisms that newer hardware
supports. Removing this platform also implies removing armv6 support
soon.

Signed-off-by: Kent McLeod <kent@kry10.com>
2021-09-30 18:07:19 +10:00
Qian Ge
512a0200de replacing all ifndef with pargma once
All the kernel header files now use pargma once rather than the ifndef,
as the pre-processed C files do not change while header files
are protected with pargma once. This will also solve any naming issues
caused by ifndef.
2020-03-23 11:04:46 +11:00
Gerwin Klein
79da079239 Convert license tags to SPDX identifiers
This commit also converts our own copyright headers to directly use
SPDX, but leaves all other copyright header intact, only adding the
SPDX ident. As far as possible this commit also merges multiple
Data61 copyright statements/headers into one for consistency.
2020-03-09 13:21:49 +08:00
Alison Felizzi
71d636f8b3 arm_hyp: Save and restore vtimer state on switches
Added support for reading and writing additional virtual timer
registers for vcpu hw read and write accesses. These include the
compare value register (CNTV_CVAL) and offset register (CNTV_OFF),
each represented as two 32 bit (high and low) registers on aarch32 and
as single 64 bit registers on aarch64.

Added support for explicitly saving and restoring the virtual
timer registers when the vcpu is enabled and disabled. This
ensures when the vcpu is switched in and out, the virtual timer
registers are restored to a state that is consistent to when
it was last run.

By default the CNTVOFF register will be updated by the kernel to
accumulate the time the VCPU is not running. From the guest this will
result in the VCNT register not increasing when the VCPU is suspended.
This behavior can be turned off by disabling the
KernelArmVtimerUpdateVOffset config option.
2020-02-20 11:40:59 +11:00
Kent McLeod
a5148a1957 exynos: Move mct MCS functions to specific header
On exynos5 platforms the Arm Generic timer is available and is used for
MCS, but the mct.h is still used as the mct device needs to be
configured to implement the Arm Generic timer. mct.h is a common header
for register definitions while exynos4412-mct.h is used for implementing
timer functions on the exynos4 where the mct doesn't support being the
Arm generic timer.

Also remove misplaced initGenericTimer() declaration.
2019-10-23 16:30:17 +11:00
Oliver Scott
cd956d5769 bbone-MCS: add mcs
Add MCS functionality to bboneblack platform.
2019-10-22 16:31:58 +11:00
Oliver Scott
7dc6b23ef9 exynos4: MCS timer
Add required functionality for MCS.
2019-10-11 11:16:47 +11:00
Anna Lyons
4db4a3b882 kzm: implement MCS timer driver
- use gpt, so we can have overflow and compare interrupts at the same
time (epit only allows compare)
- set the gpt to use the ipg_highfreq timer, as the standard ipg is too
low and breaks the timer calculations
2019-08-22 11:22:35 +10:00
Anna Lyons
ea07ad0414 omap3: implement tickless timer driver
Update the existing omap driver to implement the new tickless api.
2019-08-22 11:22:35 +10:00
Anna Lyons
bdc56112bd arm: tickless generic timer implementation
Update the generic timer to implement the MCS kernels tickless timer
driver API and update all platforms that use the arm generic timers:

    - bcm2837
    - exynos5
    - hikey
    - imx7
    - odroidc2
    - tk1
    - tx1
    - tx2
    - zynq7000

Also move the generic timer constants to machine.h to avoid a circular
dependency.
2019-08-22 11:22:35 +10:00
Anna Lyons
a7fb6b56b7 cortex-a9: tickless global timer driver
- use in sabre (imx6) and zynq7000, the two platforms that were using
  the private timer.
2019-08-22 11:22:35 +10:00
Anna Lyons
f7c43820d2 trivial: fix #ifdef on am335x 2019-04-15 08:47:32 +10:00
Anna Lyons
82d0485911 arm: priv_timer -> include/drivers/timer/arm_priv
update configs that use it.
2019-04-12 14:25:58 +10:00
Anna Lyons
391b717d1d arm: generic_timer -> drivers/timer/arm_generic
- move generic_timer.h to drivers/timer/arm_generic.h
- update all configs that use it.
2019-04-12 14:25:58 +10:00
Anna Lyons
26a3b55521 omap3: use declare_default_headers
- remove unused header files replaced by declare_default_headers
- move timer.h to drivers/timer/omap3430.h
- move interrupt.h to drivers/irq/omap3.h
2019-04-12 14:25:58 +10:00
Anna Lyons
7bf513b75e imx31: use declare_default_headers
- remove unused header files replaced by declare_default_headers
- move interrupt.h -> drivers/irq/imx31.h
- move hardware.bf -> drivers/timer/imx31-epit.bf
- move timer.h -> drivers/timer/imx31-epit.h
- move definitions from hardware.h to plat/imx31/machine/hardware.c
2019-04-12 14:25:58 +10:00
Anna Lyons
e1a36c2601 exynos: use declare_default_headers
- remove unused header files replaced by declare_default_headers
- move timer.h to drivers/timer/exynos5422-mct.h
- move mct.h to drivers/timer/mct.h
2019-04-12 14:25:58 +10:00
Anna Lyons
a69c3f0f9c am335x: use declare_default_headers
- move timer.h to include/drivers/timer/am335x.h
- move interrupt.h to include/drivers/irq/am335x.h
- remove unused header files replaced by declare_default_headers
2019-04-12 14:25:58 +10:00
Anna Lyons
0a4ffd0a9a allwinnerA20: use declare_default_headers
- move timer.h to include/drivers/timer/allwinner.h
- remove unused header files replaced by declare_default_headers
2019-04-12 14:25:58 +10:00