@@ -20,7 +20,7 @@
#include <linux/types.h>
#include <linux/arm-smccc.h>
-#include <asm/hyperv-tlfs.h>
+#include <hyperv/hv_defs.h>
/*
* Declare calls to get and set Hyper-V VP register values on ARM64, which
@@ -6,9 +6,9 @@
#include <linux/nmi.h>
#include <linux/msi.h>
#include <linux/io.h>
-#include <asm/hyperv-tlfs.h>
#include <asm/nospec-branch.h>
#include <asm/paravirt.h>
+#include <hyperv/hv_defs.h>
/*
* Hyper-V always provides a single IO-APIC at this MMIO address.
@@ -5,7 +5,7 @@
#include <uapi/asm/svm.h>
#include <uapi/asm/kvm.h>
-#include <asm/hyperv-tlfs.h>
+#include <hyperv/hv_defs.h>
/*
* 32-bit intercept words in the VMCB Control Area, starting
@@ -25,7 +25,7 @@
#include <linux/cpumask.h>
#include <linux/nmi.h>
#include <asm/ptrace.h>
-#include <asm/hyperv-tlfs.h>
+#include <hyperv/hv_defs.h>
#define VTPM_BASE_ADDRESS 0xfed40000
@@ -15,7 +15,7 @@
#include <linux/clocksource.h>
#include <linux/math64.h>
-#include <asm/hyperv-tlfs.h>
+#include <hyperv/hv_defs.h>
#define HV_MAX_MAX_DELTA_TICKS 0xffffffff
#define HV_MIN_DELTA_TICKS 1
new file mode 100644
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * This file includes Microsoft Hypervisor definitions from hyperv-tlfs.h, or
+ * hvhdk.h when HYPERV_NONTLFS_HEADERS is defined.
+ */
+/*
+ * NOTE:
+ * The typical #ifdef guard to prevent redefinition errors is intentionally
+ * omitted. This makes compiler error (either via #error or redefinition) in
+ * the case where hyperv-tlfs.h is accidentally included, followed by
+ * definition of HYPERV_NON_TLFS_HEADERS and inclusion of this file.
+ * If this file could only be included once, the compiler would ignore the
+ * attempt to use HYPERV_NONTLFS_HEADERS to include hvhdk.h.
+ */
+
+#ifdef HYPERV_NONTLFS_HEADERS
+
+#ifdef HYPERV_TLFS_HEADERS_INCLUDED
+#error "hyperv-tlfs.h was already included before HYPERV_NONTLFS_HEADERS was defined"
+#else
+#include <hyperv/hvhdk.h>
+#endif
+
+#else /* HYPERV_NONTLFS_HEADERS */
+
+#include <asm/hyperv-tlfs.h>
+#define HYPERV_TLFS_HEADERS_INCLUDED
+
+#endif /* !HYPERV_NONTLFS_HEADERS */
Include one or the other depending on whether HYPERV_NONTLFS_HEADERS is defined. This will allow Hyper-V code to use the new headers while other code can continue using hyperv-tlfs.h which is only for Hyper-V guests. Replace hyperv-tlfs.h in shared headers with hv_defs.h These headers are shared between Hyper-V code and non-Hyper-V code (KVM for example). This will allow switching to the new headers in Hyper-V code only. Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com> --- arch/arm64/include/asm/mshyperv.h | 2 +- arch/x86/include/asm/mshyperv.h | 2 +- arch/x86/include/asm/svm.h | 2 +- include/asm-generic/mshyperv.h | 2 +- include/clocksource/hyperv_timer.h | 2 +- include/hyperv/hv_defs.h | 29 +++++++++++++++++++++++++++++ 6 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 include/hyperv/hv_defs.h