Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/nvmm/x86 Respect the convention for the hypervisor i...



details:   https://anonhg.NetBSD.org/src/rev/f8be150ad0f3
branches:  trunk
changeset: 1009976:f8be150ad0f3
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun May 10 06:24:16 2020 +0000

description:
Respect the convention for the hypervisor information: return the highest
hypervisor leaf in 0x40000000.EAX.

diffstat:

 sys/dev/nvmm/x86/nvmm_x86_svm.c |  7 +++++--
 sys/dev/nvmm/x86/nvmm_x86_vmx.c |  7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diffs (70 lines):

diff -r 1081875e94a1 -r f8be150ad0f3 sys/dev/nvmm/x86/nvmm_x86_svm.c
--- a/sys/dev/nvmm/x86/nvmm_x86_svm.c   Sun May 10 02:56:12 2020 +0000
+++ b/sys/dev/nvmm/x86/nvmm_x86_svm.c   Sun May 10 06:24:16 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvmm_x86_svm.c,v 1.60 2020/05/09 16:18:57 maxv Exp $   */
+/*     $NetBSD: nvmm_x86_svm.c,v 1.61 2020/05/10 06:24:16 maxv Exp $   */
 
 /*
  * Copyright (c) 2018-2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.60 2020/05/09 16:18:57 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.61 2020/05/10 06:24:16 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -771,6 +771,8 @@
        vmcb->ctrl.intr &= ~VMCB_CTRL_INTR_SHADOW;
 }
 
+#define SVM_CPUID_MAX_HYPERVISOR       0x40000000
+
 static void
 svm_inkernel_handle_cpuid(struct nvmm_cpu *vcpu, uint64_t eax, uint64_t ecx)
 {
@@ -856,6 +858,7 @@
                break;
 
        case 0x40000000: /* Hypervisor Information */
+               cpudata->vmcb->state.rax = SVM_CPUID_MAX_HYPERVISOR;
                cpudata->gprs[NVMM_X64_GPR_RBX] = 0;
                cpudata->gprs[NVMM_X64_GPR_RCX] = 0;
                cpudata->gprs[NVMM_X64_GPR_RDX] = 0;
diff -r 1081875e94a1 -r f8be150ad0f3 sys/dev/nvmm/x86/nvmm_x86_vmx.c
--- a/sys/dev/nvmm/x86/nvmm_x86_vmx.c   Sun May 10 02:56:12 2020 +0000
+++ b/sys/dev/nvmm/x86/nvmm_x86_vmx.c   Sun May 10 06:24:16 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvmm_x86_vmx.c,v 1.56 2020/05/09 16:18:57 maxv Exp $   */
+/*     $NetBSD: nvmm_x86_vmx.c,v 1.57 2020/05/10 06:24:16 maxv Exp $   */
 
 /*
  * Copyright (c) 2018-2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx.c,v 1.56 2020/05/09 16:18:57 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx.c,v 1.57 2020/05/10 06:24:16 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1137,6 +1137,8 @@
        vmx_exit_invalid(exit, VMCS_EXITCODE_EXC_NMI);
 }
 
+#define VMX_CPUID_MAX_HYPERVISOR       0x40000000
+
 static void
 vmx_inkernel_handle_cpuid(struct nvmm_machine *mach, struct nvmm_cpu *vcpu,
     uint64_t eax, uint64_t ecx)
@@ -1293,6 +1295,7 @@
                break;
 
        case 0x40000000: /* Hypervisor Information */
+               cpudata->gprs[NVMM_X64_GPR_RAX] = VMX_CPUID_MAX_HYPERVISOR;
                cpudata->gprs[NVMM_X64_GPR_RBX] = 0;
                cpudata->gprs[NVMM_X64_GPR_RCX] = 0;
                cpudata->gprs[NVMM_X64_GPR_RDX] = 0;



Home | Main Index | Thread Index | Old Index