Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/nvmm When the identification fails, print the reason.



details:   https://anonhg.NetBSD.org/src/rev/c58f6cd4c1dd
branches:  trunk
changeset: 931797:c58f6cd4c1dd
user:      maxv <maxv%NetBSD.org@localhost>
date:      Thu Apr 30 16:50:17 2020 +0000

description:
When the identification fails, print the reason.

diffstat:

 sys/dev/nvmm/nvmm.c             |   6 +++---
 sys/dev/nvmm/x86/nvmm_x86_svm.c |   9 +++++++--
 sys/dev/nvmm/x86/nvmm_x86_vmx.c |  19 +++++++++++++++++--
 3 files changed, 27 insertions(+), 7 deletions(-)

diffs (197 lines):

diff -r bf7eeff8c027 -r c58f6cd4c1dd sys/dev/nvmm/nvmm.c
--- a/sys/dev/nvmm/nvmm.c       Thu Apr 30 16:50:00 2020 +0000
+++ b/sys/dev/nvmm/nvmm.c       Thu Apr 30 16:50:17 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvmm.c,v 1.26 2020/04/26 19:31:36 maxv Exp $   */
+/*     $NetBSD: nvmm.c,v 1.27 2020/04/30 16:50:17 maxv Exp $   */
 
 /*
  * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvmm.c,v 1.26 2020/04/26 19:31:36 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm.c,v 1.27 2020/04/30 16:50:17 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -961,7 +961,7 @@
                break;
        }
        if (nvmm_impl == NULL) {
-               printf("[!] No implementation found\n");
+               printf("NVMM: CPU not supported\n");
                return ENOTSUP;
        }
 
diff -r bf7eeff8c027 -r c58f6cd4c1dd sys/dev/nvmm/x86/nvmm_x86_svm.c
--- a/sys/dev/nvmm/x86/nvmm_x86_svm.c   Thu Apr 30 16:50:00 2020 +0000
+++ b/sys/dev/nvmm/x86/nvmm_x86_svm.c   Thu Apr 30 16:50:17 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvmm_x86_svm.c,v 1.58 2020/03/22 00:16:16 ad Exp $     */
+/*     $NetBSD: nvmm_x86_svm.c,v 1.59 2020/04/30 16:50:17 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.58 2020/03/22 00:16:16 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.59 2020/04/30 16:50:17 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -2257,21 +2257,25 @@
                return false;
        }
        if (!(cpu_feature[3] & CPUID_SVM)) {
+               printf("NVMM: SVM not supported\n");
                return false;
        }
 
        if (curcpu()->ci_max_ext_cpuid < 0x8000000a) {
+               printf("NVMM: CPUID leaf not available\n");
                return false;
        }
        x86_cpuid(0x8000000a, descs);
 
        /* Want Nested Paging. */
        if (!(descs[3] & CPUID_AMD_SVM_NP)) {
+               printf("NVMM: SVM-NP not supported\n");
                return false;
        }
 
        /* Want nRIP. */
        if (!(descs[3] & CPUID_AMD_SVM_NRIPS)) {
+               printf("NVMM: SVM-NRIPS not supported\n");
                return false;
        }
 
@@ -2279,6 +2283,7 @@
 
        msr = rdmsr(MSR_VMCR);
        if ((msr & VMCR_SVMED) && (msr & VMCR_LOCK)) {
+               printf("NVMM: SVM disabled in BIOS\n");
                return false;
        }
 
