Skip to content

Commit ef5a3c9

Browse files
NunoDasNevesliuw
authored andcommitted
hyperv: Switch from hyperv-tlfs.h to hyperv/hvhdk.h
Switch 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. Signed-off-by: Nuno Das Neves <[email protected]> Reviewed-by: Michael Kelley <[email protected]> Reviewed-by: Easwar Hariharan <[email protected]> Signed-off-by: Roman Kisel <[email protected]> Reviewed-by: Easwar Hariharan <[email protected]> Link: https://lore.kernel.org/r/1732577084-2122-5-git-send-email-nunodasneves@linux.microsoft.com Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Wei Liu <[email protected]>
1 parent e68bda7 commit ef5a3c9

File tree

22 files changed

+39
-41
lines changed

22 files changed

+39
-41
lines changed

arch/arm64/hyperv/hv_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include <linux/arm-smccc.h>
1515
#include <linux/module.h>
1616
#include <asm-generic/bug.h>
17-
#include <asm/hyperv-tlfs.h>
17+
#include <hyperv/hvhdk.h>
1818
#include <asm/mshyperv.h>
1919

2020
/*

arch/arm64/hyperv/mshyperv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ static int __init hyperv_init(void)
4949
hv_set_vpreg(HV_REGISTER_GUEST_OS_ID, guest_id);
5050

5151
/* Get the features and hints from Hyper-V */
52-
hv_get_vpreg_128(HV_REGISTER_FEATURES, &result);
52+
hv_get_vpreg_128(HV_REGISTER_PRIVILEGES_AND_FEATURES_INFO, &result);
5353
ms_hyperv.features = result.as32.a;
5454
ms_hyperv.priv_high = result.as32.b;
5555
ms_hyperv.misc_features = result.as32.c;
5656

57-
hv_get_vpreg_128(HV_REGISTER_ENLIGHTENMENTS, &result);
57+
hv_get_vpreg_128(HV_REGISTER_FEATURES_INFO, &result);
5858
ms_hyperv.hints = result.as32.a;
5959

6060
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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
* the ARM64 architecture. See include/asm-generic/mshyperv.h for
77
* definitions are that architecture independent.
88
*
9-
* Definitions that are specified in the Hyper-V Top Level Functional
10-
* Spec (TLFS) should not go in this file, but should instead go in
11-
* hyperv-tlfs.h.
9+
* Definitions that are derived from Hyper-V code or headers should not go in
10+
* this file, but should instead go in the relevant files in include/hyperv.
1211
*
1312
* Copyright (C) 2021, Microsoft, Inc.
1413
*
@@ -20,7 +19,7 @@
2019

2120
#include <linux/types.h>
2221
#include <linux/arm-smccc.h>
23-
#include <asm/hyperv-tlfs.h>
22+
#include <hyperv/hvhdk.h>
2423

2524
/*
2625
* Declare calls to get and set Hyper-V VP register values on ARM64, which

arch/x86/hyperv/hv_init.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include <asm/sev.h>
2020
#include <asm/ibt.h>
2121
#include <asm/hypervisor.h>
22-
#include <asm/hyperv-tlfs.h>
22+
#include <hyperv/hvhdk.h>
2323
#include <asm/mshyperv.h>
2424
#include <asm/idtentry.h>
2525
#include <asm/set_memory.h>
@@ -415,24 +415,24 @@ static void __init hv_get_partition_id(void)
415415
static u8 __init get_vtl(void)
416416
{
417417
u64 control = HV_HYPERCALL_REP_COMP_1 | HVCALL_GET_VP_REGISTERS;
418-
struct hv_get_vp_registers_input *input;
419-
struct hv_get_vp_registers_output *output;
418+
struct hv_input_get_vp_registers *input;
419+
struct hv_output_get_vp_registers *output;
420420
unsigned long flags;
421421
u64 ret;
422422

423423
local_irq_save(flags);
424424
input = *this_cpu_ptr(hyperv_pcpu_input_arg);
425-
output = (struct hv_get_vp_registers_output *)input;
425+
output = (struct hv_output_get_vp_registers *)input;
426426

427-
memset(input, 0, struct_size(input, element, 1));
428-
input->header.partitionid = HV_PARTITION_ID_SELF;
429-
input->header.vpindex = HV_VP_INDEX_SELF;
430-
input->header.inputvtl = 0;
431-
input->element[0].name0 = HV_X64_REGISTER_VSM_VP_STATUS;
427+
memset(input, 0, struct_size(input, names, 1));
428+
input->partition_id = HV_PARTITION_ID_SELF;
429+
input->vp_index = HV_VP_INDEX_SELF;
430+
input->input_vtl.as_uint8 = 0;
431+
input->names[0] = HV_REGISTER_VSM_VP_STATUS;
432432

433433
ret = hv_do_hypercall(control, input, output);
434434
if (hv_result_success(ret)) {
435-
ret = output->as64.low & HV_X64_VTL_MASK;
435+
ret = output->values[0].reg8 & HV_X64_VTL_MASK;
436436
} else {
437437
pr_err("Failed to get VTL(error: %lld) exiting...\n", ret);
438438
BUG();

arch/x86/hyperv/hv_proc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ int hv_call_create_vp(int node, u64 partition_id, u32 vp_index, u32 flags)
176176
input->partition_id = partition_id;
177177
input->vp_index = vp_index;
178178
input->flags = flags;
179-
input->subnode_type = HvSubnodeAny;
179+
input->subnode_type = HV_SUBNODE_ANY;
180180
input->proximity_domain_info = hv_numa_node_to_pxm_info(node);
181181
status = hv_do_hypercall(HVCALL_CREATE_VP, input, NULL);
182182
local_irq_restore(irq_flags);

arch/x86/hyperv/nested.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
#include <linux/types.h>
14-
#include <asm/hyperv-tlfs.h>
14+
#include <hyperv/hvhdk.h>
1515
#include <asm/mshyperv.h>
1616
#include <asm/tlbflush.h>
1717

arch/x86/include/asm/kvm_host.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
#include <asm/asm.h>
3636
#include <asm/kvm_page_track.h>
3737
#include <asm/kvm_vcpu_regs.h>
38-
#include <asm/hyperv-tlfs.h>
3938
#include <asm/reboot.h>
39+
#include <hyperv/hvhdk.h>
4040

4141
#define __KVM_HAVE_ARCH_VCPU_DEBUGFS
4242

arch/x86/include/asm/mshyperv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
#include <linux/nmi.h>
77
#include <linux/msi.h>
88
#include <linux/io.h>
9-
#include <asm/hyperv-tlfs.h>
109
#include <asm/nospec-branch.h>
1110
#include <asm/paravirt.h>
11+
#include <hyperv/hvhdk.h>
1212

1313
/*
1414
* Hyper-V always provides a single IO-APIC at this MMIO address.

arch/x86/include/asm/svm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <uapi/asm/svm.h>
66
#include <uapi/asm/kvm.h>
77

8-
#include <asm/hyperv-tlfs.h>
8+
#include <hyperv/hvhdk.h>
99

1010
/*
1111
* 32-bit intercept words in the VMCB Control Area, starting

arch/x86/kernel/cpu/mshyperv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include <linux/random.h>
2020
#include <asm/processor.h>
2121
#include <asm/hypervisor.h>
22-
#include <asm/hyperv-tlfs.h>
22+
#include <hyperv/hvhdk.h>
2323
#include <asm/mshyperv.h>
2424
#include <asm/desc.h>
2525
#include <asm/idtentry.h>

0 commit comments

Comments
 (0)