diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2018-09-17 15:45:35 +0300 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2018-10-05 00:00:24 +0300 |
commit | 2a21ad571b62440a4ad66d70b4b5d09c00029af4 (patch) | |
tree | 39d0f0f18e1128a3b2991c62dc4428b19f3fe6bf /arch/x86/kernel/time.c | |
parent | d67f34c19a679436dd2963b588015e119279e7a8 (diff) | |
download | linux-2a21ad571b62440a4ad66d70b4b5d09c00029af4.tar.xz |
x86/time: Implement clocksource_arch_init()
Runtime validate the VCLOCK_MODE in clocksource::archdata and disable
VCLOCK if invalid, which disables the VDSO but keeps the system running.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Andy Lutomirski <luto@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Matt Rickard <matt@softrans.com.au>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: devel@linuxdriverproject.org
Cc: virtualization@lists.linux-foundation.org
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Juergen Gross <jgross@suse.com>
Link: https://lkml.kernel.org/r/20180917130707.069167446@linutronix.de
Diffstat (limited to 'arch/x86/kernel/time.c')
-rw-r--r-- | arch/x86/kernel/time.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c index be01328eb755..1fa632e0829f 100644 --- a/arch/x86/kernel/time.c +++ b/arch/x86/kernel/time.c @@ -10,6 +10,7 @@ * */ +#include <linux/clocksource.h> #include <linux/clockchips.h> #include <linux/interrupt.h> #include <linux/irq.h> @@ -105,3 +106,18 @@ void __init time_init(void) { late_time_init = x86_late_time_init; } + +/* + * Sanity check the vdso related archdata content. + */ +void clocksource_arch_init(struct clocksource *cs) +{ + if (cs->archdata.vclock_mode == VCLOCK_NONE) + return; + + if (cs->archdata.vclock_mode > VCLOCK_MAX) { + pr_warn("clocksource %s registered with invalid vclock_mode %d. Disabling vclock.\n", + cs->name, cs->archdata.vclock_mode); + cs->archdata.vclock_mode = VCLOCK_NONE; + } +} |