diff -r bf7eeff8c027 -r c58f6cd4c1dd sys/dev/nvmm/x86/nvmm_x86_vmx.c
--- a/sys/dev/nvmm/x86/nvmm_x86_vmx.c   Thu Apr 30 16:50:00 2020 +0000
+++ b/sys/dev/nvmm/x86/nvmm_x86_vmx.c   Thu Apr 30 16:50:17 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvmm_x86_vmx.c,v 1.52 2020/03/22 00:16:16 ad Exp $     */
+/*     $NetBSD: nvmm_x86_vmx.c,v 1.53 2020/04/30 16:50:17 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.52 2020/03/22 00:16:16 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx.c,v 1.53 2020/04/30 16:50:17 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -3001,17 +3001,21 @@
 
        msr = rdmsr(MSR_IA32_FEATURE_CONTROL);
        if ((msr & IA32_FEATURE_CONTROL_LOCK) == 0) {
+               printf("NVMM: VMX disabled in BIOS\n");
                return false;
        }
        if ((msr & IA32_FEATURE_CONTROL_OUT_SMX) == 0) {
+               printf("NVMM: VMX disabled in BIOS\n");
                return false;
        }
 
        msr = rdmsr(MSR_IA32_VMX_BASIC);
        if ((msr & IA32_VMX_BASIC_IO_REPORT) == 0) {
+               printf("NVMM: I/O reporting not supported\n");
                return false;
        }
        if (__SHIFTOUT(msr, IA32_VMX_BASIC_MEM_TYPE) != MEM_TYPE_WB) {
+               printf("NVMM: WB memory not supported\n");
                return false;
        }
 
@@ -3020,6 +3024,7 @@
        vmx_cr0_fixed1 = rdmsr(MSR_IA32_VMX_CR0_FIXED1) | (CR0_PG|CR0_PE);
        ret = vmx_check_cr(rcr0(), vmx_cr0_fixed0, vmx_cr0_fixed1);
        if (ret == -1) {
+               printf("NVMM: CR0 requirements not satisfied\n");
                return false;
        }
 
@@ -3027,6 +3032,7 @@
        vmx_cr4_fixed1 = rdmsr(MSR_IA32_VMX_CR4_FIXED1);
        ret = vmx_check_cr(rcr4() | CR4_VMXE, vmx_cr4_fixed0, vmx_cr4_fixed1);
        if (ret == -1) {
+               printf("NVMM: CR4 requirements not satisfied\n");
                return false;
        }
 
@@ -3036,6 +3042,7 @@
            VMX_PINBASED_CTLS_ONE, VMX_PINBASED_CTLS_ZERO,
            &vmx_pinbased_ctls);
        if (ret == -1) {
+               printf("NVMM: pin-based-ctls requirements not satisfied\n");
                return false;
        }
        ret = vmx_init_ctls(
@@ -3043,6 +3050,7 @@
            VMX_PROCBASED_CTLS_ONE, VMX_PROCBASED_CTLS_ZERO,
            &vmx_procbased_ctls);
        if (ret == -1) {
+               printf("NVMM: proc-based-ctls requirements not satisfied\n");
                return false;
        }
        ret = vmx_init_ctls(
@@ -3050,6 +3058,7 @@
            VMX_PROCBASED_CTLS2_ONE, VMX_PROCBASED_CTLS2_ZERO,
            &vmx_procbased_ctls2);
        if (ret == -1) {
+               printf("NVMM: proc-based-ctls2 requirements not satisfied\n");
                return false;
        }
        ret = vmx_check_ctls(
@@ -3063,6 +3072,7 @@
            VMX_ENTRY_CTLS_ONE, VMX_ENTRY_CTLS_ZERO,
            &vmx_entry_ctls);
        if (ret == -1) {
+               printf("NVMM: entry-ctls requirements not satisfied\n");
                return false;
        }
        ret = vmx_init_ctls(
@@ -3070,17 +3080,21 @@
            VMX_EXIT_CTLS_ONE, VMX_EXIT_CTLS_ZERO,
            &vmx_exit_ctls);
        if (ret == -1) {
+               printf("NVMM: exit-ctls requirements not satisfied\n");
                return false;
        }
 
        msr = rdmsr(MSR_IA32_VMX_EPT_VPID_CAP);
        if ((msr & IA32_VMX_EPT_VPID_WALKLENGTH_4) == 0) {
+               printf("NVMM: 4-level page tree not supported\n");
                return false;
        }
        if ((msr & IA32_VMX_EPT_VPID_INVEPT) == 0) {
+               printf("NVMM: INVEPT not supported\n");
                return false;
        }
        if ((msr & IA32_VMX_EPT_VPID_INVVPID) == 0) {
+               printf("NVMM: INVVPID not supported\n");
                return false;
        }
        if ((msr & IA32_VMX_EPT_VPID_FLAGS_AD) != 0) {
@@ -3089,6 +3103,7 @@
                pmap_ept_has_ad = false;
        }
        if (!(msr & IA32_VMX_EPT_VPID_UC) && !(msr & IA32_VMX_EPT_VPID_WB)) {
+               printf("NVMM: EPT UC/WB memory types not supported\n");
                return false;
        }
 



Home | Main Index | Thread Index | Old Index