summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2021-10-26 14:13:58 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2021-10-26 14:13:58 +0000
commit5891dec48ad1bcd01e584f6213df4e0749505a61 (patch)
tree3c921f65d322a1d405e0be490e3ee9cff7e0f090 /sys/arch
parent371fb6b46a880410f8e2ed0c620f70b00a107c4d (diff)
Only flush freshly mapped uncached/device mappings if we have a vm_page for it,
meaning we make sure it is indeed managed memory/RAM and not some MMIO. Fixes booting on VMware Fusion (and an older QEMU diff for HVF acceleration). ok kettenis@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/arm64/arm64/pmap.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/arch/arm64/arm64/pmap.c b/sys/arch/arm64/arm64/pmap.c
index 688ae5d05c4..a34968e2848 100644
--- a/sys/arch/arm64/arm64/pmap.c
+++ b/sys/arch/arm64/arm64/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.81 2021/09/14 16:18:57 kettenis Exp $ */
+/* $OpenBSD: pmap.c,v 1.82 2021/10/26 14:13:57 patrick Exp $ */
/*
* Copyright (c) 2008-2009,2014-2016 Dale Rahn <drahn@dalerahn.com>
*
@@ -724,6 +724,7 @@ _pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot, int flags, int cache)
{
pmap_t pm = pmap_kernel();
struct pte_desc *pted;
+ struct vm_page *pg;
pted = pmap_vp_lookup(pm, va, NULL);
@@ -746,7 +747,9 @@ _pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot, int flags, int cache)
pmap_pte_insert(pted);
ttlb_flush(pm, va & ~PAGE_MASK);
- if (cache == PMAP_CACHE_CI || cache == PMAP_CACHE_DEV_NGNRNE)
+
+ pg = PHYS_TO_VM_PAGE(pted->pted_pte & PTE_RPGN);
+ if (pg && (cache == PMAP_CACHE_CI || cache == PMAP_CACHE_DEV_NGNRNE))
cpu_idcache_wbinv_range(va & ~PAGE_MASK, PAGE_SIZE);
}