| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: xen_shm_machdep.c,v 1.8 2010/03/28 20:46:18 snj Exp $ */ | | 1 | /* $NetBSD: xen_shm_machdep.c,v 1.9 2011/07/31 18:00:54 jym Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2006 Manuel Bouyer. | | 4 | * Copyright (c) 2006 Manuel Bouyer. |
5 | * | | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions | | 7 | * modification, are permitted provided that the following conditions |
8 | * are met: | | 8 | * are met: |
9 | * 1. Redistributions of source code must retain the above copyright | | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * 2. Redistributions in binary form must reproduce the above copyright | | 11 | * 2. Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the | | 12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. | | 13 | * documentation and/or other materials provided with the distribution. |
14 | * | | 14 | * |
| @@ -16,49 +16,49 @@ | | | @@ -16,49 +16,49 @@ |
16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | | 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | | 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 | * | | 25 | * |
26 | */ | | 26 | */ |
27 | | | 27 | |
28 | #include <sys/cdefs.h> | | 28 | #include <sys/cdefs.h> |
29 | __KERNEL_RCSID(0, "$NetBSD: xen_shm_machdep.c,v 1.8 2010/03/28 20:46:18 snj Exp $"); | | 29 | __KERNEL_RCSID(0, "$NetBSD: xen_shm_machdep.c,v 1.9 2011/07/31 18:00:54 jym Exp $"); |
30 | | | 30 | |
31 | | | 31 | |
32 | #include <sys/types.h> | | 32 | #include <sys/types.h> |
33 | #include <sys/param.h> | | 33 | #include <sys/param.h> |
34 | #include <sys/systm.h> | | 34 | #include <sys/systm.h> |
35 | #include <sys/queue.h> | | 35 | #include <sys/queue.h> |
36 | #include <sys/vmem.h> | | 36 | #include <sys/vmem.h> |
37 | #include <sys/kernel.h> | | 37 | #include <sys/kernel.h> |
38 | #include <uvm/uvm.h> | | 38 | #include <uvm/uvm.h> |
39 | | | 39 | |
40 | #include <machine/pmap.h> | | 40 | #include <machine/pmap.h> |
41 | #include <xen/hypervisor.h> | | 41 | #include <xen/hypervisor.h> |
42 | #include <xen/xen.h> | | 42 | #include <xen/xen.h> |
43 | #include <xen/evtchn.h> | | 43 | #include <xen/evtchn.h> |
44 | #include <xen/xen_shm.h> | | 44 | #include <xen/xen_shm.h> |
45 | | | 45 | |
46 | /* | | 46 | /* |
47 | * Helper routines for the backend drivers. This implement the necessary | | 47 | * Helper routines for the backend drivers. This implement the necessary |
48 | * functions to map a bunch of pages from foreign domains in our kernel VM | | 48 | * functions to map a bunch of pages from foreign domains in our kernel VM |
49 | * space, do I/O to it, and unmap it. | | 49 | * space, do I/O to it, and unmap it. |
50 | * | | 50 | * |
51 | * At boot time, we grap some kernel VM space that we'll use to map the foreign | | 51 | * At boot time, we grab some kernel VM space that we'll use to map the foreign |
52 | * pages. We also maintain a virtual to machine mapping table to give back | | 52 | * pages. We also maintain a virtual to machine mapping table to give back |
53 | * the appropriate address to bus_dma if requested. | | 53 | * the appropriate address to bus_dma if requested. |
54 | * If no more VM space is available, we return an error. The caller can then | | 54 | * If no more VM space is available, we return an error. The caller can then |
55 | * register a callback which will be called when the required VM space is | | 55 | * register a callback which will be called when the required VM space is |
56 | * available. | | 56 | * available. |
57 | */ | | 57 | */ |
58 | | | 58 | |
59 | /* pointers to our VM space */ | | 59 | /* pointers to our VM space */ |
60 | static vaddr_t xen_shm_base_address; | | 60 | static vaddr_t xen_shm_base_address; |
61 | static u_long xen_shm_base_address_pg; | | 61 | static u_long xen_shm_base_address_pg; |
62 | static vaddr_t xen_shm_end_address; | | 62 | static vaddr_t xen_shm_end_address; |
63 | | | 63 | |
64 | /* Grab enough VM space to map an entire vbd ring. */ | | 64 | /* Grab enough VM space to map an entire vbd ring. */ |