| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: hypervisor_machdep.c,v 1.19 2011/12/26 18:27:11 cherry Exp $ */ | | 1 | /* $NetBSD: hypervisor_machdep.c,v 1.20 2011/12/27 07:45:41 cherry Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * | | 4 | * |
5 | * Copyright (c) 2004 Christian Limpach. | | 5 | * Copyright (c) 2004 Christian Limpach. |
6 | * All rights reserved. | | 6 | * All rights reserved. |
7 | * | | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | | 9 | * modification, are permitted provided that the following conditions |
10 | * are met: | | 10 | * are met: |
11 | * 1. Redistributions of source code must retain the above copyright | | 11 | * 1. Redistributions of source code must retain the above copyright |
12 | * notice, this list of conditions and the following disclaimer. | | 12 | * notice, this list of conditions and the following disclaimer. |
13 | * 2. Redistributions in binary form must reproduce the above copyright | | 13 | * 2. Redistributions in binary form must reproduce the above copyright |
14 | * notice, this list of conditions and the following disclaimer in the | | 14 | * notice, this list of conditions and the following disclaimer in the |
| @@ -44,27 +44,27 @@ | | | @@ -44,27 +44,27 @@ |
44 | * all copies or substantial portions of the Software. | | 44 | * all copies or substantial portions of the Software. |
45 | * | | 45 | * |
46 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | | 46 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
47 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | | 47 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
48 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | | 48 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
49 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | | 49 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
50 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | | 50 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
51 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | | 51 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
52 | * DEALINGS IN THE SOFTWARE. | | 52 | * DEALINGS IN THE SOFTWARE. |
53 | */ | | 53 | */ |
54 | | | 54 | |
55 | | | 55 | |
56 | #include <sys/cdefs.h> | | 56 | #include <sys/cdefs.h> |
57 | __KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.19 2011/12/26 18:27:11 cherry Exp $"); | | 57 | __KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.20 2011/12/27 07:45:41 cherry Exp $"); |
58 | | | 58 | |
59 | #include <sys/param.h> | | 59 | #include <sys/param.h> |
60 | #include <sys/systm.h> | | 60 | #include <sys/systm.h> |
61 | #include <sys/kmem.h> | | 61 | #include <sys/kmem.h> |
62 | | | 62 | |
63 | #include <uvm/uvm_extern.h> | | 63 | #include <uvm/uvm_extern.h> |
64 | | | 64 | |
65 | #include <machine/vmparam.h> | | 65 | #include <machine/vmparam.h> |
66 | #include <machine/pmap.h> | | 66 | #include <machine/pmap.h> |
67 | | | 67 | |
68 | #include <xen/xen.h> | | 68 | #include <xen/xen.h> |
69 | #include <xen/hypervisor.h> | | 69 | #include <xen/hypervisor.h> |
70 | #include <xen/evtchn.h> | | 70 | #include <xen/evtchn.h> |
| @@ -285,30 +285,32 @@ void | | | @@ -285,30 +285,32 @@ void |
285 | hypervisor_send_event(struct cpu_info *ci, unsigned int ev) | | 285 | hypervisor_send_event(struct cpu_info *ci, unsigned int ev) |
286 | { | | 286 | { |
287 | KASSERT(ci != NULL); | | 287 | KASSERT(ci != NULL); |
288 | | | 288 | |
289 | volatile shared_info_t *s = HYPERVISOR_shared_info; | | 289 | volatile shared_info_t *s = HYPERVISOR_shared_info; |
290 | volatile struct vcpu_info *vci = ci->ci_vcpu; | | 290 | volatile struct vcpu_info *vci = ci->ci_vcpu; |
291 | | | 291 | |
292 | #ifdef PORT_DEBUG | | 292 | #ifdef PORT_DEBUG |
293 | if (ev == PORT_DEBUG) | | 293 | if (ev == PORT_DEBUG) |
294 | printf("hypervisor_send_event %d\n", ev); | | 294 | printf("hypervisor_send_event %d\n", ev); |
295 | #endif | | 295 | #endif |
296 | | | 296 | |
297 | xen_atomic_set_bit(&s->evtchn_pending[0], ev); | | 297 | xen_atomic_set_bit(&s->evtchn_pending[0], ev); |
298 | xen_atomic_set_bit(&vci->evtchn_pending_sel, | | | |
299 | ev >> LONG_SHIFT); | | | |
300 | | | 298 | |
301 | xen_atomic_set_bit(&vci->evtchn_upcall_pending, 0); | | 299 | if (__predict_true(ci == curcpu())) { |
| | | 300 | xen_atomic_set_bit(&vci->evtchn_pending_sel, |
| | | 301 | ev >> LONG_SHIFT); |
| | | 302 | xen_atomic_set_bit(&vci->evtchn_upcall_pending, 0); |
| | | 303 | } |
302 | | | 304 | |
303 | xen_atomic_clear_bit(&s->evtchn_mask[0], ev); | | 305 | xen_atomic_clear_bit(&s->evtchn_mask[0], ev); |
304 | | | 306 | |
305 | if (__predict_true(ci == curcpu())) { | | 307 | if (__predict_true(ci == curcpu())) { |
306 | hypervisor_force_callback(); | | 308 | hypervisor_force_callback(); |
307 | } else { | | 309 | } else { |
308 | if (__predict_false(xen_send_ipi(ci, XEN_IPI_HVCB))) { | | 310 | if (__predict_false(xen_send_ipi(ci, XEN_IPI_HVCB))) { |
309 | panic("xen_send_ipi(cpu%d, XEN_IPI_HVCB) failed\n", | | 311 | panic("xen_send_ipi(cpu%d, XEN_IPI_HVCB) failed\n", |
310 | (int) ci->ci_cpuid); | | 312 | (int) ci->ci_cpuid); |
311 | } | | 313 | } |
312 | } | | 314 | } |
313 | } | | 315 | } |
314 | | | 316 | |