Date: Thu, 16 May 2019 19:10:49 +0000 (UTC) From: Conrad Meyer <cem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r347888 - in head/sys/mips: include mips Message-ID: <201905161910.x4GJAndf062696@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cem Date: Thu May 16 19:10:48 2019 New Revision: 347888 URL: https://svnweb.freebsd.org/changeset/base/347888 Log: mips: Implement basic pmap_kenter_device, pmap_kremove_device Unbreak mips.BERI_DE4_SDROOT build, which uses device xdma. Device xdma depends on the pmap_kenter_device APIs. Reported by: tinderbox (local) Sponsored by: Dell EMC Isilon Modified: head/sys/mips/include/pmap.h head/sys/mips/mips/pmap.c Modified: head/sys/mips/include/pmap.h ============================================================================== --- head/sys/mips/include/pmap.h Thu May 16 19:09:41 2019 (r347887) +++ head/sys/mips/include/pmap.h Thu May 16 19:10:48 2019 (r347888) @@ -177,7 +177,9 @@ void pmap_unmapdev(vm_offset_t, vm_size_t); vm_offset_t pmap_steal_memory(vm_size_t size); void pmap_kenter(vm_offset_t va, vm_paddr_t pa); void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, vm_memattr_t attr); +void pmap_kenter_device(vm_offset_t, vm_size_t, vm_paddr_t); void pmap_kremove(vm_offset_t va); +void pmap_kremove_device(vm_offset_t, vm_size_t); void *pmap_kenter_temporary(vm_paddr_t pa, int i); void pmap_kenter_temporary_free(vm_paddr_t pa); void pmap_flush_pvcache(vm_page_t m); Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Thu May 16 19:09:41 2019 (r347887) +++ head/sys/mips/mips/pmap.c Thu May 16 19:10:48 2019 (r347888) @@ -854,6 +854,44 @@ pmap_kenter(vm_offset_t va, vm_paddr_t pa) pmap_kenter_attr(va, pa, VM_MEMATTR_DEFAULT); } +void +pmap_kenter_device(vm_offset_t va, vm_size_t size, vm_paddr_t pa) +{ + + KASSERT((size & PAGE_MASK) == 0, + ("%s: device mapping not page-sized", __func__)); + + for (; size > 0; size -= PAGE_SIZE) { + /* + * XXXCEM: this is somewhat inefficient on SMP systems in that + * every single page is individually TLB-invalidated via + * rendezvous (pmap_update_page()), instead of invalidating the + * entire range via a single rendezvous. + */ + pmap_kenter_attr(va, pa, VM_MEMATTR_UNCACHEABLE); + va += PAGE_SIZE; + pa += PAGE_SIZE; + } +} + +void +pmap_kremove_device(vm_offset_t va, vm_size_t size) +{ + + KASSERT((size & PAGE_MASK) == 0, + ("%s: device mapping not page-sized", __func__)); + + /* + * XXXCEM: Similar to pmap_kenter_device, this is inefficient on SMP, + * in that pages are invalidated individually instead of a single range + * rendezvous. + */ + for (; size > 0; size -= PAGE_SIZE) { + pmap_kremove(va); + va += PAGE_SIZE; + } +} + /* * remove a page from the kernel pagetables */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905161910.x4GJAndf062696>