]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86/paravirt: Move paravirt_sched_clock() related code into tsc.c
authorJuergen Gross <jgross@suse.com>
Mon, 5 Jan 2026 11:05:11 +0000 (12:05 +0100)
committerBorislav Petkov (AMD) <bp@alien8.de>
Mon, 12 Jan 2026 17:47:39 +0000 (18:47 +0100)
The only user of paravirt_sched_clock() is in tsc.c, so move the code
from paravirt.c and paravirt.h to tsc.c.

Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260105110520.21356-13-jgross@suse.com
arch/x86/include/asm/paravirt.h
arch/x86/include/asm/timer.h
arch/x86/kernel/kvmclock.c
arch/x86/kernel/paravirt.c
arch/x86/kernel/tsc.c
arch/x86/xen/time.c
drivers/clocksource/hyperv_timer.c

index 766a7cee3d646c168d84254a0047a0e1ae5ec604..b69e75a5c8725456ab837cc57508e57b7b1413e9 100644 (file)
 #ifndef __ASSEMBLER__
 #include <linux/types.h>
 #include <linux/cpumask.h>
-#include <linux/static_call_types.h>
 #include <asm/frame.h>
 
-u64 dummy_sched_clock(void);
-
-DECLARE_STATIC_CALL(pv_sched_clock, dummy_sched_clock);
-
-void paravirt_set_sched_clock(u64 (*func)(void));
-
-static __always_inline u64 paravirt_sched_clock(void)
-{
-       return static_call(pv_sched_clock)();
-}
-
 __visible void __native_queued_spin_unlock(struct qspinlock *lock);
 bool pv_is_native_spin_unlock(void);
 __visible bool __native_vcpu_is_preempted(long cpu);
index 23baf8c9b34ca7ceb4c425ef90d038bf882c22e6..fda18bcb19b45a2774c7545edb5c7d12ff2e92c2 100644 (file)
@@ -12,6 +12,7 @@ extern void recalibrate_cpu_khz(void);
 extern int no_timer_check;
 
 extern bool using_native_sched_clock(void);
+void paravirt_set_sched_clock(u64 (*func)(void));
 
 /*
  * We use the full linear equation: f(x) = a + b*x, in order to allow
index ca0a49eeac4a2980d5c56b588174a6e30e463b4e..b5991d53fc0ea941a69c288521ec2f8aacfe871b 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/cc_platform.h>
 
 #include <asm/hypervisor.h>
+#include <asm/timer.h>
 #include <asm/x86_init.h>
 #include <asm/kvmclock.h>
 
index 42991d471bf3c0e1fc9222a56c3dc6924a36729b..4e37db8073f92d025da882bfbdd51eccf17863da 100644 (file)
@@ -60,13 +60,6 @@ void __init native_pv_lock_init(void)
                static_branch_enable(&virt_spin_lock_key);
 }
 
-DEFINE_STATIC_CALL(pv_sched_clock, native_sched_clock);
-
-void paravirt_set_sched_clock(u64 (*func)(void))
-{
-       static_call_update(pv_sched_clock, func);
-}
-
 static noinstr void pv_native_safe_halt(void)
 {
        native_safe_halt();
index 7d3e13e14eabe602acf57c30f1c5eab01c89ec75..d5d0b500d13e2ed984bfee156bff42015513eea0 100644 (file)
@@ -267,19 +267,27 @@ u64 native_sched_clock_from_tsc(u64 tsc)
 /* We need to define a real function for sched_clock, to override the
    weak default version */
 #ifdef CONFIG_PARAVIRT
+DEFINE_STATIC_CALL(pv_sched_clock, native_sched_clock);
+
 noinstr u64 sched_clock_noinstr(void)
 {
-       return paravirt_sched_clock();
+       return static_call(pv_sched_clock)();
 }
 
 bool using_native_sched_clock(void)
 {
        return static_call_query(pv_sched_clock) == native_sched_clock;
 }
+
+void paravirt_set_sched_clock(u64 (*func)(void))
+{
+       static_call_update(pv_sched_clock, func);
+}
 #else
 u64 sched_clock_noinstr(void) __attribute__((alias("native_sched_clock")));
 
 bool using_native_sched_clock(void) { return true; }
+void paravirt_set_sched_clock(u64 (*func)(void)) { }
 #endif
 
 notrace u64 sched_clock(void)
index e4754b2fa900506ef3966c06e42e66239212e448..6f9f665bb7aeaa842e17866a32e9ac7499824e5a 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/sched/cputime.h>
 
 #include <asm/pvclock.h>
+#include <asm/timer.h>
 #include <asm/xen/hypervisor.h>
 #include <asm/xen/hypercall.h>
 #include <asm/xen/cpuid.h>
index 10356d4ec55c3ed5e54176042b7f11993ef0ee97..e9f5034a1bc899d86d50b53509b2f2d06872a37e 100644 (file)
@@ -535,6 +535,8 @@ static __always_inline void hv_setup_sched_clock(void *sched_clock)
        sched_clock_register(sched_clock, 64, NSEC_PER_SEC);
 }
 #elif defined CONFIG_PARAVIRT
+#include <asm/timer.h>
+
 static __always_inline void hv_setup_sched_clock(void *sched_clock)
 {
        /* We're on x86/x64 *and* using PV ops */