-/* $OpenBSD: vmmvar.h,v 1.101 2024/04/29 14:47:05 dv Exp $ */
+/* $OpenBSD: vmmvar.h,v 1.102 2024/07/09 09:31:37 dv Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
#define VMM_HV_SIGNATURE "OpenBSDVMM58"
-#define VMM_MAX_MEM_RANGES 16
-#define VMM_MAX_DISKS_PER_VM 4
-#define VMM_MAX_NAME_LEN 64
-#define VMM_MAX_VCPUS 512
-#define VMM_MAX_VCPUS_PER_VM 64
-#define VMM_MAX_VM_MEM_SIZE 128L * 1024 * 1024 * 1024
-#define VMM_MAX_NICS_PER_VM 4
-
#define VMM_PCI_MMIO_BAR_BASE 0xF0000000ULL
#define VMM_PCI_MMIO_BAR_END 0xFFDFFFFFULL /* 2 MiB below 4 GiB */
int cpl;
};
-struct vm_run_params {
- /* Input parameters to VMM_IOC_RUN */
- uint32_t vrp_vm_id;
- uint32_t vrp_vcpu_id;
- struct vcpu_inject_event vrp_inject;
- uint8_t vrp_intr_pending; /* Additional intrs pending? */
-
- /* Input/output parameter to VMM_IOC_RUN */
- struct vm_exit *vrp_exit; /* updated exit data */
-
- /* Output parameter from VMM_IOC_RUN */
- uint16_t vrp_exit_reason; /* exit reason */
- uint8_t vrp_irqready; /* ready for IRQ on entry */
-};
-
struct vm_intr_params {
/* Input parameters to VMM_IOC_INTR */
uint32_t vip_vm_id;
void vcpu_deinit(struct vcpu *);
int vm_rwvmparams(struct vm_rwvmparams_params *, int);
int vm_rwregs(struct vm_rwregs_params *, int);
-int vm_run(struct vm_run_params *);
int vcpu_reset_regs(struct vcpu *, struct vcpu_reg_state *);
#endif /* _KERNEL */
-/* $OpenBSD: vmm.h,v 1.4 2024/01/11 17:13:48 jan Exp $ */
+/* $OpenBSD: vmm.h,v 1.5 2024/07/09 09:31:37 dv Exp $ */
/*
* Copyright (c) 2014-2023 Mike Larkin <mlarkin@openbsd.org>
*
#include <uvm/uvm_extern.h>
+#include <machine/vmmvar.h>
+
#ifndef DEV_VMM_H
#define DEV_VMM_H
+#define VMM_MAX_MEM_RANGES 16
+#define VMM_MAX_DISKS_PER_VM 4
+#define VMM_MAX_NAME_LEN 64
+#define VMM_MAX_VCPUS 512
+#define VMM_MAX_VCPUS_PER_VM 64
+#define VMM_MAX_VM_MEM_SIZE 128L * 1024 * 1024 * 1024
+#define VMM_MAX_NICS_PER_VM 4
+
struct vm_mem_range {
paddr_t vmr_gpa;
vaddr_t vmr_va;
struct vm_mem_range vsp_memranges[VMM_MAX_MEM_RANGES];
};
+struct vm_run_params {
+ /* Input parameters to VMM_IOC_RUN */
+ uint32_t vrp_vm_id;
+ uint32_t vrp_vcpu_id;
+ struct vcpu_inject_event vrp_inject;
+ uint8_t vrp_intr_pending; /* Additional intrs pending? */
+
+ /* Input/output parameter to VMM_IOC_RUN */
+ struct vm_exit *vrp_exit; /* updated exit data */
+
+ /* Output parameter from VMM_IOC_RUN */
+ uint16_t vrp_exit_reason; /* exit reason */
+ uint8_t vrp_irqready; /* ready for IRQ on entry */
+};
+
/* IOCTL definitions */
#define VMM_IOC_CREATE _IOWR('V', 1, struct vm_create_params) /* Create VM */
#define VMM_IOC_RUN _IOWR('V', 2, struct vm_run_params) /* Run VCPU */
int vm_resetcpu(struct vm_resetcpu_params *);
int vcpu_must_stop(struct vcpu *);
int vm_share_mem(struct vm_sharemem_params *, struct proc *);
+int vm_run(struct vm_run_params *);
#ifdef VMM_DEBUG
void dump_vcpu(struct vcpu *);
-/* $OpenBSD: fw_cfg.c,v 1.8 2024/02/04 14:53:12 dv Exp $ */
+/* $OpenBSD: fw_cfg.c,v 1.9 2024/07/09 09:31:37 dv Exp $ */
/*
* Copyright (c) 2018 Claudio Jeker <claudio@openbsd.org>
*
#include <sys/types.h>
#include <sys/uio.h>
#include <machine/biosvar.h> /* bios_memmap_t */
-#include <machine/vmmvar.h>
#include <dev/pv/virtioreg.h>
+#include <dev/vmm/vmm.h>
#include <stdlib.h>
#include <string.h>
-/* $OpenBSD: i8253.c,v 1.39 2024/02/09 14:35:47 dv Exp $ */
+/* $OpenBSD: i8253.c,v 1.40 2024/07/09 09:31:37 dv Exp $ */
/*
* Copyright (c) 2016 Mike Larkin <mlarkin@openbsd.org>
*
#include <sys/types.h>
#include <dev/ic/i8253reg.h>
-
-#include <machine/vmmvar.h>
+#include <dev/vmm/vmm.h>
#include <event.h>
#include <string.h>
-/* $OpenBSD: i8259.c,v 1.22 2023/09/01 19:42:26 dv Exp $ */
+/* $OpenBSD: i8259.c,v 1.23 2024/07/09 09:31:37 dv Exp $ */
/*
* Copyright (c) 2016 Mike Larkin <mlarkin@openbsd.org>
*
#include <sys/types.h>
#include <dev/isa/isareg.h>
-
-#include <machine/vmmvar.h>
+#include <dev/vmm/vmm.h>
#include <unistd.h>
#include <pthread.h>
-/* $OpenBSD: i8259.h,v 1.6 2024/05/18 06:45:00 jsg Exp $ */
+/* $OpenBSD: i8259.h,v 1.7 2024/07/09 09:31:37 dv Exp $ */
/*
* Copyright (c) 2016 Mike Larkin <mlarkin@openbsd.org>
*
#include <sys/types.h>
-#include <machine/vmmvar.h>
-
#define MASTER 0
#define SLAVE 1
/* $NetBSD: loadfile.c,v 1.10 2000/12/03 02:53:04 tsutsui Exp $ */
-/* $OpenBSD: loadfile_elf.c,v 1.47 2023/04/25 12:46:13 dv Exp $ */
+/* $OpenBSD: loadfile_elf.c,v 1.48 2024/07/09 09:31:37 dv Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
#include <err.h>
#include <stddef.h>
-#include <machine/vmmvar.h>
+#include <dev/vmm/vmm.h>
+
#include <machine/biosvar.h>
#include <machine/segments.h>
#include <machine/specialreg.h>
-/* $OpenBSD: mc146818.c,v 1.27 2023/10/25 12:44:28 dv Exp $ */
+/* $OpenBSD: mc146818.c,v 1.28 2024/07/09 09:31:37 dv Exp $ */
/*
* Copyright (c) 2016 Mike Larkin <mlarkin@openbsd.org>
*
#include <dev/ic/mc146818reg.h>
#include <dev/isa/isareg.h>
-
-#include <machine/vmmvar.h>
+#include <dev/vmm/vmm.h>
#include <event.h>
#include <stddef.h>
-/* $OpenBSD: mmio.h,v 1.1 2022/11/10 11:46:39 dv Exp $ */
+/* $OpenBSD: mmio.h,v 1.2 2024/07/09 09:31:37 dv Exp $ */
/*
* Copyright (c) 2022 Dave Voutila <dv@openbsd.org>
#define _MMIO_H_
#include <sys/types.h>
-#include <machine/vmmvar.h>
/* Code segment bits */
#define CS_L (1 << 13)
-/* $OpenBSD: ns8250.c,v 1.38 2023/10/25 12:44:28 dv Exp $ */
+/* $OpenBSD: ns8250.c,v 1.39 2024/07/09 09:31:37 dv Exp $ */
/*
* Copyright (c) 2016 Mike Larkin <mlarkin@openbsd.org>
*
#include <sys/ttycom.h>
#include <dev/ic/comreg.h>
-
-#include <machine/vmmvar.h>
+#include <dev/vmm/vmm.h>
#include <errno.h>
#include <event.h>
-/* $OpenBSD: parse.y,v 1.68 2023/07/13 18:31:59 dv Exp $ */
+/* $OpenBSD: parse.y,v 1.69 2024/07/09 09:31:37 dv Exp $ */
/*
* Copyright (c) 2007-2016 Reyk Floeter <reyk@openbsd.org>
#include <sys/socket.h>
#include <sys/uio.h>
-#include <machine/vmmvar.h>
+#include <dev/vmm/vmm.h>
#include <arpa/inet.h>
#include <net/if.h>
-/* $OpenBSD: pci.c,v 1.31 2023/02/06 20:33:34 dv Exp $ */
+/* $OpenBSD: pci.c,v 1.32 2024/07/09 09:31:37 dv Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcidevs.h>
#include <dev/pv/virtioreg.h>
-#include <machine/vmmvar.h>
+#include <dev/vmm/vmm.h>
#include <string.h>
#include <unistd.h>
-/* $OpenBSD: virtio.c,v 1.113 2024/02/20 21:40:37 dv Exp $ */
+/* $OpenBSD: virtio.c,v 1.114 2024/07/09 09:31:37 dv Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
#include <sys/socket.h>
#include <sys/wait.h>
-#include <machine/vmmvar.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcidevs.h>
#include <dev/pv/virtioreg.h>
#include <dev/pci/virtio_pcireg.h>
#include <dev/pv/vioblkreg.h>
#include <dev/pv/vioscsireg.h>
+#include <dev/vmm/vmm.h>
#include <net/if.h>
#include <netinet/in.h>
-/* $OpenBSD: vm.c,v 1.102 2024/07/08 17:33:45 dv Exp $ */
+/* $OpenBSD: vm.c,v 1.103 2024/07/09 09:31:37 dv Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
#include <dev/ic/i8253reg.h>
#include <dev/isa/isareg.h>
#include <dev/pci/pcireg.h>
+#include <dev/vmm/vmm.h>
#include <machine/psl.h>
#include <machine/pte.h>
#include <machine/specialreg.h>
-#include <machine/vmmvar.h>
#include <net/if.h>
-/* $OpenBSD: vmd.c,v 1.157 2024/05/18 06:45:00 jsg Exp $ */
+/* $OpenBSD: vmd.c,v 1.158 2024/07/09 09:31:37 dv Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
#include <ctype.h>
#include <grp.h>
+#include <dev/vmm/vmm.h>
#include <machine/specialreg.h>
-#include <machine/vmmvar.h>
#include "proc.h"
#include "atomicio.h"
-/* $OpenBSD: vmd.h,v 1.125 2024/02/20 21:40:37 dv Exp $ */
+/* $OpenBSD: vmd.h,v 1.126 2024/07/09 09:31:37 dv Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
#include <sys/un.h>
#include <sys/socket.h>
-#include <machine/vmmvar.h>
-
#include <dev/vmm/vmm.h>
#include <net/if.h>
-/* $OpenBSD: vmm.c,v 1.119 2024/02/05 21:58:09 dv Exp $ */
+/* $OpenBSD: vmm.c,v 1.120 2024/07/09 09:31:37 dv Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
#include <dev/ic/i8253reg.h>
#include <dev/isa/isareg.h>
#include <dev/pci/pcireg.h>
+#include <dev/vmm/vmm.h>
#include <machine/psl.h>
#include <machine/specialreg.h>
-#include <machine/vmmvar.h>
#include <net/if.h>