From owner-svn-src-projects@FreeBSD.ORG Sun Sep 22 02:14:55 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 84754E60; Sun, 22 Sep 2013 02:14:55 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7243A2457; Sun, 22 Sep 2013 02:14:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8M2Et1o038580; Sun, 22 Sep 2013 02:14:55 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8M2EtgO038579; Sun, 22 Sep 2013 02:14:55 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201309220214.r8M2EtgO038579@svn.freebsd.org> From: Neel Natu Date: Sun, 22 Sep 2013 02:14:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r255782 - projects/bhyve_npt_pmap/sys/amd64/vmm/intel X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Sep 2013 02:14:55 -0000 Author: neel Date: Sun Sep 22 02:14:54 2013 New Revision: 255782 URL: http://svnweb.freebsd.org/changeset/base/255782 Log: Add a tunable "hw.vmm.ept.use_superpages" to allow superpages to be disabled for EPT mappings. Add a sysctl "hw.vmm.ept.pmap_flags" to display the flags used for PT_EPT type of pmaps. Modified: projects/bhyve_npt_pmap/sys/amd64/vmm/intel/ept.c Modified: projects/bhyve_npt_pmap/sys/amd64/vmm/intel/ept.c ============================================================================== --- projects/bhyve_npt_pmap/sys/amd64/vmm/intel/ept.c Sun Sep 22 00:54:22 2013 (r255781) +++ projects/bhyve_npt_pmap/sys/amd64/vmm/intel/ept.c Sun Sep 22 02:14:54 2013 (r255782) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -64,13 +65,19 @@ __FBSDID("$FreeBSD$"); #define EPT_PWLEVELS 4 /* page walk levels */ #define EPT_ENABLE_AD_BITS (1 << 6) -static int ept_pmap_flags; +SYSCTL_DECL(_hw_vmm); +SYSCTL_NODE(_hw_vmm, OID_AUTO, ept, CTLFLAG_RW, NULL, NULL); + static int ept_enable_ad_bits; +static int ept_pmap_flags; +SYSCTL_INT(_hw_vmm_ept, OID_AUTO, pmap_flags, CTLFLAG_RD, + &ept_pmap_flags, 0, NULL); + int ept_init(void) { - int use_hw_ad_bits; + int use_hw_ad_bits, use_superpages; uint64_t cap; cap = rdmsr(MSR_VMX_EPT_VPID_CAP); @@ -90,11 +97,13 @@ ept_init(void) !INVEPT_ALL_TYPES_SUPPORTED(cap)) return (EINVAL); - if (EPT_PDE_SUPERPAGE(cap)) + use_superpages = 1; + TUNABLE_INT_FETCH("hw.vmm.ept.use_superpages", &use_superpages); + if (use_superpages && EPT_PDE_SUPERPAGE(cap)) ept_pmap_flags |= PMAP_PDE_SUPERPAGE; /* 2MB superpage */ use_hw_ad_bits = 1; - TUNABLE_INT_FETCH("vmx.ept.use_hw_ad_bits", &use_hw_ad_bits); + TUNABLE_INT_FETCH("hw.vmm.ept.use_hw_ad_bits", &use_hw_ad_bits); if (use_hw_ad_bits && AD_BITS_SUPPORTED(cap)) ept_enable_ad_bits = 1; else