Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Oct 2021 18:54:05 GMT
From:      Jessica Clarke <jrtc27@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: af818612a5d3 - stable/13 - riscv: Implement pmap_mapdev_attr
Message-ID:  <202110241854.19OIs5iV080928@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by jrtc27:

URL: https://cgit.FreeBSD.org/src/commit/?id=af818612a5d3941763b1b0c620b929df89bc6c4d

commit af818612a5d3941763b1b0c620b929df89bc6c4d
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2021-10-17 14:31:35 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2021-10-24 18:51:10 +0000

    riscv: Implement pmap_mapdev_attr
    
    This is needed for LinuxKPI's _ioremap_attr. This reuses the generic
    implementation introduced for aarch64, and itself requires implementing
    pmap_kenter, which is trivial to do given riscv currently treats all
    mapping attributes the same due to the Svpbmt extension not yet being
    ratified and in hardware.
    
    Reviewed by:    markj, mhorne
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D32445
    
    (cherry picked from commit 682c00a6ce2f3870e9c698b283ee2b2a56c28c0b)
---
 sys/kern/subr_devmap.c   | 2 +-
 sys/riscv/include/pmap.h | 2 ++
 sys/riscv/riscv/pmap.c   | 8 +++++++-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/sys/kern/subr_devmap.c b/sys/kern/subr_devmap.c
index 23baceb05129..1c9b192cc4c8 100644
--- a/sys/kern/subr_devmap.c
+++ b/sys/kern/subr_devmap.c
@@ -290,7 +290,7 @@ pmap_mapdev(vm_offset_t pa, vm_size_t size)
 	return ((void *)(va + offset));
 }
 
-#if defined(__aarch64__)
+#if defined(__aarch64__) || defined(__riscv)
 void *
 pmap_mapdev_attr(vm_offset_t pa, vm_size_t size, vm_memattr_t ma)
 {
diff --git a/sys/riscv/include/pmap.h b/sys/riscv/include/pmap.h
index 024bc3743f67..0ef221ed2393 100644
--- a/sys/riscv/include/pmap.h
+++ b/sys/riscv/include/pmap.h
@@ -145,10 +145,12 @@ void	pmap_activate_boot(pmap_t);
 void	pmap_activate_sw(struct thread *);
 void	pmap_bootstrap(vm_offset_t, vm_paddr_t, vm_size_t);
 int	pmap_change_attr(vm_offset_t va, vm_size_t size, int mode);
+void	pmap_kenter(vm_offset_t sva, vm_size_t size, vm_paddr_t pa, int mode);
 void	pmap_kenter_device(vm_offset_t, vm_size_t, vm_paddr_t);
 vm_paddr_t pmap_kextract(vm_offset_t va);
 void	pmap_kremove(vm_offset_t);
 void	pmap_kremove_device(vm_offset_t, vm_size_t);
+void	*pmap_mapdev_attr(vm_offset_t pa, vm_size_t size, vm_memattr_t ma);
 bool	pmap_page_is_mapped(vm_page_t m);
 bool	pmap_ps_enabled(pmap_t);
 
diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c
index eab61032fbcb..06bb19fb5f24 100644
--- a/sys/riscv/riscv/pmap.c
+++ b/sys/riscv/riscv/pmap.c
@@ -916,7 +916,7 @@ pmap_kextract(vm_offset_t va)
  ***************************************************/
 
 void
-pmap_kenter_device(vm_offset_t sva, vm_size_t size, vm_paddr_t pa)
+pmap_kenter(vm_offset_t sva, vm_size_t size, vm_paddr_t pa, int mode __unused)
 {
 	pt_entry_t entry;
 	pt_entry_t *l3;
@@ -947,6 +947,12 @@ pmap_kenter_device(vm_offset_t sva, vm_size_t size, vm_paddr_t pa)
 	pmap_invalidate_range(kernel_pmap, sva, va);
 }
 
+void
+pmap_kenter_device(vm_offset_t sva, vm_size_t size, vm_paddr_t pa)
+{
+	pmap_kenter(sva, size, pa, VM_MEMATTR_DEVICE);
+}
+
 /*
  * Remove a page from the kernel pagetables.
  * Note: not SMP coherent.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202110241854.19OIs5iV080928>