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