1 | /****************************************************************************** |
---|
2 | * balloon.h |
---|
3 | * |
---|
4 | * Xen balloon driver - enables returning/claiming memory to/from Xen. |
---|
5 | * |
---|
6 | * Copyright (c) 2003, B Dragovic |
---|
7 | * Copyright (c) 2003-2004, M Williamson, K Fraser |
---|
8 | * |
---|
9 | * This program is free software; you can redistribute it and/or |
---|
10 | * modify it under the terms of the GNU General Public License version 2 |
---|
11 | * as published by the Free Software Foundation; or, when distributed |
---|
12 | * separately from the Linux kernel or incorporated into other |
---|
13 | * software packages, subject to the following license: |
---|
14 | * |
---|
15 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
---|
16 | * of this source file (the "Software"), to deal in the Software without |
---|
17 | * restriction, including without limitation the rights to use, copy, modify, |
---|
18 | * merge, publish, distribute, sublicense, and/or sell copies of the Software, |
---|
19 | * and to permit persons to whom the Software is furnished to do so, subject to |
---|
20 | * the following conditions: |
---|
21 | * |
---|
22 | * The above copyright notice and this permission notice shall be included in |
---|
23 | * all copies or substantial portions of the Software. |
---|
24 | * |
---|
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
26 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
27 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
---|
28 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
---|
29 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
---|
30 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
---|
31 | * IN THE SOFTWARE. |
---|
32 | */ |
---|
33 | |
---|
34 | #ifndef __ASM_BALLOON_H__ |
---|
35 | #define __ASM_BALLOON_H__ |
---|
36 | |
---|
37 | /* |
---|
38 | * Inform the balloon driver that it should allow some slop for device-driver |
---|
39 | * memory activities. |
---|
40 | */ |
---|
41 | void balloon_update_driver_allowance(long delta); |
---|
42 | |
---|
43 | /* Allocate/free a set of empty pages in low memory (i.e., no RAM mapped). */ |
---|
44 | struct page **alloc_empty_pages_and_pagevec(int nr_pages); |
---|
45 | void free_empty_pages_and_pagevec(struct page **pagevec, int nr_pages); |
---|
46 | |
---|
47 | void balloon_release_driver_page(struct page *page); |
---|
48 | |
---|
49 | /* |
---|
50 | * Prevent the balloon driver from changing the memory reservation during |
---|
51 | * a driver critical region. |
---|
52 | */ |
---|
53 | extern spinlock_t balloon_lock; |
---|
54 | #define balloon_lock(__flags) spin_lock_irqsave(&balloon_lock, __flags) |
---|
55 | #define balloon_unlock(__flags) spin_unlock_irqrestore(&balloon_lock, __flags) |
---|
56 | |
---|
57 | #endif /* __ASM_BALLOON_H__ */ |
---|