git: 4017abda6551 - stable/14 - powerpc/radix: synchronize temporary kernel mappings

From: Minsoo Choo <mchoo_at_FreeBSD.org>
Date: Mon, 12 Oct 2026 04:00:58 UTC
The branch stable/14 has been updated by mchoo:

URL: https://cgit.FreeBSD.org/src/commit/?id=4017abda65518722ae56ac7c2f01c1f302e316aa

commit 4017abda65518722ae56ac7c2f01c1f302e316aa
Author:     Minsoo Choo <mchoo@FreeBSD.org>
AuthorDate: 2026-09-16 15:33:52 +0000
Commit:     Minsoo Choo <mchoo@FreeBSD.org>
CommitDate: 2026-10-12 04:00:10 +0000

    powerpc/radix: synchronize temporary kernel mappings
    
    The radix kremove implementation cleared a kernel PTE without
    invalidating its TLB entry.  Reusing crashdumpmap could therefore keep
    accessing an old physical page, causing minidumps to contain repeated
    stale page contents.
    
    Invalidate the removed kernel mapping and synchronize newly installed
    kernel PTEs before they are accessed.
    
    Reviewed by:    jhibbits
    Approved by:    olce (mentor)
    Fixes:          65bbba25d214 ("powerpc64: Implement Radix MMU for POWER9 CPUs")
    MFC after:      2 weeks
    Sponsored by:   FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D59728
    
    (cherry picked from commit 8970a9f2ef781ab4f7d3fa446f7c6ac5eda26cc0)
---
 sys/powerpc/aim/mmu_radix.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c
index 519663930cba..f18e8259bef7 100644
--- a/sys/powerpc/aim/mmu_radix.c
+++ b/sys/powerpc/aim/mmu_radix.c
@@ -921,6 +921,7 @@ mmu_radix_kenter(vm_offset_t va, vm_paddr_t pa)
 	MPASS(pte != NULL);
 	*pte = htobe64(pa | RPTE_VALID | RPTE_LEAF | RPTE_EAA_R | \
 	    RPTE_EAA_W | RPTE_EAA_P | PG_M | PG_A);
+	ptesync();
 }
 
 bool
@@ -6092,6 +6093,7 @@ mmu_radix_kenter_attr(vm_offset_t va, vm_paddr_t pa, vm_memattr_t ma)
 	pteval = pa | RPTE_EAA_R | RPTE_EAA_W | RPTE_EAA_P | PG_M | PG_A;
 	cache_bits = mmu_radix_calc_wimg(pa, ma);
 	pte_store(pte, pteval | cache_bits);
+	ptesync();
 }
 
 void
@@ -6103,6 +6105,7 @@ mmu_radix_kremove(vm_offset_t va)
 
 	pte = kvtopte(va);
 	pte_clear(pte);
+	pmap_invalidate_page(kernel_pmap, va);
 }
 
 int