xref: /titanic_51/usr/src/uts/i86pc/sys/xpv_support.h (revision 349b53dd4e695e3d833b5380540385145b2d3ae8)
1*349b53ddSStuart Maybee /*
2*349b53ddSStuart Maybee  * CDDL HEADER START
3*349b53ddSStuart Maybee  *
4*349b53ddSStuart Maybee  * The contents of this file are subject to the terms of the
5*349b53ddSStuart Maybee  * Common Development and Distribution License (the "License").
6*349b53ddSStuart Maybee  * You may not use this file except in compliance with the License.
7*349b53ddSStuart Maybee  *
8*349b53ddSStuart Maybee  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*349b53ddSStuart Maybee  * or http://www.opensolaris.org/os/licensing.
10*349b53ddSStuart Maybee  * See the License for the specific language governing permissions
11*349b53ddSStuart Maybee  * and limitations under the License.
12*349b53ddSStuart Maybee  *
13*349b53ddSStuart Maybee  * When distributing Covered Code, include this CDDL HEADER in each
14*349b53ddSStuart Maybee  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*349b53ddSStuart Maybee  * If applicable, add the following below this CDDL HEADER, with the
16*349b53ddSStuart Maybee  * fields enclosed by brackets "[]" replaced with your own identifying
17*349b53ddSStuart Maybee  * information: Portions Copyright [yyyy] [name of copyright owner]
18*349b53ddSStuart Maybee  *
19*349b53ddSStuart Maybee  * CDDL HEADER END
20*349b53ddSStuart Maybee  */
21*349b53ddSStuart Maybee 
22*349b53ddSStuart Maybee /*
23*349b53ddSStuart Maybee  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24*349b53ddSStuart Maybee  * Use is subject to license terms.
25*349b53ddSStuart Maybee  */
26*349b53ddSStuart Maybee 
27*349b53ddSStuart Maybee #ifndef _SYS_XPV_SUPPORT_H
28*349b53ddSStuart Maybee #define	_SYS_XPV_SUPPORT_H
29*349b53ddSStuart Maybee 
30*349b53ddSStuart Maybee #ifdef __cplusplus
31*349b53ddSStuart Maybee extern "C" {
32*349b53ddSStuart Maybee #endif
33*349b53ddSStuart Maybee 
34*349b53ddSStuart Maybee #define	__XEN_INTERFACE_VERSION__	__XEN_LATEST_INTERFACE_VERSION__
35*349b53ddSStuart Maybee 
36*349b53ddSStuart Maybee #if !defined(_ASM)
37*349b53ddSStuart Maybee 
38*349b53ddSStuart Maybee #include <sys/types.h>
39*349b53ddSStuart Maybee #include <sys/inttypes.h>
40*349b53ddSStuart Maybee #include <sys/dditypes.h>
41*349b53ddSStuart Maybee #include <sys/xpv_impl.h>
42*349b53ddSStuart Maybee #include <sys/xen_mmu.h>
43*349b53ddSStuart Maybee 
44*349b53ddSStuart Maybee #define	IPL_DEBUG	15	/* domain debug interrupt */
45*349b53ddSStuart Maybee #define	IPL_CONS	9
46*349b53ddSStuart Maybee #define	IPL_VIF		6
47*349b53ddSStuart Maybee #define	IPL_VBD		5
48*349b53ddSStuart Maybee #define	IPL_EVTCHN	1
49*349b53ddSStuart Maybee 
50*349b53ddSStuart Maybee #define	INVALID_EVTCHN 0
51*349b53ddSStuart Maybee 
52*349b53ddSStuart Maybee typedef uint_t (*ec_handler_fcn_t)();
53*349b53ddSStuart Maybee 
54*349b53ddSStuart Maybee extern int ec_init(void);
55*349b53ddSStuart Maybee extern void ec_fini();
56*349b53ddSStuart Maybee extern void ec_bind_evtchn_to_handler(int, pri_t, ec_handler_fcn_t, void *);
57*349b53ddSStuart Maybee extern void ec_unbind_evtchn(int);
58*349b53ddSStuart Maybee extern void ec_notify_via_evtchn(uint_t);
59*349b53ddSStuart Maybee extern void hypervisor_mask_event(uint_t);
60*349b53ddSStuart Maybee extern void hypervisor_unmask_event(uint_t);
61*349b53ddSStuart Maybee 
62*349b53ddSStuart Maybee extern void xen_hvm_init(void);
63*349b53ddSStuart Maybee extern int xen_bind_interdomain(int, int, int *);
64*349b53ddSStuart Maybee extern int xen_alloc_unbound_evtchn(int, int *);
65*349b53ddSStuart Maybee extern int xen_xlate_errcode(int error);
66*349b53ddSStuart Maybee extern void *xen_alloc_pages(pgcnt_t cnt);
67*349b53ddSStuart Maybee extern void kbm_map_ma(maddr_t ma, uintptr_t va, uint_t level);
68*349b53ddSStuart Maybee 
69*349b53ddSStuart Maybee /*
70*349b53ddSStuart Maybee  * Stub functions to allow the FE drivers to build without littering them
71*349b53ddSStuart Maybee  * with #ifdefs
72*349b53ddSStuart Maybee  */
73*349b53ddSStuart Maybee extern void balloon_drv_added(int64_t);
74*349b53ddSStuart Maybee extern long balloon_free_pages(uint_t, mfn_t *, caddr_t, pfn_t *);
75*349b53ddSStuart Maybee extern void xen_release_pfn(pfn_t);
76*349b53ddSStuart Maybee extern void reassign_pfn(pfn_t, mfn_t);
77*349b53ddSStuart Maybee 
78*349b53ddSStuart Maybee extern shared_info_t *HYPERVISOR_shared_info;
79*349b53ddSStuart Maybee extern pfn_t xen_shared_info_frame;
80*349b53ddSStuart Maybee 
81*349b53ddSStuart Maybee /*
82*349b53ddSStuart Maybee  * Argument to xpv_feature(). This function will return -1 if a feature
83*349b53ddSStuart Maybee  * is not available, 1 if a boolean feature is available, and a value >= 0
84*349b53ddSStuart Maybee  * if a numeric value is requested.
85*349b53ddSStuart Maybee  */
86*349b53ddSStuart Maybee #define	XPVF_BITS		0	/* numeric (32 or 64) */
87*349b53ddSStuart Maybee #define	XPVF_VERSION_MAJOR	1	/* numeric */
88*349b53ddSStuart Maybee #define	XPVF_VERSION_MINOR	2	/* numeric */
89*349b53ddSStuart Maybee #define	XPVF_HYPERCALLS		3	/* boolean (hypercalls work) */
90*349b53ddSStuart Maybee #define	XPVF_SHARED_INFO	4	/* boolean (shared info is valid) */
91*349b53ddSStuart Maybee #define	XPVF_TLB_FLUSH		5	/* boolean (tlb flush call present) */
92*349b53ddSStuart Maybee 
93*349b53ddSStuart Maybee extern int xpv_feature(int);
94*349b53ddSStuart Maybee 
95*349b53ddSStuart Maybee #define	IN_XPV_PANIC()	(__lintzero)
96*349b53ddSStuart Maybee 
97*349b53ddSStuart Maybee #ifdef __cplusplus
98*349b53ddSStuart Maybee }
99*349b53ddSStuart Maybee #endif
100*349b53ddSStuart Maybee 
101*349b53ddSStuart Maybee #endif	/* __ASM */
102*349b53ddSStuart Maybee #endif	/* _SYS_XPV_SUPPORT_H */
103