[PATCH 1/7] mm: rust: add pgprot_noncached helper
From: Deborah Brouwer
Date: Thu May 07 2026 - 19:33:56 EST
From: Daniel Almeida <daniel.almeida@xxxxxxxxxxxxx>
Expose pgprot_noncached() to Rust code through a small helper wrapper.
Rust drivers that insert raw PFN mappings into userspace MMIO VMAs need
to derive an appropriate non-cached pgprot before calling helpers such
as vmf_insert_pfn_prot(). pgprot_noncached() is currently inaccessible
from Rust because it is provided through C helpers/macros rather than a
normal exported symbol.
Add a Rust helper wrapper so Rust MMIO mmap paths can construct
non-cached page protections for device mappings.
Signed-off-by: Daniel Almeida <daniel.almeida@xxxxxxxxxxxxx>
Signed-off-by: Deborah Brouwer <deborah.brouwer@xxxxxxxxxxxxx>
---
rust/helpers/mm.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/rust/helpers/mm.c b/rust/helpers/mm.c
index b5540997bd20..22194d3196d2 100644
--- a/rust/helpers/mm.c
+++ b/rust/helpers/mm.c
@@ -48,3 +48,8 @@ __rust_helper void rust_helper_vma_end_read(struct vm_area_struct *vma)
{
vma_end_read(vma);
}
+
+__rust_helper pgprot_t rust_helper_pgprot_noncached(pgprot_t prot)
+{
+ return pgprot_noncached(prot);
+}
--
2.53.0