forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 748e4f3d702def1a4bff191e0cf93b6a05340f01
kernel/arch/x86/kvm/hyperv.h
....@@ -1,3 +1,4 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * KVM Microsoft Hyper-V emulation
34 *
....@@ -15,14 +16,39 @@
1516 * Amit Shah <amit.shah@qumranet.com>
1617 * Ben-Ami Yassour <benami@il.ibm.com>
1718 * Andrey Smetanin <asmetanin@virtuozzo.com>
18
- *
19
- * This work is licensed under the terms of the GNU GPL, version 2. See
20
- * the COPYING file in the top-level directory.
21
- *
2219 */
2320
2421 #ifndef __ARCH_X86_KVM_HYPERV_H__
2522 #define __ARCH_X86_KVM_HYPERV_H__
23
+
24
+#include <linux/kvm_host.h>
25
+
26
+/*
27
+ * The #defines related to the synthetic debugger are required by KDNet, but
28
+ * they are not documented in the Hyper-V TLFS because the synthetic debugger
29
+ * functionality has been deprecated and is subject to removal in future
30
+ * versions of Windows.
31
+ */
32
+#define HYPERV_CPUID_SYNDBG_VENDOR_AND_MAX_FUNCTIONS 0x40000080
33
+#define HYPERV_CPUID_SYNDBG_INTERFACE 0x40000081
34
+#define HYPERV_CPUID_SYNDBG_PLATFORM_CAPABILITIES 0x40000082
35
+
36
+/*
37
+ * Hyper-V synthetic debugger platform capabilities
38
+ * These are HYPERV_CPUID_SYNDBG_PLATFORM_CAPABILITIES.EAX bits.
39
+ */
40
+#define HV_X64_SYNDBG_CAP_ALLOW_KERNEL_DEBUGGING BIT(1)
41
+
42
+/* Hyper-V Synthetic debug options MSR */
43
+#define HV_X64_MSR_SYNDBG_CONTROL 0x400000F1
44
+#define HV_X64_MSR_SYNDBG_STATUS 0x400000F2
45
+#define HV_X64_MSR_SYNDBG_SEND_BUFFER 0x400000F3
46
+#define HV_X64_MSR_SYNDBG_RECV_BUFFER 0x400000F4
47
+#define HV_X64_MSR_SYNDBG_PENDING_BUFFER 0x400000F5
48
+#define HV_X64_MSR_SYNDBG_OPTIONS 0x400000FF
49
+
50
+/* Hyper-V HV_X64_MSR_SYNDBG_OPTIONS bits */
51
+#define HV_X64_SYNDBG_OPTION_USE_HCALLS BIT(2)
2652
2753 static inline struct kvm_vcpu_hv *vcpu_to_hv_vcpu(struct kvm_vcpu *vcpu)
2854 {
....@@ -45,6 +71,11 @@
4571 static inline struct kvm_vcpu *synic_to_vcpu(struct kvm_vcpu_hv_synic *synic)
4672 {
4773 return hv_vcpu_to_vcpu(container_of(synic, struct kvm_vcpu_hv, synic));
74
+}
75
+
76
+static inline struct kvm_hv_syndbg *vcpu_to_hv_syndbg(struct kvm_vcpu *vcpu)
77
+{
78
+ return &vcpu->kvm->arch.hyperv.hv_syndbg;
4879 }
4980
5081 int kvm_hv_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data, bool host);
....@@ -95,5 +126,7 @@
95126 void kvm_hv_init_vm(struct kvm *kvm);
96127 void kvm_hv_destroy_vm(struct kvm *kvm);
97128 int kvm_vm_ioctl_hv_eventfd(struct kvm *kvm, struct kvm_hyperv_eventfd *args);
129
+int kvm_vcpu_ioctl_get_hv_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid2 *cpuid,
130
+ struct kvm_cpuid_entry2 __user *entries);
98131
99132 #endif