xref: /freebsd/share/man/man9/pmap_quick_enter_page.9 (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1.\"
2.\" Copyright (c) 2015 Jason A. Harmening <jah@FreeBSD.org>
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.Dd August 6, 2015
27.Dt PMAP_QUICK_ENTER_PAGE 9
28.Os
29.Sh NAME
30.Nm pmap_quick_enter_page ,
31.Nm pmap_quick_remove_page
32.Nd manage fast, single-page kernel address space mappings
33.Sh SYNOPSIS
34.In sys/param.h
35.In vm/vm.h
36.In vm/pmap.h
37.Ft vm_offset_t
38.Fn pmap_quick_enter_page "vm_page_t m"
39.Ft void
40.Fn pmap_quick_remove_page "vm_offset_t kva"
41.Sh DESCRIPTION
42The
43.Fn pmap_quick_enter_page
44function accepts a single page
45.Fa m ,
46and enters this page into a preallocated address in kernel virtual
47address (KVA) space.
48This function is intended for temporary mappings that will only
49be used for a very short period, for example a copy operation on
50the page contents.
51.Pp
52The
53.Fn pmap_quick_remove_page
54function removes a mapping previously created by
55.Fn pmap_quick_enter_page
56at
57.Fa kva ,
58making the KVA frame used by
59.Fn pmap_quick_enter_page
60available for reuse.
61.Pp
62On many architectures,
63.Fn pmap_quick_enter_page
64uses a per-CPU pageframe.
65In those cases, it must disable preemption on the local CPU.
66The corresponding call to
67.Fn pmap_quick_remove_page
68then re-enables preemption.
69It is therefore not safe for machine-independent code to sleep
70or perform locking operations while holding these mappings.
71Current implementations only guarantee the availability of a single
72page for the calling thread, so calls to
73.Fn pmap_quick_enter_page
74must not be nested.
75.Pp
76.Fn pmap_quick_enter_page
77and
78.Fn pmap_quick_remove_page
79do not sleep, and
80.Fn pmap_quick_enter_page
81always returns a valid address.
82It is safe to use these functions under all types of locks except spin mutexes.
83It is also safe to use them in all thread contexts except primary interrupt
84context.
85.Pp
86The page
87.Em must
88not be swapped or otherwise reused while the mapping is active.
89It must be either wired or held, or it must belong to an unmanaged
90region such as I/O device memory.
91.Sh RETURN VALUES
92The
93.Fn pmap_quick_enter_page
94function returns the kernel virtual address
95that is mapped to the page
96.Fa m .
97.Sh SEE ALSO
98.Xr pmap 9
99.Sh AUTHORS
100This manual page was written by
101.An Jason A Harmening Aq Mt jah@FreeBSD.org .
102