git: 7fb152d22935 - main - arm64: Sync icache when creating executable superpage mappings
Alan Cox
alc at FreeBSD.org
Thu Jul 15 22:35:39 UTC 2021
The branch main has been updated by alc:
URL: https://cgit.FreeBSD.org/src/commit/?id=7fb152d22935e014afcad4ddc0b3a7e3c2795762
commit 7fb152d22935e014afcad4ddc0b3a7e3c2795762
Author: Alan Cox <alc at FreeBSD.org>
AuthorDate: 2021-07-14 17:59:49 +0000
Commit: Alan Cox <alc at FreeBSD.org>
CommitDate: 2021-07-15 22:34:54 +0000
arm64: Sync icache when creating executable superpage mappings
Reviewed by: andrew, kib, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31181
---
sys/arm64/arm64/pmap.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
index 190b56285e76..13941f4f61ea 100644
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -4041,7 +4041,7 @@ pmap_enter_2mpage(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot,
if (pmap != kernel_pmap)
new_l2 |= ATTR_S1_nG;
return (pmap_enter_l2(pmap, va, new_l2, PMAP_ENTER_NOSLEEP |
- PMAP_ENTER_NOREPLACE | PMAP_ENTER_NORECLAIM, NULL, lockp) ==
+ PMAP_ENTER_NOREPLACE | PMAP_ENTER_NORECLAIM, m, lockp) ==
KERN_SUCCESS);
}
@@ -4071,8 +4071,6 @@ pmap_every_pte_zero(vm_paddr_t pa)
* KERN_RESOURCE_SHORTAGE if PMAP_ENTER_NOSLEEP was specified and a page table
* page allocation failed. Returns KERN_RESOURCE_SHORTAGE if
* PMAP_ENTER_NORECLAIM was specified and a PV entry allocation failed.
- *
- * The parameter "m" is only used when creating a managed, writeable mapping.
*/
static int
pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t new_l2, u_int flags,
@@ -4159,6 +4157,16 @@ pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t new_l2, u_int flags,
pmap->pm_stats.wired_count += L2_SIZE / PAGE_SIZE;
pmap->pm_stats.resident_count += L2_SIZE / PAGE_SIZE;
+ /*
+ * Conditionally sync the icache. See pmap_enter() for details.
+ */
+ if ((new_l2 & ATTR_S1_XN) == 0 && ((new_l2 & ~ATTR_MASK) !=
+ (old_l2 & ~ATTR_MASK) || (old_l2 & ATTR_S1_XN) != 0) &&
+ pmap != kernel_pmap && m->md.pv_memattr == VM_MEMATTR_WRITE_BACK) {
+ cpu_icache_sync_range(PHYS_TO_DMAP(new_l2 & ~ATTR_MASK),
+ L2_SIZE);
+ }
+
/*
* Map the superpage.
*/
More information about the dev-commits-src-all
mailing list