Index | Thread | Search

From:
Dave Voutila <dv@sisu.io>
Subject:
implement pmap_shootept for non-MULTIPROCESSOR
To:
tech@openbsd.org
Date:
Fri, 27 Sep 2024 13:51:45 -0400

Download raw body.

Thread
Yesterday I committed a quick fix for my breakage of amd64/GENERIC
kernels because of a missing pmap_shootept symbol. This adds in a
simplified non-SMP version similar to how pmap_tlb_shoottlb() is
implemented.

This simplifies a different diff I was about to send today, so I'd
rather land this first before asking for testers of a larger, uglier
diff.

ok?


diffstat 4878470a40918f54d3d6099e01505877832370a9 370d0ec5da6c47b4bd6afbd2c7613b87e93c2466
 M  sys/arch/amd64/amd64/pmap.c  |  18+  2-

1 file changed, 18 insertions(+), 2 deletions(-)

diff 4878470a40918f54d3d6099e01505877832370a9 370d0ec5da6c47b4bd6afbd2c7613b87e93c2466
commit - 4878470a40918f54d3d6099e01505877832370a9
commit + 370d0ec5da6c47b4bd6afbd2c7613b87e93c2466
blob - 7dbe6648b0dfc08784ccf85aefbd64977a5db388
blob + c550a5e99aeb6c938cfcaddd4605f81d642df2d4
--- sys/arch/amd64/amd64/pmap.c
+++ sys/arch/amd64/amd64/pmap.c
@@ -2503,9 +2503,7 @@ pmap_remove_ept(struct pmap *pmap, vaddr_t sgpa, vaddr
 	for (v = sgpa; v < egpa + PAGE_SIZE; v += PAGE_SIZE)
 		pmap_do_remove_ept(pmap, v, &free_pvs);
 
-#ifdef MULTIPROCESSOR
 	pmap_shootept(pmap, 1);
-#endif /* MULTIPROCESSOR */
 
 	mtx_leave(&pmap->pm_mtx);
 	pmap_tlb_shootwait();
@@ -3596,4 +3594,22 @@ pmap_tlb_shoottlb(struct pmap *pm, int shootself)
 		}
 	}
 }
+
+#if NVMM > 0
+void
+pmap_shootept(struct pmap *pm, int shootself)
+{
+	struct cpu_info *self = curcpu();
+	struct vmx_invept_descriptor vid;
+
+	KASSERT(pmap_is_ept(pm));
+
+	if (shootself && (self->ci_flags & CPUF_VMM)) {
+		vid.vid_eptp = pm->eptp;
+		vid.vid_reserved = 0;
+		invept(self->ci_vmm_cap.vcc_vmx.vmx_invept_mode, &vid);
+	}
+}
+#endif /* NVMM > 0 */
+
 #endif /* MULTIPROCESSOR */