The branch main has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=6a5f3834108a779070efbabbac2689373a6705c1

commit 6a5f3834108a779070efbabbac2689373a6705c1
Author:     Osvaldo Janeri Filho <[email protected]>
AuthorDate: 2026-12-04 13:10:52 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2026-12-04 19:21:43 +0000

    vmm/svm: force new ASID on eptgen-only invalidation when flush-by-asid is 
insufficient
    
    On AMD SVM hosts with flush-by-asid, svm_pmap_activate() handles an
    eptgen-only change with TLB_FLUSH_GUEST on the same ASID -- insufficient
    to evict cached NPT-walk state for a GPA with no prior translation of
    the faulting access type. Guest takes the same #NPF forever (e.g. bhyve
    UEFI bootrom never gets past the reset vector). Force a new ASID
    allocation here too, same as the existing asidgen-mismatch path. No
    change on hosts without flush-by-asid, no effect on Intel EPT. Costs an
    extra ASID (and possibly a full flush on rollover) per eptgen bump, not
    just for this case -- not benchmarked.
    
    Reviewed by:    kib
    Sponsored by:   Advanced Micro Devices, Inc.
    Signed-off-by: Osvaldo Janeri Filho <[email protected]>
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D61226
---
 sys/amd64/vmm/amd/svm.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/sys/amd64/vmm/amd/svm.c b/sys/amd64/vmm/amd/svm.c
index 1fd266e658bc..aee0b092c46b 100644
--- a/sys/amd64/vmm/amd/svm.c
+++ b/sys/amd64/vmm/amd/svm.c
@@ -1996,10 +1996,13 @@ svm_pmap_activate(struct svm_vcpu *vcpu, pmap_t pmap)
        if (vcpu->asid.gen != asid[cpu].gen) {
                alloc_asid = true;      /* (c) and (d) */
        } else if (vcpu->eptgen != eptgen) {
-               if (flush_by_asid())
-                       ctrl->tlb_ctrl = VMCB_TLB_FLUSH_GUEST;  /* (b1) */
-               else
-                       alloc_asid = true;                      /* (b2) */
+               /*
+                * flush-by-asid doesn't reliably evict cached NPT walk
+                * state for addresses with no prior translation (e.g.
+                * bhyve UEFI bootrom execute faults); force a new ASID
+                * instead, as in the asidgen-mismatch case above.
+                */
+               alloc_asid = true;
        } else {
                /*
                 * This is the common case (a).

Reply via email to