Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/kvmclock: Move this_cpu_pvti into kvmclock.h

There're other modules might use hv_clock_per_cpu variable like ptp_kvm,
so move it into kvmclock.h and export the symbol to make it visiable to
other modules.

Signed-off-by: Zelin Deng <zelin.deng@linux.alibaba.com>
Cc: <stable@vger.kernel.org>
Message-Id: <1632892429-101194-2-git-send-email-zelin.deng@linux.alibaba.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

authored by

Zelin Deng and committed by
Paolo Bonzini
ad9af930 e02c16b9

+16 -11
+14
arch/x86/include/asm/kvmclock.h
··· 2 2 #ifndef _ASM_X86_KVM_CLOCK_H 3 3 #define _ASM_X86_KVM_CLOCK_H 4 4 5 + #include <linux/percpu.h> 6 + 5 7 extern struct clocksource kvm_clock; 8 + 9 + DECLARE_PER_CPU(struct pvclock_vsyscall_time_info *, hv_clock_per_cpu); 10 + 11 + static inline struct pvclock_vcpu_time_info *this_cpu_pvti(void) 12 + { 13 + return &this_cpu_read(hv_clock_per_cpu)->pvti; 14 + } 15 + 16 + static inline struct pvclock_vsyscall_time_info *this_cpu_hvclock(void) 17 + { 18 + return this_cpu_read(hv_clock_per_cpu); 19 + } 6 20 7 21 #endif /* _ASM_X86_KVM_CLOCK_H */
+2 -11
arch/x86/kernel/kvmclock.c
··· 49 49 static struct pvclock_vsyscall_time_info 50 50 hv_clock_boot[HVC_BOOT_ARRAY_SIZE] __bss_decrypted __aligned(PAGE_SIZE); 51 51 static struct pvclock_wall_clock wall_clock __bss_decrypted; 52 - static DEFINE_PER_CPU(struct pvclock_vsyscall_time_info *, hv_clock_per_cpu); 53 52 static struct pvclock_vsyscall_time_info *hvclock_mem; 54 - 55 - static inline struct pvclock_vcpu_time_info *this_cpu_pvti(void) 56 - { 57 - return &this_cpu_read(hv_clock_per_cpu)->pvti; 58 - } 59 - 60 - static inline struct pvclock_vsyscall_time_info *this_cpu_hvclock(void) 61 - { 62 - return this_cpu_read(hv_clock_per_cpu); 63 - } 53 + DEFINE_PER_CPU(struct pvclock_vsyscall_time_info *, hv_clock_per_cpu); 54 + EXPORT_PER_CPU_SYMBOL_GPL(hv_clock_per_cpu); 64 55 65 56 /* 66 57 * The wallclock is the time of day when we booted. Since then, some time may