Print this page
Revert "OS-8005 bhyve memory pressure needs to target ARC better (#354)"
This reverts commit a6033573eedd94118d2b9e65f45deca0bf4b42f7.


  21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  26  * SUCH DAMAGE.
  27  *
  28  * $FreeBSD$
  29  */
  30 /*
  31  * This file and its contents are supplied under the terms of the
  32  * Common Development and Distribution License ("CDDL"), version 1.0.
  33  * You may only use this file in accordance with the terms of version
  34  * 1.0 of the CDDL.
  35  *
  36  * A full copy of the text of the CDDL should have accompanied this
  37  * source.  A copy of the CDDL is also available via the Internet at
  38  * http://www.illumos.org/license/CDDL.
  39  *
  40  * Copyright 2015 Pluribus Networks Inc.
  41  * Copyright 2020 Joyent, Inc.
  42  * Copyright 2020 Oxide Computer Company
  43  */
  44 
  45 #ifndef _VMMAPI_H_
  46 #define _VMMAPI_H_
  47 
  48 #include <sys/param.h>
  49 #include <sys/cpuset.h>
  50 #include <x86/segments.h>
  51 
  52 #include <stdbool.h>
  53 
  54 /*
  55  * API version for out-of-tree consumers like grub-bhyve for making compile
  56  * time decisions.
  57  */
  58 #define VMMAPI_VERSION  0103    /* 2 digit major followed by 2 digit minor */
  59 
  60 struct iovec;
  61 struct vmctx;


 299 int     vm_suspended_cpus(struct vmctx *ctx, cpuset_t *cpus);
 300 int     vm_debug_cpus(struct vmctx *ctx, cpuset_t *cpus);
 301 int     vm_activate_cpu(struct vmctx *ctx, int vcpu);
 302 int     vm_suspend_cpu(struct vmctx *ctx, int vcpu);
 303 int     vm_resume_cpu(struct vmctx *ctx, int vcpu);
 304 
 305 /* CPU topology */
 306 int     vm_set_topology(struct vmctx *ctx, uint16_t sockets, uint16_t cores,
 307             uint16_t threads, uint16_t maxcpus);
 308 int     vm_get_topology(struct vmctx *ctx, uint16_t *sockets, uint16_t *cores,
 309             uint16_t *threads, uint16_t *maxcpus);
 310 
 311 #ifndef __FreeBSD__
 312 /* illumos-specific APIs */
 313 int     vm_pmtmr_set_location(struct vmctx *ctx, uint16_t ioport);
 314 int     vm_wrlock_cycle(struct vmctx *ctx);
 315 int vm_get_run_state(struct vmctx *ctx, int vcpu, enum vcpu_run_state *state,
 316     uint8_t *sipi_vector);
 317 int vm_set_run_state(struct vmctx *ctx, int vcpu, enum vcpu_run_state state,
 318     uint8_t sipi_vector);
 319 int     vm_arc_resv(struct vmctx *ctx, size_t);
 320 #endif  /* __FreeBSD__ */
 321 
 322 #ifdef  __FreeBSD__
 323 /*
 324  * FreeBSD specific APIs
 325  */
 326 int     vm_setup_freebsd_registers(struct vmctx *ctx, int vcpu,
 327                                 uint64_t rip, uint64_t cr3, uint64_t gdtbase,
 328                                 uint64_t rsp);
 329 int     vm_setup_freebsd_registers_i386(struct vmctx *vmctx, int vcpu,
 330                                         uint32_t eip, uint32_t gdtbase,
 331                                         uint32_t esp);
 332 void    vm_setup_freebsd_gdt(uint64_t *gdtr);
 333 #endif
 334 #endif  /* _VMMAPI_H_ */


  21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  26  * SUCH DAMAGE.
  27  *
  28  * $FreeBSD$
  29  */
  30 /*
  31  * This file and its contents are supplied under the terms of the
  32  * Common Development and Distribution License ("CDDL"), version 1.0.
  33  * You may only use this file in accordance with the terms of version
  34  * 1.0 of the CDDL.
  35  *
  36  * A full copy of the text of the CDDL should have accompanied this
  37  * source.  A copy of the CDDL is also available via the Internet at
  38  * http://www.illumos.org/license/CDDL.
  39  *
  40  * Copyright 2015 Pluribus Networks Inc.
  41  * Copyright 2019 Joyent, Inc.
  42  * Copyright 2020 Oxide Computer Company
  43  */
  44 
  45 #ifndef _VMMAPI_H_
  46 #define _VMMAPI_H_
  47 
  48 #include <sys/param.h>
  49 #include <sys/cpuset.h>
  50 #include <x86/segments.h>
  51 
  52 #include <stdbool.h>
  53 
  54 /*
  55  * API version for out-of-tree consumers like grub-bhyve for making compile
  56  * time decisions.
  57  */
  58 #define VMMAPI_VERSION  0103    /* 2 digit major followed by 2 digit minor */
  59 
  60 struct iovec;
  61 struct vmctx;


 299 int     vm_suspended_cpus(struct vmctx *ctx, cpuset_t *cpus);
 300 int     vm_debug_cpus(struct vmctx *ctx, cpuset_t *cpus);
 301 int     vm_activate_cpu(struct vmctx *ctx, int vcpu);
 302 int     vm_suspend_cpu(struct vmctx *ctx, int vcpu);
 303 int     vm_resume_cpu(struct vmctx *ctx, int vcpu);
 304 
 305 /* CPU topology */
 306 int     vm_set_topology(struct vmctx *ctx, uint16_t sockets, uint16_t cores,
 307             uint16_t threads, uint16_t maxcpus);
 308 int     vm_get_topology(struct vmctx *ctx, uint16_t *sockets, uint16_t *cores,
 309             uint16_t *threads, uint16_t *maxcpus);
 310 
 311 #ifndef __FreeBSD__
 312 /* illumos-specific APIs */
 313 int     vm_pmtmr_set_location(struct vmctx *ctx, uint16_t ioport);
 314 int     vm_wrlock_cycle(struct vmctx *ctx);
 315 int vm_get_run_state(struct vmctx *ctx, int vcpu, enum vcpu_run_state *state,
 316     uint8_t *sipi_vector);
 317 int vm_set_run_state(struct vmctx *ctx, int vcpu, enum vcpu_run_state state,
 318     uint8_t sipi_vector);

 319 #endif  /* __FreeBSD__ */
 320 
 321 #ifdef  __FreeBSD__
 322 /*
 323  * FreeBSD specific APIs
 324  */
 325 int     vm_setup_freebsd_registers(struct vmctx *ctx, int vcpu,
 326                                 uint64_t rip, uint64_t cr3, uint64_t gdtbase,
 327                                 uint64_t rsp);
 328 int     vm_setup_freebsd_registers_i386(struct vmctx *vmctx, int vcpu,
 329                                         uint32_t eip, uint32_t gdtbase,
 330                                         uint32_t esp);
 331 void    vm_setup_freebsd_gdt(uint64_t *gdtr);
 332 #endif
 333 #endif  /* _VMMAPI_H_ */