[patch 3/5] kvmclock: export kvmclock clocksource pointer

From: Marcelo Tosatti
Date: Fri Jan 20 2017 - 07:29:02 EST


To be used by KVM PTP driver.

Signed-off-by: Marcelo Tosatti <mtosatti@xxxxxxxxxx>

---
arch/x86/include/asm/kvmclock.h | 6 ++++++
arch/x86/kernel/kvmclock.c | 6 ++++++
2 files changed, 12 insertions(+)

Index: kvm-ptpdriver/arch/x86/include/asm/kvmclock.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ kvm-ptpdriver/arch/x86/include/asm/kvmclock.h 2017-01-18 18:20:35.463472189 -0200
@@ -0,0 +1,6 @@
+#ifndef _ASM_X86_KVM_CLOCK_H
+#define _ASM_X86_KVM_CLOCK_H
+
+struct clocksource *get_kvmclock_cs(void);
+
+#endif /* _ASM_X86_KVM_CLOCK_H */
Index: kvm-ptpdriver/arch/x86/kernel/kvmclock.c
===================================================================
--- kvm-ptpdriver.orig/arch/x86/kernel/kvmclock.c 2017-01-11 21:22:13.306315984 -0200
+++ kvm-ptpdriver/arch/x86/kernel/kvmclock.c 2017-01-18 18:20:02.543397125 -0200
@@ -28,6 +28,7 @@

#include <asm/x86_init.h>
#include <asm/reboot.h>
+#include <asm/kvmclock.h>

static int kvmclock __ro_after_init = 1;
static int msr_kvm_system_time = MSR_KVM_SYSTEM_TIME;
@@ -182,6 +183,11 @@
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};

+struct clocksource *get_kvmclock_cs(void)
+{
+ return &kvm_clock;
+}
+
int kvm_register_clock(char *txt)
{
int cpu = smp_processor_id();