mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

All architectures which use the generic VDSO code have their own storage for the VDSO clock mode. That's pointless and just requires duplicate code. X86 abuses the function which retrieves the architecture specific clock mode storage to mark the clocksource as used in the VDSO. That's silly because this is invoked on every tick when the VDSO data is updated. Move this functionality to the clocksource::enable() callback so it gets invoked once when the clocksource is installed. This allows to make the clock mode storage generic. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Michael Kelley <mikelley@microsoft.com> (Hyper-V parts) Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com> (VDSO parts) Acked-by: Juergen Gross <jgross@suse.com> (Xen parts) Link: https://lkml.kernel.org/r/20200207124402.934519777@linutronix.de
29 lines
753 B
C
29 lines
753 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/* x86-specific clocksource additions */
|
|
|
|
#ifndef _ASM_X86_CLOCKSOURCE_H
|
|
#define _ASM_X86_CLOCKSOURCE_H
|
|
|
|
#define VCLOCK_NONE 0 /* No vDSO clock available. */
|
|
#define VCLOCK_TSC 1 /* vDSO should use vread_tsc. */
|
|
#define VCLOCK_PVCLOCK 2 /* vDSO should use vread_pvclock. */
|
|
#define VCLOCK_HVCLOCK 3 /* vDSO should use vread_hvclock. */
|
|
#define VCLOCK_MAX 3
|
|
|
|
struct arch_clocksource_data {
|
|
int vclock_mode;
|
|
};
|
|
|
|
extern unsigned int vclocks_used;
|
|
|
|
static inline bool vclock_was_used(int vclock)
|
|
{
|
|
return READ_ONCE(vclocks_used) & (1U << vclock);
|
|
}
|
|
|
|
static inline void vclocks_set_used(unsigned int which)
|
|
{
|
|
WRITE_ONCE(vclocks_used, READ_ONCE(vclocks_used) | (1 << which));
|
|
}
|
|
|
|
#endif /* _ASM_X86_CLOCKSOURCE_H */
|