Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Apr 2017 00:27:36 +0000
From:      "jan.dakinevich_gmail.com (Jan Dakinevich)" <phabric-noreply@FreeBSD.org>
To:        freebsd-virtualization@freebsd.org
Subject:   [Differential] D10540: vmx: explicit checking for necessary invvpid/invept types
Message-ID:  <differential-rev-PHID-DREV-dvcgq67pzsk2bfph2tq5-req@FreeBSD.org>

index | next in thread | raw e-mail

[-- Attachment #1 --]
jan.dakinevich_gmail.com created this revision.
Herald added a subscriber: imp.

REVISION SUMMARY
  Currently, during EPT initialization it is checked that invvpid
  instruction supports all possible invalidation types, however only two
  of them are used (single context and all contexts invalidations).
  
  Checking for invept invalidation types is adjusted for code consistency.

REPOSITORY
  rS FreeBSD src repository

REVISION DETAIL
  https://reviews.freebsd.org/D10540

AFFECTED FILES
  sys/amd64/vmm/intel/ept.c

EMAIL PREFERENCES
  https://reviews.freebsd.org/settings/panel/emailpreferences/

To: jan.dakinevich_gmail.com, grehan, neel
Cc: imp, freebsd-virtualization-list

[-- Attachment #2 --]
diff --git a/sys/amd64/vmm/intel/ept.c b/sys/amd64/vmm/intel/ept.c
--- a/sys/amd64/vmm/intel/ept.c
+++ b/sys/amd64/vmm/intel/ept.c
@@ -54,13 +54,17 @@
 #define	AD_BITS_SUPPORTED(cap)		((cap) & (1UL << 21))
 #define	INVVPID_SUPPORTED(cap)		((cap) & (1UL << 32))
 
-#define	INVVPID_ALL_TYPES_MASK		0xF0000000000UL
-#define	INVVPID_ALL_TYPES_SUPPORTED(cap)	\
-	(((cap) & INVVPID_ALL_TYPES_MASK) == INVVPID_ALL_TYPES_MASK)
-
-#define	INVEPT_ALL_TYPES_MASK		0x6000000UL
-#define	INVEPT_ALL_TYPES_SUPPORTED(cap)		\
-	(((cap) & INVEPT_ALL_TYPES_MASK) == INVEPT_ALL_TYPES_MASK)
+#define	INVVPID_REQUIRED_TYPES_MASK				\
+	((1UL << (INVVPID_TYPE_SINGLE_CONTEXT + 40)) |	\
+	(1UL << (INVVPID_TYPE_ALL_CONTEXTS + 40)))
+#define	INVVPID_REQUIRED_TYPES_SUPPORTED(cap)	\
+	(((cap) & INVVPID_REQUIRED_TYPES_MASK) == INVVPID_REQUIRED_TYPES_MASK)
+
+#define	INVEPT_REQUIRED_TYPES_MASK			\
+	((1UL << (INVEPT_TYPE_SINGLE_CONTEXT + 24)) |	\
+	(1UL << (INVEPT_TYPE_ALL_CONTEXTS + 24)))
+#define	INVEPT_REQUIRED_TYPES_SUPPORTED(cap)		\
+	(((cap) & INVEPT_REQUIRED_TYPES_MASK) == INVEPT_REQUIRED_TYPES_MASK)
 
 #define	EPT_PWLEVELS		4		/* page walk levels */
 #define	EPT_ENABLE_AD_BITS	(1 << 6)
@@ -86,15 +90,15 @@
 	 * Verify that:
 	 * - page walk length is 4 steps
 	 * - extended page tables can be laid out in write-back memory
-	 * - invvpid instruction with all possible types is supported
-	 * - invept instruction with all possible types is supported
+	 * - invvpid instruction with required types is supported
+	 * - invept instruction with required types is supported
 	 */
 	if (!EPT_PWL4(cap) ||
 	    !EPT_MEMORY_TYPE_WB(cap) ||
 	    !INVVPID_SUPPORTED(cap) ||
-	    !INVVPID_ALL_TYPES_SUPPORTED(cap) ||
+	    !INVVPID_REQUIRED_TYPES_SUPPORTED(cap) ||
 	    !INVEPT_SUPPORTED(cap) ||
-	    !INVEPT_ALL_TYPES_SUPPORTED(cap))
+	    !INVEPT_REQUIRED_TYPES_SUPPORTED(cap))
 		return (EINVAL);
 
 	ept_pmap_flags = ipinum & PMAP_NESTED_IPIMASK;

help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?differential-rev-PHID-DREV-dvcgq67pzsk2bfph2tq5-req>