[RFC PATCH 4/7] clocksource: arm_arch_timer: Export counter type, clocksource

Marc Zyngier maz at kernel.org
Mon Jul 3 01:13:08 PDT 2023


On Fri, 30 Jun 2023 18:10:47 +0100,
Peter Hilber <peter.hilber at opensynergy.com> wrote:
> 
> Export helper functions to allow other code to
> 
> - determine the counter type in use (virtual or physical, CP15 or memory),
> 
> - get a pointer to the arm_arch_timer clocksource, which can be compared
>   with the current clocksource.
> 
> The virtio_rtc driver will require the clocksource pointer when using
> get_device_system_crosststamp(), and should communicate the actual Arm
> counter type to the Virtio RTC device (cf. spec draft [1]).

I really don't see why you should poke at the clocksource backend:

- the MMIO clocksource is only used in PM situations, which a virtio
  driver has no business being involved with

- only the virtual counter is relevant -- it is always at a 0-offset
  from the physical one when userspace has an opportunity to run

So it really looks that out of the four combinations, only one is
relevant.

I'm not Cc'd on the rest of the series, so I can't even see in which
context this is used. But as it is, the approach looks wrong.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.



More information about the linux-arm-kernel mailing list