xref: /openbmc/linux/include/xen/balloon.h (revision 22246614)
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 __XEN_BALLOON_H__
35 #define __XEN_BALLOON_H__
36 
37 #include <linux/spinlock.h>
38 
39 #if 0
40 /*
41  * Inform the balloon driver that it should allow some slop for device-driver
42  * memory activities.
43  */
44 void balloon_update_driver_allowance(long delta);
45 
46 /* Allocate/free a set of empty pages in low memory (i.e., no RAM mapped). */
47 struct page **alloc_empty_pages_and_pagevec(int nr_pages);
48 void free_empty_pages_and_pagevec(struct page **pagevec, int nr_pages);
49 
50 void balloon_release_driver_page(struct page *page);
51 
52 /*
53  * Prevent the balloon driver from changing the memory reservation during
54  * a driver critical region.
55  */
56 extern spinlock_t balloon_lock;
57 #define balloon_lock(__flags)   spin_lock_irqsave(&balloon_lock, __flags)
58 #define balloon_unlock(__flags) spin_unlock_irqrestore(&balloon_lock, __flags)
59 #endif
60 
61 #endif /* __XEN_BALLOON_H__ */
62