Introduce new headers for Hyper-V
Subsystems (14)
v3 cover Introduce new headers for Hyper-V
To support Linux as root partition[1] on Hyper-V many new definitions are required.
The plan going forward is to directly import definitions from Hyper-V code without waiting for them to land in the TLFS document. This is a quicker and more maintainable way to import definitions, and is a step toward the eventual goal of exporting the headers directly from Hyper-V for use in Linux.
This patch series introduces new headers (hvhdk.h, hvgdk.h, etc, see patch #3) derived directly from Hyper-V code. hyperv-tlfs.h is replaced with hvhdk.h (which includes the other new headers) everywhere.
No functional change is expected.
Summary:
Patch 1-2: Minor cleanup patches
Patch 3: Add the new headers (hvhdk.h, etc..) in include/hyperv/ Patch 4: Switch to the new headers
Patch 5: Delete hyperv-tlfs.h files
---
Changelog:
v3:
- Add patch (#5) to delete the hyperv-tlfs.h files, suggested by Michael Kelley and Easwar Hariharan
- Reword commit message on patch #3 to improve clarity, suggested by Michael Kelley
- Clarify "Dom0" terminology, suggested by Michael Kelley v2:
- Rework the series to simply use the new headers everywhere, instead of fiddling around to keep hyperv-tlfs.h in some areas, suggested by Michael Kelley and Easwar Hariharan
- Fix compilation issues with some configs by adding missing definitions and changing some names, thanks to Simon Horman for catching those
- Add additional definitions to the new headers due to them now being used everywhere
- Don't remove indirect includes in patch #2, only remove those which truly aren't used, suggested by Michael Kelley
---
Footnotes:
[1] Linux as root partition on Hyper-V is sometimes referred to as "Dom0", borrowing the terminology from Xen. Although they are conceptually similar, note that "Hyper-V Dom0" has nothing to do with Xen.
Nuno Das Neves (5):
hyperv: Move hv_connection_id to hyperv-tlfs.h
hyperv: Clean up unnecessary #includes
hyperv: Add new Hyper-V headers in include/hyperv
hyperv: Switch from hyperv-tlfs.h to hyperv/hvhdk.h
hyperv: Remove the now unused hyperv-tlfs.h files
MAINTAINERS | 8 +- arch/arm64/hyperv/hv_core.c | 3 +- arch/arm64/hyperv/mshyperv.c | 4 +- arch/arm64/include/asm/hyperv-tlfs.h | 71 -- arch/arm64/include/asm/mshyperv.h | 7 +- arch/x86/hyperv/hv_apic.c | 1 - arch/x86/hyperv/hv_init.c | 21 +- arch/x86/hyperv/hv_proc.c | 3 +- arch/x86/hyperv/ivm.c | 1 - arch/x86/hyperv/mmu.c | 1 - arch/x86/hyperv/nested.c | 2 +- arch/x86/include/asm/hyperv-tlfs.h | 811 ---------------- arch/x86/include/asm/kvm_host.h | 3 +- arch/x86/include/asm/mshyperv.h | 3 +- arch/x86/include/asm/svm.h | 2 +- arch/x86/kernel/cpu/mshyperv.c | 2 +- arch/x86/kvm/vmx/hyperv_evmcs.h | 2 +- arch/x86/kvm/vmx/vmx_onhyperv.h | 2 +- arch/x86/mm/pat/set_memory.c | 2 - drivers/clocksource/hyperv_timer.c | 2 +- drivers/hv/hv_balloon.c | 4 +- drivers/hv/hv_common.c | 2 +- drivers/hv/hv_kvp.c | 2 +- drivers/hv/hv_snapshot.c | 2 +- drivers/hv/hyperv_vmbus.h | 2 +- include/asm-generic/hyperv-tlfs.h | 874 ----------------- include/asm-generic/mshyperv.h | 7 +- include/clocksource/hyperv_timer.h | 2 +- include/hyperv/hvgdk.h | 308 ++++++ include/hyperv/hvgdk_ext.h | 46 + include/hyperv/hvgdk_mini.h | 1306 ++++++++++++++++++++++++++ include/hyperv/hvhdk.h | 733 +++++++++++++++ include/hyperv/hvhdk_mini.h | 311 ++++++ include/linux/hyperv.h | 11 +- net/vmw_vsock/hyperv_transport.c | 6 +- 35 files changed, 2748 insertions(+), 1819 deletions(-) delete mode 100644 arch/arm64/include/asm/hyperv-tlfs.h delete mode 100644 arch/x86/include/asm/hyperv-tlfs.h delete mode 100644 include/asm-generic/hyperv-tlfs.h create mode 100644 include/hyperv/hvgdk.h create mode 100644 include/hyperv/hvgdk_ext.h create mode 100644 include/hyperv/hvgdk_mini.h create mode 100644 include/hyperv/hvhdk.h create mode 100644 include/hyperv/hvhdk_mini.h
Signature · 1 line
2.34.1
PATCH v3 1/5 hyperv: Move hv_connection_id to hyperv-tlfs.h
This definition is in the wrong file; it is part of the TLFS doc.
--- include/asm-generic/hyperv-tlfs.h | 9 +++++++++ include/linux/hyperv.h | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-)
include/asm-generic/hyperv-tlfs.h +9 -0
@@ -871,4 +871,13 @@ struct hv_mmio_write_input { u8 data[HV_HYPERCALL_MMIO_MAX_DATA_LENGTH]; } __packed; +/* Define connection identifier type. */ +union hv_connection_id { +u32 asu32; +struct { +u32 id:24 ; +u32 reserved:8 ; + } u; +}; +#endif
include/linux/hyperv.h +0 -9
@@ -768,15 +768,6 @@ struct vmbus_close_msg {struct vmbus_channel_close_channel msg; }; -/* Define connection identifier type. */ -union hv_connection_id { -u32 asu32; -struct { -u32 id:24 ; -u32 reserved:8 ; - } u; -}; -enum vmbus_device_type {HV_IDE =0 ,HV_SCSI ,
Signature · 1 line
2.34.1
Re: [PATCH v3 1/5] hyperv: Move hv_connection_id to hyperv-tlfs.h
Quoted 6 lines · Nuno Das Neves
This definition is in the wrong file; it is part of the TLFS doc.
Acked-by Wei Liu <[email protected]>Reviewed-by Easwar Hariharan <[email protected]>Reviewed-by Michael Kelley <[email protected]>Signed-off-by Nuno Das Neves <[email protected]>
One comment about the ordering of the tags. It is better to organize them in the following order:
I've made the change for you while applying the patch.
Thanks,
Wei.
Re: [PATCH v3 1/5] hyperv: Move hv_connection_id to hyperv-tlfs.h
Quoted 11 lines · Wei Liu
Quoted 6 lines · Nuno Das Neves
This definition is in the wrong file; it is part of the TLFS doc.
Acked-by Wei Liu <[email protected]>Reviewed-by Easwar Hariharan <[email protected]>Reviewed-by Michael Kelley <[email protected]>Signed-off-by Nuno Das Neves <[email protected]>One comment about the ordering of the tags. It is better to organize them in the following order:
Quoted 7 lines
Signed-off-by Nuno Das Neves <[email protected]>Acked-by Wei Liu <[email protected]>Reviewed-by Easwar Hariharan <[email protected]>Reviewed-by Michael Kelley <[email protected]>I've made the change for you while applying the patch.
Thank you, noted for next time.
Quoted 2 lines
Thanks,
Wei.
PATCH v3 2/5 hyperv: Clean up unnecessary #includes
In reply to Nuno Das NevesRemove includes of linux/hyperv.h, mshyperv.h, and hyperv-tlfs.h where they are not used.
--- arch/arm64/hyperv/hv_core.c | 1 - arch/x86/hyperv/hv_apic.c | 1 - arch/x86/hyperv/hv_init.c | 1 - arch/x86/hyperv/hv_proc.c | 1 - arch/x86/hyperv/ivm.c | 1 - arch/x86/hyperv/mmu.c | 1 - arch/x86/include/asm/kvm_host.h | 1 - arch/x86/include/asm/mshyperv.h | 1 - arch/x86/mm/pat/set_memory.c | 2 -- 9 files changed, 10 deletions(-)
arch/arm64/hyperv/hv_core.c +0 -1
@@ -11,7 +11,6 @@#include <linux/types.h> #include <linux/export.h> #include <linux/mm.h> -#include <linux/hyperv.h> #include <linux/arm-smccc.h> #include <linux/module.h> #include <asm-generic/bug.h>
arch/x86/hyperv/hv_apic.c +0 -1
@@ -23,7 +23,6 @@#include <linux/vmalloc.h> #include <linux/mm.h> #include <linux/clockchips.h> -#include <linux/hyperv.h> #include <linux/slab.h> #include <linux/cpuhotplug.h> #include <asm/hypervisor.h>
arch/x86/hyperv/hv_init.c +0 -1
@@ -27,7 +27,6 @@#include <linux/version.h> #include <linux/vmalloc.h> #include <linux/mm.h> -#include <linux/hyperv.h> #include <linux/slab.h> #include <linux/kernel.h> #include <linux/cpuhotplug.h>
arch/x86/hyperv/hv_proc.c +0 -1
@@ -3,7 +3,6 @@#include <linux/vmalloc.h> #include <linux/mm.h> #include <linux/clockchips.h> -#include <linux/hyperv.h> #include <linux/slab.h> #include <linux/cpuhotplug.h> #include <linux/minmax.h>
arch/x86/hyperv/ivm.c +0 -1
@@ -7,7 +7,6 @@*/ #include <linux/bitfield.h> -#include <linux/hyperv.h> #include <linux/types.h> #include <linux/slab.h> #include <asm/svm.h>
arch/x86/hyperv/mmu.c +0 -1
@@ -1,6 +1,5 @@#define pr_fmt (fmt) "Hyper-V: " fmt -#include <linux/hyperv.h> #include <linux/log2.h> #include <linux/slab.h> #include <linux/types.h>
arch/x86/include/asm/kvm_host.h +0 -1
@@ -24,7 +24,6 @@#include <linux/pvclock_gtod.h> #include <linux/clocksource.h> #include <linux/irqbypass.h> -#include <linux/hyperv.h> #include <linux/kfifo.h> #include <linux/sched/vhost_task.h>
arch/x86/include/asm/mshyperv.h +0 -1
@@ -9,7 +9,6 @@#include <asm/hyperv-tlfs.h> #include <asm/nospec-branch.h> #include <asm/paravirt.h> -#include <asm/mshyperv.h> /* * Hyper-V always provides a single IO-APIC at this MMIO address.
arch/x86/mm/pat/set_memory.c +0 -2
@@ -32,8 +32,6 @@#include <asm/pgalloc.h> #include <asm/proto.h> #include <asm/memtype.h> -#include <asm/hyperv-tlfs.h> -#include <asm/mshyperv.h> #include "../mm_internal.h"
Signature · 1 line
2.34.1
PATCH v3 3/5 hyperv: Add new Hyper-V headers in include/hyperv
In reply to Nuno Das NevesThese headers contain definitions for regular Hyper-V guests (as in hyperv-tlfs.h), as well as interfaces for more privileged guests like the root partition (aka Dom0).
These files are derived from headers exported from Hyper-V, rather than being derived from the TLFS document. (Although, to preserve compatibility with existing Linux code, some definitions are copied directly from hyperv-tlfs.h too).
The new files follow a naming convention according to their original use:
- hdk "host development kit"
- gdk "guest development kit"
With postfix "_mini" implying userspace-only headers, and "_ext" for extended hypercalls.
The use of multiple files and their original names is primarily to keep the provenance of exactly where they came from in Hyper-V code, which is helpful for manual maintenance and extension of these definitions. Microsoft maintainers importing new definitions should take care to put them in the right file. However, Linux kernel code that uses any of the definitions need not be aware of the multiple files or assign any meaning to the new names. Linux kernel code should always just include hvhdk.h
Note the new headers contain both arm64 and x86_64 definitions. Some are guarded by #ifdefs, and some are instead prefixed with the architecture, e.g. hv_x64_*. These conventions are kept from Hyper-V code as another tactic to simplify the process of importing and maintaining the definitions, rather than splitting them up into their own files in arch/x86/ and arch/arm64/.
These headers are a step toward importing headers directly from Hyper-V in the future, similar to Xen public files in include/xen/interface/.
--- MAINTAINERS | 5 + include/hyperv/hvgdk.h | 308 +++++++++ include/hyperv/hvgdk_ext.h | 46 ++ include/hyperv/hvgdk_mini.h | 1306 +++++++++++++++++++++++++++++++++++ include/hyperv/hvhdk.h | 733 ++++++++++++++++++++ include/hyperv/hvhdk_mini.h | 311 +++++++++ 6 files changed, 2709 insertions(+) create mode 100644 include/hyperv/hvgdk.h create mode 100644 include/hyperv/hvgdk_ext.h create mode 100644 include/hyperv/hvgdk_mini.h create mode 100644 include/hyperv/hvhdk.h create mode 100644 include/hyperv/hvhdk_mini.h
MAINTAINERS +5 -0
@@ -10694,6 +10694,11 @@ F: drivers/video/fbdev/hyperv_fb.c F: include/asm-generic/hyperv-tlfs.h F: include/asm-generic/mshyperv.h F: include/clocksource/hyperv_timer.h +F: include/hyperv/hvgdk.h +F: include/hyperv/hvgdk_ext.h +F: include/hyperv/hvgdk_mini.h +F: include/hyperv/hvhdk.h +F: include/hyperv/hvhdk_mini.h F: include/linux/hyperv.h F: include/net/mana F: include/uapi/linux/hyperv.h
include/hyperv/hvgdk.h new file +308 -0
308 lines not on this page · raw message
include/hyperv/hvgdk_ext.h new file +46 -0
46 lines not on this page · raw message
include/hyperv/hvgdk_mini.h new file +1306 -0
1,306 lines not on this page · raw message
include/hyperv/hvhdk.h new file +733 -0
733 lines not on this page · raw message
include/hyperv/hvhdk_mini.h new file +311 -0
311 lines not on this page · raw message
Signature · 1 line
2.34.1
RE: [PATCH v3 3/5] hyperv: Add new Hyper-V headers in include/hyperv
From: Nuno Das Neves <[email protected]> Sent: Monday, November 25, 2024 3:25 PM
Quoted 33 lines
These headers contain definitions for regular Hyper-V guests (as in
hyperv-tlfs.h), as well as interfaces for more privileged guests like the root partition (aka Dom0).These files are derived from headers exported from Hyper-V, rather than being derived from the TLFS document. (Although, to preserve compatibility with existing Linux code, some definitions are copied directly from
hyperv-tlfs.htoo).The new files follow a naming convention according to their original use:
- hdk "host development kit"
- gdk "guest development kit"
With postfix "_mini" implying userspace-only headers, and "_ext" for extended hypercalls.The use of multiple files and their original names is primarily to keep the provenance of exactly where they came from in Hyper-V code, which is helpful for manual maintenance and extension of these definitions. Microsoft maintainers importing new definitions should take care to put them in the right file. However, Linux kernel code that uses any of the definitions need not be aware of the multiple files or assign any meaning to the new names. Linux kernel code should always just include
hvhdk.hNote the new headers contain both arm64 and
x86_64definitions. Some are guarded by #ifdefs, and some are instead prefixed with the architecture, e.g. hv_x64_*. These conventions are kept from Hyper-V code as another tactic to simplify the process of importing and maintaining the definitions, rather than splitting them up into their own files inarch/x86/andarch/arm64/.
Quoted 4 lines
These headers are a step toward importing headers directly from Hyper-V in the future, similar to Xen public files in
include/xen/interface/.Signed-off-by Nuno Das Neves <[email protected]>
Re: [PATCH v3 3/5] hyperv: Add new Hyper-V headers in include/hyperv
In reply to Nuno Das NevesQuoted 36 lines · Nuno Das Neves
These headers contain definitions for regular Hyper-V guests (as in
hyperv-tlfs.h), as well as interfaces for more privileged guests like the root partition (aka Dom0).These files are derived from headers exported from Hyper-V, rather than being derived from the TLFS document. (Although, to preserve compatibility with existing Linux code, some definitions are copied directly from
hyperv-tlfs.htoo).The new files follow a naming convention according to their original use:
- hdk "host development kit"
- gdk "guest development kit"
With postfix "_mini" implying userspace-only headers, and "_ext" for extended hypercalls.The use of multiple files and their original names is primarily to keep the provenance of exactly where they came from in Hyper-V code, which is helpful for manual maintenance and extension of these definitions. Microsoft maintainers importing new definitions should take care to put them in the right file. However, Linux kernel code that uses any of the definitions need not be aware of the multiple files or assign any meaning to the new names. Linux kernel code should always just include
hvhdk.hNote the new headers contain both arm64 and
x86_64definitions. Some are guarded by #ifdefs, and some are instead prefixed with the architecture, e.g. hv_x64_*. These conventions are kept from Hyper-V code as another tactic to simplify the process of importing and maintaining the definitions, rather than splitting them up into their own files inarch/x86/andarch/arm64/.These headers are a step toward importing headers directly from Hyper-V in the future, similar to Xen public files in
include/xen/interface/.Signed-off-by Nuno Das Neves <[email protected]>
Quoted 13 lines
--- MAINTAINERS | 5 + include/hyperv/hvgdk.h | 308 +++++++++ include/hyperv/hvgdk_ext.h | 46 ++ include/hyperv/hvgdk_mini.h | 1306 +++++++++++++++++++++++++++++++++++ include/hyperv/hvhdk.h | 733 ++++++++++++++++++++ include/hyperv/hvhdk_mini.h | 311 +++++++++ 6 files changed, 2709 insertions(+) create mode 100644 include/hyperv/hvgdk.h create mode 100644 include/hyperv/hvgdk_ext.h create mode 100644 include/hyperv/hvgdk_mini.h create mode 100644 include/hyperv/hvhdk.h create mode 100644 include/hyperv/hvhdk_mini.h
PATCH v3 4/5 hyperv: Switch from hyperv-tlfs.h to hyperv/hvhdk.h
In reply to Nuno Das NevesSwitch to using hvhdk.h everywhere in the kernel. This header includes all the new Hyper-V headers in include/hyperv, which form a superset of the definitions found in hyperv-tlfs.h.
This makes it easier to add new Hyper-V interfaces without being restricted to those in the TLFS doc (reflected in hyperv-tlfs.h).
To be more consistent with the original Hyper-V code, the names of some definitions are changed slightly. Update those where needed.
Update comments in mshyperv.h files to point to include/hyperv for adding new definitions.
--- arch/arm64/hyperv/hv_core.c | 2 +- arch/arm64/hyperv/mshyperv.c | 4 ++-- arch/arm64/include/asm/mshyperv.h | 7 +++---- arch/x86/hyperv/hv_init.c | 20 ++++++++++---------- arch/x86/hyperv/hv_proc.c | 2 +- arch/x86/hyperv/nested.c | 2 +- arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/include/asm/mshyperv.h | 2 +- arch/x86/include/asm/svm.h | 2 +- arch/x86/kernel/cpu/mshyperv.c | 2 +- arch/x86/kvm/vmx/hyperv_evmcs.h | 2 +- arch/x86/kvm/vmx/vmx_onhyperv.h | 2 +- drivers/clocksource/hyperv_timer.c | 2 +- drivers/hv/hv_balloon.c | 4 ++-- drivers/hv/hv_common.c | 2 +- drivers/hv/hv_kvp.c | 2 +- drivers/hv/hv_snapshot.c | 2 +- drivers/hv/hyperv_vmbus.h | 2 +- include/asm-generic/mshyperv.h | 7 +++---- include/clocksource/hyperv_timer.h | 2 +- include/linux/hyperv.h | 2 +- net/vmw_vsock/hyperv_transport.c | 6 +++--- 22 files changed, 39 insertions(+), 41 deletions(-)
arch/arm64/hyperv/hv_core.c +1 -1
@@ -14,7 +14,7 @@#include <linux/arm-smccc.h> #include <linux/module.h> #include <asm-generic/bug.h> -#include <asm/hyperv-tlfs.h> +#include <hyperv/hvhdk.h> #include <asm/mshyperv.h> /*
arch/arm64/hyperv/mshyperv.c +2 -2
@@ -49,12 +49,12 @@ static int __init hyperv_init(void)hv_set_vpreg (HV_REGISTER_GUEST_OS_ID , guest_id);/* Get the features and hints from Hyper-V */ -hv_get_vpreg_128 (HV_REGISTER_FEATURES , &result); +hv_get_vpreg_128 (HV_REGISTER_PRIVILEGES_AND_FEATURES_INFO , &result); ms_hyperv.features = result.as32.a; ms_hyperv.priv_high = result.as32.b; ms_hyperv.misc_features = result.as32.c; -hv_get_vpreg_128 (HV_REGISTER_ENLIGHTENMENTS , &result); +hv_get_vpreg_128 (HV_REGISTER_FEATURES_INFO , &result); ms_hyperv.hints = result.as32.a; pr_info("Hyper-V: privilege flags low 0x%x, high 0x%x, hints 0x%x, misc 0x%x\n",
arch/arm64/include/asm/mshyperv.h +3 -4
@@ -6,9 +6,8 @@* the ARM64 architecture. See include/asm-generic/mshyperv.h for * definitions are that architecture independent. * -* Definitions that are specified in the Hyper-V Top Level Functional -* Spec (TLFS) should not go in this file, but should instead go in -* hyperv-tlfs.h. +* Definitions that are derived from Hyper-V code or headers should not go in +* this file, but should instead go in the relevant files in include/hyperv. * * Copyright (C) 2021, Microsoft, Inc. *
@@ -20,7 +19,7 @@#include <linux/types.h> #include <linux/arm-smccc.h> -#include <asm/hyperv-tlfs.h> +#include <hyperv/hvhdk.h> /* * Declare calls to get and set Hyper-V VP register values on ARM64, which
arch/x86/hyperv/hv_init.c +10 -10
@@ -19,7 +19,7 @@#include <asm/sev.h> #include <asm/ibt.h> #include <asm/hypervisor.h> -#include <asm/hyperv-tlfs.h> +#include <hyperv/hvhdk.h> #include <asm/mshyperv.h> #include <asm/idtentry.h> #include <asm/set_memory.h>
@@ -415,24 +415,24 @@ static void __init hv_get_partition_id(void)static u8 __init get_vtl (void ) {u64 control =HV_HYPERCALL_REP_COMP_1 |HVCALL_GET_VP_REGISTERS ; -struct hv_get_vp_registers_input *input; -struct hv_get_vp_registers_output *output; +struct hv_input_get_vp_registers *input; +struct hv_register_assoc *output;unsigned long flags;u64 ret;local_irq_save (flags); input = *this_cpu_ptr (hyperv_pcpu_input_arg); - output = (struct hv_get_vp_registers_output *)input; + output = (struct hv_register_assoc *)input; -memset (input,0 ,struct_size (input, element,1 )); - input->header.partitionid =HV_PARTITION_ID_SELF ; - input->header.vpindex =HV_VP_INDEX_SELF ; - input->header.inputvtl =0 ; - input->element[0 ].name0 =HV_X64_REGISTER_VSM_VP_STATUS ; +memset (input,0 ,struct_size (input, names,1 )); + input->partition_id =HV_PARTITION_ID_SELF ; + input->vp_index =HV_VP_INDEX_SELF ; + input->input_vtl.as_uint8 =0 ; + input->names[0 ] =HV_REGISTER_VSM_VP_STATUS ; ret =hv_do_hypercall (control, input, output);if (hv_result_success (ret)) { - ret = output->as64.low &HV_X64_VTL_MASK ; + ret = output->value.reg8 &HV_X64_VTL_MASK ; }else {pr_err ("Failed to get VTL(error: %lld) exiting...\n" , ret);BUG ();
arch/x86/hyperv/hv_proc.c +1 -1
@@ -176,7 +176,7 @@ int hv_call_create_vp(int node, u64 partition_id, u32 vp_index, u32 flags) input->partition_id = partition_id; input->vp_index = vp_index; input->flags = flags; - input->subnode_type = HvSubnodeAny; + input->subnode_type =HV_SUBNODE_ANY ; input->proximity_domain_info =hv_numa_node_to_pxm_info (node); status =hv_do_hypercall (HVCALL_CREATE_VP , input,NULL );local_irq_restore (irq_flags);
arch/x86/hyperv/nested.c +1 -1
@@ -11,7 +11,7 @@#include <linux/types.h> -#include <asm/hyperv-tlfs.h> +#include <hyperv/hvhdk.h> #include <asm/mshyperv.h> #include <asm/tlbflush.h>
arch/x86/include/asm/kvm_host.h +1 -1
@@ -35,8 +35,8 @@#include <asm/asm.h> #include <asm/kvm_page_track.h> #include <asm/kvm_vcpu_regs.h> -#include <asm/hyperv-tlfs.h> #include <asm/reboot.h> +#include <hyperv/hvhdk.h> #define __KVM_HAVE_ARCH_VCPU_DEBUGFS
arch/x86/include/asm/mshyperv.h +1 -1
@@ -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/hvhdk.h> /* * Hyper-V always provides a single IO-APIC at this MMIO address.
arch/x86/include/asm/svm.h +1 -1
@@ -5,7 +5,7 @@#include <uapi/asm/svm.h> #include <uapi/asm/kvm.h> -#include <asm/hyperv-tlfs.h> +#include <hyperv/hvhdk.h> /* * 32-bit intercept words in the VMCB Control Area, starting
arch/x86/kernel/cpu/mshyperv.c +1 -1
@@ -19,7 +19,7 @@#include <linux/random.h> #include <asm/processor.h> #include <asm/hypervisor.h> -#include <asm/hyperv-tlfs.h> +#include <hyperv/hvhdk.h> #include <asm/mshyperv.h> #include <asm/desc.h> #include <asm/idtentry.h>
arch/x86/kvm/vmx/hyperv_evmcs.h +1 -1
@@ -6,7 +6,7 @@#ifndef __KVM_X86_VMX_HYPERV_EVMCS_H#define __KVM_X86_VMX_HYPERV_EVMCS_H -#include <asm/hyperv-tlfs.h> +#include <hyperv/hvhdk.h> #include "capabilities.h" #include "vmcs12.h"
arch/x86/kvm/vmx/vmx_onhyperv.h +1 -1
@@ -3,7 +3,7 @@#ifndef __ARCH_X86_KVM_VMX_ONHYPERV_H__#define __ARCH_X86_KVM_VMX_ONHYPERV_H__ -#include <asm/hyperv-tlfs.h> +#include <hyperv/hvhdk.h> #include <asm/mshyperv.h> #include <linux/jump_label.h>
drivers/clocksource/hyperv_timer.c +1 -1
@@ -23,7 +23,7 @@#include <linux/acpi.h> #include <linux/hyperv.h> #include <clocksource/hyperv_timer.h> -#include <asm/hyperv-tlfs.h> +#include <hyperv/hvhdk.h> #include <asm/mshyperv.h> static struct clock_event_device __percpu *hv_clock_event;
drivers/hv/hv_balloon.c +2 -2
@@ -28,7 +28,7 @@#include <linux/sizes.h> #include <linux/hyperv.h> -#include <asm/hyperv-tlfs.h> +#include <hyperv/hvhdk.h> #include <asm/mshyperv.h>
@@ -1585,7 +1585,7 @@ static int hv_free_page_report(struct page_reporting_dev_info *pr_dev_info,return -ENOSPC ; } - hint->type =HV_EXT_MEMORY_HEAT_HINT_TYPE_COLD_DISCARD ; + hint->heat_type =HV_EXTMEM_HEAT_HINT_COLD_DISCARD ; hint->reserved =0 ;for_each_sg (sgl, sg, nents, i) {union hv_gpa_page_range *range;
drivers/hv/hv_common.c +1 -1
@@ -28,7 +28,7 @@#include <linux/slab.h> #include <linux/dma-map-ops.h> #include <linux/set_memory.h> -#include <asm/hyperv-tlfs.h> +#include <hyperv/hvhdk.h> #include <asm/mshyperv.h> /*
drivers/hv/hv_kvp.c +1 -1
@@ -27,7 +27,7 @@#include <linux/connector.h> #include <linux/workqueue.h> #include <linux/hyperv.h> -#include <asm/hyperv-tlfs.h> +#include <hyperv/hvhdk.h> #include "hyperv_vmbus.h" #include "hv_utils_transport.h"
drivers/hv/hv_snapshot.c +1 -1
@@ -12,7 +12,7 @@#include <linux/connector.h> #include <linux/workqueue.h> #include <linux/hyperv.h> -#include <asm/hyperv-tlfs.h> +#include <hyperv/hvhdk.h> #include "hyperv_vmbus.h" #include "hv_utils_transport.h"
drivers/hv/hyperv_vmbus.h +1 -1
@@ -15,10 +15,10 @@#include <linux/list.h> #include <linux/bitops.h> #include <asm/sync_bitops.h> -#include <asm/hyperv-tlfs.h> #include <linux/atomic.h> #include <linux/hyperv.h> #include <linux/interrupt.h> +#include <hyperv/hvhdk.h> #include "hv_trace.h"
include/asm-generic/mshyperv.h +3 -4
@@ -6,9 +6,8 @@* independent. See arch/<arch>/include/asm/mshyperv.h for definitions * that are specific to architecture <arch>. * -* Definitions that are specified in the Hyper-V Top Level Functional -* Spec (TLFS) should not go in this file, but should instead go in -* hyperv-tlfs.h. +* Definitions that are derived from Hyper-V code or headers should not go in +* this file, but should instead go in the relevant files in include/hyperv. * * Copyright (C) 2019, Microsoft, Inc. *
@@ -25,7 +24,7 @@#include <linux/cpumask.h> #include <linux/nmi.h> #include <asm/ptrace.h> -#include <asm/hyperv-tlfs.h> +#include <hyperv/hvhdk.h> #define VTPM_BASE_ADDRESS 0xfed40000
include/clocksource/hyperv_timer.h +1 -1
@@ -15,7 +15,7 @@#include <linux/clocksource.h> #include <linux/math64.h> -#include <asm/hyperv-tlfs.h> +#include <hyperv/hvhdk.h> #define HV_MAX_MAX_DELTA_TICKS 0xffffffff#define HV_MIN_DELTA_TICKS 1
include/linux/hyperv.h +1 -1
@@ -24,7 +24,7 @@#include <linux/mod_devicetable.h> #include <linux/interrupt.h> #include <linux/reciprocal_div.h> -#include <asm/hyperv-tlfs.h> +#include <hyperv/hvhdk.h> #define MAX_PAGE_BUFFER_COUNT 32#define MAX_MULTIPAGE_BUFFER_COUNT 32/* 128K */
net/vmw_vsock/hyperv_transport.c +3 -3
@@ -13,12 +13,12 @@#include <linux/hyperv.h> #include <net/sock.h> #include <net/af_vsock.h> -#include <asm/hyperv-tlfs.h> +#include <hyperv/hvhdk.h> /* Older (VMBUS version 'VERSION_WIN10' or before) Windows hosts have some * stricter requirements on the hv_sock ring buffer size of six 4K pages. -* hyperv-tlfs defines HV_HYP_PAGE_SIZE as 4K. Newer hosts don't have this -* limitation; but, keep the defaults the same for compat. +* HV_HYP_PAGE_SIZE is defined as 4K. Newer hosts don't have this limitation; +* but, keep the defaults the same for compat. */ #define RINGBUFFER_HVS_RCV_SIZE (HV_HYP_PAGE_SIZE * 6)#define RINGBUFFER_HVS_SND_SIZE (HV_HYP_PAGE_SIZE * 6)
Signature · 1 line
2.34.1
RE: [PATCH v3 4/5] hyperv: Switch from hyperv-tlfs.h to hyperv/hvhdk.h
From: Nuno Das Neves <[email protected]> Sent: Monday, November 25, 2024 3:25 PM
Quoted 8 lines
Switch to using
hvhdk.heverywhere in the kernel. This header includes all the new Hyper-V headers ininclude/hyperv, which form a superset of the definitions found inhyperv-tlfs.h.This makes it easier to add new Hyper-V interfaces without being restricted to those in the TLFS doc (reflected in
hyperv-tlfs.h).
Quoted 7 lines
To be more consistent with the original Hyper-V code, the names of some definitions are changed slightly. Update those where needed.
Update comments in
mshyperv.hfiles to point toinclude/hypervfor adding new definitions.Signed-off-by Nuno Das Neves <[email protected]>
Re: [PATCH v3 4/5] hyperv: Switch from hyperv-tlfs.h to hyperv/hvhdk.h
In reply to Nuno Das NevesQuoted 30 lines · Nuno Das Neves
Switch to using
hvhdk.heverywhere in the kernel. This header includes all the new Hyper-V headers ininclude/hyperv, which form a superset of the definitions found inhyperv-tlfs.h.This makes it easier to add new Hyper-V interfaces without being restricted to those in the TLFS doc (reflected in
hyperv-tlfs.h).To be more consistent with the original Hyper-V code, the names of some definitions are changed slightly. Update those where needed.
Update comments in
mshyperv.hfiles to point toinclude/hypervfor adding new definitions.Signed-off-by Nuno Das Neves <[email protected]>--- arch/arm64/hyperv/hv_core.c | 2 +- arch/arm64/hyperv/mshyperv.c | 4 ++-- arch/arm64/include/asm/mshyperv.h | 7 +++---- arch/x86/hyperv/hv_init.c | 20 ++++++++++---------- arch/x86/hyperv/hv_proc.c | 2 +- arch/x86/hyperv/nested.c | 2 +- arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/include/asm/mshyperv.h | 2 +- arch/x86/include/asm/svm.h | 2 +- arch/x86/kernel/cpu/mshyperv.c | 2 +- arch/x86/kvm/vmx/hyperv_evmcs.h | 2 +- arch/x86/kvm/vmx/vmx_onhyperv.h | 2 +- drivers/clocksource/hyperv_timer.c | 2 +- drivers/hv/hv_balloon.c | 4 ++-- drivers/hv/hv_common.c | 2 +-
Quoted 8 lines
drivers/hv/hv_kvp.c | 2 +- drivers/hv/hv_snapshot.c | 2 +- drivers/hv/hyperv_vmbus.h | 2 +- include/asm-generic/mshyperv.h | 7 +++---- include/clocksource/hyperv_timer.h | 2 +- include/linux/hyperv.h | 2 +- net/vmw_vsock/hyperv_transport.c | 6 +++--- 22 files changed, 39 insertions(+), 41 deletions(-)
PATCH v3 5/5 hyperv: Remove the now unused hyperv-tlfs.h files
In reply to Nuno Das NevesRemove all hyperv-tlfs.h files. These are no longer included anywhere. hyperv/hvhdk.h serves the same role, but with an easier path for adding new definitions.
Remove the relevant lines in MAINTAINERS.
--- MAINTAINERS | 3 - arch/arm64/include/asm/hyperv-tlfs.h | 71 --- arch/x86/include/asm/hyperv-tlfs.h | 811 ------------------------ include/asm-generic/hyperv-tlfs.h | 883 --------------------------- 4 files changed, 1768 deletions(-) delete mode 100644 arch/arm64/include/asm/hyperv-tlfs.h delete mode 100644 arch/x86/include/asm/hyperv-tlfs.h delete mode 100644 include/asm-generic/hyperv-tlfs.h
MAINTAINERS +0 -3
@@ -10672,10 +10672,8 @@ F: Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml F: Documentation/networking/device_drivers/ethernet/microsoft/netvsc.rst F: Documentation/virt/hyperv F: arch/arm64/hyperv -F: arch/arm64/include/asm/hyperv-tlfs.h F: arch/arm64/include/asm/mshyperv.h F: arch/x86/hyperv -F: arch/x86/include/asm/hyperv-tlfs.h F: arch/x86/include/asm/mshyperv.h F: arch/x86/include/asm/trace/hyperv.h F: arch/x86/kernel/cpu/mshyperv.c
@@ -10691,7 +10689,6 @@ F: drivers/pci/controller/pci-hyperv.c F: drivers/scsi/storvsc_drv.c F: drivers/uio/uio_hv_generic.c F: drivers/video/fbdev/hyperv_fb.c -F: include/asm-generic/hyperv-tlfs.h F: include/asm-generic/mshyperv.h F: include/clocksource/hyperv_timer.h F: include/hyperv/hvgdk.h
arch/arm64/include/asm/hyperv-tlfs.h deleted +0 -71
71 lines not on this page · raw message
arch/x86/include/asm/hyperv-tlfs.h deleted +0 -811
811 lines not on this page · raw message
include/asm-generic/hyperv-tlfs.h deleted +0 -883
883 lines not on this page · raw message
Signature · 1 line
2.34.1
RE: [PATCH v3 5/5] hyperv: Remove the now unused hyperv-tlfs.h files
From: Nuno Das Neves <[email protected]> Sent: Monday, November 25, 2024 3:25 PM
Quoted 8 lines
Remove all
hyperv-tlfs.hfiles. These are no longer included anywhere.hyperv/hvhdk.hserves the same role, but with an easier path for adding new definitions.Remove the relevant lines in
MAINTAINERS.Signed-off-by Nuno Das Neves <[email protected]>
Re: [PATCH v3 5/5] hyperv: Remove the now unused hyperv-tlfs.h files
Quoted 11 lines · Michael Kelley
From: Nuno Das Neves <[email protected]> Sent: Monday, November 25, 2024 3:25 PM
Quoted 8 lines
Remove all
hyperv-tlfs.hfiles. These are no longer included anywhere.hyperv/hvhdk.hserves the same role, but with an easier path for adding new definitions.Remove the relevant lines in
MAINTAINERS.Signed-off-by Nuno Das Neves <[email protected]>Reviewed-by Michael Kelley <[email protected]>
Thanks for the reviews on this series Michael!
Re: [PATCH v3 5/5] hyperv: Remove the now unused hyperv-tlfs.h files
In reply to Nuno Das NevesQuoted 7 lines · Nuno Das Neves
Remove all
hyperv-tlfs.hfiles. These are no longer included anywhere.hyperv/hvhdk.hserves the same role, but with an easier path for adding new definitions.Remove the relevant lines in
MAINTAINERS.Signed-off-by Nuno Das Neves <[email protected]>
Quoted 10 lines
--- MAINTAINERS | 3 - arch/arm64/include/asm/hyperv-tlfs.h | 71 --- arch/x86/include/asm/hyperv-tlfs.h | 811 ------------------------ include/asm-generic/hyperv-tlfs.h | 883 --------------------------- 4 files changed, 1768 deletions(-) delete mode 100644 arch/arm64/include/asm/hyperv-tlfs.h delete mode 100644 arch/x86/include/asm/hyperv-tlfs.h delete mode 100644 include/asm-generic/hyperv-tlfs.h
Quoted 16 lines · Nuno Das Neves
To support Linux as root partition[1] on Hyper-V many new definitions are required.
The plan going forward is to directly import definitions from Hyper-V code without waiting for them to land in the TLFS document. This is a quicker and more maintainable way to import definitions, and is a step toward the eventual goal of exporting the headers directly from Hyper-V for use in Linux.
This patch series introduces new headers (
hvhdk.h,hvgdk.h, etc, see patch #3) derived directly from Hyper-V code.hyperv-tlfs.his replaced withhvhdk.h(which includes the other new headers) everywhere.No functional change is expected.
Quoted 7 lines
Summary:
Patch 1-2: Minor cleanup patches
Patch 3: Add the new headers (hvhdk.h, etc..) ininclude/hyperv/Patch 4: Switch to the new headers
Patch 5: Deletehyperv-tlfs.hfilesSigned-off-by Nuno Das Neves <[email protected]>
Applied to hyperv-next. Thanks.