From: dv Date: Wed, 2 Oct 2024 18:18:27 +0000 (+0000) Subject: amd64: implement a pmap_shootept() for non-MP kernels. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=67e4adbbdf0eff47ba3a8c6e928b43ff03ad8244;p=openbsd amd64: implement a pmap_shootept() for non-MP kernels. Simplifies some of the recent INVEPT changes and mirrors the design of other pmap tlb shootdown functions that provide simplified non-MP implementations. ok mlarkin@ --- diff --git a/sys/arch/amd64/amd64/pmap.c b/sys/arch/amd64/amd64/pmap.c index ceef0b25bbd..35af9d10cdc 100644 --- a/sys/arch/amd64/amd64/pmap.c +++ b/sys/arch/amd64/amd64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.176 2024/09/26 21:55:42 dv Exp $ */ +/* $OpenBSD: pmap.c,v 1.177 2024/10/02 18:18:27 dv Exp $ */ /* $NetBSD: pmap.c,v 1.3 2003/05/08 18:13:13 thorpej Exp $ */ /* @@ -2468,9 +2468,7 @@ pmap_remove_ept(struct pmap *pmap, vaddr_t sgpa, vaddr_t egpa) for (v = sgpa; v < egpa + PAGE_SIZE; v += PAGE_SIZE) pmap_do_remove_ept(pmap, v); -#ifdef MULTIPROCESSOR pmap_shootept(pmap, 1); -#endif /* MULTIPROCESSOR */ mtx_leave(&pmap->pm_mtx); @@ -3518,4 +3516,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 */