git: 8970a9f2ef78 - main - powerpc/radix: synchronize temporary kernel mappings

From: Minsoo Choo <mchoo_at_FreeBSD.org>
Date: Mon, 28 Sep 2026 15:44:02 UTC
The branch main has been updated by mchoo:

URL: https://cgit.FreeBSD.org/src/commit/?id=8970a9f2ef781ab4f7d3fa446f7c6ac5eda26cc0

commit 8970a9f2ef781ab4f7d3fa446f7c6ac5eda26cc0
Author:     Minsoo Choo <mchoo@FreeBSD.org>
AuthorDate: 2026-09-16 15:33:52 +0000
Commit:     Minsoo Choo <mchoo@FreeBSD.org>
CommitDate: 2026-09-28 15:41:31 +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
---
 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 5a249c18c511..772a3d4bc835 100644
--- a/sys/powerpc/aim/mmu_radix.c
+++ b/sys/powerpc/aim/mmu_radix.c
@@ -931,6 +931,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
@@ -6147,6 +6148,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
@@ -6158,6 +6160,7 @@ mmu_radix_kremove(vm_offset_t va)
 
 	pte = kvtopte(va);
 	pte_clear(pte);
+	pmap_invalidate_page(kernel_pmap, va);
 }
 
 int