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