Skip to content

Commit ad9af93

Browse files
Zelin Dengbonzini
authored andcommitted
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 <[email protected]> Cc: <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent e02c16b commit ad9af93

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

arch/x86/include/asm/kvmclock.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22
#ifndef _ASM_X86_KVM_CLOCK_H
33
#define _ASM_X86_KVM_CLOCK_H
44

5+
#include <linux/percpu.h>
6+
57
extern struct clocksource kvm_clock;
68

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+
}
20+
721
#endif /* _ASM_X86_KVM_CLOCK_H */

arch/x86/kernel/kvmclock.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,9 @@ early_param("no-kvmclock-vsyscall", parse_no_kvmclock_vsyscall);
4949
static struct pvclock_vsyscall_time_info
5050
hv_clock_boot[HVC_BOOT_ARRAY_SIZE] __bss_decrypted __aligned(PAGE_SIZE);
5151
static struct pvclock_wall_clock wall_clock __bss_decrypted;
52-
static DEFINE_PER_CPU(struct pvclock_vsyscall_time_info *, hv_clock_per_cpu);
5352
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);
6455

6556
/*
6657
* The wallclock is the time of day when we booted. Since then, some time may

0 commit comments

Comments
 (0)