xref: /illumos-gate/usr/src/cmd/bhyve/bhyverun.h (revision 32640292339b07090f10ce34d455f98711077343)
1bf21cd93STycho Nightingale /*-
2*32640292SAndy Fiddaman  * SPDX-License-Identifier: BSD-2-Clause
34c87aefeSPatrick Mooney  *
4bf21cd93STycho Nightingale  * Copyright (c) 2011 NetApp, Inc.
5bf21cd93STycho Nightingale  * All rights reserved.
6bf21cd93STycho Nightingale  *
7bf21cd93STycho Nightingale  * Redistribution and use in source and binary forms, with or without
8bf21cd93STycho Nightingale  * modification, are permitted provided that the following conditions
9bf21cd93STycho Nightingale  * are met:
10bf21cd93STycho Nightingale  * 1. Redistributions of source code must retain the above copyright
11bf21cd93STycho Nightingale  *    notice, this list of conditions and the following disclaimer.
12bf21cd93STycho Nightingale  * 2. Redistributions in binary form must reproduce the above copyright
13bf21cd93STycho Nightingale  *    notice, this list of conditions and the following disclaimer in the
14bf21cd93STycho Nightingale  *    documentation and/or other materials provided with the distribution.
15bf21cd93STycho Nightingale  *
16bf21cd93STycho Nightingale  * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND
17bf21cd93STycho Nightingale  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18bf21cd93STycho Nightingale  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19bf21cd93STycho Nightingale  * ARE DISCLAIMED.  IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE
20bf21cd93STycho Nightingale  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21bf21cd93STycho Nightingale  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22bf21cd93STycho Nightingale  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23bf21cd93STycho Nightingale  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24bf21cd93STycho Nightingale  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25bf21cd93STycho Nightingale  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26bf21cd93STycho Nightingale  * SUCH DAMAGE.
27bf21cd93STycho Nightingale  */
28bf21cd93STycho Nightingale /*
29bf21cd93STycho Nightingale  * This file and its contents are supplied under the terms of the
30bf21cd93STycho Nightingale  * Common Development and Distribution License ("CDDL"), version 1.0.
31bf21cd93STycho Nightingale  * You may only use this file in accordance with the terms of version
32bf21cd93STycho Nightingale  * 1.0 of the CDDL.
33bf21cd93STycho Nightingale  *
34bf21cd93STycho Nightingale  * A full copy of the text of the CDDL should have accompanied this
35bf21cd93STycho Nightingale  * source.  A copy of the CDDL is also available via the Internet at
36bf21cd93STycho Nightingale  * http://www.illumos.org/license/CDDL.
37bf21cd93STycho Nightingale  *
38bf21cd93STycho Nightingale  * Copyright 2015 Pluribus Networks Inc.
39bf21cd93STycho Nightingale  */
40bf21cd93STycho Nightingale 
41bf21cd93STycho Nightingale #ifndef	_FBSDRUN_H_
42bf21cd93STycho Nightingale #define	_FBSDRUN_H_
43bf21cd93STycho Nightingale 
44bf21cd93STycho Nightingale #define	VMEXIT_CONTINUE		(0)
45bf21cd93STycho Nightingale #define	VMEXIT_ABORT		(-1)
46bf21cd93STycho Nightingale 
47bf21cd93STycho Nightingale extern int guest_ncpus;
4859d65d31SAndy Fiddaman extern uint16_t cpu_cores, cpu_sockets, cpu_threads;
4959d65d31SAndy Fiddaman 
50*32640292SAndy Fiddaman struct vcpu;
5159d65d31SAndy Fiddaman struct vmctx;
5259d65d31SAndy Fiddaman struct vm_exit;
53bf21cd93STycho Nightingale 
54bf21cd93STycho Nightingale void *paddr_guest2host(struct vmctx *ctx, uintptr_t addr, size_t len);
55bf21cd93STycho Nightingale 
56bf21cd93STycho Nightingale int  fbsdrun_virtio_msix(void);
572b948146SAndy Fiddaman 
58*32640292SAndy Fiddaman int vmexit_task_switch(struct vmctx *, struct vcpu *, struct vm_exit *);
59*32640292SAndy Fiddaman 
60*32640292SAndy Fiddaman #ifndef	__FreeBSD__
61*32640292SAndy Fiddaman struct vcpu_info;
62*32640292SAndy Fiddaman void fbsdrun_addcpu(struct vcpu_info *, bool);
63*32640292SAndy Fiddaman #endif
6459d65d31SAndy Fiddaman 
65bf21cd93STycho Nightingale #endif
66