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 nvmm-x86-svm: check the SVM revision



details:   https://anonhg.NetBSD.org/src/rev/a7484cde92ff
branches:  trunk
changeset: 943475:a7484cde92ff
user:      maxv <maxv%NetBSD.org@localhost>
date:      Fri Sep 04 17:06:23 2020 +0000

description:
nvmm-x86-svm: check the SVM revision

Only revision 1 exists, but check it, for future-proofness.

diffstat:

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

diffs (31 lines):

diff -r ade867502fd0 -r a7484cde92ff sys/dev/nvmm/x86/nvmm_x86_svm.c
--- a/sys/dev/nvmm/x86/nvmm_x86_svm.c   Fri Sep 04 17:05:39 2020 +0000
+++ b/sys/dev/nvmm/x86/nvmm_x86_svm.c   Fri Sep 04 17:06:23 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvmm_x86_svm.c,v 1.74 2020/08/26 16:33:03 maxv Exp $   */
+/*     $NetBSD: nvmm_x86_svm.c,v 1.75 2020/09/04 17:06:23 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.74 2020/08/26 16:33:03 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.75 2020/09/04 17:06:23 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -2445,6 +2445,12 @@
        }
        x86_cpuid(0x8000000a, descs);
 
+       /* Expect revision 1. */
+       if (__SHIFTOUT(descs[0], CPUID_AMD_SVM_REV) != 1) {
+               printf("NVMM: SVM revision not supported\n");
+               return false;
+       }
+
        /* Want Nested Paging. */
        if (!(descs[3] & CPUID_AMD_SVM_NP)) {
                printf("NVMM: SVM-NP not supported\n");



Home | Main Index | Thread Index | Old Index