git: 75734a4b6d0b - main - md: Map preloaded images with pmap_mapdev_attr()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 12 Nov 2026 09:46:27 UTC
The branch main has been updated by olivier:
URL: https://cgit.FreeBSD.org/src/commit/?id=75734a4b6d0b89820ca17a10991edcea86867102
commit 75734a4b6d0b89820ca17a10991edcea86867102
Author: Olivier Cochard <olivier@FreeBSD.org>
AuthorDate: 2026-11-08 22:25:56 +0000
Commit: Olivier Cochard <olivier@FreeBSD.org>
CommitDate: 2026-11-12 09:41:40 +0000
md: Map preloaded images with pmap_mapdev_attr()
pmap_map() only works for memory the kernel already maps. A ram disk the loader
places in reserved memory may lie outside the direct map, and some platforms
have no direct map.
Reviewed by: imp
Approved by: imp
Sponsored by: Netflix
Differential Revision: https://ron-dev.freebsd.org/FreeBSD/src/pulls/101
---
sys/dev/md/md.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c
index 5fec3181aaff..f29490d12b85 100644
--- a/sys/dev/md/md.c
+++ b/sys/dev/md/md.c
@@ -2131,7 +2131,12 @@ g_md_init(struct g_class *mp __unused)
(long *) &paddr) != 0 ||
resource_int_value("md", i, "len", &len) != 0)
break;
- ptr = pmap_map(NULL, paddr, paddr + len, VM_PROT_READ);
+ /*
+ * Map the memory into the kernel pmap, if not already present.
+ * Some RamDisks reside in reserved memory without mappings, so
+ * a simple pmap_map() won't always work.
+ */
+ ptr = pmap_mapdev_attr(paddr, len, VM_MEMATTR_DEFAULT);
if (ptr != NULL && len != 0) {
sprintf(scratch, "preload%d 0x%016jx", i,
(uintmax_t)paddr);