xref: /onnv-gate/usr/src/uts/i86xpv/sys/balloon_impl.h (revision 5084:7d838c5c0eed)
1*5084Sjohnlev /*
2*5084Sjohnlev  * CDDL HEADER START
3*5084Sjohnlev  *
4*5084Sjohnlev  * The contents of this file are subject to the terms of the
5*5084Sjohnlev  * Common Development and Distribution License (the "License").
6*5084Sjohnlev  * You may not use this file except in compliance with the License.
7*5084Sjohnlev  *
8*5084Sjohnlev  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*5084Sjohnlev  * or http://www.opensolaris.org/os/licensing.
10*5084Sjohnlev  * See the License for the specific language governing permissions
11*5084Sjohnlev  * and limitations under the License.
12*5084Sjohnlev  *
13*5084Sjohnlev  * When distributing Covered Code, include this CDDL HEADER in each
14*5084Sjohnlev  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*5084Sjohnlev  * If applicable, add the following below this CDDL HEADER, with the
16*5084Sjohnlev  * fields enclosed by brackets "[]" replaced with your own identifying
17*5084Sjohnlev  * information: Portions Copyright [yyyy] [name of copyright owner]
18*5084Sjohnlev  *
19*5084Sjohnlev  * CDDL HEADER END
20*5084Sjohnlev  */
21*5084Sjohnlev /*
22*5084Sjohnlev  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23*5084Sjohnlev  * Use is subject to license terms.
24*5084Sjohnlev  */
25*5084Sjohnlev 
26*5084Sjohnlev #ifndef	_SYS_BALLOON_IMPL_H
27*5084Sjohnlev #define	_SYS_BALLOON_IMPL_H
28*5084Sjohnlev 
29*5084Sjohnlev #pragma ident	"%Z%%M%	%I%	%E% SMI"
30*5084Sjohnlev 
31*5084Sjohnlev #include <sys/balloon.h>
32*5084Sjohnlev #include <sys/types.h>
33*5084Sjohnlev #include <vm/page.h>
34*5084Sjohnlev #include <sys/xen_mmu.h>	/* to get typedef of mfn_t */
35*5084Sjohnlev 
36*5084Sjohnlev #ifdef __cplusplus
37*5084Sjohnlev extern "C" {
38*5084Sjohnlev #endif
39*5084Sjohnlev 
40*5084Sjohnlev /*
41*5084Sjohnlev  * This file contains interfaces for both the balloon kernel thread
42*5084Sjohnlev  * and the balloon driver.  The balloon device is installed under /dev/xen,
43*5084Sjohnlev  * and can be used with the ioctl values in balloon.h to get the balloon
44*5084Sjohnlev  * memory status.
45*5084Sjohnlev  */
46*5084Sjohnlev 
47*5084Sjohnlev /* balloon thread declarations */
48*5084Sjohnlev void balloon_init(pgcnt_t);
49*5084Sjohnlev size_t balloon_values(int);
50*5084Sjohnlev void balloon_drv_added(int64_t);
51*5084Sjohnlev void balloon_drv_subtracted(int64_t);
52*5084Sjohnlev long balloon_alloc_pages(uint_t, mfn_t *);
53*5084Sjohnlev long balloon_free_pages(uint_t, mfn_t *, caddr_t, pfn_t *);
54*5084Sjohnlev long balloon_replace_pages(uint_t, page_t **, uint_t, uint_t, mfn_t *);
55*5084Sjohnlev 
56*5084Sjohnlev /* balloon driver information */
57*5084Sjohnlev #define	BALLOON_MINOR		0
58*5084Sjohnlev 
59*5084Sjohnlev /*
60*5084Sjohnlev  * Critical stats for the balloon thread.  All values are in pages.
61*5084Sjohnlev  */
62*5084Sjohnlev typedef struct {
63*5084Sjohnlev 	pgcnt_t bln_current_pages;	/* current reservation */
64*5084Sjohnlev 	pgcnt_t bln_new_target;		/* target value for reservation */
65*5084Sjohnlev 	pgcnt_t bln_max_pages;	/* first pfn for which we don't have a page_t */
66*5084Sjohnlev 	pgcnt_t bln_low;	/* lowest value of reservation since boot */
67*5084Sjohnlev 	pgcnt_t bln_high;	/* highest value of reservation since boot */
68*5084Sjohnlev 	spgcnt_t bln_hv_pages;	/* number of total pages given to hypervisor */
69*5084Sjohnlev 	spgcnt_t bln_hard_limit;	/* domain's max-mem limit */
70*5084Sjohnlev } bln_stats_t;
71*5084Sjohnlev 
72*5084Sjohnlev #ifdef __cplusplus
73*5084Sjohnlev }
74*5084Sjohnlev #endif
75*5084Sjohnlev 
76*5084Sjohnlev #endif /* _SYS_BALLOON_IMPL_H */
77