git: 682c00a6ce2f - main - riscv: Implement pmap_mapdev_attr
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 17 Oct 2021 14:37:37 UTC
The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=682c00a6ce2f3870e9c698b283ee2b2a56c28c0b commit 682c00a6ce2f3870e9c698b283ee2b2a56c28c0b Author: Jessica Clarke <jrtc27@FreeBSD.org> AuthorDate: 2021-10-17 14:31:35 +0000 Commit: Jessica Clarke <jrtc27@FreeBSD.org> CommitDate: 2021-10-17 14:31:35 +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 --- 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 0918325c13fb..292b1c2f6b3f 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.