From: kettenis Date: Wed, 3 Jul 2024 21:04:04 +0000 (+0000) Subject: Map BUS_SPACE_MAP_PREFETCHABLE to Normal-NC. There are other memory X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=1b96b3b977dfac01c78cc8d9e321ae6a5015a49f;p=openbsd 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@ --- 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 * Copyright (c) 2021 Mark Kettenis @@ -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;