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
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;

_______________________________________________
freebsd-virtualization@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"

Reply via email to