Commit 5e3c6a31 authored by Thomas Gleixner's avatar Thomas Gleixner
Browse files

ARM/arm64: vdso: Use common vdso clock mode storage



Convert ARM/ARM64 to the generic VDSO clock mode storage. This needs to
happen in one go as they share the clocksource driver.

Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Tested-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
Reviewed-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
Link: https://lkml.kernel.org/r/20200207124403.363235229@linutronix.de

parent e1bdb22e
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@ config ARM
	bool
	default y
	select ARCH_32BIT_OFF_T
	select ARCH_CLOCKSOURCE_DATA
	select ARCH_HAS_BINFMT_FLAT
	select ARCH_HAS_DEBUG_VIRTUAL if MMU
	select ARCH_HAS_DEVMEM_IS_ALLOWED
+2 −3
Original line number Diff line number Diff line
#ifndef _ASM_CLOCKSOURCE_H
#define _ASM_CLOCKSOURCE_H

struct arch_clocksource_data {
	bool vdso_direct;	/* Usable for direct VDSO access? */
};
#define VDSO_ARCH_CLOCKMODES	\
	VDSO_CLOCKMODE_ARCHTIMER

#endif
+9 −3
Original line number Diff line number Diff line
@@ -117,15 +117,21 @@ static __always_inline u64 __arch_get_hw_counter(int clock_mode)
#ifdef CONFIG_ARM_ARCH_TIMER
	u64 cycle_now;

	if (!clock_mode)
		return -EINVAL;
	/*
	 * Core checks for mode already, so this raced against a concurrent
	 * update. Return something. Core will do another round and then
	 * see the mode change and fallback to the syscall.
	 */
	if (clock_mode == VDSO_CLOCKMODE_NONE)
		return 0;

	isb();
	cycle_now = read_sysreg(CNTVCT);

	return cycle_now;
#else
	return -EINVAL; /* use fallback */
	/* Make GCC happy. This is compiled out anyway */
	return 0;
#endif
}

+0 −21
Original line number Diff line number Diff line
@@ -11,18 +11,6 @@
extern struct vdso_data *vdso_data;
extern bool cntvct_ok;

static __always_inline
bool tk_is_cntvct(const struct timekeeper *tk)
{
	if (!IS_ENABLED(CONFIG_ARM_ARCH_TIMER))
		return false;

	if (!tk->tkr_mono.clock->archdata.vdso_direct)
		return false;

	return true;
}

/*
 * Update the vDSO data page to keep in sync with kernel timekeeping.
 */
@@ -40,15 +28,6 @@ bool __arm_update_vdso_data(void)
}
#define __arch_update_vdso_data __arm_update_vdso_data

static __always_inline
int __arm_get_clock_mode(struct timekeeper *tk)
{
	u32 __tk_is_cntvct = tk_is_cntvct(tk);

	return __tk_is_cntvct;
}
#define __arch_get_clock_mode __arm_get_clock_mode

static __always_inline
void __arm_sync_vdso_data(struct vdso_data *vdata)
{
+1 −0
Original line number Diff line number Diff line
@@ -900,6 +900,7 @@ config VDSO
	select GENERIC_TIME_VSYSCALL
	select GENERIC_VDSO_32
	select GENERIC_GETTIMEOFDAY
	select GENERIC_VDSO_CLOCK_MODE
	help
	  Place in the process address space an ELF shared object
	  providing fast implementations of gettimeofday and
Loading