diff --git a/arch/arm/boot/dts/rockchip/rv1106-warden-m2.dts b/arch/arm/boot/dts/rockchip/rv1106-warden-m2.dts --- a/arch/arm/boot/dts/rockchip/rv1106-warden-m2.dts +++ b/arch/arm/boot/dts/rockchip/rv1106-warden-m2.dts @@ -74,6 +74,15 @@ interrupts = , ; clock-frequency = <24000000>; + /* + * The boot firmware does not enter the kernel in HYP mode and leaves + * CNTVOFF non-zero (bfe-core1106-sdk#35): the virtual counter the + * arm32 vDSO reads runs a fixed offset away from the physical one + * the kernel keeps time on. This keeps the kernel on the physical + * timer and drops the vDSO clock calls, so clock_gettime() uses the + * syscall and agrees with every kernel deadline. + */ + arm,cpu-registers-not-fw-configured; }; gic: interrupt-controller@ff1f0000 { diff --git a/arch/arm/boot/dts/rockchip/rv1106.dtsi b/arch/arm/boot/dts/rockchip/rv1106.dtsi --- a/arch/arm/boot/dts/rockchip/rv1106.dtsi +++ b/arch/arm/boot/dts/rockchip/rv1106.dtsi @@ -417,6 +417,15 @@ interrupts = , ; clock-frequency = <24000000>; + /* + * The boot firmware does not enter the kernel in HYP mode and leaves + * CNTVOFF non-zero (bfe-core1106-sdk#35): the virtual counter the + * arm32 vDSO reads runs a fixed offset away from the physical one + * the kernel keeps time on. This keeps the kernel on the physical + * timer and drops the vDSO clock calls, so clock_gettime() uses the + * syscall and agrees with every kernel deadline. + */ + arm,cpu-registers-not-fw-configured; }; grf: syscon@ff000000 { diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -933,6 +933,20 @@ static void __init arch_counter_register(void) arch_timer_read_counter = rd; clocksource_counter.vdso_clock_mode = vdso_default; + /* + * The arm32 vDSO always reads the virtual counter. A kernel that keeps + * time on the physical counter and was not entered in HYP mode never + * had CNTVOFF zeroed by the hyp stub, so the vDSO clock may sit a fixed + * offset away from the kernel's and absolute deadlines taken from it + * expire late. Fall back to the syscall then. + */ + if (IS_ENABLED(CONFIG_ARM) && arch_timer_uses_ppi != ARCH_TIMER_VIRT_PPI && + !is_hyp_mode_available() && + clocksource_counter.vdso_clock_mode != VDSO_CLOCKMODE_NONE) { + clocksource_counter.vdso_clock_mode = VDSO_CLOCKMODE_NONE; + pr_info("physical counter without HYP: vDSO clock disabled\n"); + } + width = arch_counter_get_width(); clocksource_counter.mask = CLOCKSOURCE_MASK(width); cyclecounter.mask = CLOCKSOURCE_MASK(width);