summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2024-07-03 21:04:05 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2024-07-03 21:04:05 +0000
commit19a9fa439c647e78d772db8214de33b3b041df13 (patch)
tree0703dd3fcf546a12608d1b3e636e80ad713d0dc8 /sys/arch
parent8d92a043b0c46a73c7557ffdccd9b0010be7e9a5 (diff)
Map BUS_SPACE_MAP_PREFETCHABLE to Normal-NC. There are other memory
attributes that could map to what we call write-combining on x86, but this is what Linux uses. This speeds up framebuffer access significantly. ok patrick@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/arm64/arm64/machdep.c9
-rw-r--r--sys/arch/arm64/dev/arm64_bus_space.c4
2 files changed, 9 insertions, 4 deletions
diff --git a/sys/arch/arm64/arm64/machdep.c b/sys/arch/arm64/arm64/machdep.c
index 98437f72c2f..7b53ee1f446 100644
--- a/sys/arch/arm64/arm64/machdep.c
+++ b/sys/arch/arm64/arm64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.89 2024/04/29 13:01:54 jsg Exp $ */
+/* $OpenBSD: machdep.c,v 1.90 2024/07/03 21:04:04 kettenis Exp $ */
/*
* Copyright (c) 2014 Patrick Wildt <patrick@blueri.se>
* Copyright (c) 2021 Mark Kettenis <kettenis@openbsd.org>
@@ -1170,6 +1170,10 @@ pmap_bootstrap_bs_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size,
{
u_long startpa, pa, endpa;
vaddr_t va;
+ int cache = PMAP_CACHE_DEV_NGNRNE;
+
+ if (flags & BUS_SPACE_MAP_PREFETCHABLE)
+ cache = PMAP_CACHE_CI;
va = virtual_avail; /* steal memory from virtual avail. */
@@ -1179,8 +1183,7 @@ pmap_bootstrap_bs_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size,
*bshp = (bus_space_handle_t)(va + (bpa - startpa));
for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE)
- pmap_kenter_cache(va, pa, PROT_READ | PROT_WRITE,
- PMAP_CACHE_DEV_NGNRNE);
+ pmap_kenter_cache(va, pa, PROT_READ | PROT_WRITE, cache);
virtual_avail = va;
diff --git a/sys/arch/arm64/dev/arm64_bus_space.c b/sys/arch/arm64/dev/arm64_bus_space.c
index e4847cbb004..f78905fb47c 100644
--- a/sys/arch/arm64/dev/arm64_bus_space.c
+++ b/sys/arch/arm64/dev/arm64_bus_space.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arm64_bus_space.c,v 1.8 2021/02/16 12:33:22 kettenis Exp $ */
+/* $OpenBSD: arm64_bus_space.c,v 1.9 2024/07/03 21:04:04 kettenis Exp $ */
/*
* Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -195,6 +195,8 @@ generic_space_map(bus_space_tag_t t, bus_addr_t offs, bus_size_t size,
if (flags & BUS_SPACE_MAP_CACHEABLE)
cache = PMAP_CACHE_WB;
+ if (flags & BUS_SPACE_MAP_PREFETCHABLE)
+ cache = PMAP_CACHE_CI;
if (flags & BUS_SPACE_MAP_POSTED)
cache = PMAP_CACHE_DEV_NGNRE;