xref: /freebsd/share/man/man9/pmap_quick_enter_page.9 (revision 193d9e768ba63fcfb187cfd17f461f7d41345048)
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.\" $FreeBSD$
27.\"
28.Dd August 6, 2015
29.Dt PMAP_QUICK_ENTER_PAGE 9
30.Os
31.Sh NAME
32.Nm pmap_quick_enter_page ,
33.Nm pmap_quick_remove_page
34.Nd manage fast, single-page kernel address space mappings
35.Sh SYNOPSIS
36.In sys/param.h
37.In vm/vm.h
38.In vm/pmap.h
39.Ft vm_offset_t
40.Fn pmap_quick_enter_page "vm_page_t m"
41.Ft void
42.Fn pmap_quick_remove_page "vm_offset_t kva"
43.Sh DESCRIPTION
44The
45.Fn pmap_quick_enter_page
46function accepts a single page
47.Fa m ,
48and enters this page into a preallocated address in kernel virtual
49address (KVA) space.
50This function is intended for temporary mappings that will only
51be used for a very short period, for example a copy operation on
52the page contents.
53.Pp
54The
55.Fn pmap_quick_remove_page
56function removes a mapping previously created by
57.Fn pmap_quick_enter_page
58at
59.Fa kva ,
60making the KVA frame used by
61.Fn pmap_quick_enter_page
62available for reuse.
63.Pp
64On many architectures,
65.Fn pmap_quick_enter_page
66uses a per-CPU pageframe.
67In those cases, it must disable preemption on the local CPU.
68The corresponding call to
69.Fn pmap_quick_remove_page
70then re-enables preemption.
71It is therefore not safe for machine-independent code to sleep
72or perform locking operations while holding these mappings.
73Current implementations only guarantee the availability of a single
74page for the calling thread, so calls to
75.Fn pmap_quick_enter_page
76must not be nested.
77.Pp
78.Fn pmap_quick_enter_page
79and
80.Fn pmap_quick_remove_page
81do not sleep, and
82.Fn pmap_quick_enter_page
83always returns a valid address.
84It is safe to use these functions under all types of locks except spin mutexes.
85It is also safe to use them in all thread contexts except primary interrupt
86context.
87.Pp
88The page
89.Em must
90not be swapped or otherwise reused while the mapping is active.
91It must be either wired or held, or it must belong to an unmanaged
92region such as I/O device memory.
93.Sh RETURN VALUES
94The
95.Fn pmap_quick_enter_page
96function returns the kernel virtual address
97that is mapped to the page
98.Fa m .
99.Sh SEE ALSO
100.Xr pmap 9
101.Sh AUTHORS
102This manual page was written by
103.An Jason A Harmening Aq Mt jah@FreeBSD.org .
104