Home | History | Annotate | Line # | Download | only in nvmm
nvmm_ioctl.h revision 1.1
      1 /*	$NetBSD: nvmm_ioctl.h,v 1.1 2018/11/07 07:43:08 maxv Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 2018 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Maxime Villard.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  * POSSIBILITY OF SUCH DAMAGE.
     30  */
     31 
     32 #ifndef _NVMM_IOCTL_H_
     33 #define _NVMM_IOCTL_H_
     34 
     35 #include <dev/nvmm/nvmm.h>
     36 
     37 struct nvmm_ioc_capability {
     38 	struct nvmm_capability cap;
     39 };
     40 
     41 struct nvmm_ioc_machine_create {
     42 	nvmm_machid_t machid;
     43 };
     44 
     45 struct nvmm_ioc_machine_destroy {
     46 	nvmm_machid_t machid;
     47 };
     48 
     49 struct nvmm_ioc_machine_configure {
     50 	nvmm_machid_t machid;
     51 	uint64_t op;
     52 	void *conf;
     53 };
     54 
     55 struct nvmm_ioc_vcpu_create {
     56 	nvmm_machid_t machid;
     57 	nvmm_cpuid_t cpuid;
     58 };
     59 
     60 struct nvmm_ioc_vcpu_destroy {
     61 	nvmm_machid_t machid;
     62 	nvmm_cpuid_t cpuid;
     63 };
     64 
     65 struct nvmm_ioc_vcpu_setstate {
     66 	nvmm_machid_t machid;
     67 	nvmm_cpuid_t cpuid;
     68 	uint64_t flags;
     69 	void *state;
     70 };
     71 
     72 struct nvmm_ioc_vcpu_getstate {
     73 	nvmm_machid_t machid;
     74 	nvmm_cpuid_t cpuid;
     75 	uint64_t flags;
     76 	void *state;
     77 };
     78 
     79 struct nvmm_ioc_vcpu_inject {
     80 	nvmm_machid_t machid;
     81 	nvmm_cpuid_t cpuid;
     82 	struct nvmm_event event;
     83 };
     84 
     85 struct nvmm_ioc_vcpu_run {
     86 	/* input */
     87 	nvmm_machid_t machid;
     88 	nvmm_cpuid_t cpuid;
     89 	/* output */
     90 	struct nvmm_exit exit;
     91 };
     92 
     93 struct nvmm_ioc_gpa_map {
     94 	nvmm_machid_t machid;
     95 	uintptr_t hva;
     96 	gpaddr_t gpa;
     97 	size_t size;
     98 	int flags;
     99 };
    100 
    101 struct nvmm_ioc_gpa_unmap {
    102 	nvmm_machid_t machid;
    103 	gpaddr_t gpa;
    104 	size_t size;
    105 };
    106 
    107 #define NVMM_IOC_CAPABILITY		_IOR ('N',  0, struct nvmm_ioc_capability)
    108 #define NVMM_IOC_MACHINE_CREATE		_IOWR('N',  1, struct nvmm_ioc_machine_create)
    109 #define NVMM_IOC_MACHINE_DESTROY	_IOW ('N',  2, struct nvmm_ioc_machine_destroy)
    110 #define NVMM_IOC_MACHINE_CONFIGURE	_IOW ('N',  3, struct nvmm_ioc_machine_configure)
    111 #define NVMM_IOC_VCPU_CREATE		_IOW ('N',  4, struct nvmm_ioc_vcpu_create)
    112 #define NVMM_IOC_VCPU_DESTROY		_IOW ('N',  5, struct nvmm_ioc_vcpu_destroy)
    113 #define NVMM_IOC_VCPU_SETSTATE		_IOW ('N',  6, struct nvmm_ioc_vcpu_setstate)
    114 #define NVMM_IOC_VCPU_GETSTATE		_IOW ('N',  7, struct nvmm_ioc_vcpu_getstate)
    115 #define NVMM_IOC_VCPU_INJECT		_IOWR('N',  8, struct nvmm_ioc_vcpu_inject)
    116 #define NVMM_IOC_VCPU_RUN		_IOWR('N',  9, struct nvmm_ioc_vcpu_run)
    117 #define NVMM_IOC_GPA_MAP		_IOW ('N', 10, struct nvmm_ioc_gpa_map)
    118 #define NVMM_IOC_GPA_UNMAP		_IOW ('N', 11, struct nvmm_ioc_gpa_unmap)
    119 
    120 #endif /* _NVMM_IOCTL_H_ */
    121