Commit b9d8cf2e authored by Michael Kelley's avatar Michael Kelley Committed by Wei Liu

x86/hyperv: Make hv_setup_sched_clock inline

Make hv_setup_sched_clock inline so the reference to pv_ops works
correctly with objtool updates to detect noinstr violations.
See https://lore.kernel.org/patchwork/patch/1283635/Signed-off-by: default avatarMichael Kelley <mikelley@microsoft.com>
Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/1597022991-24088-1-git-send-email-mikelley@microsoft.comSigned-off-by: default avatarWei Liu <wei.liu@kernel.org>
parent 608a973b
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/hyperv-tlfs.h> #include <asm/hyperv-tlfs.h>
#include <asm/nospec-branch.h> #include <asm/nospec-branch.h>
#include <asm/paravirt.h>
typedef int (*hyperv_fill_flush_list_func)( typedef int (*hyperv_fill_flush_list_func)(
struct hv_guest_mapping_flush_list *flush, struct hv_guest_mapping_flush_list *flush,
...@@ -54,6 +55,17 @@ typedef int (*hyperv_fill_flush_list_func)( ...@@ -54,6 +55,17 @@ typedef int (*hyperv_fill_flush_list_func)(
vclocks_set_used(VDSO_CLOCKMODE_HVCLOCK); vclocks_set_used(VDSO_CLOCKMODE_HVCLOCK);
#define hv_get_raw_timer() rdtsc_ordered() #define hv_get_raw_timer() rdtsc_ordered()
/*
* Reference to pv_ops must be inline so objtool
* detection of noinstr violations can work correctly.
*/
static __always_inline void hv_setup_sched_clock(void *sched_clock)
{
#ifdef CONFIG_PARAVIRT
pv_ops.time.sched_clock = sched_clock;
#endif
}
void hyperv_vector_handler(struct pt_regs *regs); void hyperv_vector_handler(struct pt_regs *regs);
static inline void hv_enable_stimer0_percpu_irq(int irq) {} static inline void hv_enable_stimer0_percpu_irq(int irq) {}
......
...@@ -361,13 +361,6 @@ static void __init ms_hyperv_init_platform(void) ...@@ -361,13 +361,6 @@ static void __init ms_hyperv_init_platform(void)
#endif #endif
} }
void hv_setup_sched_clock(void *sched_clock)
{
#ifdef CONFIG_PARAVIRT
pv_ops.time.sched_clock = sched_clock;
#endif
}
const __initconst struct hypervisor_x86 x86_hyper_ms_hyperv = { const __initconst struct hypervisor_x86 x86_hyper_ms_hyperv = {
.name = "Microsoft Hyper-V", .name = "Microsoft Hyper-V",
.detect = ms_hyperv_platform, .detect = ms_hyperv_platform,
......
...@@ -168,7 +168,6 @@ void hyperv_report_panic_msg(phys_addr_t pa, size_t size); ...@@ -168,7 +168,6 @@ void hyperv_report_panic_msg(phys_addr_t pa, size_t size);
bool hv_is_hyperv_initialized(void); bool hv_is_hyperv_initialized(void);
bool hv_is_hibernation_supported(void); bool hv_is_hibernation_supported(void);
void hyperv_cleanup(void); void hyperv_cleanup(void);
void hv_setup_sched_clock(void *sched_clock);
#else /* CONFIG_HYPERV */ #else /* CONFIG_HYPERV */
static inline bool hv_is_hyperv_initialized(void) { return false; } static inline bool hv_is_hyperv_initialized(void) { return false; }
static inline bool hv_is_hibernation_supported(void) { return false; } static inline bool hv_is_hibernation_supported(void) { return false; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment