| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: subr_xcall.c,v 1.21 2018/02/01 03:15:29 ozaki-r Exp $ */ | | 1 | /* $NetBSD: subr_xcall.c,v 1.22 2018/02/03 11:30:01 martin Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2007-2010 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2007-2010 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Andrew Doran and Mindaugas Rasiukevicius. | | 8 | * by Andrew Doran and Mindaugas Rasiukevicius. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -64,27 +64,27 @@ | | | @@ -64,27 +64,27 @@ |
64 | * CPU, and so has exclusive access to the CPU. Since this facility | | 64 | * CPU, and so has exclusive access to the CPU. Since this facility |
65 | * is heavyweight, it's expected that it will not be used often. | | 65 | * is heavyweight, it's expected that it will not be used often. |
66 | * | | 66 | * |
67 | * Cross calls must not allocate memory, as the pagedaemon uses | | 67 | * Cross calls must not allocate memory, as the pagedaemon uses |
68 | * them (and memory allocation may need to wait on the pagedaemon). | | 68 | * them (and memory allocation may need to wait on the pagedaemon). |
69 | * | | 69 | * |
70 | * A low-overhead mechanism for high priority calls (XC_HIGHPRI) is | | 70 | * A low-overhead mechanism for high priority calls (XC_HIGHPRI) is |
71 | * also provided. The function to be executed runs on a software | | 71 | * also provided. The function to be executed runs on a software |
72 | * interrupt context, at IPL_SOFTSERIAL level, and is expected to | | 72 | * interrupt context, at IPL_SOFTSERIAL level, and is expected to |
73 | * be very lightweight, e.g. avoid blocking. | | 73 | * be very lightweight, e.g. avoid blocking. |
74 | */ | | 74 | */ |
75 | | | 75 | |
76 | #include <sys/cdefs.h> | | 76 | #include <sys/cdefs.h> |
77 | __KERNEL_RCSID(0, "$NetBSD: subr_xcall.c,v 1.21 2018/02/01 03:15:29 ozaki-r Exp $"); | | 77 | __KERNEL_RCSID(0, "$NetBSD: subr_xcall.c,v 1.22 2018/02/03 11:30:01 martin Exp $"); |
78 | | | 78 | |
79 | #include <sys/types.h> | | 79 | #include <sys/types.h> |
80 | #include <sys/param.h> | | 80 | #include <sys/param.h> |
81 | #include <sys/xcall.h> | | 81 | #include <sys/xcall.h> |
82 | #include <sys/mutex.h> | | 82 | #include <sys/mutex.h> |
83 | #include <sys/condvar.h> | | 83 | #include <sys/condvar.h> |
84 | #include <sys/evcnt.h> | | 84 | #include <sys/evcnt.h> |
85 | #include <sys/kthread.h> | | 85 | #include <sys/kthread.h> |
86 | #include <sys/cpu.h> | | 86 | #include <sys/cpu.h> |
87 | | | 87 | |
88 | #ifdef _RUMPKERNEL | | 88 | #ifdef _RUMPKERNEL |
89 | #include "rump_private.h" | | 89 | #include "rump_private.h" |
90 | #endif | | 90 | #endif |
| @@ -176,30 +176,34 @@ xc_init(void) | | | @@ -176,30 +176,34 @@ xc_init(void) |
176 | /* | | 176 | /* |
177 | * Encode an IPL to a form that can be embedded into flags of xc_broadcast | | 177 | * Encode an IPL to a form that can be embedded into flags of xc_broadcast |
178 | * or xc_unicast. | | 178 | * or xc_unicast. |
179 | */ | | 179 | */ |
180 | unsigned int | | 180 | unsigned int |
181 | xc_encode_ipl(int ipl) | | 181 | xc_encode_ipl(int ipl) |
182 | { | | 182 | { |
183 | | | 183 | |
184 | switch (ipl) { | | 184 | switch (ipl) { |
185 | case IPL_SOFTSERIAL: | | 185 | case IPL_SOFTSERIAL: |
186 | return __SHIFTIN(XC_IPL_SOFTSERIAL, XC_IPL_MASK); | | 186 | return __SHIFTIN(XC_IPL_SOFTSERIAL, XC_IPL_MASK); |
187 | case IPL_SOFTBIO: | | 187 | case IPL_SOFTBIO: |
188 | return __SHIFTIN(XC_IPL_SOFTBIO, XC_IPL_MASK); | | 188 | return __SHIFTIN(XC_IPL_SOFTBIO, XC_IPL_MASK); |
| | | 189 | #if IPL_SOFTCLOCK != IPL_SOFTBIO |
189 | case IPL_SOFTCLOCK: | | 190 | case IPL_SOFTCLOCK: |
190 | return __SHIFTIN(XC_IPL_SOFTCLOCK, XC_IPL_MASK); | | 191 | return __SHIFTIN(XC_IPL_SOFTCLOCK, XC_IPL_MASK); |
| | | 192 | #endif |
| | | 193 | #if IPL_SOFTNET != IPL_SOFTBIO |
191 | case IPL_SOFTNET: | | 194 | case IPL_SOFTNET: |
192 | return __SHIFTIN(XC_IPL_SOFTNET, XC_IPL_MASK); | | 195 | return __SHIFTIN(XC_IPL_SOFTNET, XC_IPL_MASK); |
| | | 196 | #endif |
193 | } | | 197 | } |
194 | | | 198 | |
195 | panic("Invalid IPL: %d", ipl); | | 199 | panic("Invalid IPL: %d", ipl); |
196 | } | | 200 | } |
197 | | | 201 | |
198 | /* | | 202 | /* |
199 | * Extract an XC_IPL from flags of xc_broadcast or xc_unicast. | | 203 | * Extract an XC_IPL from flags of xc_broadcast or xc_unicast. |
200 | */ | | 204 | */ |
201 | static inline unsigned int | | 205 | static inline unsigned int |
202 | xc_extract_ipl(unsigned int flags) | | 206 | xc_extract_ipl(unsigned int flags) |
203 | { | | 207 | { |
204 | | | 208 | |
205 | return __SHIFTOUT(flags, XC_IPL_MASK); | | 209 | return __SHIFTOUT(flags, XC_IPL_MASK); |