7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #pragma ident "%Z%%M% %I% %E% SMI"
28
29 /*
30 * Kernel Physical Mapping (kpm) segment driver (segkpm).
31 *
32 * This driver delivers along with the hat_kpm* interfaces an alternative
33 * mechanism for kernel mappings within the 64-bit Solaris operating system,
34 * which allows the mapping of all physical memory into the kernel address
35 * space at once. This is feasible in 64 bit kernels, e.g. for Ultrasparc II
36 * and beyond processors, since the available VA range is much larger than
37 * possible physical memory. Momentarily all physical memory is supported,
38 * that is represented by the list of memory segments (memsegs).
39 *
40 * Segkpm mappings have also very low overhead and large pages are used
41 * (when possible) to minimize the TLB and TSB footprint. It is also
42 * extentable for other than Sparc architectures (e.g. AMD64). Main
43 * advantage is the avoidance of the TLB-shootdown X-calls, which are
44 * normally needed when a kernel (global) mapping has to be removed.
45 *
46 * First example of a kernel facility that uses the segkpm mapping scheme
47 * is seg_map, where it is used as an alternative to hat_memload().
48 * See also hat layer for more information about the hat_kpm* routines.
104 */
105 faultcode_t segkpm_fault(struct hat *hat, struct seg *seg, caddr_t addr,
106 size_t len, enum fault_type type, enum seg_rw rw);
107 static void segkpm_dump(struct seg *);
108 static void segkpm_badop(void);
109 static int segkpm_notsup(void);
110 static int segkpm_capable(struct seg *, segcapability_t);
111
112 #define SEGKPM_BADOP(t) (t(*)())segkpm_badop
113 #define SEGKPM_NOTSUP (int(*)())segkpm_notsup
114
115 static struct seg_ops segkpm_ops = {
116 SEGKPM_BADOP(int), /* dup */
117 SEGKPM_BADOP(int), /* unmap */
118 SEGKPM_BADOP(void), /* free */
119 segkpm_fault,
120 SEGKPM_BADOP(int), /* faulta */
121 SEGKPM_BADOP(int), /* setprot */
122 SEGKPM_BADOP(int), /* checkprot */
123 SEGKPM_BADOP(int), /* kluster */
124 SEGKPM_BADOP(size_t), /* swapout */
125 SEGKPM_BADOP(int), /* sync */
126 SEGKPM_BADOP(size_t), /* incore */
127 SEGKPM_BADOP(int), /* lockop */
128 SEGKPM_BADOP(int), /* getprot */
129 SEGKPM_BADOP(u_offset_t), /* getoffset */
130 SEGKPM_BADOP(int), /* gettype */
131 SEGKPM_BADOP(int), /* getvp */
132 SEGKPM_BADOP(int), /* advise */
133 segkpm_dump, /* dump */
134 SEGKPM_NOTSUP, /* pagelock */
135 SEGKPM_BADOP(int), /* setpgsz */
136 SEGKPM_BADOP(int), /* getmemid */
137 SEGKPM_BADOP(lgrp_mem_policy_info_t *), /* getpolicy */
138 segkpm_capable, /* capable */
139 };
140
141 /*
142 * kpm_pgsz and kpm_pgshft are set by platform layer.
143 */
144 size_t kpm_pgsz; /* kpm page size */
|
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * Kernel Physical Mapping (kpm) segment driver (segkpm).
29 *
30 * This driver delivers along with the hat_kpm* interfaces an alternative
31 * mechanism for kernel mappings within the 64-bit Solaris operating system,
32 * which allows the mapping of all physical memory into the kernel address
33 * space at once. This is feasible in 64 bit kernels, e.g. for Ultrasparc II
34 * and beyond processors, since the available VA range is much larger than
35 * possible physical memory. Momentarily all physical memory is supported,
36 * that is represented by the list of memory segments (memsegs).
37 *
38 * Segkpm mappings have also very low overhead and large pages are used
39 * (when possible) to minimize the TLB and TSB footprint. It is also
40 * extentable for other than Sparc architectures (e.g. AMD64). Main
41 * advantage is the avoidance of the TLB-shootdown X-calls, which are
42 * normally needed when a kernel (global) mapping has to be removed.
43 *
44 * First example of a kernel facility that uses the segkpm mapping scheme
45 * is seg_map, where it is used as an alternative to hat_memload().
46 * See also hat layer for more information about the hat_kpm* routines.
102 */
103 faultcode_t segkpm_fault(struct hat *hat, struct seg *seg, caddr_t addr,
104 size_t len, enum fault_type type, enum seg_rw rw);
105 static void segkpm_dump(struct seg *);
106 static void segkpm_badop(void);
107 static int segkpm_notsup(void);
108 static int segkpm_capable(struct seg *, segcapability_t);
109
110 #define SEGKPM_BADOP(t) (t(*)())segkpm_badop
111 #define SEGKPM_NOTSUP (int(*)())segkpm_notsup
112
113 static struct seg_ops segkpm_ops = {
114 SEGKPM_BADOP(int), /* dup */
115 SEGKPM_BADOP(int), /* unmap */
116 SEGKPM_BADOP(void), /* free */
117 segkpm_fault,
118 SEGKPM_BADOP(int), /* faulta */
119 SEGKPM_BADOP(int), /* setprot */
120 SEGKPM_BADOP(int), /* checkprot */
121 SEGKPM_BADOP(int), /* kluster */
122 SEGKPM_BADOP(int), /* sync */
123 SEGKPM_BADOP(size_t), /* incore */
124 SEGKPM_BADOP(int), /* lockop */
125 SEGKPM_BADOP(int), /* getprot */
126 SEGKPM_BADOP(u_offset_t), /* getoffset */
127 SEGKPM_BADOP(int), /* gettype */
128 SEGKPM_BADOP(int), /* getvp */
129 SEGKPM_BADOP(int), /* advise */
130 segkpm_dump, /* dump */
131 SEGKPM_NOTSUP, /* pagelock */
132 SEGKPM_BADOP(int), /* setpgsz */
133 SEGKPM_BADOP(int), /* getmemid */
134 SEGKPM_BADOP(lgrp_mem_policy_info_t *), /* getpolicy */
135 segkpm_capable, /* capable */
136 };
137
138 /*
139 * kpm_pgsz and kpm_pgshft are set by platform layer.
140 */
141 size_t kpm_pgsz; /* kpm page size */
|