clocksource/drivers/hyper-v: Include asm/hyperv-tlfs.h not asm/mshyperv.h
authorThomas Gleixner <tglx@linutronix.de>
Sun, 13 Nov 2022 21:21:15 +0000 (22:21 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 17 Nov 2022 12:58:32 +0000 (13:58 +0100)
clocksource/hyperv_timer.h is included into the VDSO build. It includes
asm/mshyperv.h which in turn includes the world and some more. This worked
so far by chance, but any subtle change in the include chain results in a
build breakage because VDSO builds are building user space libraries.

Include asm/hyperv-tlfs.h instead which contains everything what the VDSO
build needs except the hv_get_raw_timer() define. Move this define into a
separate header file, which contains the prerequisites (msr.h) and is
included by clocksource/hyperv_timer.h.

Fixup drivers/hv/vmbus_drv.c which relies on the indirect include of
asm/mshyperv.h.

With that the VDSO build only pulls in the minimum requirements.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Link: https://lore.kernel.org/r/87fsemtut0.ffs@tglx
arch/x86/include/asm/hyperv_timer.h [new file with mode: 0644]
arch/x86/include/asm/mshyperv.h
drivers/hv/vmbus_drv.c
include/clocksource/hyperv_timer.h

diff --git a/arch/x86/include/asm/hyperv_timer.h b/arch/x86/include/asm/hyperv_timer.h
new file mode 100644 (file)
index 0000000..388fa81
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_X86_HYPERV_TIMER_H
+#define _ASM_X86_HYPERV_TIMER_H
+
+#include <asm/msr.h>
+
+#define hv_get_raw_timer() rdtsc_ordered()
+
+#endif
index 61f0c206bff0f638fb1caeba3bb42694deb088cc..6d502f3efb0f4792544766b677bc51d5147d1da6 100644 (file)
@@ -19,8 +19,6 @@ typedef int (*hyperv_fill_flush_list_func)(
                struct hv_guest_mapping_flush_list *flush,
                void *data);
 
-#define hv_get_raw_timer() rdtsc_ordered()
-
 void hyperv_vector_handler(struct pt_regs *regs);
 
 #if IS_ENABLED(CONFIG_HYPERV)
index 8b2e413bf19cc1ef9f55c9cd9d2bd9213ddc2a0e..1f5d37ad74b97551b8c74987dd9e53ede5ef6327 100644 (file)
@@ -37,6 +37,7 @@
 #include <linux/dma-map-ops.h>
 #include <linux/pci.h>
 #include <clocksource/hyperv_timer.h>
+#include <asm/mshyperv.h>
 #include "hyperv_vmbus.h"
 
 struct vmbus_dynid {
index b3f5d73ae1d6db1977d7bcfb36c90ad147ec488f..b4a3935801ca94423e0add80f064c93375558e6b 100644 (file)
 
 #include <linux/clocksource.h>
 #include <linux/math64.h>
-#include <asm/mshyperv.h>
+#include <asm/hyperv-tlfs.h>
 
 #define HV_MAX_MAX_DELTA_TICKS 0xffffffff
 #define HV_MIN_DELTA_TICKS 1
 
 #ifdef CONFIG_HYPERV_TIMER
 
+#include <asm/hyperv_timer.h>
+
 /* Routines called by the VMbus driver */
 extern int hv_stimer_alloc(bool have_percpu_irqs);
 extern int hv_stimer_cleanup(unsigned int cpu);