summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2013-12-20 05:50:22 +0000
committerneel <neel@FreeBSD.org>2013-12-20 05:50:22 +0000
commitfffd41bbf1fffc5ae361c92987e9a90d48e3b220 (patch)
tree58e1d7f971a16cfc3b5e94bad1a8d43461219e5d /sys/amd64
parentf572ad7562bc158af1a89c71d22c64633d292ed7 (diff)
downloadFreeBSD-src-fffd41bbf1fffc5ae361c92987e9a90d48e3b220.zip
FreeBSD-src-fffd41bbf1fffc5ae361c92987e9a90d48e3b220.tar.gz
Re-arrange bits in the amd64/pmap 'pm_flags' field.
The least significant 8 bits of 'pm_flags' are now used for the IPI vector to use for nested page table TLB shootdown. Previously we used IPI_AST to interrupt the host cpu which is functionally correct but could lead to misleading interrupt counts for AST handler. The AST handler was also doing a lot more than what is required for the nested page table TLB shootdown (EOI and IRET).
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/pmap.c7
-rw-r--r--sys/amd64/include/pmap.h7
-rw-r--r--sys/amd64/vmm/intel/ept.c3
3 files changed, 10 insertions, 7 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index d60cbd1..014020b 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -1295,6 +1295,7 @@ pmap_invalidate_page_pcid(pmap_t pmap, vm_offset_t va)
static __inline void
pmap_invalidate_ept(pmap_t pmap)
{
+ int ipinum;
sched_pin();
KASSERT(!CPU_ISSET(curcpu, &pmap->pm_active),
@@ -1319,11 +1320,9 @@ pmap_invalidate_ept(pmap_t pmap)
/*
* Force the vcpu to exit and trap back into the hypervisor.
- *
- * XXX this is not optimal because IPI_AST builds a trapframe
- * whereas all we need is an 'eoi' followed by 'iret'.
*/
- ipi_selected(pmap->pm_active, IPI_AST);
+ ipinum = pmap->pm_flags & PMAP_NESTED_IPIMASK;
+ ipi_selected(pmap->pm_active, ipinum);
sched_unpin();
}
diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h
index 01de629..3918282 100644
--- a/sys/amd64/include/pmap.h
+++ b/sys/amd64/include/pmap.h
@@ -312,9 +312,10 @@ struct pmap {
};
/* flags */
-#define PMAP_PDE_SUPERPAGE (1 << 0) /* supports 2MB superpages */
-#define PMAP_EMULATE_AD_BITS (1 << 1) /* needs A/D bits emulation */
-#define PMAP_SUPPORTS_EXEC_ONLY (1 << 2) /* execute only mappings ok */
+#define PMAP_NESTED_IPIMASK 0xff
+#define PMAP_PDE_SUPERPAGE (1 << 8) /* supports 2MB superpages */
+#define PMAP_EMULATE_AD_BITS (1 << 9) /* needs A/D bits emulation */
+#define PMAP_SUPPORTS_EXEC_ONLY (1 << 10) /* execute only mappings ok */
typedef struct pmap *pmap_t;
diff --git a/sys/amd64/vmm/intel/ept.c b/sys/amd64/vmm/intel/ept.c
index 18e90f3..d68b7f9 100644
--- a/sys/amd64/vmm/intel/ept.c
+++ b/sys/amd64/vmm/intel/ept.c
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include <machine/vmm.h>
#include "vmx_cpufunc.h"
+#include "vmm_ipi.h"
#include "vmx_msr.h"
#include "ept.h"
@@ -98,6 +99,8 @@ ept_init(void)
!INVEPT_ALL_TYPES_SUPPORTED(cap))
return (EINVAL);
+ ept_pmap_flags = vmm_ipinum & PMAP_NESTED_IPIMASK;
+
use_superpages = 1;
TUNABLE_INT_FETCH("hw.vmm.ept.use_superpages", &use_superpages);
if (use_superpages && EPT_PDE_SUPERPAGE(cap))
OpenPOWER on IntegriCloud